summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Anton Lundin <glance@acc.umu.se>2014-03-21 18:56:10 +0100
committerGravatar Dirk Hohndel <dirk@hohndel.org>2014-03-21 21:30:39 -0700
commit9cfc585563ac584b792e8f1a5836ccfd75a3739d (patch)
treeda8d3605c4828993e1d23e360a131ffa72892120
parent41209005c949a65b3f3adb733ebda052e36980f4 (diff)
downloadsubsurface-9cfc585563ac584b792e8f1a5836ccfd75a3739d.tar.gz
Fix system default font handling
We didn't care about system default fonts and sizes, we just used the Qt default font. Due to how QFont is constructed, there was need to split font and font size. Signed-off-by: Anton Lundin <glance@acc.umu.se> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
-rw-r--r--linux.c3
-rw-r--r--macos.c3
-rw-r--r--pref.h1
-rw-r--r--qt-ui/mainwindow.cpp5
-rw-r--r--subsurfacestartup.c1
-rw-r--r--windows.c3
6 files changed, 11 insertions, 5 deletions
diff --git a/linux.c b/linux.c
index 346af092d..6bfb38126 100644
--- a/linux.c
+++ b/linux.c
@@ -9,7 +9,8 @@
#include <stdio.h>
#include <fcntl.h>
-const char system_divelist_default_font[] = "Sans 8";
+const char system_divelist_default_font[] = "Sans";
+const int system_divelist_default_font_size = 8;
const char *system_default_filename(void)
{
diff --git a/macos.c b/macos.c
index 58619d7af..01c3fbfb5 100644
--- a/macos.c
+++ b/macos.c
@@ -25,7 +25,8 @@
#define ICON_NAME "Subsurface.icns"
#define UI_FONT "Arial 12"
-const char system_divelist_default_font[] = "Arial 10";
+const char system_divelist_default_font[] = "Arial";
+const int system_divelist_default_font_size = 10;
const char *system_default_filename(void)
{
diff --git a/pref.h b/pref.h
index a5d90a921..3955b88d7 100644
--- a/pref.h
+++ b/pref.h
@@ -64,6 +64,7 @@ extern void subsurface_flush_conf(void);
extern void subsurface_close_conf(void);
extern const char system_divelist_default_font[];
+extern const int system_divelist_default_font_size;
extern const char *system_default_filename();
extern void load_preferences(void);
diff --git a/qt-ui/mainwindow.cpp b/qt-ui/mainwindow.cpp
index 8fd51a5b9..e77fa6b2c 100644
--- a/qt-ui/mainwindow.cpp
+++ b/qt-ui/mainwindow.cpp
@@ -645,8 +645,9 @@ void MainWindow::readSettings()
{
QSettings s;
s.beginGroup("Display");
- QFont defaultFont = s.value("divelist_font", qApp->font()).value<QFont>();
- defaultFont.setPointSizeF(s.value("font_size", qApp->font().pointSizeF()).toFloat());
+ QFont defaultFont = QFont(default_prefs.divelist_font);
+ defaultFont = s.value("divelist_font", defaultFont).value<QFont>();
+ defaultFont.setPointSizeF(s.value("font_size", default_prefs.font_size).toFloat());
qApp->setFont(defaultFont);
s.endGroup();
diff --git a/subsurfacestartup.c b/subsurfacestartup.c
index 3f410aff4..6d3714b91 100644
--- a/subsurfacestartup.c
+++ b/subsurfacestartup.c
@@ -170,6 +170,7 @@ void setup_system_prefs(void)
const char *env;
default_prefs.divelist_font = strdup(system_divelist_default_font);
+ default_prefs.font_size = system_divelist_default_font_size;
default_prefs.default_filename = system_default_filename();
env = getenv("LC_MEASUREMENT");
diff --git a/windows.c b/windows.c
index 7e3c50742..c76a73048 100644
--- a/windows.c
+++ b/windows.c
@@ -10,7 +10,8 @@
#include <dirent.h>
#include <zip.h>
-const char system_divelist_default_font[] = "Sans 8";
+const char system_divelist_default_font[] = "Sans";
+const int system_divelist_default_font_size = 8;
const char *system_default_filename(void)
{