summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSimon Rettberg2019-03-15 22:30:14 +0100
committerSimon Rettberg2019-03-15 22:30:14 +0100
commit347261f8895d959269afc0e63f2b0d98826086c4 (patch)
tree3bb47f1eb8d9a210ff691bde4b0f1706f775cc3a
parentIncrease LDAP timeout to 8 secs (diff)
downloadslxgreeter-347261f8895d959269afc0e63f2b0d98826086c4.tar.gz
slxgreeter-347261f8895d959269afc0e63f2b0d98826086c4.tar.xz
slxgreeter-347261f8895d959269afc0e63f2b0d98826086c4.zip
Support passing dir as bottom-left-logo-path
*.svg found in that directory will be shown in the bottom left corner, stacked on top of each other, in alphabetical order (top -> bottom).
-rw-r--r--src/loginform.ui9
-rw-r--r--src/mainwindow.cpp26
-rw-r--r--src/mainwindow.h4
3 files changed, 32 insertions, 7 deletions
diff --git a/src/loginform.ui b/src/loginform.ui
index abb196f..10f7105 100644
--- a/src/loginform.ui
+++ b/src/loginform.ui
@@ -80,12 +80,12 @@ QComboBox QAbstractItemView::item {
</sizepolicy>
</property>
<layout class="QGridLayout" name="gridLayout">
- <property name="verticalSpacing">
- <number>8</number>
- </property>
<property name="bottomMargin">
<number>9</number>
</property>
+ <property name="verticalSpacing">
+ <number>8</number>
+ </property>
<item row="0" column="0">
<widget class="QLabel" name="hostnameLabel">
<property name="minimumSize">
@@ -137,6 +137,9 @@ QComboBox QAbstractItemView::item {
<height>30</height>
</size>
</property>
+ <property name="focusPolicy">
+ <enum>Qt::NoFocus</enum>
+ </property>
<item>
<property name="text">
<string/>
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;
}
diff --git a/src/mainwindow.h b/src/mainwindow.h
index 8a5bcf7..dad9089 100644
--- a/src/mainwindow.h
+++ b/src/mainwindow.h
@@ -33,7 +33,9 @@ public:
void setFocus(Qt::FocusReason reason);
- QSize createLogo(const QRect &max);
+ QSize createLogo(QRect max);
+
+ QSize createNextLogo(const QRect &max, const QString &path);
QSize createDistro(const QRect &max);