#include "app.h" AConfig::AConfig() { filename_ = QApplication::applicationDirPath() + "/settings.ini"; } AConfig::AConfig(const AConfig&) { throw QException(); // Выкидываем QException, в случае если // вообще попытались скопировать объект } AConfig& AConfig::operator=(AConfig&) { throw QException(); // Выкидываем QException, в случае если // вообще попытались скопировать объект } void AConfig::saveConfig(){ QSettings settings(filename_, QSettings::IniFormat); //Global settings.setValue("Global/current_theme", "lotro"); settings.setValue("Global/default_theme", "lotro"); //Editor settings.setValue("Editor/texts", true); settings.setValue("Editor/fonts", true); settings.setValue("Editor/images", true); settings.setValue("Editor/sounds", true); settings.setValue("Editor/videos", false); settings.setValue("Editor/screens", true); settings.setValue("Editor/textures", true); //Network settings.setValue("Network/server", "http://translate.lotros.ru"); settings.setValue("Network/coupon", "http://translate.lotros.ru/coupon"); settings.setValue("Network/servers", "http://translate.lotros.ru/servers"); settings.setValue("Network/foot", "http://translate.lotros.ru/profmessage"); settings.setValue("Network/news", "http://translate.lotros.ru/groupware/launcher_news"); settings.setValue("Network/launcher", "http://translate.lotros.ru/upload/launcher"); settings.setValue("Network/releases", "http://translate.lotros.ru/groupware/check_updates"); settings.setValue("Network/info", "http://translate.lotros.ru/paths"); settings.setValue("Network/update", "http://translate.lotros.ru/groupware/update"); // Values settings.setValue("Values/coupon", ""); settings.setValue("Values/servers", ""); // Local settings.setValue("Local/file", "client_local_English.dat"); //Datetime settings.setValue("Datetime/texts", true); settings.setValue("Datetime/fonts", true); settings.setValue("Datetime/images", true); settings.setValue("Datetime/sounds", true); settings.setValue("Datetime/videos", false); settings.setValue("Datetime/loadscreens", true); settings.setValue("Datetime/textures", true); //Updates settings.setValue("Updates/update", false); settings.setValue("Updates/micro", false); settings.sync(); } QString AConfig::getValue(QString section, QString key){ QSettings settings( conffile, QSettings::IniFormat ); settings.beginGroup(section); key = settings.value(key, -1).toString(); settings.endGroup(); return key; } void AConfig::setValue(QString section, QString key, QString value){ QSettings settings( conffile, QSettings::IniFormat ); settings.beginGroup(section); settings.setValue(key, value); settings.sync(); } void AConfig::deleteKey(QString section, QString key){ QSettings settings( conffile, QSettings::IniFormat ); QStringList keys = settings.childKeys(); settings.beginGroup(section); if (keys.contains(key)){ settings.remove(key); } settings.endGroup(); } void AConfig::deleteSection(QString section){ QSettings settings( conffile, QSettings::IniFormat ); settings.beginGroup(section); settings.remove(""); settings.endGroup(); }