aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Dirk Hohndel <dirk@hohndel.org>2020-02-08 11:08:03 -0800
committerGravatar Dirk Hohndel <dirk@hohndel.org>2020-02-08 13:58:54 -0800
commit9069f3364d971c4387fd6fa048f73323240bccf9 (patch)
tree291711c5039a1ab814533b8fb195b50f5b34cbf1
parent641ca47fd5e53cdddb01d3ee127274012fa5a9cb (diff)
downloadsubsurface-9069f3364d971c4387fd6fa048f73323240bccf9.tar.gz
core/settings: add new preference to limit number of columns on mobile
The idea is that in portrait mode we can force the display to be single column (which makes sure that the profile in dive display mode is nice and big). This commit only implements the preference variable that we need for that. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
-rw-r--r--core/settings/qPrefDisplay.cpp7
-rw-r--r--core/settings/qPrefDisplay.h6
2 files changed, 12 insertions, 1 deletions
diff --git a/core/settings/qPrefDisplay.cpp b/core/settings/qPrefDisplay.cpp
index d29134d69..cea33a90a 100644
--- a/core/settings/qPrefDisplay.cpp
+++ b/core/settings/qPrefDisplay.cpp
@@ -41,6 +41,9 @@ static const QByteArray st_windowState_default;
int qPrefDisplay::st_lastState;
static int st_lastState_default = false;
+bool qPrefDisplay::st_singleColumnPortrait;
+static bool st_singleColumnPortrait_default = false;
+
qPrefDisplay *qPrefDisplay::instance()
{
static qPrefDisplay *self = new qPrefDisplay;
@@ -66,7 +69,7 @@ void qPrefDisplay::loadSync(bool doSync)
load_geometry();
load_windowState();
load_lastState();
-
+ load_singleColumnPortrait();
}
}
@@ -198,3 +201,5 @@ HANDLE_PROP_QBYTEARRAY(Display, "MainWindow/geometry", geometry);
HANDLE_PROP_QBYTEARRAY(Display, "MainWindow/windowState", windowState);
HANDLE_PROP_INT(Display, "MainWindow/lastState", lastState);
+
+HANDLE_PROP_BOOL(Display, "singleColumnPortrait", singleColumnPortrait);
diff --git a/core/settings/qPrefDisplay.h b/core/settings/qPrefDisplay.h
index 782001fb4..42d5c8e84 100644
--- a/core/settings/qPrefDisplay.h
+++ b/core/settings/qPrefDisplay.h
@@ -25,6 +25,7 @@ class qPrefDisplay : public QObject {
Q_PROPERTY(QByteArray geometry READ geometry WRITE set_geometry NOTIFY geometryChanged)
Q_PROPERTY(QByteArray windowState READ windowState WRITE set_windowState NOTIFY windowStateChanged)
Q_PROPERTY(int lastState READ lastState WRITE set_lastState NOTIFY lastStateChanged)
+ Q_PROPERTY(bool singleColumnPortrait READ singleColumnPortrait WRITE set_singleColumnPortrait NOTIFY singleColumnPortraitChanged)
public:
static qPrefDisplay *instance();
@@ -52,6 +53,7 @@ public:
static QByteArray geometry() { return st_geometry; }
static QByteArray windowState() { return st_windowState; }
static int lastState() { return st_lastState; }
+ static bool singleColumnPortrait() { return st_singleColumnPortrait; }
public slots:
static void set_animation_speed(int value);
@@ -71,6 +73,7 @@ public slots:
static void set_geometry(const QByteArray& value);
static void set_windowState(const QByteArray& value);
static void set_lastState(int value);
+ static void set_singleColumnPortrait(bool value);
signals:
void animation_speedChanged(int value);
@@ -90,6 +93,7 @@ signals:
void geometryChanged(const QByteArray& value);
void windowStateChanged(const QByteArray& value);
void lastStateChanged(int value);
+ void singleColumnPortraitChanged(bool value);
private:
qPrefDisplay() {}
@@ -114,6 +118,7 @@ private:
static void load_geometry();
static void load_windowState();
static void load_lastState();
+ static void load_singleColumnPortrait();
// font helper function
static void setCorrectFont();
@@ -130,5 +135,6 @@ private:
static QByteArray st_geometry;
static QByteArray st_windowState;
static int st_lastState;
+ static bool st_singleColumnPortrait;
};
#endif