blob: 5bda9b0895a8c5692156e9526745b84057290c97 (
plain) (
tree)
|
|
#ifndef SETTINGS_H
#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"
#define CONFIG_QSS_FILE "/etc/lightdm/qt-lightdm-greeter.qss"
class Settings;
extern Settings *s_settings;
class Settings : public QSettings
{
public:
Settings() : QSettings(QString(CONFIG_FILE), IniFormat)
{
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, IniFormat);
for(QString key : setting.allKeys()) {
this->setValue(key, setting.value(key));
}
}
}
static QString iconThemeName() { return s_settings->value("greeter-icon-theme").toString(); }
static QString backgrundImageFile() { return s_settings->value("greeter-background-image").toString(); }
static QString offsetX() { return s_settings->value("loginform-offset-x").toString(); }
static QString offsetY() { return s_settings->value("loginform-offset-y").toString(); }
static QString miniIconFile() { return s_settings->value("loginform-mini-icon").toString(); }
static QString bannerImageFile() { return s_settings->value("greeter-banner-image").toString(); }
static QString bottomLeftLogoFile() { return s_settings->value("greeter-bottom-left-logo-file").toString(); }
static QString bottomLeftLogoDir() { return s_settings->value("greeter-bottom-left-logo-path").toString(); }
static QStringList gradientColors() { return s_settings->value("greeter-background-gradient").toString().split(QRegExp("\\s"), QString::SkipEmptyParts); }
static QString logMessageFile() { return s_settings->value("greeter-message-file").toString(); }
static QString newsHtmlFile() { return s_settings->value("news-html-file").toString(); }
static QString autoLoginCheckCmd() { return s_settings->value("auto-login-check-cmd").toString(); }
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 QString passwordPlaceholder() { return s_settings->value("password-placeholder").toString(); }
static bool userSessionEnabled() { return s_settings->value("user-session-enabled", "1").toBool(); }
static bool guestSessionEnabled() { return s_settings->value("guest-session-enabled").toBool(); }
static bool shibSessionEnabled() { return s_settings->value("shib-session-enabled").toBool(); }
static bool qrSessionEnabled() { return s_settings->value("qr-session-enabled").toBool(); }
static QString shibUrl() { return s_settings->value("shib-url").toString(); }
static QString urlWhitelistFile() { return s_settings->value("shib-url-whitelist").toString(); }
static QString urlBlacklistFile() { return s_settings->value("shib-url-blacklist").toString(); }
static QString shibSessionButtonText() { return s_settings->value("shib-session-button-text").toString(); }
static QString qrSessionButtonText() { return s_settings->value("qr-session-button-text").toString(); }
static QString userSessionButtonText() { return s_settings->value("user-session-button-text").toString(); }
static QString guestSessionButtonText() { return s_settings->value("guest-session-button-text").toString(); }
static QString guestSessionStartText() { return s_settings->value("guest-session-start-text").toString(); }
static QString guestSessionStartButtonText() { return s_settings->value("guest-session-start-button-text").toString(); }
static int resetForm() { return s_settings->value("reset-timeout", "30").toInt(); }
static int rpcPort() { return s_settings->value("rpc-port", "0").toInt(); }
};
#endif // SETTINGS_H
|