summaryrefslogtreecommitdiffstats
path: root/qt-ui
diff options
context:
space:
mode:
authorGravatar Tomaz Canabrava <tomaz.canabrava@intel.com>2014-05-25 14:16:43 -0300
committerGravatar Dirk Hohndel <dirk@hohndel.org>2014-05-26 13:17:32 -0700
commitfeff22c2228d56cd75594e1a20d9a2181f9f9a6b (patch)
tree97bba5359a9f94ac37ef61d1aed9095ca0411e20 /qt-ui
parentd1366257f081fc28939bd6abe9b67b1dba3fb07a (diff)
downloadsubsurface-feff22c2228d56cd75594e1a20d9a2181f9f9a6b.tar.gz
Planner: Re-enable using the new profile.
This correctly enables the planner on the new profile, but it doesn't triggers the correct paint on the canvas. [Dirk Hohndel: remove other remnants of the disabled planner as well] Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'qt-ui')
-rw-r--r--qt-ui/diveplanner.cpp2
-rw-r--r--qt-ui/maintab.cpp2
-rw-r--r--qt-ui/mainwindow.cpp4
-rw-r--r--qt-ui/models.cpp6
-rw-r--r--qt-ui/models.h2
-rw-r--r--qt-ui/profile/profilewidget2.cpp9
6 files changed, 10 insertions, 15 deletions
diff --git a/qt-ui/diveplanner.cpp b/qt-ui/diveplanner.cpp
index 3ffacdd2b..4fff79666 100644
--- a/qt-ui/diveplanner.cpp
+++ b/qt-ui/diveplanner.cpp
@@ -215,9 +215,7 @@ DivePlannerWidget::DivePlannerWidget(QWidget *parent, Qt::WindowFlags f) : QWidg
QTableView *view = ui.cylinderTableWidget->view();
view->setColumnHidden(CylindersModel::START, true);
view->setColumnHidden(CylindersModel::END, true);
-#ifdef ENABLE_PLANNER
view->setColumnHidden(CylindersModel::DEPTH, false);
-#endif
view->setItemDelegateForColumn(CylindersModel::TYPE, new TankInfoDelegate(this));
connect(ui.cylinderTableWidget, SIGNAL(addButtonClicked()), DivePlannerPointsModel::instance(), SLOT(addCylinder_clicked()));
connect(ui.tableWidget, SIGNAL(addButtonClicked()), DivePlannerPointsModel::instance(), SLOT(addStop()));
diff --git a/qt-ui/maintab.cpp b/qt-ui/maintab.cpp
index 2bb261448..34be53a90 100644
--- a/qt-ui/maintab.cpp
+++ b/qt-ui/maintab.cpp
@@ -88,9 +88,7 @@ MainTab::MainTab(QWidget *parent) : QTabWidget(parent),
ui.cylinders->view()->setItemDelegateForColumn(CylindersModel::TYPE, new TankInfoDelegate(this));
ui.weights->view()->setItemDelegateForColumn(WeightModel::TYPE, new WSInfoDelegate(this));
-#ifdef ENABLE_PLANNER
ui.cylinders->view()->setColumnHidden(CylindersModel::DEPTH, true);
-#endif
completers.buddy = new QCompleter(&buddyModel, ui.buddy);
completers.divemaster = new QCompleter(&diveMasterModel, ui.divemaster);
completers.location = new QCompleter(&locationModel, ui.location);
diff --git a/qt-ui/mainwindow.cpp b/qt-ui/mainwindow.cpp
index 19a16a886..2bfeca64e 100644
--- a/qt-ui/mainwindow.cpp
+++ b/qt-ui/mainwindow.cpp
@@ -87,9 +87,6 @@ MainWindow::MainWindow() : QMainWindow(),
ui.ListWidget->scrollTo(ui.ListWidget->model()->index(0, 0), QAbstractItemView::PositionAtCenter);
ui.divePlannerWidget->settingsChanged();
-#ifndef ENABLE_PLANNER
- ui.menuLog->removeAction(ui.actionDivePlanner);
-#endif
#ifdef NO_MARBLE
ui.layoutWidget->hide();
ui.menuView->removeAction(ui.actionViewGlobe);
@@ -318,6 +315,7 @@ void MainWindow::on_actionDivePlanner_triggered()
break;
}
}
+ ui.newProfile->setPlanState();
ui.infoPane->setCurrentIndex(PLANNERWIDGET);
}
diff --git a/qt-ui/models.cpp b/qt-ui/models.cpp
index dc9a7189a..5efcf5a34 100644
--- a/qt-ui/models.cpp
+++ b/qt-ui/models.cpp
@@ -67,9 +67,7 @@ CylindersModel::CylindersModel(QObject *parent) : current(0), rows(0)
{
// enum {REMOVE, TYPE, SIZE, WORKINGPRESS, START, END, O2, HE, DEPTH};
setHeaderDataStrings(QStringList() << "" << tr("Type") << tr("Size") << tr("WorkPress") << tr("StartPress") << tr("EndPress") << trUtf8("O" UTF8_SUBSCRIPT_2 "%") << tr("He%")
-#ifdef ENABLE_PLANNER
<< tr("Switch at")
-#endif
);
}
@@ -145,11 +143,9 @@ QVariant CylindersModel::data(const QModelIndex &index, int role) const
case HE:
ret = percent_string(cyl->gasmix.he);
break;
-#ifdef ENABLE_PLANNER
case DEPTH:
ret = get_depth_string(cyl->depth, true);
break;
-#endif
}
break;
case Qt::DecorationRole:
@@ -263,13 +259,11 @@ bool CylindersModel::setData(const QModelIndex &index, const QVariant &value, in
changed = true;
}
break;
-#ifdef ENABLE_PLANNER
case DEPTH:
if (CHANGED()) {
cyl->depth = string_to_depth(vString.toUtf8().data());
changed = true;
}
-#endif
}
dataChanged(index, index);
if (addDiveMode)
diff --git a/qt-ui/models.h b/qt-ui/models.h
index 34d7d4827..17be8cbc9 100644
--- a/qt-ui/models.h
+++ b/qt-ui/models.h
@@ -102,9 +102,7 @@ public:
END,
O2,
HE,
-#ifdef ENABLE_PLANNER
DEPTH,
-#endif
COLUMNS
};
diff --git a/qt-ui/profile/profilewidget2.cpp b/qt-ui/profile/profilewidget2.cpp
index 2de64e71f..71a2f4856 100644
--- a/qt-ui/profile/profilewidget2.cpp
+++ b/qt-ui/profile/profilewidget2.cpp
@@ -773,6 +773,15 @@ void ProfileWidget2::setPlanState()
setProfileState();
disconnectTemporaryConnections();
/* show the same stuff that the profile shows. */
+
+ DivePlannerPointsModel *plannerModel = DivePlannerPointsModel::instance();
+ connect(plannerModel, SIGNAL(dataChanged(QModelIndex, QModelIndex)), this, SLOT(replot()));
+ connect(plannerModel, SIGNAL(cylinderModelEdited()), this, SLOT(replot()));
+ connect(plannerModel, SIGNAL(rowsInserted(const QModelIndex &, int, int)),
+ this, SLOT(pointInserted(const QModelIndex &, int, int)));
+ connect(plannerModel, SIGNAL(rowsRemoved(const QModelIndex &, int, int)),
+ this, SLOT(pointsRemoved(const QModelIndex &, int, int)));
+
currentState = PLAN; /* enable the add state. */
setBackgroundBrush(QColor(Qt::green).light());
}