summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/loginform.cpp4
-rw-r--r--src/mainwindow.cpp40
-rw-r--r--src/mainwindow.h2
-rw-r--r--src/settings.h9
4 files changed, 29 insertions, 26 deletions
diff --git a/src/loginform.cpp b/src/loginform.cpp
index 69015f7..f6c438d 100644
--- a/src/loginform.cpp
+++ b/src/loginform.cpp
@@ -51,8 +51,8 @@ void LoginForm::initialize()
{
// fallback to built-in bwlp logo
QPixmap icon(":/resources/bwlp.svg"); // This project came from Razor-qt
- if (!Settings::miniIconPath().isNull() && !Settings::miniIconPath().isEmpty()) {
- QPixmap configuredIcon(Settings::miniIconPath());
+ if (!Settings::miniIconFile().isNull() && !Settings::miniIconFile().isEmpty()) {
+ QPixmap configuredIcon(Settings::miniIconFile());
if (!configuredIcon.isNull())
icon = configuredIcon;
}
diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp
index 554d972..15736f0 100644
--- a/src/mainwindow.cpp
+++ b/src/mainwindow.cpp
@@ -72,9 +72,9 @@ MainWindow::MainWindow(bool primary, int screen, const QRect &screenRect, QWidge
}
// Banner
- if (!Settings::bannerImagePath().isEmpty()) {
- qWarning() << "Have banner " << Settings::bannerImagePath();
- QSvgWidget *banner = new QSvgWidget(Settings::bannerImagePath(), this);
+ if (!Settings::bannerImageFile().isEmpty()) {
+ qWarning() << "Have banner " << Settings::bannerImageFile();
+ QSvgWidget *banner = new QSvgWidget(Settings::bannerImageFile(), this);
qWarning() << banner->sizeHint();
if (banner->renderer()->isValid()) {
QSize sh;
@@ -111,39 +111,41 @@ MainWindow::~MainWindow()
QSize MainWindow::createLogo(QRect max)
{
- QString path = Settings::bottomLeftLogoPath();
- if (path.isEmpty())
- return QSize(0, 0);
+ QSize retval(0, 0);
+ QString path = Settings::bottomLeftLogoFile();
+ if (!path.isEmpty()) { // Single explicit file first
+ createNextLogo(max, retval, path);
+ }
+ path = Settings::bottomLeftLogoDir();
// Check whether it's a file or directory
- if (QFileInfo(path).isDir()) {
- QSize retval(0, 0);
+ if (!path.isEmpty() && QFileInfo(path).isDir()) {
QFileInfoList fileInfoList = QDir(path).entryInfoList(QStringList() << "*.svg", QDir::Files, QDir::Name | QDir::Reversed);
for (QFileInfo fileInfo : fileInfoList) {
QString filePath = fileInfo.absoluteFilePath();
- QSize s = createNextLogo(max, filePath);
- max.setHeight(max.height() - s.height());
- retval.setWidth(qMax(retval.width(), s.width()));
- retval.setHeight(retval.height() + s.height());
+ createNextLogo(max, retval, filePath);
}
return retval;
}
- return createNextLogo(max, path);
+ createNextLogo(max, retval, path);
+ return retval;
}
-QSize MainWindow::createNextLogo(const QRect &max, const QString &path)
+void MainWindow::createNextLogo(QRect &max, QSize &retval, const QString &path)
{
if (max.height() <= 0)
- return QSize(0, 0);
+ return;
QSvgWidget *img = new QSvgWidget(path, this);
if (!img->renderer()->isValid())
- return QSize(0, 0);
+ return;
QSize virtualSize = img->sizeHint().scaled(max.width(), max.height(), Qt::KeepAspectRatio);
QSize realSize = img->sizeHint().scaled(max.width() - 20, max.height() - 20, Qt::KeepAspectRatio);
if (virtualSize.width() == 0 || virtualSize.height() == 0)
- return QSize(0, 0);
+ return;
QRect c(max.left() + 10, max.bottom() - realSize.height() - 10, realSize.width(), realSize.height());
img->setGeometry(c);
- return virtualSize;
+ max.setHeight(max.height() - virtualSize.height());
+ retval.setWidth(qMax(retval.width(), virtualSize.width()));
+ retval.setHeight(retval.height() + virtualSize.height());
}
QSize MainWindow::createDistro(const QRect &max)
@@ -290,7 +292,7 @@ int MainWindow::getOffset(QString settingsOffset, int maxVal, int defaultVal)
void MainWindow::setBackground()
{
Qt::AspectRatioMode arMode = Qt::KeepAspectRatioByExpanding;
- QString bgPath = Settings::backgrundImagePath();
+ QString bgPath = Settings::backgrundImageFile();
if (bgPath.length() != 0) {
m_background = QImage(bgPath);
if (m_background.isNull()) {
diff --git a/src/mainwindow.h b/src/mainwindow.h
index dad9089..b6a756c 100644
--- a/src/mainwindow.h
+++ b/src/mainwindow.h
@@ -35,7 +35,7 @@ public:
QSize createLogo(QRect max);
- QSize createNextLogo(const QRect &max, const QString &path);
+ void createNextLogo(QRect &max, QSize &retval, const QString &path);
QSize createDistro(const QRect &max);
diff --git a/src/settings.h b/src/settings.h
index 7a587ea..59410bd 100644
--- a/src/settings.h
+++ b/src/settings.h
@@ -28,12 +28,13 @@ public:
}
}
static QString iconThemeName() { return s_settings->value("greeter-icon-theme").toString(); }
- static QString backgrundImagePath() { return s_settings->value("greeter-background-image").toString(); }
+ static QString backgrundImageFile() { return s_settings->value("greeter-background-image").toString(); }
static QString offsetX() { return s_settings->value("loginform-offset-x").toString(); }
static QString offsetY() { return s_settings->value("loginform-offset-y").toString(); }
- static QString miniIconPath() { return s_settings->value("loginform-mini-icon").toString(); }
- static QString bannerImagePath() { return s_settings->value("greeter-banner-image").toString(); }
- static QString bottomLeftLogoPath() { return s_settings->value("greeter-bottom-left-logo-path").toString(); }
+ static QString miniIconFile() { return s_settings->value("loginform-mini-icon").toString(); }
+ static QString bannerImageFile() { return s_settings->value("greeter-banner-image").toString(); }
+ static QString bottomLeftLogoFile() { return s_settings->value("greeter-bottom-left-logo-file").toString(); }
+ static QString bottomLeftLogoDir() { return s_settings->value("greeter-bottom-left-logo-path").toString(); }
static QStringList gradientColors() { return s_settings->value("greeter-background-gradient").toString().split(QRegExp("\\s"), QString::SkipEmptyParts); }
static QString logMessageFile() { return s_settings->value("greeter-message-file").toString(); }
static QString autoLoginCheckCmd() { return s_settings->value("auto-login-check-cmd").toString(); }