mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
Disconnect temporary connections on the Profile.
This code adds the disconnections of temporaries. A temporary connection is a connection that should be active only on a certain state, and we need to clean that for the new state that will enter after. Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
parent
27afb33806
commit
e249fe8703
2 changed files with 19 additions and 1 deletions
|
@ -606,6 +606,7 @@ void ProfileWidget2::setEmptyState()
|
||||||
if (currentState == EMPTY)
|
if (currentState == EMPTY)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
disconnectTemporaryConnections();
|
||||||
setBackgroundBrush(getColor(::BACKGROUND, isGrayscale));
|
setBackgroundBrush(getColor(::BACKGROUND, isGrayscale));
|
||||||
dataModel->clear();
|
dataModel->clear();
|
||||||
currentState = EMPTY;
|
currentState = EMPTY;
|
||||||
|
@ -648,6 +649,7 @@ void ProfileWidget2::setProfileState()
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
disconnectTemporaryConnections();
|
||||||
currentState = PROFILE;
|
currentState = PROFILE;
|
||||||
MainWindow::instance()->setToolButtonsEnabled(true);
|
MainWindow::instance()->setToolButtonsEnabled(true);
|
||||||
toolTipItem->readPos();
|
toolTipItem->readPos();
|
||||||
|
@ -707,6 +709,7 @@ void ProfileWidget2::setAddState()
|
||||||
if (currentState == ADD)
|
if (currentState == ADD)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
disconnectTemporaryConnections();
|
||||||
/* show the same stuff that the profile shows. */
|
/* show the same stuff that the profile shows. */
|
||||||
currentState = ADD; /* enable the add state. */
|
currentState = ADD; /* enable the add state. */
|
||||||
setBackgroundBrush(QColor(Qt::blue).light());
|
setBackgroundBrush(QColor(Qt::blue).light());
|
||||||
|
@ -717,6 +720,7 @@ void ProfileWidget2::setPlanState()
|
||||||
if (currentState == PLAN)
|
if (currentState == PLAN)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
disconnectTemporaryConnections();
|
||||||
/* show the same stuff that the profile shows. */
|
/* show the same stuff that the profile shows. */
|
||||||
currentState = PLAN; /* enable the add state. */
|
currentState = PLAN; /* enable the add state. */
|
||||||
setBackgroundBrush(QColor(Qt::green).light());
|
setBackgroundBrush(QColor(Qt::green).light());
|
||||||
|
@ -920,6 +924,18 @@ void ProfileWidget2::editName()
|
||||||
replot();
|
replot();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void ProfileWidget2::disconnectTemporaryConnections()
|
||||||
|
{
|
||||||
|
DivePlannerPointsModel *plannerModel = DivePlannerPointsModel::instance();
|
||||||
|
disconnect(plannerModel, SIGNAL(dataChanged(QModelIndex, QModelIndex)), this, SLOT(replot()));
|
||||||
|
disconnect(plannerModel, SIGNAL(cylinderModelEdited()), this, SLOT(replot()));
|
||||||
|
|
||||||
|
disconnect(plannerModel, SIGNAL(rowsInserted(const QModelIndex &, int, int)),
|
||||||
|
this, SLOT(pointInserted(const QModelIndex &, int, int)));
|
||||||
|
disconnect(plannerModel, SIGNAL(rowsRemoved(const QModelIndex &, int, int)),
|
||||||
|
this, SLOT(pointsRemoved(const QModelIndex &, int, int)));
|
||||||
|
}
|
||||||
|
|
||||||
void ProfileWidget2::pointInserted(const QModelIndex &parent, int start, int end)
|
void ProfileWidget2::pointInserted(const QModelIndex &parent, int start, int end)
|
||||||
{
|
{
|
||||||
DiveHandler *item = new DiveHandler();
|
DiveHandler *item = new DiveHandler();
|
||||||
|
|
|
@ -67,7 +67,6 @@ public:
|
||||||
|
|
||||||
ProfileWidget2(QWidget *parent = 0);
|
ProfileWidget2(QWidget *parent = 0);
|
||||||
void plotDives(QList<dive *> dives);
|
void plotDives(QList<dive *> dives);
|
||||||
void replot();
|
|
||||||
virtual bool eventFilter(QObject *, QEvent *);
|
virtual bool eventFilter(QObject *, QEvent *);
|
||||||
void setupItem(AbstractProfilePolygonItem *item, DiveCartesianAxis *hAxis, DiveCartesianAxis *vAxis, DivePlotDataModel *model, int vData, int hData, int zValue);
|
void setupItem(AbstractProfilePolygonItem *item, DiveCartesianAxis *hAxis, DiveCartesianAxis *vAxis, DivePlotDataModel *model, int vData, int hData, int zValue);
|
||||||
void setPrintMode(bool mode, bool grayscale = false);
|
void setPrintMode(bool mode, bool grayscale = false);
|
||||||
|
@ -90,6 +89,7 @@ slots: // Necessary to call from QAction's signals.
|
||||||
void makeFirstDC();
|
void makeFirstDC();
|
||||||
void pointInserted(const QModelIndex &parent, int start, int end);
|
void pointInserted(const QModelIndex &parent, int start, int end);
|
||||||
void pointsRemoved(const QModelIndex &, int start, int end);
|
void pointsRemoved(const QModelIndex &, int start, int end);
|
||||||
|
void replot();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual void resizeEvent(QResizeEvent *event);
|
virtual void resizeEvent(QResizeEvent *event);
|
||||||
|
@ -105,6 +105,8 @@ private: /*methods*/
|
||||||
void setupItemSizes();
|
void setupItemSizes();
|
||||||
void addItemsToScene();
|
void addItemsToScene();
|
||||||
void setupItemOnScene();
|
void setupItemOnScene();
|
||||||
|
void disconnectTemporaryConnections();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
DivePlotDataModel *dataModel;
|
DivePlotDataModel *dataModel;
|
||||||
int zoomLevel;
|
int zoomLevel;
|
||||||
|
|
Loading…
Add table
Reference in a new issue