mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
Removed inconsistency when user tried to add dive while planning.
The user could add a dive, and in the middle click on the 'plan' button. Since we didn't cared about that on the widget, a lot of inconsistencies could occour. this fixes that by setting a flag on the Planner, that has now three modes: nothing, plan and add. (maybe in the future an edit mode will be valid too.) If in 'NOTHING' mode, user can enter the addition, edition and planning. If in any other mode, user can't do a thing. The mode gets back to NOTHING when user accepts or cancels a plan / add / edition. Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
parent
f850a0817c
commit
8a970c64c2
4 changed files with 46 additions and 25 deletions
|
|
@ -21,6 +21,7 @@ class DivePlannerPointsModel : public QAbstractTableModel{
|
|||
public:
|
||||
static DivePlannerPointsModel* instance();
|
||||
enum Sections{REMOVE, DEPTH, DURATION, GAS, CCSETPOINT, COLUMNS};
|
||||
enum Mode { NOTHING, PLAN, ADD };
|
||||
virtual int columnCount(const QModelIndex& parent = QModelIndex()) const;
|
||||
virtual QVariant data(const QModelIndex& index, int role = Qt::DisplayRole) const;
|
||||
virtual int rowCount(const QModelIndex& parent = QModelIndex()) const;
|
||||
|
|
@ -28,11 +29,11 @@ public:
|
|||
virtual bool setData(const QModelIndex& index, const QVariant& value, int role = Qt::EditRole);
|
||||
virtual Qt::ItemFlags flags(const QModelIndex& index) const;
|
||||
void removeSelectedPoints(const QVector<int>& rows);
|
||||
enum Modes { PLAN, ADD };
|
||||
void setPlanMode(bool);
|
||||
void setPlanMode(Mode mode);
|
||||
bool isPlanner();
|
||||
void createSimpleDive();
|
||||
|
||||
void clear();
|
||||
Mode currentMode() const;
|
||||
/**
|
||||
* @return the row number.
|
||||
*/
|
||||
|
|
@ -63,7 +64,7 @@ signals:
|
|||
private:
|
||||
explicit DivePlannerPointsModel(QObject* parent = 0);
|
||||
struct diveplan diveplan;
|
||||
Modes mode;
|
||||
Mode mode;
|
||||
QVector<divedatapoint> divepoints;
|
||||
struct dive *tempDive;
|
||||
void deleteTemporaryPlan(struct divedatapoint *dp);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue