From 57d416a2b4dd45831ecaddd9732e6f7e62b626ee Mon Sep 17 00:00:00 2001 From: Jonathan Bauer Date: Wed, 31 Oct 2018 14:47:37 +0100 Subject: [loginform] configurable icon for login form with 'loginform-mini-icon' in config file --- qt-lightdm-greeter.conf | 11 +++++++---- src/loginform.cpp | 6 ++++++ 2 files changed, 13 insertions(+), 4 deletions(-) diff --git a/qt-lightdm-greeter.conf b/qt-lightdm-greeter.conf index 703d2dc..d658d70 100644 --- a/qt-lightdm-greeter.conf +++ b/qt-lightdm-greeter.conf @@ -2,18 +2,21 @@ ; ; General configuration ; -; greeter-icon-theme = name of icon theme to use for the greeter +; greeter-icon-theme = name of icon theme to use for the greeter ; -; greeter-background = /path/to/background/image to set a background image for the login screen +; greeter-background = /path/to/background/image to set a background image for the login screen ; -; loginform-offset-x = how far from the left edge of the screen should the loginform be placed. +; loginform-offset-x = how far from the left edge of the screen should the loginform be placed. ; Can be given in pixels, e.g. loginform-offset-x=60px, or in percentage of screen width, e.g. loginform-offset-x=20%. ; -; loginform-offset-y = how far from the left edge of the screen should the loginform be placed. +; loginform-offset-y = how far from the left edge of the screen should the loginform be placed. ; Can be given in pixels, e.g. loginform-offset-y=60px, or in percentage of screen width, e.g. loginform-offset-y=20%. +; loginform-mini-icon = /path/to/loginform/icon to use as a top-right icon inside the login form +; [General] ;greeter-icon-theme=oxygen ;greeter-background-image=/path/to/background/image.png ;loginform-offset-x=50% ;loginform-offset-y=50% +;loginform-mini-icon=/path/to/loginform/icon.png diff --git a/src/loginform.cpp b/src/loginform.cpp index 6e58d94..69015f7 100644 --- a/src/loginform.cpp +++ b/src/loginform.cpp @@ -49,7 +49,13 @@ void LoginForm::setFocus(Qt::FocusReason reason) 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 (!configuredIcon.isNull()) + icon = configuredIcon; + } ui->iconLabel->setPixmap(icon.scaled(ui->iconLabel->size(), Qt::KeepAspectRatio, Qt::SmoothTransformation)); ui->leaveComboBox->setView(new QListView()); // This is required to get the stylesheet to apply -- cgit v1.2.3-55-g7522