On Sat, Apr 5, 2014 at 10:41 AM, Dirk Hohndel <[email protected]> wrote:
> Sorry for top post.
> I meant to remove the option from preferences and always show the temperature 
> units in the add dive mode.
>
Attached patch does the job as per the suggestion.

Thank you,
Lakshman
From 7433e91b10e7e8b859a964c67a90132946eb3847 Mon Sep 17 00:00:00 2001
From: Lakshman Anumolu <[email protected]>
Date: Sat, 5 Apr 2014 10:49:58 -0500
Subject: [PATCH] Remove check option to show units in text label

Currently the feature to show temperature units while adding dive is
provided through checkbox in preferences->units section. This patch
disables this checkbox and always enables this feature.

Signed-off-by: Lakshman Anumolu <[email protected]>
---
 pref.h                |  1 -
 qt-ui/maintab.cpp     |  6 +++---
 qt-ui/maintab.h       |  2 +-
 qt-ui/preferences.cpp |  3 ---
 qt-ui/preferences.ui  | 14 --------------
 subsurfacestartup.c   |  3 +--
 6 files changed, 5 insertions(+), 24 deletions(-)

diff --git a/pref.h b/pref.h
index ec2aab2..c9cb271 100644
--- a/pref.h
+++ b/pref.h
@@ -41,7 +41,6 @@ struct preferences {
 	bool display_unused_tanks;
 	bool show_average_depth;
 	bool zoomed_plot;
-	bool text_label_with_units;
 };
 enum unit_system_values {
 	METRIC,
diff --git a/qt-ui/maintab.cpp b/qt-ui/maintab.cpp
index 70a9dc3..227d89b 100644
--- a/qt-ui/maintab.cpp
+++ b/qt-ui/maintab.cpp
@@ -202,7 +202,7 @@ void MainTab::hideMessage()
 	ui.diveEquipmentMessage->animatedHide();
 	ui.diveInfoMessage->animatedHide();
 	ui.diveStatisticsMessage->animatedHide();
-	updateTextLabels();
+	updateTextLabels(false);
 }
 
 void MainTab::closeMessage()
@@ -224,12 +224,12 @@ void MainTab::displayMessage(QString str)
 	ui.diveInfoMessage->animatedShow();
 	ui.diveStatisticsMessage->setText(str);
 	ui.diveStatisticsMessage->animatedShow();
-	updateTextLabels(true);
+	updateTextLabels();
 }
 
 void MainTab::updateTextLabels(bool showUnits)
 {
-	if (showUnits && prefs.text_label_with_units) {
+	if (showUnits) {
 		ui.airTempLabel->setText(tr("Air temp [%1]").arg(get_temp_unit()));
 		ui.waterTempLabel->setText(tr("Water temp [%1]").arg(get_temp_unit()));
 	} else {
diff --git a/qt-ui/maintab.h b/qt-ui/maintab.h
index 9da1e89..eee07a3 100644
--- a/qt-ui/maintab.h
+++ b/qt-ui/maintab.h
@@ -94,7 +94,7 @@ slots:
 	void displayMessage(QString str);
 	void enableEdition(EditMode newEditMode = NONE);
 	void toggleTriggeredColumn();
-	void updateTextLabels(bool showUnits = false);
+	void updateTextLabels(bool showUnits = true);
 
 private:
 	Ui::MainTab ui;
diff --git a/qt-ui/preferences.cpp b/qt-ui/preferences.cpp
index 7c74b15..e49984c 100644
--- a/qt-ui/preferences.cpp
+++ b/qt-ui/preferences.cpp
@@ -75,7 +75,6 @@ void PreferencesDialog::setUiFromPrefs()
 	ui.cuft->setChecked(prefs.units.volume == units::CUFT);
 	ui.kg->setChecked(prefs.units.weight == units::KG);
 	ui.lbs->setChecked(prefs.units.weight == units::LBS);
-	ui.text_label_with_units->setChecked(prefs.text_label_with_units);
 
 	ui.font->setCurrentFont(QString(prefs.divelist_font));
 	ui.fontsize->setValue(prefs.font_size);
@@ -198,7 +197,6 @@ void PreferencesDialog::syncSettings()
 	s.setValue("volume", ui.cuft->isChecked() ? units::CUFT : units::LITER);
 	s.setValue("weight", ui.lbs->isChecked() ? units::LBS : units::KG);
 	s.setValue("vertical_speed_time", ui.vertical_speed_minutes->isChecked() ? units::MINUTES : units::SECONDS);
-	SB("text_label_with_units", ui.text_label_with_units);
 	s.endGroup();
 	// Defaults
 	s.beginGroup("GeneralSettings");
@@ -255,7 +253,6 @@ void PreferencesDialog::loadSettings()
 		GET_UNIT("weight", weight, units::LBS, units::KG);
 	}
 	GET_UNIT("vertical_speed_time", vertical_speed_time, units::MINUTES, units::SECONDS);
-	GET_BOOL("text_label_with_units", text_label_with_units);
 	s.endGroup();
 	s.beginGroup("TecDetails");
 	GET_BOOL("po2graph", pp_graphs.po2);
diff --git a/qt-ui/preferences.ui b/qt-ui/preferences.ui
index 4345730..0069ccc 100644
--- a/qt-ui/preferences.ui
+++ b/qt-ui/preferences.ui
@@ -512,20 +512,6 @@
            </item>
           </layout>
 	 </item>
-	 <item>
-	  <layout class="QHBoxLayout" name="text_label_with_units_hbox">
-	   <item>
-	    <widget class="QCheckBox" name="text_label_with_units">
-	     <property name="enabled">
-	      <bool>true</bool>
-	     </property>
-	     <property name="text">
-	      <string>Show units in text labels</string>
-	     </property>
-	    </widget>
-	   </item>
-	  </layout>
-	 </item>
          <item>
           <spacer name="verticalSpacer">
            <property name="orientation">
diff --git a/subsurfacestartup.c b/subsurfacestartup.c
index 06a76d0..63ecaa1 100644
--- a/subsurfacestartup.c
+++ b/subsurfacestartup.c
@@ -30,8 +30,7 @@ struct preferences default_prefs = {
 	.display_invalid_dives = false,
 	.show_sac = false,
 	.display_unused_tanks = false,
-	.show_average_depth = true,
-	.text_label_with_units = false
+	.show_average_depth = true
 };
 
 struct units *get_units()
-- 
1.8.3.2

_______________________________________________
subsurface mailing list
[email protected]
http://lists.hohndel.org/cgi-bin/mailman/listinfo/subsurface

Reply via email to