refs #568, specialized view class for DB objects

* CViewWithDbObjects
* new menu for views (delete key, remove)
* adjusted derived classes
This commit is contained in:
Klaus Basan
2016-01-08 00:33:51 +01:00
parent 1ddf470a1d
commit 46e7d42e8c
16 changed files with 281 additions and 75 deletions

View File

@@ -15,7 +15,7 @@
#include "blackgui/blackguiexport.h"
#include "blackgui/filters/aircraftmodelfilterdialog.h"
#include "blackgui/models/aircraftmodellistmodel.h"
#include "viewbase.h"
#include "viewdbobjects.h"
namespace BlackGui
{
@@ -23,7 +23,7 @@ namespace BlackGui
{
//! Aircraft view
class BLACKGUI_EXPORT CAircraftModelView :
public CViewBase<Models::CAircraftModelListModel, BlackMisc::Simulation::CAircraftModelList, BlackMisc::Simulation::CAircraftModel>
public CViewWithDbObjects<Models::CAircraftModelListModel, BlackMisc::Simulation::CAircraftModelList, BlackMisc::Simulation::CAircraftModel, int>
{
Q_OBJECT
@@ -46,15 +46,18 @@ namespace BlackGui
//! Allow to stash
void setAllowStash(bool stash) { m_allowStash = stash; }
//! Has any models to stash amd is allowed to stash
bool hasModelsToStash() const;
//! Has any models to stash and it is allowed to stash
bool hasSelectedModelsToStash() const;
//! Add the technically supported metatypes as allows
//! Add the technically supported metatypes allowed for drag and drop
void setImplementedMetaTypeIds();
//! Add my own filter dialog
void addFilterDialog();
//! Remove models with model strings
int removeModelsWithModelString(const QStringList &modelStrings, Qt::CaseSensitivity sensitivity = Qt::CaseInsensitive);
signals:
//! Request to stash if applicable
void requestStash();
@@ -67,9 +70,6 @@ namespace BlackGui
virtual void dropEvent(QDropEvent *event) override;
private slots:
//! Highlight DB models
void ps_toggleHighlightDbModels();
//! Highlight stashed models
void ps_toggleHighlightStashedModels();
@@ -79,17 +79,6 @@ namespace BlackGui
private:
bool m_allowStash = false; //!< allow to stash
//! Custom menu for the models which have been loaded
class CHighlightDbModelsMenu : public BlackGui::IMenuDelegate
{
public:
//! Constructor
CHighlightDbModelsMenu(CAircraftModelView *parent, bool separatorAtEnd) : IMenuDelegate(parent, separatorAtEnd) {}
//! \copydoc IMenuDelegate::customMenu
virtual void customMenu(QMenu &menu) const override;
};
//! Custom menu for the models which have been loaded
class CHighlightStashedModelsMenu : public BlackGui::IMenuDelegate
{