summaryrefslogtreecommitdiffstats
path: root/src/config.cpp
diff options
context:
space:
mode:
authorSimon Rettberg2018-11-05 10:12:54 +0100
committerSimon Rettberg2018-11-05 10:12:54 +0100
commit827f27462e84e1ebc1c94ec50efa0dfaf5d944b1 (patch)
treec764148272feae27c331526463d00a047352dbc7 /src/config.cpp
parentRead messages from external files (diff)
downloadbwlp-screensaver-827f27462e84e1ebc1c94ec50efa0dfaf5d944b1.tar.gz
bwlp-screensaver-827f27462e84e1ebc1c94ec50efa0dfaf5d944b1.tar.xz
bwlp-screensaver-827f27462e84e1ebc1c94ec50efa0dfaf5d944b1.zip
Make QSS customizable as well
Diffstat (limited to 'src/config.cpp')
-rw-r--r--src/config.cpp20
1 files changed, 20 insertions, 0 deletions
diff --git a/src/config.cpp b/src/config.cpp
index 7dfb6b1..450c8db 100644
--- a/src/config.cpp
+++ b/src/config.cpp
@@ -1,5 +1,8 @@
#include "config.h"
+#include <QFile>
+#include <QTextStream>
+
const QString CONFIG_DIR("/opt/openslx/xscreensaver");
const QString CONFIG_QSS(CONFIG_DIR + "/style.qss");
@@ -7,3 +10,20 @@ Config::Config()
{
}
+
+QString Config::loadFileToString(const QString &fileName)
+{
+ QFile f(fileName);
+ QString str;
+ if (f.open(QFile::ReadOnly | QFile::Text)) {
+ QTextStream s(&f);
+ s.setCodec("UTF-8");
+ str = s.readAll();
+ }
+ return str;
+}
+
+QString Config::getMainQss()
+{
+ return loadFileToString(CONFIG_QSS);
+}