Instead of hard coding the default value as 14, it loads its size value
from the system font (if not already defined).

--
Danilo Cesar
From 508e7b144b259bcef4789ce32089fff6a0dde0c9 Mon Sep 17 00:00:00 2001
From: Danilo Cesar Lemes de Paula <[email protected]>
Date: Wed, 26 Feb 2014 16:27:26 -0300
Subject: [PATCH] fixing default font on preference window

Default font was hardcoded as 14.
What happen if you change any other preference value is that the application would start to use fontSize=14.

This commit loads the right value in the QDoubleSpinBox

Signed-off-by: Danilo Cesar Lemes de Paula <[email protected]>
---
 qt-ui/preferences.cpp | 3 +++
 subsurfacestartup.c   | 2 +-
 2 files changed, 4 insertions(+), 1 deletion(-)

diff --git a/qt-ui/preferences.cpp b/qt-ui/preferences.cpp
index 01f1815..c1c03e8 100644
--- a/qt-ui/preferences.cpp
+++ b/qt-ui/preferences.cpp
@@ -278,8 +278,11 @@ void PreferencesDialog::loadSettings()
 	QFont defaultFont = s.value("divelist_font", qApp->font()).value<QFont>();
 	defaultFont.setPointSizeF(s.value("font_size", qApp->font().pointSizeF()).toFloat());
 	qApp->setFont(defaultFont);
+
 	GET_TXT("divelist_font", divelist_font);
 	GET_INT("font_size", font_size);
+	if (prefs.font_size < 0)
+		prefs.font_size = defaultFont.pointSizeF();
 	GET_INT("displayinvalid", display_invalid_dives);
 	s.endGroup();
 }
diff --git a/subsurfacestartup.c b/subsurfacestartup.c
index e858285..eafe597 100644
--- a/subsurfacestartup.c
+++ b/subsurfacestartup.c
@@ -26,7 +26,7 @@ struct preferences default_prefs = {
 	.gflow = 30,
 	.gfhigh = 75,
 	.gf_low_at_maxdepth = false,
-	.font_size = 14.0,
+	.font_size = -1,
 	.display_invalid_dives = false,
 	.show_sac = false,
 	.display_unused_tanks = false
-- 
1.9.0

Attachment: signature.asc
Description: OpenPGP digital signature

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

Reply via email to