summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSteffen Ritter2018-08-15 15:55:10 +0200
committerSteffen Ritter2018-08-15 15:55:10 +0200
commit3d44182a26af01b5c37fd85dadee0683805fc1a9 (patch)
tree5993ac67fcc21c7d0dbc2813d95a88a5a3f254bc
parentRestructure clock styling, split background and text so shadows work with bgc... (diff)
downloadslxgreeter-3d44182a26af01b5c37fd85dadee0683805fc1a9.tar.gz
slxgreeter-3d44182a26af01b5c37fd85dadee0683805fc1a9.tar.xz
slxgreeter-3d44182a26af01b5c37fd85dadee0683805fc1a9.zip
Make username placeholder configurable
Also make use of conf.d folder for easy overriding of already existing variables
-rw-r--r--src/loginform.cpp3
-rw-r--r--src/main.cpp1
-rw-r--r--src/settings.h16
3 files changed, 20 insertions, 0 deletions
diff --git a/src/loginform.cpp b/src/loginform.cpp
index d5e141e..9473875 100644
--- a/src/loginform.cpp
+++ b/src/loginform.cpp
@@ -64,6 +64,9 @@ void LoginForm::initialize()
if (!Global::testMode()) {
ui->hostnameLabel->setText(Global::greeter()->hostname());
+ if(!Settings::usernamePlaceholder().isEmpty()) {
+ ui->userInput->setPlaceholderText(Settings::usernamePlaceholder());
+ }
addLeaveEntry(Global::power()->canShutdown(), "system-shutdown", tr("Shutdown"), "shutdown");
addLeaveEntry(Global::power()->canRestart(), "system-reboot", tr("Restart"), "restart");
diff --git a/src/main.cpp b/src/main.cpp
index 7973a68..fdaada9 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -53,6 +53,7 @@ int main(int argc, char *argv[])
}
QApplication a(argc, argv);
+ Settings::loadConfigs();
// I have no idea why, but Qt's stock qWarning() output never makes it
// to /var/log/lightdm/x-0-greeter.log, so we use std::cerr instead..
diff --git a/src/settings.h b/src/settings.h
index d2213ae..b6c9db0 100644
--- a/src/settings.h
+++ b/src/settings.h
@@ -2,8 +2,10 @@
#define SETTINGS_H
#include <QSettings>
+#include <QDir>
#define CONFIG_FILE "/etc/lightdm/qt-lightdm-greeter.conf"
+#define CONFIG_FOLDER "/etc/lightdm/qt-lightdm-greeter.conf.d"
class Settings;
extern Settings *s_settings;
@@ -26,6 +28,20 @@ public:
static QString clockStyle() { return s_settings->value("clock-text-style").toString(); }
static QString clockBackgroundStyle() { return s_settings->value("clock-background-style").toString(); }
static QStringList clockShadow() { return s_settings->value("clock-shadow").toString().split(QRegExp("\\s"), QString::SkipEmptyParts); }
+ static QString usernamePlaceholder() { return s_settings->value("username-placeholder").toString(); }
+
+ static void loadConfigs() {
+ QDir configDir(CONFIG_FOLDER);
+ QFileInfoList fileInfoList = configDir.entryInfoList(QStringList() << "*.conf", QDir::Files, QDir::Name);
+
+ for (QFileInfo fileInfo : fileInfoList) {
+ QString filePath = fileInfo.absoluteFilePath();
+ QSettings setting(filePath, QSettings::NativeFormat);
+ for(QString key : setting.allKeys()) {
+ s_settings->setValue(key, setting.value(key));
+ }
+ }
+ }
};
#endif // SETTINGS_H