You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

144 lines
3.8 KiB

// This file is auto-generated file, don't modify it unless you want to lose your code
// Generated by qgenconfig v0.1 (c) Ulrich Van Den Hekke
#include "pluginsettings.h"
/* PluginSettingsSettings */
PluginSettingsSettings::PluginSettingsSettings(const QString & organization, const QString & application) : QSettings(organization, application)
{
}
void PluginSettingsSettings::setValue(const QString & key, const QVariant & value, const QVariant & defaultValue)
{
if (value == defaultValue)
remove(key);
else
QSettings::setValue(key, value);
}
void PluginSettingsSettings::setValue(const QString & key, const QVariant & value)
{
QSettings::setValue(key, value);
}
/* PrivatePluginSettings */
class PrivatePluginSettings
{
public:
PrivatePluginSettings(PluginSettings * parent);
PluginSettingsSettings * m_settings;
void createSettings();
void deleteSettings();
PluginSettings::struct_globals m_globals;
private:
PluginSettings * m_parent;
};
PrivatePluginSettings::PrivatePluginSettings(PluginSettings * parent)
{
m_parent = parent;
}
void PrivatePluginSettings::createSettings()
{
m_settings = new PluginSettingsSettings("Shadoware.Org", "XINX");
}
void PrivatePluginSettings::deleteSettings()
{
if (m_settings)
delete m_settings;
m_settings = NULL;
}
/* PluginSettings */
PluginSettings::PluginSettings(const PluginSettings & origine) : d(new PrivatePluginSettings(this))
{
d->m_globals = origine.d->m_globals;
}
PluginSettings::PluginSettings() : d(new PrivatePluginSettings(this))
{
}
PluginSettings::~PluginSettings()
{
}
PluginSettings&PluginSettings::operator=(const PluginSettings& p)
{
d->m_globals = p.d->m_globals;
return *this;
}
PluginSettings::struct_globals & PluginSettings::config()
{
return d->m_globals;
}
void PluginSettings::setDefault()
{
d->m_globals = getDefaultGlobals();
}
void PluginSettings::save()
{
d->createSettings();
setSettingsGlobals(d->m_settings, "PluginsSettings/cvsplugin", d->m_globals);
d->deleteSettings();
}
void PluginSettings::load()
{
d->createSettings();
d->m_globals = getSettingsGlobals(d->m_settings, "PluginsSettings/cvsplugin", getDefaultGlobals());
d->deleteSettings();
}
PluginSettings::PluginSettings::struct_globals PluginSettings::getDefaultGlobals()
{
struct_globals value;
value.progressMessages = "-q";
value.compressionLevel = 9;
value.pruneEmptyDirectories = false;
value.createDirectories = true;
return value;
}
PluginSettings::PluginSettings::struct_globals PluginSettings::getSettingsGlobals(PluginSettingsSettings * settings, const QString & path, PluginSettings::PluginSettings::struct_globals defaultValue)
{
struct_globals value;
settings->beginGroup(path);
value.progressMessages = settings->value("Progress Messages", defaultValue.progressMessages).toString();
value.compressionLevel = settings->value("Compression Level", defaultValue.compressionLevel).toInt();
value.pruneEmptyDirectories = settings->value("Prune Empty Directories", defaultValue.pruneEmptyDirectories).toBool();
value.createDirectories = settings->value("Create Directories", defaultValue.createDirectories).toBool();
settings->endGroup();
return value;
}
void PluginSettings::setSettingsGlobals(PluginSettingsSettings * settings, const QString & path, PluginSettings::PluginSettings::struct_globals value)
{
struct_globals defaultValue = getDefaultGlobals();
settings->beginGroup(path);
settings->setValue("Progress Messages", value.progressMessages, defaultValue.progressMessages);
settings->setValue("Compression Level", value.compressionLevel, defaultValue.compressionLevel);
settings->setValue("Prune Empty Directories", value.pruneEmptyDirectories, defaultValue.pruneEmptyDirectories);
settings->setValue("Create Directories", value.createDirectories, defaultValue.createDirectories);
settings->endGroup();
}