From 542b440ad64b50f265b72246981d5e9d655eb4d4 Mon Sep 17 00:00:00 2001 From: Simon Rettberg Date: Sun, 12 Nov 2017 13:04:26 +0100 Subject: Fix banner display, gradient parsing, add test mode (--test) --- src/mainwindow.cpp | 25 ++++++++++++++++--------- 1 file changed, 16 insertions(+), 9 deletions(-) (limited to 'src/mainwindow.cpp') diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp index c578c43..f5bd274 100644 --- a/src/mainwindow.cpp +++ b/src/mainwindow.cpp @@ -10,7 +10,7 @@ #include #include #include -#include +#include #include #include #include @@ -21,7 +21,7 @@ static const Settings _settings; -MainWindow::MainWindow(bool primary, int screen, const QRect &screenRect, QWidget *parent) : +MainWindow::MainWindow(bool primary, int screen, const QRect &screenRect, bool testMode, QWidget *parent) : QWidget(parent), m_Screen(screen), m_Primary(primary) @@ -37,7 +37,7 @@ MainWindow::MainWindow(bool primary, int screen, const QRect &screenRect, QWidge int spaceY = screenRect.height() / 2; if (showLoginForm()) { - m_LoginForm = new LoginForm(this); + m_LoginForm = new LoginForm(testMode, this); spaceY -= m_LoginForm->height() / 2; int maxX = screenRect.width() - m_LoginForm->width(); @@ -71,13 +71,16 @@ MainWindow::MainWindow(bool primary, int screen, const QRect &screenRect, QWidge p.setColor(QPalette::Base, QColor(0,0,0,0)); // r,g,b,A QPalette::Light; m_messages->setPalette(p); - //m_messages->setText("TODO\nLogmessages\n\nWarnings\netc."); + m_messages->setFontPointSize(16); + //m_messages->setText("TODO\nLogmessages\n\nWarnings\netc."); TODO m_messages->setReadOnly(true); - this->setStyle(QStyleFactory::create("#m_messages, QTextEdit { border: none; }")); // TODO: Get rid of black 1px border + m_messages->setStyleSheet("border:none;"); // Banner - if (_settings.bannerImagePath().isEmpty()) { + if (!_settings.bannerImagePath().isEmpty()) { + qWarning() << "Have banner " << _settings.bannerImagePath(); QSvgWidget *banner = new QSvgWidget(_settings.bannerImagePath(), this); + qWarning() << banner->sizeHint(); if (banner->sizeHint().height() > 0) { int bw, bh; QSize sh = banner->sizeHint(); @@ -154,15 +157,19 @@ void MainWindow::setBackground() if (m_background.isNull()) { 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) c = a = cols.at(0).toUInt(&ok, 16) | 0xff000000; - if (ok) d = b = cols.at(1).toUInt(&ok, 16) | 0xff000000; + 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); @@ -178,7 +185,7 @@ void MainWindow::setBackground() // Hard-coded default: Gradient m_background = QImage(2, 2, QImage::Format_RGB32); m_background.setPixel(0, 0, 0xffffffff); - m_background.setPixel(1, 0, 0xff888687); + m_background.setPixel(1, 0, 0xffffffff); m_background.setPixel(0, 1, 0xff888687); m_background.setPixel(1, 1, 0xfff9a72b); } -- cgit v1.2.3-55-g7522