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.
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
Resolvessddm/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.