diff options
Diffstat (limited to 'src/mainwindow.cpp')
-rw-r--r-- | src/mainwindow.cpp | 26 |
1 files changed, 23 insertions, 3 deletions
diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp index b66a73d..554d972 100644 --- a/src/mainwindow.cpp +++ b/src/mainwindow.cpp @@ -93,7 +93,7 @@ MainWindow::MainWindow(bool primary, int screen, const QRect &screenRect, QWidge int ls = (spaceY > 500 ? 500 : spaceY); if (ls > screenRect.height() / 5) ls = screenRect.height() / 5; if (ls > screenRect.width() / 5) ls = screenRect.width() / 5; - QRect logoRect(QPoint(0, screenRect.height() - ls), QSize(ls, ls)); + QRect logoRect(QPoint(0, screenRect.height() / 3), QSize(ls, screenRect.height() * 2 / 3)); QSize logoSize = createLogo(logoRect); QRect distroRect(QPoint(screenRect.width() - ls, screenRect.height() - ls), QSize(ls, ls)); QSize distroSize = createDistro(distroRect); @@ -109,11 +109,31 @@ MainWindow::~MainWindow() { } -QSize MainWindow::createLogo(const QRect &max) +QSize MainWindow::createLogo(QRect max) { QString path = Settings::bottomLeftLogoPath(); if (path.isEmpty()) return QSize(0, 0); + // Check whether it's a file or directory + if (QFileInfo(path).isDir()) { + QSize retval(0, 0); + 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()); + } + return retval; + } + return createNextLogo(max, path); +} + +QSize MainWindow::createNextLogo(const QRect &max, const QString &path) +{ + if (max.height() <= 0) + return QSize(0, 0); QSvgWidget *img = new QSvgWidget(path, this); if (!img->renderer()->isValid()) return QSize(0, 0); @@ -121,7 +141,7 @@ QSize MainWindow::createLogo(const QRect &max) QSize realSize = img->sizeHint().scaled(max.width() - 20, max.height() - 20, Qt::KeepAspectRatio); if (virtualSize.width() == 0 || virtualSize.height() == 0) return QSize(0, 0); - QRect c(10, max.bottom() - realSize.height() - 10, realSize.width(), realSize.height()); + QRect c(max.left() + 10, max.bottom() - realSize.height() - 10, realSize.width(), realSize.height()); img->setGeometry(c); return virtualSize; } |