summaryrefslogtreecommitdiffstats
path: root/src/mainwindow.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/mainwindow.cpp')
-rw-r--r--src/mainwindow.cpp32
1 files changed, 5 insertions, 27 deletions
diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp
index 2eb84c9..79a5190 100644
--- a/src/mainwindow.cpp
+++ b/src/mainwindow.cpp
@@ -20,6 +20,7 @@
#include "mainwindow.h"
#include "loginform.h"
#include "settings.h"
+#include "global.h"
static const Settings _settings;
@@ -78,8 +79,8 @@ MainWindow::MainWindow(bool primary, int screen, const QRect &screenRect, QWidge
bw = sh.width();
bh = sh.height();
} else {
- int bh = spaceY - 20;
- int bw = sh.width() * bh / sh.height();
+ bh = spaceY - 20;
+ bw = sh.width() * bh / sh.height();
banner->setFixedSize(bw, bh);
}
banner->move((screenRect.width() - bw) / 2, (spaceY - bh) / 2);
@@ -219,31 +220,8 @@ void MainWindow::setBackground()
}
if (m_background.isNull()) {
+ m_background = Global::getConfigGradient();
arMode = Qt::IgnoreAspectRatio;
- QStringList cols = _settings.gradientColors();
- qWarning() << "Got 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 {
- c = b;
- }
- qWarning() << a << b << c << d;
- if (ok) {
- m_background = QImage(cols.length() / 2, 2, QImage::Format_RGB32);
- m_background.setPixel(0, 0, a);
- m_background.setPixel(0, 1, c);
- if (cols.length() == 4) {
- m_background.setPixel(1, 0, b);
- m_background.setPixel(1, 1, d);
- }
- }
- }
}
if (m_background.isNull()) {
// Hard-coded default: Gradient
@@ -259,7 +237,7 @@ void MainWindow::setBackground()
palette.setColor(QPalette::Background, Qt::black);
}
else {
- m_background = m_background.scaled(m_ScreenRect.width(), m_ScreenRect.height(), Qt::KeepAspectRatioByExpanding, Qt::SmoothTransformation);
+ m_background = m_background.scaled(m_ScreenRect.width(), m_ScreenRect.height(), arMode, Qt::SmoothTransformation);
int xoff = (m_background.width() - m_ScreenRect.width()) / 2;
int yoff = (m_background.height() - m_ScreenRect.height()) / 2;
if (xoff != 0 || yoff != 0) {