Commit Graph

7 Commits

Author SHA1 Message Date
David Edmundson
9451f9ce04 Load config from /usr/lib/sddm/sddm.conf.d before /etc/sddm/sddm.conf.d 2017-07-10 12:17:59 +01:00
David Edmundson
2316a509bc Load configuration information from config directories
Our configuration generally consists of user set config options and
distro defined options.

For example, a distro might want to specify a custom theme, but the
user's autostart name can't come from the distro.

Using the same config file leads to problems when upgrading.

This loads configuration from all files in a directory
(/etc/sddm/conf.d) as well as the main config file /etc/sddm.conf
The latter has priority and all writes occur in that file.
2017-03-30 00:30:27 +01:00
Stefan Majewsky
d42700a313 enable QT_NO_CAST_FROM_ASCII
To facilitate that, sprinkle a bunch of QStringLiteral() around string
literals and QLatin1Char() around char literals. In some places, I used
QLatin1String() instead of QStringLiteral() when the expression is used
as an argument to a function that has a QLatin1String overload (this is
advised by the Qt docs).

I also replaced empty strings like

    QString x = "";
    QString x { "" };
    funcWithQStringArg("");
    funcWithQStringArg(QString(""));

by the QString() default constructor, which yields an empty string more
efficiently:

    QString x;
    funcWithQStringArg(QString());

QString::fromLocal8Bit() was used whenever strings were read from C
libraries (e.g. PAM). For SDDM's own configuration files, I used
QString::fromUtf8(), under the assumption that most text editors today
default to UTF-8.

In some places, I also used the chance to optimize single-char string
literals to char literals, e.g.

    str << list.join(",");              //before
    str << list.join(QLatin1Char(',')); //after

Testing done: It compiles and the ConfigurationTest passes. I don't have
a test setup for actually running a compiled SDDM, so if someone could
check that I didn't break anything, that would be highly appreciated.

Closes: #469
2015-08-22 16:17:37 +02:00
David Edmundson
cf3aac7b3c Reload config file whenever we start a new session
This is useful if the user has changed which greeter to use
2014-10-29 16:55:25 +01:00
Martin Briza
4dd0109b5b Add a test to check if config is initialized right on construction 2014-07-23 13:11:47 +02:00
Martin Briza
e9059a06ca Added an enum configuration test
Also fixed a bug I discovered thanks to it
2014-07-19 01:57:50 +02:00
Martin Briza
c449adc9b0 Rewrote the config to a more rigid state
Resolves sddm/sddm#39

More configuration instances now available. Every instance is a separate class.

Sections are supported.

Serialization handled in a more sensitive way - does not remove comments.

Type handling is unified, using the QTextStream shift operators.

There are also some basic tests, to be further improved...

Probably the most overengineered configuration parser you've ever witnessed.
2014-07-15 12:48:25 +02:00