1 /*************************************************************************** 2 * Copyright (c) 2016 Pier Luigi Fiorini <pierluigi.fiorini@gmail.com> 3 * Copyright (c) 2013 Abdurrahman AVCI <abdurrahmanavci@gmail.com> 4 * 5 * This program is free software; you can redistribute it and/or modify 6 * it under the terms of the GNU General Public License as published by 7 * the Free Software Foundation; either version 2 of the License, or 8 * (at your option) any later version. 9 * 10 * This program is distributed in the hope that it will be useful, 11 * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 * GNU General Public License for more details. 14 * 15 * You should have received a copy of the GNU General Public License 16 * along with this program; if not, write to the 17 * Free Software Foundation, Inc., 18 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. 19 ***************************************************************************/ 20 21 #include "ThemeMetadata.h" 22 23 #include <QSettings> 24 25 namespace SDDM { 26 class ThemeMetadataPrivate { 27 public: 28 QString mainScript { QStringLiteral("Main.qml") }; 29 QString configFile; 30 QString translationsDirectory { QStringLiteral(".") }; 31 }; 32 ThemeMetadata(const QString & path,QObject * parent)33 ThemeMetadata::ThemeMetadata(const QString &path, QObject *parent) : QObject(parent), d(new ThemeMetadataPrivate()) { 34 setTo(path); 35 } 36 ~ThemeMetadata()37 ThemeMetadata::~ThemeMetadata() { 38 delete d; 39 } 40 mainScript() const41 const QString &ThemeMetadata::mainScript() const { 42 return d->mainScript; 43 } 44 configFile() const45 const QString &ThemeMetadata::configFile() const { 46 return d->configFile; 47 } 48 translationsDirectory() const49 const QString &ThemeMetadata::translationsDirectory() const { 50 return d->translationsDirectory; 51 } 52 setTo(const QString & path)53 void ThemeMetadata::setTo(const QString &path) { 54 QSettings settings(path, QSettings::IniFormat); 55 // read values 56 d->mainScript = settings.value(QStringLiteral("SddmGreeterTheme/MainScript"), QStringLiteral("Main.qml")).toString(); 57 d->configFile = settings.value(QStringLiteral("SddmGreeterTheme/ConfigFile"), QStringLiteral("theme.conf")).toString(); 58 d->translationsDirectory = settings.value(QStringLiteral("SddmGreeterTheme/TranslationsDirectory"), QStringLiteral(".")).toString(); 59 } 60 } 61