Updraft  1.0
Open source glider flight visualisation tool.
taskdeclpanel.h
Go to the documentation of this file.
00001 #ifndef UPDRAFT_SRC_PLUGINS_TASKDECL_TASKDECLPANEL_H_
00002 #define UPDRAFT_SRC_PLUGINS_TASKDECL_TASKDECLPANEL_H_
00003 
00004 #include <QtGui/QMainWindow>
00005 #include <QHash>
00006 #include <QString>
00007 // #include "ui_qtgui.h"
00008 
00009 class QPushButton;
00010 class QButtonGroup;
00011 
00012 namespace Ui { class TaskDeclPanel; }
00013 
00014 namespace Updraft {
00015 
00016 class TaskLayer;
00017 class TaskFile;
00018 class TaskPoint;
00019 class TaskAxis;
00020 class TaskData;
00021 
00023 class TaskDeclPanel : public QWidget {
00024   Q_OBJECT
00025 
00026  public:
00027   TaskDeclPanel(TaskLayer* layer, QWidget *parent = 0, Qt::WFlags flags = 0);
00028   ~TaskDeclPanel();
00029 
00031   bool hasToggledButton();
00032 
00034   int getToggledButtonIndex();
00035 
00037   void newTurnpointButton(int index, const QString& name);
00038 
00040   void newAddTpButton(int index, bool checked = false);
00041 
00043   void initFromFile(TaskFile* file);
00044 
00047   const QWidget* getTaskPointWidget(int i) const;
00048 
00049  private slots:
00050   void addTpButtonPushed();
00051   void removeTpButtonPushed();
00052   void saveButtonPushed();
00053   void undoButtonPushed();
00054   void redoButtonPushed();
00055   void dataChanged();
00056 
00058   void updateButtons();
00059 
00060  private:
00062   bool tpButtonExists(int pos);
00065   bool tpButtonCorrect(int pos, const TaskPoint* point);
00067   void updateTpButton(int pos, const TaskPoint* point);
00069   void updateAddTpButton(int pos, bool checkState);
00071   void updateSummaryLabel(const TaskData* data);
00072 
00074   void removeTpButtons(int pos);
00075 
00076   int tpIndexToLayoutPos(int index) const;
00077   int tpLayoutPosToIndex(int pos) const;
00078   int addIndexToLayoutPos(int index) const;
00079   int addLayoutPosToIndex(int pos) const;
00080 
00081   QString addTpText;  // This is here because of translations
00083   void adjustAddTpText();
00085   void uncheckAllAddTpButtons();
00086 
00087   Ui::TaskDeclPanel *ui;
00088 
00090   QButtonGroup* addButtons;
00091 
00093   bool isBeingEdited;
00094 
00096   TaskAxis *taskAxis;
00097 
00098   TaskLayer* taskLayer;
00099 };
00100 
00101 }  // End namespace Updraft
00102 
00103 #endif  // UPDRAFT_SRC_PLUGINS_TASKDECL_TASKDECLPANEL_H_
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Defines