Updraft
1.0
Open source glider flight visualisation tool.
|
00001 #ifndef UPDRAFT_SRC_CORE_MAPLAYER_H_ 00002 #define UPDRAFT_SRC_CORE_MAPLAYER_H_ 00003 00004 #include <QObject> 00005 #include <QPoint> 00006 #include "../maplayerinterface.h" 00007 00008 class QTreeWidgetItem; 00009 00010 namespace Updraft { 00011 namespace Core { 00012 00013 class MapLayerGroup; 00014 00021 class MapLayer : public QObject, virtual public MapLayerInterface { 00022 Q_OBJECT 00023 00024 public: 00025 explicit MapLayer(const QString &title); 00026 ~MapLayer(); 00027 00031 void connectSignalChecked(const QObject* receiver, 00032 const char *method); 00033 00037 void connectSignalContextMenuRequested(const QObject* receiver, 00038 const char* method); 00039 00045 void connectSlotSetVisibility(const QObject* sender, 00046 const char *method); 00047 00050 void connectCheckedToVisibility(); 00051 00054 void setId(const QByteArray& id); 00055 00058 QByteArray getId(); 00059 00062 void setTitle(const QString& title); 00063 00066 QTreeWidgetItem *getTreeItem(); 00067 00070 void setDisabled(bool disabled); 00071 00074 void setChecked(bool value); 00075 00078 void setCheckable(bool value); 00079 00082 void inserted(MapLayerGroup* parent); 00083 00087 void setFilePath(const QString& path); 00088 00091 QAction* getDeleteAction(); 00092 00096 QByteArray saveState(); 00097 00102 bool restoreState(const QByteArray &state); 00103 00104 public slots: 00107 void setVisibility(bool value) = 0; 00108 00109 private slots: 00112 void deleteActionSlot(); 00113 00114 signals: 00119 void checked(bool value, MapLayerInterface* sender); 00120 00124 void contextMenuRequested(QPoint pos, MapLayerInterface* sender); 00125 00126 protected: 00130 void emitChecked(bool value); 00131 00134 void emitContextMenuRequested(const QPoint& pos); 00135 00136 explicit MapLayer(QTreeWidgetItem* item); 00137 00140 QByteArray id; 00141 00143 QAction* deleteAction; 00144 00146 QString deleteFilePath; 00147 00149 QTreeWidgetItem *treeItem; 00150 00154 bool ownsTreeItem; 00155 00159 MapLayerGroup* parent; 00160 }; 00161 00162 } // End namespace Core 00163 } // End namespace Updraft 00164 00165 #endif // UPDRAFT_SRC_CORE_MAPLAYER_H_