summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--qt-ui/diveplanner.cpp6
-rw-r--r--qt-ui/diveplanner.ui12
-rw-r--r--qt-ui/maintab.cpp2
-rw-r--r--qt-ui/mainwindow.cpp1
-rw-r--r--qt-ui/models.cpp6
-rw-r--r--qt-ui/models.h1
6 files changed, 25 insertions, 3 deletions
diff --git a/qt-ui/diveplanner.cpp b/qt-ui/diveplanner.cpp
index d7522b505..ba0bc80d7 100644
--- a/qt-ui/diveplanner.cpp
+++ b/qt-ui/diveplanner.cpp
@@ -878,7 +878,9 @@ DivePlannerWidget::DivePlannerWidget(QWidget* parent, Qt::WindowFlags f): QWidge
ui.tableWidget->setTitle(tr("Dive Planner Points"));
ui.tableWidget->setModel(DivePlannerPointsModel::instance());
ui.tableWidget->view()->setItemDelegateForColumn(DivePlannerPointsModel::GAS, new AirTypesDelegate(this));
-
+ ui.cylinderTableWidget->setTitle(tr("Available Gases"));
+ ui.cylinderTableWidget->setModel(CylindersModel::instance());
+// connect(ui.cylinderTableWidget, SIGNAL(addButtonClicked()), CylindersModel::instance(), SLOT(add()));
connect(ui.tableWidget, SIGNAL(addButtonClicked()), DivePlannerPointsModel::instance(), SLOT(addStop()));
connect(ui.startTime, SIGNAL(timeChanged(QTime)), this, SLOT(startTimeChanged(QTime)));
connect(ui.ATMPressure, SIGNAL(textChanged(QString)), this, SLOT(atmPressureChanged(QString)));
@@ -1190,6 +1192,7 @@ void DivePlannerPointsModel::cancelPlan()
clear();
emit planCanceled();
setPlanMode(NOTHING);
+ CylindersModel::instance()->update();
}
DivePlannerPointsModel::Mode DivePlannerPointsModel::currentMode() const
@@ -1283,4 +1286,5 @@ void DivePlannerPointsModel::createPlan()
clear();
planCreated();
setPlanMode(NOTHING);
+ CylindersModel::instance()->update();
}
diff --git a/qt-ui/diveplanner.ui b/qt-ui/diveplanner.ui
index 5c2f1ef69..570d64819 100644
--- a/qt-ui/diveplanner.ui
+++ b/qt-ui/diveplanner.ui
@@ -116,7 +116,7 @@
</widget>
</item>
<item row="7" column="0" colspan="2">
- <widget class="TableView" name="tableWidget" native="true">
+ <widget class="TableView" name="cylinderTableWidget" native="true">
<property name="sizePolicy">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="MinimumExpanding">
<horstretch>0</horstretch>
@@ -126,6 +126,16 @@
</widget>
</item>
<item row="8" column="0" colspan="2">
+ <widget class="TableView" name="tableWidget" native="true">
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="MinimumExpanding" vsizetype="MinimumExpanding">
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ </widget>
+ </item>
+ <item row="9" column="0" colspan="2">
<widget class="QDialogButtonBox" name="buttonBox">
<property name="standardButtons">
<set>QDialogButtonBox::Abort|QDialogButtonBox::Save</set>
diff --git a/qt-ui/maintab.cpp b/qt-ui/maintab.cpp
index 2708687da..6c071d911 100644
--- a/qt-ui/maintab.cpp
+++ b/qt-ui/maintab.cpp
@@ -25,7 +25,7 @@
MainTab::MainTab(QWidget *parent) : QTabWidget(parent),
weightModel(new WeightModel()),
- cylindersModel(new CylindersModel()),
+ cylindersModel(CylindersModel::instance()),
editMode(NONE)
{
ui.setupUi(this);
diff --git a/qt-ui/mainwindow.cpp b/qt-ui/mainwindow.cpp
index 61fa76bfe..348d08c44 100644
--- a/qt-ui/mainwindow.cpp
+++ b/qt-ui/mainwindow.cpp
@@ -226,6 +226,7 @@ void MainWindow::on_actionDivePlanner_triggered()
disableDcShortcuts();
DivePlannerPointsModel::instance()->setPlanMode(DivePlannerPointsModel::PLAN);
DivePlannerPointsModel::instance()->clear();
+ CylindersModel::instance()->clear();
ui.stackedWidget->setCurrentIndex(PLANNERPROFILE);
ui.infoPane->setCurrentIndex(PLANNERWIDGET);
}
diff --git a/qt-ui/models.cpp b/qt-ui/models.cpp
index a89557570..0324fe4ba 100644
--- a/qt-ui/models.cpp
+++ b/qt-ui/models.cpp
@@ -62,6 +62,12 @@ CylindersModel::CylindersModel(QObject* parent): current(0), rows(0)
setHeaderDataStrings( QStringList() << "" << tr("Type") << tr("Size") << tr("WorkPress") << tr("StartPress") << tr("EndPress") << tr("O2%") << tr("HE"));
}
+CylindersModel *CylindersModel::instance()
+{
+ static CylindersModel *self = new CylindersModel();
+ return self;
+}
+
static QVariant percent_string(fraction_t fraction)
{
int permille = fraction.permille;
diff --git a/qt-ui/models.h b/qt-ui/models.h
index 32ce3df47..78313c963 100644
--- a/qt-ui/models.h
+++ b/qt-ui/models.h
@@ -82,6 +82,7 @@ public:
enum Column {REMOVE, TYPE, SIZE, WORKINGPRESS, START, END, O2, HE};
explicit CylindersModel(QObject* parent = 0);
+ static CylindersModel *instance();
/*reimp*/ QVariant data(const QModelIndex& index, int role = Qt::DisplayRole) const;
/*reimp*/ int rowCount(const QModelIndex& parent = QModelIndex()) const;
/*reimp*/ Qt::ItemFlags flags(const QModelIndex& index) const;