summaryrefslogtreecommitdiffstats
path: root/qt-ui
diff options
context:
space:
mode:
authorGravatar Anton Lundin <glance@acc.umu.se>2013-12-05 00:48:37 +0100
committerGravatar Dirk Hohndel <dirk@hohndel.org>2013-12-04 15:49:55 -0800
commita0df62d913a8bfc54aae0c7b69a3197bdfae3dd5 (patch)
treea82134e53650111508fb34f9cc2db019d574d857 /qt-ui
parentb5d3476b0ba881699c604a3d97c5801b8bb99a08 (diff)
downloadsubsurface-a0df62d913a8bfc54aae0c7b69a3197bdfae3dd5.tar.gz
Add some limits to the GF's
Sets the limit for GF's in the preferences panel to 1<=x<=150 and color it read if gf > 100. Remove the % in the diveplanner view that was rejected for the preferences view. The 150 maximum is needed because QSpinBox defaults to maximum 99. Signed-off-by: Anton Lundin <glance@acc.umu.se> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'qt-ui')
-rw-r--r--qt-ui/diveplanner.ui11
-rw-r--r--qt-ui/preferences.cpp18
-rw-r--r--qt-ui/preferences.h3
-rw-r--r--qt-ui/preferences.ui18
4 files changed, 41 insertions, 9 deletions
diff --git a/qt-ui/diveplanner.ui b/qt-ui/diveplanner.ui
index 55208abb3..558be069d 100644
--- a/qt-ui/diveplanner.ui
+++ b/qt-ui/diveplanner.ui
@@ -101,25 +101,22 @@
</item>
<item row="5" column="0">
<widget class="QSpinBox" name="gflow">
- <property name="suffix">
- <string>%</string>
- </property>
<property name="minimum">
<number>1</number>
</property>
<property name="maximum">
- <number>100</number>
+ <number>150</number>
</property>
</widget>
</item>
<item row="5" column="1">
<widget class="QSpinBox" name="gfhigh">
- <property name="suffix">
- <string>%</string>
- </property>
<property name="minimum">
<number>1</number>
</property>
+ <property name="maximum">
+ <number>150</number>
+ </property>
</widget>
</item>
<item row="6" column="0">
diff --git a/qt-ui/preferences.cpp b/qt-ui/preferences.cpp
index 5a1a2a5e2..f8b24da42 100644
--- a/qt-ui/preferences.cpp
+++ b/qt-ui/preferences.cpp
@@ -15,10 +15,28 @@ PreferencesDialog::PreferencesDialog(QWidget* parent, Qt::WindowFlags f) : QDial
{
ui.setupUi(this);
connect(ui.buttonBox, SIGNAL(clicked(QAbstractButton*)), this, SLOT(buttonClicked(QAbstractButton*)));
+ connect(ui.gflow, SIGNAL(valueChanged(int)), this, SLOT(gflowChanged(int)));
+ connect(ui.gfhigh, SIGNAL(valueChanged(int)), this, SLOT(gfhighChanged(int)));
setUiFromPrefs();
rememberPrefs();
}
+void PreferencesDialog::gflowChanged(int gf)
+{
+ if (gf > 100)
+ ui.gflow->setStyleSheet("* { color: red; }");
+ else
+ ui.gflow->setStyleSheet("");
+}
+
+void PreferencesDialog::gfhighChanged(int gf)
+{
+ if (gf > 100)
+ ui.gfhigh->setStyleSheet("* { color: red; }");
+ else
+ ui.gfhigh->setStyleSheet("");
+}
+
void PreferencesDialog::showEvent(QShowEvent *event)
{
setUiFromPrefs();
diff --git a/qt-ui/preferences.h b/qt-ui/preferences.h
index fb0fcbc94..dbc17cb9f 100644
--- a/qt-ui/preferences.h
+++ b/qt-ui/preferences.h
@@ -22,6 +22,9 @@ public slots:
void syncSettings();
void restorePrefs();
void rememberPrefs();
+ void gflowChanged(int gf);
+ void gfhighChanged(int gf);
+
private:
explicit PreferencesDialog(QWidget* parent = 0, Qt::WindowFlags f = 0);
diff --git a/qt-ui/preferences.ui b/qt-ui/preferences.ui
index e80cc8493..7b6f3e596 100644
--- a/qt-ui/preferences.ui
+++ b/qt-ui/preferences.ui
@@ -779,7 +779,14 @@
</widget>
</item>
<item row="0" column="1">
- <widget class="QSpinBox" name="gflow"/>
+ <widget class="QSpinBox" name="gflow">
+ <property name="minimum">
+ <number>1</number>
+ </property>
+ <property name="maximum">
+ <number>150</number>
+ </property>
+ </widget>
</item>
<item row="1" column="0">
<widget class="QLabel" name="label_20">
@@ -789,7 +796,14 @@
</widget>
</item>
<item row="1" column="1">
- <widget class="QSpinBox" name="gfhigh"/>
+ <widget class="QSpinBox" name="gfhigh">
+ <property name="minimum">
+ <number>1</number>
+ </property>
+ <property name="maximum">
+ <number>150</number>
+ </property>
+ </widget>
</item>
<item row="2" column="0" colspan="2">
<widget class="QCheckBox" name="gf_low_at_maxdepth">