summaryrefslogtreecommitdiffstats
path: root/src/global.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/global.cpp')
-rw-r--r--src/global.cpp31
1 files changed, 31 insertions, 0 deletions
diff --git a/src/global.cpp b/src/global.cpp
index 7039bc1..1a3cf80 100644
--- a/src/global.cpp
+++ b/src/global.cpp
@@ -1,10 +1,12 @@
#include "global.h"
+#include "settings.h"
#include <QTimer>
#include <QModelIndex>
#include <QString>
#include <QEventLoop>
#include <QDebug>
#include <QCoreApplication>
+#include <QStringList>
bool Global::m_testMode = false;
@@ -49,3 +51,32 @@ bool Global::startSession()
QString s = m_Sessions->data(i, QLightDM::SessionsModel::KeyRole).toString();
return m_Greeter->startSessionSync(s);
}
+
+QImage Global::getConfigGradient()
+{
+ QImage img;
+ const QStringList cols = Settings().gradientColors();
+ qWarning() << "Got gradient color list: " << cols;
+ if (cols.length() == 4 || cols.length() == 2) {
+ bool ok = true;
+ uint a, b, c, d;
+ if (ok) a = cols.at(0).toUInt(&ok, 16) | 0xff000000;
+ if (ok) b = cols.at(1).toUInt(&ok, 16) | 0xff000000;
+ if (cols.length() == 4) {
+ if (ok) c = cols.at(2).toUInt(&ok, 16) | 0xff000000;
+ if (ok) d = cols.at(3).toUInt(&ok, 16) | 0xff000000;
+ } else if (ok) {
+ c = b;
+ }
+ if (ok) {
+ img = QImage(cols.length() / 2, 2, QImage::Format_RGB32);
+ img.setPixel(0, 0, a);
+ img.setPixel(0, 1, c);
+ if (cols.length() == 4) {
+ img.setPixel(1, 0, b);
+ img.setPixel(1, 1, d);
+ }
+ }
+ }
+ return img;
+}