diff options
author | Dirk Hohndel <dirk@hohndel.org> | 2014-08-15 08:11:14 -0600 |
---|---|---|
committer | Dirk Hohndel <dirk@hohndel.org> | 2014-08-15 08:11:14 -0600 |
commit | e8d430341c1102c0da1a3847ad2d39f41fc642d3 (patch) | |
tree | 2d07fdeb70e25c5411f707d90d77c3c3cb0cbff9 | |
parent | e71119b40bac8d6dc33449e33329f235350b08f5 (diff) | |
download | subsurface-e8d430341c1102c0da1a3847ad2d39f41fc642d3.tar.gz |
TankBar: hook into prefs and make ppGraphs resize accordingly
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
-rw-r--r-- | pref.h | 1 | ||||
-rw-r--r-- | qt-ui/mainwindow.cpp | 12 | ||||
-rw-r--r-- | qt-ui/mainwindow.h | 1 | ||||
-rw-r--r-- | qt-ui/mainwindow.ui | 36 | ||||
-rw-r--r-- | qt-ui/preferences.cpp | 1 | ||||
-rw-r--r-- | qt-ui/profile/profilewidget2.cpp | 33 | ||||
-rw-r--r-- | subsurfacestartup.c | 3 |
7 files changed, 71 insertions, 16 deletions
@@ -46,6 +46,7 @@ struct preferences { short zoomed_plot; short hrgraph; short rulergraph; + short tankbar; short save_userid_local; char *userid; int ascrate75; diff --git a/qt-ui/mainwindow.cpp b/qt-ui/mainwindow.cpp index 1a4594bab..687fc778d 100644 --- a/qt-ui/mainwindow.cpp +++ b/qt-ui/mainwindow.cpp @@ -242,6 +242,7 @@ void MainWindow::setToolButtonsEnabled(bool enabled) ui.profScaled->setEnabled(enabled); ui.profHR->setEnabled(enabled); ui.profTogglePicture->setEnabled(enabled); + ui.profTankbar->setEnabled(enabled); } bool MainWindow::okToClose(QString message) @@ -796,6 +797,7 @@ void MainWindow::readSettings() TOOLBOX_PREF_BUTTON(rulergraph, rulergraph, profRuler); TOOLBOX_PREF_BUTTON(show_sac, show_sac, profSAC); TOOLBOX_PREF_BUTTON(show_pictures_in_profile, show_pictures_in_profile, profTogglePicture); + TOOLBOX_PREF_BUTTON(tankbar, tankbar, profTankbar); s.endGroup(); s.beginGroup("DiveComputer"); default_dive_computer_vendor = getSetting(s, "dive_computer_vendor"); @@ -1270,6 +1272,7 @@ TOOLBOX_PREF_PROFILE(profRuler, rulergraph, rulergraph); TOOLBOX_PREF_PROFILE(profSAC, show_sac, show_sac); TOOLBOX_PREF_PROFILE(profScaled, zoomed_plot, zoomed_plot); TOOLBOX_PREF_PROFILE(profTogglePicture, show_pictures_in_profile, show_pictures_in_profile); +TOOLBOX_PREF_PROFILE(profTankbar, tankbar, tankbar); void MainWindow::turnOffNdlTts() { @@ -1289,10 +1292,11 @@ void MainWindow::on_actionExport_triggered() void MainWindow::setEnabledToolbar(bool arg1) { - QList<QToolButton*> toolBar; toolBar << ui.profCalcAllTissues << ui.profCalcCeiling - << ui.profDcCeiling << ui.profEad << ui.profHR << ui.profIncrement3m - << ui.profMod << ui.profNdl_tts << ui.profNdl_tts << ui.profPhe << ui.profPn2 - << ui.profPO2 << ui.profRuler << ui.profSAC << ui.profScaled << ui.profTogglePicture; + QList<QToolButton*> toolBar; + toolBar << ui.profCalcAllTissues << ui.profCalcCeiling << ui.profDcCeiling << ui.profEad << + ui.profHR << ui.profIncrement3m << ui.profMod << ui.profNdl_tts << ui.profNdl_tts << + ui.profPhe << ui.profPn2 << ui.profPO2 << ui.profRuler << ui.profSAC << ui.profScaled << + ui.profTogglePicture << ui.profTankbar; Q_FOREACH(QToolButton *b, toolBar) b->setEnabled(arg1); } diff --git a/qt-ui/mainwindow.h b/qt-ui/mainwindow.h index 5c0ec8efa..9081bf457 100644 --- a/qt-ui/mainwindow.h +++ b/qt-ui/mainwindow.h @@ -141,6 +141,7 @@ slots: void on_profSAC_clicked(bool triggered); void on_profScaled_clicked(bool triggered); void on_profTogglePicture_clicked(bool triggered); + void on_profTankbar_clicked(bool triggered); void on_actionExport_triggered(); protected: diff --git a/qt-ui/mainwindow.ui b/qt-ui/mainwindow.ui index ac72673c8..5faac083b 100644 --- a/qt-ui/mainwindow.ui +++ b/qt-ui/mainwindow.ui @@ -109,7 +109,7 @@ <property name="spacing"> <number>0</number> </property> - <item row="15" column="0"> + <item row="17" column="0"> <spacer name="verticalSpacer"> <property name="orientation"> <enum>Qt::Vertical</enum> @@ -440,6 +440,9 @@ </property> </widget> </item> + <item row="0" column="1" rowspan="19"> + <widget class="ProfileWidget2" name="newProfile"/> + </item> <item row="0" column="0"> <widget class="QToolButton" name="profPO2"> <property name="toolTip"> @@ -466,9 +469,6 @@ </property> </widget> </item> - <item row="0" column="1" rowspan="16"> - <widget class="ProfileWidget2" name="newProfile"/> - </item> <item row="1" column="0"> <widget class="QToolButton" name="profPn2"> <property name="toolTip"> @@ -495,6 +495,32 @@ </property> </widget> </item> + <item row="15" column="0"> + <widget class="QToolButton" name="profTankbar"> + <property name="toolTip"> + <string>Toggle Cylinder Bar</string> + </property> + <property name="text"> + <string>...</string> + </property> + <property name="icon"> + <iconset resource="../subsurface.qrc"> + <normaloff>:/gaschange</normaloff>:/gaschange</iconset> + </property> + <property name="iconSize"> + <size> + <width>24</width> + <height>24</height> + </size> + </property> + <property name="checkable"> + <bool>true</bool> + </property> + <property name="autoRaise"> + <bool>true</bool> + </property> + </widget> + </item> <item row="14" column="0"> <widget class="QToolButton" name="profTogglePicture"> <property name="toolTip"> @@ -664,7 +690,7 @@ p, li { white-space: pre-wrap; } <x>0</x> <y>0</y> <width>1682</width> - <height>27</height> + <height>19</height> </rect> </property> <widget class="QMenu" name="menuFile"> diff --git a/qt-ui/preferences.cpp b/qt-ui/preferences.cpp index 6000f453a..edd95d838 100644 --- a/qt-ui/preferences.cpp +++ b/qt-ui/preferences.cpp @@ -315,6 +315,7 @@ void PreferencesDialog::loadSettings() GET_BOOL("calcndltts", calcndltts); GET_BOOL("calcalltissues", calcalltissues); GET_BOOL("hrgraph", hrgraph); + GET_BOOL("tankbar", tankbar); GET_INT("gflow", gflow); GET_INT("gfhigh", gfhigh); GET_BOOL("gf_low_at_maxdepth", gf_low_at_maxdepth); diff --git a/qt-ui/profile/profilewidget2.cpp b/qt-ui/profile/profilewidget2.cpp index 400bedde1..409328918 100644 --- a/qt-ui/profile/profilewidget2.cpp +++ b/qt-ui/profile/profilewidget2.cpp @@ -56,6 +56,7 @@ static struct _ItemPos { _Pos tankBar; _Axis depth; _Axis partialPressure; + _Axis partialPressureWithTankBar; _Axis time; _Axis cylinder; _Axis temperature; @@ -306,7 +307,9 @@ void ProfileWidget2::setupItemSizes() itemPos.partialPressure.pos.off.setX(110); itemPos.partialPressure.pos.off.setY(63); itemPos.partialPressure.expanded.setP1(QPointF(0, 0)); - itemPos.partialPressure.expanded.setP2(QPointF(0, 27)); + itemPos.partialPressure.expanded.setP2(QPointF(0, 30)); + itemPos.partialPressureWithTankBar = itemPos.partialPressure; + itemPos.partialPressureWithTankBar.expanded.setP2(QPointF(0, 27)); // cylinder axis config itemPos.cylinder.pos.on.setX(3); @@ -418,7 +421,14 @@ void ProfileWidget2::plotDive(struct dive *d, bool force) // reset some item visibility on printMode changes toolTipItem->setVisible(!printMode); rulerItem->setVisible(prefs.rulergraph && !printMode); - tankItem->setVisible(true); + tankItem->setVisible(prefs.tankbar); + if (prefs.tankbar) { + gasYAxis->setPos(itemPos.partialPressureWithTankBar.pos.on); + gasYAxis->setLine(itemPos.partialPressureWithTankBar.expanded); + } else { + gasYAxis->setPos(itemPos.partialPressure.pos.on); + gasYAxis->setLine(itemPos.partialPressure.expanded); + } if (currentState == EMPTY) setProfileState(); @@ -563,6 +573,13 @@ void ProfileWidget2::settingsChanged() temperatureAxis->animateChangeLine(itemPos.temperature.expanded); cylinderPressureAxis->animateChangeLine(itemPos.cylinder.expanded); } + if (prefs.tankbar) { + gasYAxis->setPos(itemPos.partialPressureWithTankBar.pos.on); + gasYAxis->animateChangeLine(itemPos.partialPressureWithTankBar.expanded); + } else { + gasYAxis->setPos(itemPos.partialPressure.pos.on); + gasYAxis->animateChangeLine(itemPos.partialPressure.expanded); + } if (prefs.zoomed_plot != isPlotZoomed) { isPlotZoomed = prefs.zoomed_plot; needReplot = true; @@ -796,9 +813,13 @@ void ProfileWidget2::setProfileState() po2GasItem->setVisible(prefs.pp_graphs.po2); pheGasItem->setVisible(prefs.pp_graphs.phe); - gasYAxis->setPos(itemPos.partialPressure.pos.on); - gasYAxis->setLine(itemPos.partialPressure.expanded); - + if (prefs.tankbar) { + gasYAxis->setPos(itemPos.partialPressureWithTankBar.pos.on); + gasYAxis->setLine(itemPos.partialPressureWithTankBar.expanded); + } else { + gasYAxis->setPos(itemPos.partialPressure.pos.on); + gasYAxis->setLine(itemPos.partialPressure.expanded); + } timeAxis->setPos(itemPos.time.pos.on); timeAxis->setLine(itemPos.time.expanded); @@ -821,7 +842,7 @@ void ProfileWidget2::setProfileState() } } rulerItem->setVisible(prefs.rulergraph); - tankItem->setVisible(true); + tankItem->setVisible(prefs.tankbar); tankItem->setPos(itemPos.tankBar.on); #define HIDE_ALL(TYPE, CONTAINER) \ diff --git a/subsurfacestartup.c b/subsurfacestartup.c index b7b1b6504..8edc409be 100644 --- a/subsurfacestartup.c +++ b/subsurfacestartup.c @@ -44,7 +44,8 @@ struct preferences default_prefs = { .drop_stone_mode = false, .bottomsac = 20000, .decosac = 17000, - .show_pictures_in_profile = true + .show_pictures_in_profile = true, + .tankbar = false }; int run_survey; |