2008-01-25 00:12:25 +00:00
|
|
|
/***************************************************************************
|
|
|
|
* __________ __ ___.
|
|
|
|
* Open \______ \ ____ ____ | | _\_ |__ _______ ___
|
|
|
|
* Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
|
|
|
|
* Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
|
|
|
|
* Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
|
|
|
|
* \/ \/ \/ \/ \/
|
|
|
|
*
|
|
|
|
* Copyright (C) 2007 by Dominik Wenger
|
2008-06-30 22:09:45 +00:00
|
|
|
* $Id$
|
2008-01-25 00:12:25 +00:00
|
|
|
*
|
2008-06-28 18:10:04 +00:00
|
|
|
* This program is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU General Public License
|
|
|
|
* as published by the Free Software Foundation; either version 2
|
|
|
|
* of the License, or (at your option) any later version.
|
2008-01-25 00:12:25 +00:00
|
|
|
*
|
|
|
|
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
|
|
|
|
* KIND, either express or implied.
|
|
|
|
*
|
|
|
|
****************************************************************************/
|
|
|
|
|
|
|
|
#ifndef RBSETTINGS_H
|
|
|
|
#define RBSETTINGS_H
|
|
|
|
|
2008-02-10 18:25:49 +00:00
|
|
|
#include <QtCore>
|
|
|
|
|
2008-01-25 00:12:25 +00:00
|
|
|
class QSettings;
|
|
|
|
|
|
|
|
class RbSettings : public QObject
|
|
|
|
{
|
|
|
|
Q_OBJECT
|
|
|
|
|
|
|
|
public:
|
|
|
|
RbSettings() {}
|
2008-10-24 18:41:04 +00:00
|
|
|
|
2008-01-25 00:12:25 +00:00
|
|
|
//! open the settings files
|
|
|
|
void open();
|
|
|
|
//! call this to flush the user Settings
|
|
|
|
void sync();
|
2008-10-24 18:41:04 +00:00
|
|
|
|
2008-01-25 00:12:25 +00:00
|
|
|
// returns the filename of the usersettings file
|
|
|
|
QString userSettingFilename();
|
2008-10-24 18:41:04 +00:00
|
|
|
|
2009-04-16 20:49:43 +00:00
|
|
|
enum MapType {
|
|
|
|
MapDevice,
|
|
|
|
MapError,
|
|
|
|
MapIncompatible,
|
|
|
|
};
|
2009-04-29 20:58:47 +00:00
|
|
|
enum UserSettings {
|
|
|
|
RbutilVersion,
|
|
|
|
CurrentPlatform,
|
|
|
|
Mountpoint,
|
|
|
|
CachePath,
|
|
|
|
Build,
|
|
|
|
ProxyType,
|
|
|
|
Proxy,
|
|
|
|
OfPath,
|
|
|
|
Platform,
|
|
|
|
Language,
|
|
|
|
Tts,
|
|
|
|
LastTalkedFolder,
|
|
|
|
VoiceLanguage,
|
|
|
|
TtsLanguage,
|
|
|
|
TtsOptions,
|
|
|
|
TtsPath,
|
|
|
|
TtsVoice,
|
|
|
|
EncoderPath,
|
|
|
|
EncoderOptions,
|
|
|
|
WavtrimThreshold,
|
|
|
|
EncoderComplexity,
|
|
|
|
TtsSpeed,
|
|
|
|
CacheOffline,
|
|
|
|
CacheDisabled,
|
|
|
|
TtsUseSapi4,
|
|
|
|
EncoderNarrowBand,
|
|
|
|
EncoderQuality,
|
|
|
|
EncoderVolume,
|
|
|
|
};
|
|
|
|
enum SystemSettings {
|
|
|
|
ManualUrl,
|
|
|
|
BleedingUrl,
|
|
|
|
BootloaderUrl,
|
|
|
|
BootloaderInfoUrl,
|
|
|
|
FontUrl,
|
|
|
|
VoiceUrl,
|
|
|
|
DoomUrl,
|
|
|
|
ReleaseUrl,
|
|
|
|
DailyUrl,
|
|
|
|
ServerConfUrl,
|
|
|
|
GenlangUrl,
|
|
|
|
ThemesUrl,
|
|
|
|
BleedingInfo,
|
|
|
|
CurPlatformName,
|
|
|
|
CurManual,
|
|
|
|
CurBootloaderMethod,
|
|
|
|
CurBootloaderName,
|
|
|
|
CurBootloaderFile,
|
|
|
|
CurEncoder,
|
|
|
|
CurResolution,
|
|
|
|
CurBrand,
|
|
|
|
CurName,
|
|
|
|
CurBuildserverModel,
|
|
|
|
CurConfigureModel,
|
|
|
|
CurTargetId,
|
|
|
|
};
|
|
|
|
|
|
|
|
QVariant value(enum SystemSettings setting);
|
|
|
|
// generic and "current selection" values -- getters
|
|
|
|
QVariant value(enum UserSettings setting)
|
|
|
|
{ QString empty; return subValue(empty, setting); }
|
|
|
|
void setValue(enum UserSettings setting , QVariant value)
|
|
|
|
{ QString empty; return setSubValue(empty, setting, value); }
|
2009-04-16 20:49:43 +00:00
|
|
|
|
2009-04-29 20:58:47 +00:00
|
|
|
QVariant subValue(QString& sub, enum UserSettings setting);
|
|
|
|
QVariant subValue(const char* sub, enum UserSettings setting)
|
|
|
|
{ QString s = sub; return subValue(s, setting); }
|
|
|
|
void setSubValue(QString& sub, enum UserSettings setting, QVariant value);
|
|
|
|
void setSubValue(const char* sub, enum UserSettings setting, QVariant value)
|
|
|
|
{ QString s = sub; return setSubValue(s, setting, value); }
|
|
|
|
|
|
|
|
QStringList platforms(void);
|
|
|
|
QStringList languages(void);
|
2009-03-14 23:34:40 +00:00
|
|
|
|
2008-01-25 00:12:25 +00:00
|
|
|
QString name(QString plattform);
|
|
|
|
QString brand(QString plattform);
|
2009-03-14 23:34:40 +00:00
|
|
|
|
2009-04-16 20:49:43 +00:00
|
|
|
QMap<int, QString> usbIdMap(enum MapType);
|
2009-01-25 17:48:38 +00:00
|
|
|
|
2008-01-25 00:12:25 +00:00
|
|
|
private:
|
2008-04-24 20:40:33 +00:00
|
|
|
//! private copy constructors to prvent copying
|
2008-04-24 21:42:31 +00:00
|
|
|
RbSettings& operator= (const RbSettings& other)
|
|
|
|
{ (void)other; return *this; }
|
2008-04-25 19:47:06 +00:00
|
|
|
RbSettings(const RbSettings& other) :QObject()
|
2008-04-24 21:42:31 +00:00
|
|
|
{ (void)other; }
|
2009-04-29 20:58:47 +00:00
|
|
|
QString constructSettingPath(QString path, QString substitute = QString());
|
2009-01-25 17:48:38 +00:00
|
|
|
|
2008-04-24 20:40:33 +00:00
|
|
|
//! pointers to our setting objects
|
2009-04-29 20:58:47 +00:00
|
|
|
QSettings *systemSettings;
|
2008-01-25 00:12:25 +00:00
|
|
|
QSettings *userSettings;
|
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|