summaryrefslogtreecommitdiffstats
path: root/src/mainwindow.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/mainwindow.cpp')
-rw-r--r--src/mainwindow.cpp40
1 files changed, 21 insertions, 19 deletions
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()) {