#include "settings.h" #include #include Settings::Settings(QObject *parent) : QObject(parent) { setting = new QSettings(QApplication::applicationDirPath().append("\\MabiTimer.ini"), QSettings::IniFormat, this); } void Settings::setArbeitSelected(QList &arbeitSelected) { QList value; foreach(int i, arbeitSelected) { value.append(i); } setting->beginGroup("global"); setting->setValue("arbeitAlert", value); setting->endGroup(); } QList Settings::arbeitSelected() const { bool ok; QList result; setting->beginGroup("global"); foreach(QVariant variant, setting->value("arbeitAlert", QList()).toList()) { int index = variant.toInt(&ok); if(ok) { result.append(index); } } setting->endGroup(); return result; } void Settings::setWeatherAlignment(Qt::AlignmentFlag weatherAlignment) { setting->beginGroup("global"); setting->setValue("weatherAlign", weatherAlignment); setting->endGroup(); } Qt::AlignmentFlag Settings::weatherAlignment() const { Qt::AlignmentFlag result; setting->beginGroup("global"); result = (Qt::AlignmentFlag)setting->value("weatherAlign", Qt::AlignLeft).toInt(); setting->endGroup(); return result; } void Settings::setArbeitIndex(int index) { setting->beginGroup("global"); setting->setValue("arbeit", index); setting->endGroup(); } int Settings::arbeitIndex() const { int result; setting->beginGroup("global"); result = setting->value("arbeit", 0).toInt(); setting->endGroup(); return result; } void Settings::setWeatherIndex(int index) { setting->beginGroup("global"); setting->setValue("weather", index); setting->endGroup(); } int Settings::weatherIndex() const { int result; setting->beginGroup("global"); result = setting->value("weather", 0).toInt(); setting->endGroup(); return result; }