summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDominik Wenger <domonoky@googlemail.com>2009-05-09 16:59:14 +0000
committerDominik Wenger <domonoky@googlemail.com>2009-05-09 16:59:14 +0000
commit33d9cf091a62cb217987092d03bf110c35444845 (patch)
tree4ee6be3018e0b71c38d4857f86ad17a08668afdd
parent8e63df19cbeee2de9470049feae8ae0f9c5a339e (diff)
downloadrockbox-33d9cf091a62cb217987092d03bf110c35444845.tar.gz
rockbox-33d9cf091a62cb217987092d03bf110c35444845.tar.bz2
rockbox-33d9cf091a62cb217987092d03bf110c35444845.zip
rbutil: make RbSettings a static class. (FS#10183 with improvements)
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@20890 a1c6a512-1295-4272-9138-f99709370657
-rw-r--r--rbutil/rbutilqt/base/autodetection.cpp7
-rw-r--r--rbutil/rbutilqt/base/autodetection.h4
-rw-r--r--rbutil/rbutilqt/base/detect.cpp9
-rw-r--r--rbutil/rbutilqt/base/detect.h3
-rw-r--r--rbutil/rbutilqt/base/encoders.cpp49
-rw-r--r--rbutil/rbutilqt/base/encoders.h7
-rw-r--r--rbutil/rbutilqt/base/rbsettings.cpp86
-rw-r--r--rbutil/rbutilqt/base/rbsettings.h79
-rw-r--r--rbutil/rbutilqt/base/tts.cpp81
-rw-r--r--rbutil/rbutilqt/base/tts.h7
-rw-r--r--rbutil/rbutilqt/configure.cpp108
-rw-r--r--rbutil/rbutilqt/configure.h5
-rw-r--r--rbutil/rbutilqt/createvoicewindow.cpp36
-rw-r--r--rbutil/rbutilqt/createvoicewindow.h4
-rw-r--r--rbutil/rbutilqt/install.cpp44
-rw-r--r--rbutil/rbutilqt/install.h4
-rw-r--r--rbutil/rbutilqt/installtalkwindow.cpp26
-rw-r--r--rbutil/rbutilqt/installtalkwindow.h6
-rw-r--r--rbutil/rbutilqt/rbutilqt.cpp174
-rw-r--r--rbutil/rbutilqt/rbutilqt.h5
-rw-r--r--rbutil/rbutilqt/talkfile.cpp7
-rw-r--r--rbutil/rbutilqt/talkfile.h3
-rw-r--r--rbutil/rbutilqt/themesinstallwindow.cpp21
-rw-r--r--rbutil/rbutilqt/themesinstallwindow.h3
-rw-r--r--rbutil/rbutilqt/uninstallwindow.cpp41
-rw-r--r--rbutil/rbutilqt/uninstallwindow.h4
-rw-r--r--rbutil/rbutilqt/voicefile.cpp9
-rw-r--r--rbutil/rbutilqt/voicefile.h5
28 files changed, 394 insertions, 443 deletions
diff --git a/rbutil/rbutilqt/base/autodetection.cpp b/rbutil/rbutilqt/base/autodetection.cpp
index 276c270499..30651077f2 100644
--- a/rbutil/rbutilqt/base/autodetection.cpp
+++ b/rbutil/rbutilqt/base/autodetection.cpp
@@ -19,6 +19,7 @@
#include <QtCore>
#include "autodetection.h"
+#include "rbsettings.h"
#include "../ipodpatcher/ipodpatcher.h"
#include "../sansapatcher/sansapatcher.h"
@@ -396,9 +397,9 @@ bool Autodetection::detectUsb()
// usbids holds the mapping in the form
// ((VID<<16)|(PID)), targetname
// the ini file needs to hold the IDs as hex values.
- QMap<int, QString> usbids = settings->usbIdMap(RbSettings::MapDevice);
- QMap<int, QString> usberror = settings->usbIdMap(RbSettings::MapError);
- QMap<int, QString> usbincompat = settings->usbIdMap(RbSettings::MapIncompatible);
+ QMap<int, QString> usbids = RbSettings::usbIdMap(RbSettings::MapDevice);
+ QMap<int, QString> usberror = RbSettings::usbIdMap(RbSettings::MapError);
+ QMap<int, QString> usbincompat = RbSettings::usbIdMap(RbSettings::MapIncompatible);
// usb pid detection
QList<uint32_t> attached;
diff --git a/rbutil/rbutilqt/base/autodetection.h b/rbutil/rbutilqt/base/autodetection.h
index cffab5bd4f..c6b33ac313 100644
--- a/rbutil/rbutilqt/base/autodetection.h
+++ b/rbutil/rbutilqt/base/autodetection.h
@@ -24,7 +24,6 @@
#define AUTODETECTION_H_
#include <QtCore>
-#include "rbsettings.h"
class Autodetection :public QObject
{
@@ -33,8 +32,6 @@ class Autodetection :public QObject
public:
Autodetection(QObject* parent=0);
- void setSettings(RbSettings* sett) {settings = sett;}
-
bool detect();
QString getDevice() {return m_device;}
@@ -54,7 +51,6 @@ private:
QString m_errdev;
QString m_incompat;
QList<int> m_usbconid;
- RbSettings* settings;
};
diff --git a/rbutil/rbutilqt/base/detect.cpp b/rbutil/rbutilqt/base/detect.cpp
index df1cf50647..88ffb36723 100644
--- a/rbutil/rbutilqt/base/detect.cpp
+++ b/rbutil/rbutilqt/base/detect.cpp
@@ -59,6 +59,7 @@
#endif
#include "utils.h"
+#include "rbsettings.h"
/** @brief detect permission of user (only Windows at moment).
* @return enum userlevel.
@@ -384,7 +385,7 @@ QString Detect::installedTarget(QString mountpoint)
* @param targetId the targetID to check for. if it is -1 no check is done.
* @return string with error messages if problems occurred, empty strings if none.
*/
-QString Detect::check(RbSettings* settings, bool permission)
+QString Detect::check(bool permission)
{
QString text = "";
@@ -401,12 +402,12 @@ QString Detect::check(RbSettings* settings, bool permission)
}
// Check TargetId
- QString installed = installedTarget(settings->value(RbSettings::Mountpoint).toString());
- if(!installed.isEmpty() && installed != settings->value(RbSettings::CurConfigureModel).toString())
+ QString installed = installedTarget(RbSettings::value(RbSettings::Mountpoint).toString());
+ if(!installed.isEmpty() && installed != RbSettings::value(RbSettings::CurConfigureModel).toString())
{
text += QObject::tr("<li>Target mismatch detected.\n"
"Installed target: %1, selected target: %2.</li>")
- .arg(installed, settings->value(RbSettings::CurPlatformName).toString());
+ .arg(installed, RbSettings::value(RbSettings::CurPlatformName).toString());
// FIXME: replace installed by human-friendly name
}
diff --git a/rbutil/rbutilqt/base/detect.h b/rbutil/rbutilqt/base/detect.h
index 3077699a93..96c0696467 100644
--- a/rbutil/rbutilqt/base/detect.h
+++ b/rbutil/rbutilqt/base/detect.h
@@ -27,7 +27,6 @@
#include <QString>
#include <QUrl>
-#include "rbsettings.h"
class Detect
{
@@ -49,7 +48,7 @@ public:
static QString installedVersion(QString mountpoint);
static QString installedTarget(QString mountpoint);
- static QString check(RbSettings* settings, bool permission);
+ static QString check(bool permission);
};
#endif
diff --git a/rbutil/rbutilqt/base/encoders.cpp b/rbutil/rbutilqt/base/encoders.cpp
index 6ff1185c82..59add74a0d 100644
--- a/rbutil/rbutilqt/base/encoders.cpp
+++ b/rbutil/rbutilqt/base/encoders.cpp
@@ -19,6 +19,7 @@
#include "encoders.h"
#include "utils.h"
+#include "rbsettings.h"
/*********************************************************************
* Encoder Base
@@ -87,24 +88,24 @@ EncExes::EncExes(QString name,QObject *parent) : EncBase(parent)
void EncExes::generateSettings()
{
- QString exepath =settings->subValue(m_name,RbSettings::EncoderPath).toString();
+ QString exepath =RbSettings::subValue(m_name,RbSettings::EncoderPath).toString();
if(exepath == "") exepath = findExecutable(m_name);
insertSetting(eEXEPATH,new EncTtsSetting(this,EncTtsSetting::eSTRING,"Path to Encoder:",exepath,EncTtsSetting::eBROWSEBTN));
- insertSetting(eEXEOPTIONS,new EncTtsSetting(this,EncTtsSetting::eSTRING,"Encoder options:",settings->subValue(m_name,RbSettings::EncoderOptions)));
+ insertSetting(eEXEOPTIONS,new EncTtsSetting(this,EncTtsSetting::eSTRING,"Encoder options:",RbSettings::subValue(m_name,RbSettings::EncoderOptions)));
}
void EncExes::saveSettings()
{
- settings->setSubValue(m_name,RbSettings::EncoderPath,getSetting(eEXEPATH)->current().toString());
- settings->setSubValue(m_name,RbSettings::EncoderOptions,getSetting(eEXEOPTIONS)->current().toString());
- settings->sync();
+ RbSettings::setSubValue(m_name,RbSettings::EncoderPath,getSetting(eEXEPATH)->current().toString());
+ RbSettings::setSubValue(m_name,RbSettings::EncoderOptions,getSetting(eEXEOPTIONS)->current().toString());
+ RbSettings::sync();
}
bool EncExes::start()
{
- m_EncExec = settings->subValue(m_name, RbSettings::EncoderPath).toString();
- m_EncOpts = settings->subValue(m_name, RbSettings::EncoderOptions).toString();
+ m_EncExec = RbSettings::subValue(m_name, RbSettings::EncoderPath).toString();
+ m_EncOpts = RbSettings::subValue(m_name, RbSettings::EncoderOptions).toString();
m_EncTemplate = m_TemplateMap.value(m_name);
@@ -136,7 +137,7 @@ bool EncExes::encode(QString input,QString output)
bool EncExes::configOk()
{
- QString path = settings->subValue(m_name, RbSettings::EncoderPath).toString();
+ QString path = RbSettings::subValue(m_name, RbSettings::EncoderPath).toString();
if (QFileInfo(path).exists())
return true;
@@ -154,31 +155,31 @@ EncRbSpeex::EncRbSpeex(QObject *parent) : EncBase(parent)
void EncRbSpeex::generateSettings()
{
- insertSetting(eVOLUME,new EncTtsSetting(this,EncTtsSetting::eDOUBLE,"Volume:",settings->subValue("rbspeex",RbSettings::EncoderVolume),1.0,10.0));
- insertSetting(eQUALITY,new EncTtsSetting(this,EncTtsSetting::eDOUBLE,"Quality:",settings->subValue("rbspeex",RbSettings::EncoderQuality),0,10.0));
- insertSetting(eCOMPLEXITY,new EncTtsSetting(this,EncTtsSetting::eINT,"Complexity:",settings->subValue("rbspeex",RbSettings::EncoderComplexity),0,10));
- insertSetting(eNARROWBAND,new EncTtsSetting(this,EncTtsSetting::eBOOL,"Use Narrowband:",settings->subValue("rbspeex",RbSettings::EncoderNarrowBand)));
+ insertSetting(eVOLUME,new EncTtsSetting(this,EncTtsSetting::eDOUBLE,"Volume:",RbSettings::subValue("rbspeex",RbSettings::EncoderVolume),1.0,10.0));
+ insertSetting(eQUALITY,new EncTtsSetting(this,EncTtsSetting::eDOUBLE,"Quality:",RbSettings::subValue("rbspeex",RbSettings::EncoderQuality),0,10.0));
+ insertSetting(eCOMPLEXITY,new EncTtsSetting(this,EncTtsSetting::eINT,"Complexity:",RbSettings::subValue("rbspeex",RbSettings::EncoderComplexity),0,10));
+ insertSetting(eNARROWBAND,new EncTtsSetting(this,EncTtsSetting::eBOOL,"Use Narrowband:",RbSettings::subValue("rbspeex",RbSettings::EncoderNarrowBand)));
}
void EncRbSpeex::saveSettings()
{
//save settings in user config
- settings->setSubValue("rbspeex",RbSettings::EncoderVolume,getSetting(eVOLUME)->current().toDouble());
- settings->setSubValue("rbspeex",RbSettings::EncoderQuality,getSetting(eQUALITY)->current().toDouble());
- settings->setSubValue("rbspeex",RbSettings::EncoderComplexity,getSetting(eCOMPLEXITY)->current().toInt());
- settings->setSubValue("rbspeex",RbSettings::EncoderNarrowBand,getSetting(eNARROWBAND)->current().toBool());
+ RbSettings::setSubValue("rbspeex",RbSettings::EncoderVolume,getSetting(eVOLUME)->current().toDouble());
+ RbSettings::setSubValue("rbspeex",RbSettings::EncoderQuality,getSetting(eQUALITY)->current().toDouble());
+ RbSettings::setSubValue("rbspeex",RbSettings::EncoderComplexity,getSetting(eCOMPLEXITY)->current().toInt());
+ RbSettings::setSubValue("rbspeex",RbSettings::EncoderNarrowBand,getSetting(eNARROWBAND)->current().toBool());
- settings->sync();
+ RbSettings::sync();
}
bool EncRbSpeex::start()
{
// try to get config from settings
- quality = settings->subValue("rbspeex", RbSettings::EncoderQuality).toDouble();
- complexity = settings->subValue("rbspeex", RbSettings::EncoderComplexity).toInt();
- volume = settings->subValue("rbspeex", RbSettings::EncoderVolume).toDouble();
- narrowband = settings->subValue("rbspeex", RbSettings::EncoderNarrowBand).toBool();
+ quality = RbSettings::subValue("rbspeex", RbSettings::EncoderQuality).toDouble();
+ complexity = RbSettings::subValue("rbspeex", RbSettings::EncoderComplexity).toInt();
+ volume = RbSettings::subValue("rbspeex", RbSettings::EncoderVolume).toDouble();
+ narrowband = RbSettings::subValue("rbspeex", RbSettings::EncoderNarrowBand).toBool();
return true;
@@ -219,13 +220,13 @@ bool EncRbSpeex::configOk()
bool result=true;
// check config
- if(settings->subValue("rbspeex", RbSettings::EncoderVolume).toDouble() <= 0)
+ if(RbSettings::subValue("rbspeex", RbSettings::EncoderVolume).toDouble() <= 0)
result =false;
- if(settings->subValue("rbspeex", RbSettings::EncoderQuality).toDouble() <= 0)
+ if(RbSettings::subValue("rbspeex", RbSettings::EncoderQuality).toDouble() <= 0)
result =false;
- if(settings->subValue("rbspeex", RbSettings::EncoderComplexity).toInt() <= 0)
+ if(RbSettings::subValue("rbspeex", RbSettings::EncoderComplexity).toInt() <= 0)
result =false;
return result;
diff --git a/rbutil/rbutilqt/base/encoders.h b/rbutil/rbutilqt/base/encoders.h
index d5d1723a46..a70f775e98 100644
--- a/rbutil/rbutilqt/base/encoders.h
+++ b/rbutil/rbutilqt/base/encoders.h
@@ -24,7 +24,6 @@
#include <QtCore>
-#include "rbsettings.h"
#include "encttssettings.h"
#include "rbspeex.h"
@@ -54,15 +53,11 @@ class EncBase : public EncTtsSettingInterface
static QString getEncoderName(QString name);
static EncBase* getEncoder(QObject* parent,QString name);
static QStringList getEncoderList(void);
-
- //set the config. users of Encoder classes, always have to call this first
- void setCfg(RbSettings *sett){settings = sett;}
+
private:
static void initEncodernamesList(void);
protected:
- RbSettings* settings;
-
static QMap<QString,QString> encoderList;
};
diff --git a/rbutil/rbutilqt/base/rbsettings.cpp b/rbutil/rbutilqt/base/rbsettings.cpp
index 12654cd288..8e2e7c26d2 100644
--- a/rbutil/rbutilqt/base/rbsettings.cpp
+++ b/rbutil/rbutilqt/base/rbsettings.cpp
@@ -25,6 +25,7 @@
#include <unistd.h>
#endif
+
// device settings
const static struct {
RbSettings::SystemSettings setting;
@@ -94,31 +95,45 @@ const static struct {
{ RbSettings::EncoderVolume, ":encoder:/volume", "1.0" },
};
-void RbSettings::open()
+//! pointer to setting object to NULL
+QSettings* RbSettings::systemSettings = NULL;
+QSettings* RbSettings::userSettings = NULL;
+
+void RbSettings::ensureRbSettingsExists()
{
- // only use built-in rbutil.ini
- systemSettings = new QSettings(":/ini/rbutil.ini", QSettings::IniFormat, 0);
- // portable installation:
- // check for a configuration file in the program folder.
- QFileInfo config;
- config.setFile(QCoreApplication::instance()->applicationDirPath()
- + "/RockboxUtility.ini");
- if(config.isFile())
+ //check and create settings object
+ if(systemSettings == NULL)
{
- userSettings = new QSettings(QCoreApplication::instance()->applicationDirPath()
- + "/RockboxUtility.ini", QSettings::IniFormat, this);
- qDebug() << "config: portable";
+ // only use built-in rbutil.ini
+ systemSettings = new QSettings(":/ini/rbutil.ini", QSettings::IniFormat, 0);
}
- else
+
+ if(userSettings == NULL)
{
- userSettings = new QSettings(QSettings::IniFormat,
- QSettings::UserScope, "rockbox.org", "RockboxUtility",this);
- qDebug() << "config: system";
+ // portable installation:
+ // check for a configuration file in the program folder.
+ QFileInfo config;
+ config.setFile(QCoreApplication::instance()->applicationDirPath()
+ + "/RockboxUtility.ini");
+ if(config.isFile())
+ {
+ userSettings = new QSettings(QCoreApplication::instance()->applicationDirPath()
+ + "/RockboxUtility.ini", QSettings::IniFormat, NULL);
+ qDebug() << "config: portable";
+ }
+ else
+ {
+ userSettings = new QSettings(QSettings::IniFormat,
+ QSettings::UserScope, "rockbox.org", "RockboxUtility",NULL);
+ qDebug() << "config: system";
+ }
}
}
void RbSettings::sync()
{
+ ensureRbSettingsExists();
+
userSettings->sync();
#if defined(Q_OS_LINUX)
// when using sudo it runs rbutil with uid 0 but unfortunately without a
@@ -143,9 +158,16 @@ void RbSettings::sync()
#endif
}
+QString RbSettings::userSettingFilename()
+{
+ ensureRbSettingsExists();
+ return userSettings->fileName();
+}
QVariant RbSettings::value(enum SystemSettings setting)
{
+ ensureRbSettingsExists();
+
// locate setting item
int i = 0;
while(SystemSettingsList[i].setting != setting)
@@ -158,15 +180,16 @@ QVariant RbSettings::value(enum SystemSettings setting)
return systemSettings->value(s, d);
}
-
-QString RbSettings::userSettingFilename()
-{
- return userSettings->fileName();
+QVariant RbSettings::value(enum UserSettings setting)
+{
+ QString empty;
+ return subValue(empty, setting);
}
-
-QVariant RbSettings::subValue(QString& sub, enum UserSettings setting)
+QVariant RbSettings::subValue(QString sub, enum UserSettings setting)
{
+ ensureRbSettingsExists();
+
// locate setting item
int i = 0;
while(UserSettingsList[i].setting != setting)
@@ -177,9 +200,16 @@ QVariant RbSettings::subValue(QString& sub, enum UserSettings setting)
return userSettings->value(s, UserSettingsList[i].def);
}
+void RbSettings::setValue(enum UserSettings setting , QVariant value)
+{
+ QString empty;
+ return setSubValue(empty, setting, value);
+}
-void RbSettings::setSubValue(QString& sub, enum UserSettings setting, QVariant value)
+void RbSettings::setSubValue(QString sub, enum UserSettings setting, QVariant value)
{
+ ensureRbSettingsExists();
+
// locate setting item
int i = 0;
while(UserSettingsList[i].setting != setting)
@@ -190,10 +220,10 @@ void RbSettings::setSubValue(QString& sub, enum UserSettings setting, QVariant v
userSettings->setValue(s, value);
}
-
-
QStringList RbSettings::platforms()
{
+ ensureRbSettingsExists();
+
QStringList result;
systemSettings->beginGroup("platforms");
QStringList a = systemSettings->childKeys();
@@ -207,6 +237,8 @@ QStringList RbSettings::platforms()
QStringList RbSettings::languages()
{
+ ensureRbSettingsExists();
+
QStringList result;
systemSettings->beginGroup("languages");
QStringList a = systemSettings->childKeys();
@@ -220,16 +252,20 @@ QStringList RbSettings::languages()
QString RbSettings::name(QString platform)
{
+ ensureRbSettingsExists();
return systemSettings->value(platform + "/name").toString();
}
QString RbSettings::brand(QString platform)
{
+ ensureRbSettingsExists();
return systemSettings->value(platform + "/brand").toString();
}
QMap<int, QString> RbSettings::usbIdMap(enum MapType type)
{
+ ensureRbSettingsExists();
+
QMap<int, QString> map;
// get a list of ID -> target name
QStringList platforms;
diff --git a/rbutil/rbutilqt/base/rbsettings.h b/rbutil/rbutilqt/base/rbsettings.h
index 341577abc8..4f2a5c3617 100644
--- a/rbutil/rbutilqt/base/rbsettings.h
+++ b/rbutil/rbutilqt/base/rbsettings.h
@@ -29,23 +29,15 @@ class QSettings;
class RbSettings : public QObject
{
Q_OBJECT
-
public:
- RbSettings() {}
-
- //! open the settings files
- void open();
- //! call this to flush the user Settings
- void sync();
-
- // returns the filename of the usersettings file
- QString userSettingFilename();
-
+ //! Type of requested usb-id map
enum MapType {
MapDevice,
MapError,
MapIncompatible,
};
+
+ //! All user settings
enum UserSettings {
RbutilVersion,
CurrentPlatform,
@@ -76,6 +68,8 @@ class RbSettings : public QObject
EncoderQuality,
EncoderVolume,
};
+
+ //! All system settings
enum SystemSettings {
ManualUrl,
BleedingUrl,
@@ -103,40 +97,43 @@ class RbSettings : public QObject
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); }
-
- 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);
-
- QString name(QString plattform);
- QString brand(QString plattform);
-
- QMap<int, QString> usbIdMap(enum MapType);
+
+ //! call this to flush the user Settings
+ static void sync();
+ //! returns the filename of the usersettings file
+ static QString userSettingFilename();
+ //! return a list of all platforms (rbutil internal names)
+ static QStringList platforms(void);
+ //! returns a list of all languages
+ static QStringList languages(void);
+ //! maps a platform to its name
+ static QString name(QString plattform);
+ //! maps a platform to its brand
+ static QString brand(QString plattform);
+ //! returns a map of usb-ids and their targets
+ static QMap<int, QString> usbIdMap(enum MapType);
+ //! get a value from system settings
+ static QVariant value(enum SystemSettings setting);
+ //! get a vaulue from user settings
+ static QVariant value(enum UserSettings setting);
+ //! set a user setting value
+ static void setValue(enum UserSettings setting , QVariant value);
+ //! get a user setting from a subvalue (ie for encoders and tts engines)
+ static QVariant subValue(QString sub, enum UserSettings setting);
+ //! set a user setting from a subvalue (ie for encoders and tts engines)
+ static void setSubValue(QString sub, enum UserSettings setting, QVariant value);
private:
- //! private copy constructors to prvent copying
- RbSettings& operator= (const RbSettings& other)
- { (void)other; return *this; }
- RbSettings(const RbSettings& other) :QObject()
- { (void)other; }
- QString constructSettingPath(QString path, QString substitute = QString());
+ //! you shouldnt call this, its a fully static calls
+ RbSettings() {}
+ //! create the setting objects if neccessary
+ static void ensureRbSettingsExists();
+ //! create a settings path, substitute platform, tts and encoder
+ static QString constructSettingPath(QString path, QString substitute = QString());
//! pointers to our setting objects
- QSettings *systemSettings;
- QSettings *userSettings;
+ static QSettings *systemSettings;
+ static QSettings *userSettings;
};
#endif
diff --git a/rbutil/rbutilqt/base/tts.cpp b/rbutil/rbutilqt/base/tts.cpp
index d55ba9e739..70332f5f38 100644
--- a/rbutil/rbutilqt/base/tts.cpp
+++ b/rbutil/rbutilqt/base/tts.cpp
@@ -19,6 +19,7 @@
#include "tts.h"
#include "utils.h"
+#include "rbsettings.h"
/*********************************************************************
* TTS Base
**********************************************************************/
@@ -105,24 +106,24 @@ TTSExes::TTSExes(QString name,QObject* parent) : TTSBase(parent)
void TTSExes::generateSettings()
{
- QString exepath =settings->subValue(m_name,RbSettings::TtsPath).toString();
+ QString exepath =RbSettings::subValue(m_name,RbSettings::TtsPath).toString();
if(exepath == "") exepath = findExecutable(m_name);
insertSetting(eEXEPATH,new EncTtsSetting(this,EncTtsSetting::eSTRING,"Path to TTS engine:",exepath,EncTtsSetting::eBROWSEBTN));
- insertSetting(eOPTIONS,new EncTtsSetting(this,EncTtsSetting::eSTRING,"TTS enginge options:",settings->subValue(m_name,RbSettings::TtsOptions)));
+ insertSetting(eOPTIONS,new EncTtsSetting(this,EncTtsSetting::eSTRING,"TTS enginge options:",RbSettings::subValue(m_name,RbSettings::TtsOptions)));
}
void TTSExes::saveSettings()
{
- settings->setSubValue(m_name,RbSettings::TtsPath,getSetting(eEXEPATH)->current().toString());
- settings->setSubValue(m_name,RbSettings::TtsOptions,getSetting(eOPTIONS)->current().toString());
- settings->sync();
+ RbSettings::setSubValue(m_name,RbSettings::TtsPath,getSetting(eEXEPATH)->current().toString());
+ RbSettings::setSubValue(m_name,RbSettings::TtsOptions,getSetting(eOPTIONS)->current().toString());
+ RbSettings::sync();
}
bool TTSExes::start(QString *errStr)
{
- m_TTSexec = settings->subValue(m_name,RbSettings::TtsPath).toString();
- m_TTSOpts = settings->subValue(m_name,RbSettings::TtsOptions).toString();
+ m_TTSexec = RbSettings::subValue(m_name,RbSettings::TtsPath).toString();
+ m_TTSOpts = RbSettings::subValue(m_name,RbSettings::TtsOptions).toString();
m_TTSTemplate = m_TemplateMap.value(m_name);
@@ -155,7 +156,7 @@ TTSStatus TTSExes::voice(QString text,QString wavfile, QString *errStr)
bool TTSExes::configOk()
{
- QString path = settings->subValue(m_name,RbSettings::TtsPath).toString();
+ QString path = RbSettings::subValue(m_name,RbSettings::TtsPath).toString();
if (QFileInfo(path).exists())
return true;
@@ -176,31 +177,31 @@ TTSSapi::TTSSapi(QObject* parent) : TTSBase(parent)
void TTSSapi::generateSettings()
{
// language
- QStringList languages = settings->languages();
+ QStringList languages = RbSettings::languages();
languages.sort();
- EncTtsSetting* setting =new EncTtsSetting(this,EncTtsSetting::eSTRINGLIST,"Language:",settings->subValue("sapi",RbSettings::TtsLanguage),languages);
+ EncTtsSetting* setting =new EncTtsSetting(this,EncTtsSetting::eSTRINGLIST,"Language:",RbSettings::subValue("sapi",RbSettings::TtsLanguage),languages);
connect(setting,SIGNAL(dataChanged()),this,SLOT(updateVoiceList()));
insertSetting(eLANGUAGE,setting);
// voice
- setting = new EncTtsSetting(this,EncTtsSetting::eSTRINGLIST,"Voice:",settings->subValue("sapi",RbSettings::TtsVoice),getVoiceList(settings->subValue("sapi",RbSettings::TtsLanguage).toString()),EncTtsSetting::eREFRESHBTN);
+ setting = new EncTtsSetting(this,EncTtsSetting::eSTRINGLIST,"Voice:",RbSettings::subValue("sapi",RbSettings::TtsVoice),getVoiceList(RbSettings::subValue("sapi",RbSettings::TtsLanguage).toString()),EncTtsSetting::eREFRESHBTN);
connect(setting,SIGNAL(refresh()),this,SLOT(updateVoiceList()));
insertSetting(eVOICE,setting);
//speed
- insertSetting(eSPEED,new EncTtsSetting(this,EncTtsSetting::eINT,"Speed:",settings->subValue("sapi",RbSettings::TtsSpeed),-10,10));
+ insertSetting(eSPEED,new EncTtsSetting(this,EncTtsSetting::eINT,"Speed:",RbSettings::subValue("sapi",RbSettings::TtsSpeed),-10,10));
// options
- insertSetting(eOPTIONS,new EncTtsSetting(this,EncTtsSetting::eSTRING,"Options:",settings->subValue("sapi",RbSettings::TtsOptions)));
+ insertSetting(eOPTIONS,new EncTtsSetting(this,EncTtsSetting::eSTRING,"Options:",RbSettings::subValue("sapi",RbSettings::TtsOptions)));
}
void TTSSapi::saveSettings()
{
//save settings in user config
- settings->setSubValue("sapi",RbSettings::TtsLanguage,getSetting(eLANGUAGE)->current().toString());
- settings->setSubValue("sapi",RbSettings::TtsVoice,getSetting(eVOICE)->current().toString());
- settings->setSubValue("sapi",RbSettings::TtsSpeed,getSetting(eSPEED)->current().toInt());
- settings->setSubValue("sapi",RbSettings::TtsOptions,getSetting(eOPTIONS)->current().toString());
+ RbSettings::setSubValue("sapi",RbSettings::TtsLanguage,getSetting(eLANGUAGE)->current().toString());
+ RbSettings::setSubValue("sapi",RbSettings::TtsVoice,getSetting(eVOICE)->current().toString());
+ RbSettings::setSubValue("sapi",RbSettings::TtsSpeed,getSetting(eSPEED)->current().toInt());
+ RbSettings::setSubValue("sapi",RbSettings::TtsOptions,getSetting(eOPTIONS)->current().toString());
- settings->sync();
+ RbSettings::sync();
}
void TTSSapi::updateVoiceList()
@@ -215,11 +216,11 @@ void TTSSapi::updateVoiceList()
bool TTSSapi::start(QString *errStr)
{
- m_TTSOpts = settings->subValue("sapi",RbSettings::TtsOptions).toString();
- m_TTSLanguage =settings->subValue("sapi",RbSettings::TtsLanguage).toString();
- m_TTSVoice=settings->subValue("sapi",RbSettings::TtsVoice).toString();
- m_TTSSpeed=settings->subValue("sapi",RbSettings::TtsSpeed).toString();
- m_sapi4 = settings->subValue("sapi",RbSettings::TtsUseSapi4).toBool();
+ m_TTSOpts = RbSettings::subValue("sapi",RbSettings::TtsOptions).toString();
+ m_TTSLanguage =RbSettings::subValue("sapi",RbSettings::TtsLanguage).toString();
+ m_TTSVoice=RbSettings::subValue("sapi",RbSettings::TtsVoice).toString();
+ m_TTSSpeed=RbSettings::subValue("sapi",RbSettings::TtsSpeed).toString();
+ m_sapi4 = RbSettings::subValue("sapi",RbSettings::TtsUseSapi4).toBool();
QFile::remove(QDir::tempPath() +"/sapi_voice.vbs");
QFile::copy(":/builtin/sapi_voice.vbs",QDir::tempPath() + "/sapi_voice.vbs");
@@ -283,7 +284,7 @@ QStringList TTSSapi::getVoiceList(QString language)
execstring.replace("%exe",m_TTSexec);
execstring.replace("%lang",language);
- if(settings->value(RbSettings::TtsUseSapi4).toBool())
+ if(RbSettings::value(RbSettings::TtsUseSapi4).toBool())
execstring.append(" /sapi4 ");
qDebug() << "init" << execstring;
@@ -348,7 +349,7 @@ bool TTSSapi::stop()
bool TTSSapi::configOk()
{
- if(settings->subValue("sapi",RbSettings::TtsVoice).toString().isEmpty())
+ if(RbSettings::subValue("sapi",RbSettings::TtsVoice).toString().isEmpty())
return false;
return true;
}
@@ -363,17 +364,17 @@ TTSFestival::~TTSFestival()
void TTSFestival::generateSettings()
{
// server path
- QString exepath = settings->subValue("festival-server",RbSettings::TtsPath).toString();
+ QString exepath = RbSettings::subValue("festival-server",RbSettings::TtsPath).toString();
if(exepath == "" ) exepath = findExecutable("festival");
insertSetting(eSERVERPATH,new EncTtsSetting(this,EncTtsSetting::eSTRING,"Path to Festival server:",exepath,EncTtsSetting::eBROWSEBTN));
// client path
- QString clientpath = settings->subValue("festival-client",RbSettings::TtsPath).toString();
+ QString clientpath = RbSettings::subValue("festival-client",RbSettings::TtsPath).toString();
if(clientpath == "" ) clientpath = findExecutable("festival_client");
insertSetting(eCLIENTPATH,new EncTtsSetting(this,EncTtsSetting::eSTRING,"Path to Festival client:",clientpath,EncTtsSetting::eBROWSEBTN));
// voice
- EncTtsSetting* setting = new EncTtsSetting(this,EncTtsSetting::eSTRINGLIST,"Voice:",settings->subValue("festival",RbSettings::TtsVoice),getVoiceList(exepath),EncTtsSetting::eREFRESHBTN);
+ EncTtsSetting* setting = new EncTtsSetting(this,EncTtsSetting::eSTRINGLIST,"Voice:",RbSettings::subValue("festival",RbSettings::TtsVoice),getVoiceList(exepath),EncTtsSetting::eREFRESHBTN);
connect(setting,SIGNAL(refresh()),this,SLOT(updateVoiceList()));
connect(setting,SIGNAL(dataChanged()),this,SLOT(clearVoiceDescription()));
insertSetting(eVOICE,setting);
@@ -387,11 +388,11 @@ void TTSFestival::generateSettings()
void TTSFestival::saveSettings()
{
//save settings in user config
- settings->setSubValue("festival-server",RbSettings::TtsPath,getSetting(eSERVERPATH)->current().toString());
- settings->setSubValue("festival-client",RbSettings::TtsPath,getSetting(eCLIENTPATH)->current().toString());
- settings->setSubValue("festival",RbSettings::TtsVoice,getSetting(eVOICE)->current().toString());
+ RbSettings::setSubValue("festival-server",RbSettings::TtsPath,getSetting(eSERVERPATH)->current().toString());
+ RbSettings::setSubValue("festival-client",RbSettings::TtsPath,getSetting(eCLIENTPATH)->current().toString());
+ RbSettings::setSubValue("festival",RbSettings::TtsVoice,getSetting(eVOICE)->current().toString());
- settings->sync();
+ RbSettings::sync();
}
void TTSFestival::updateVoiceDescription()
@@ -420,7 +421,7 @@ void TTSFestival::startServer(QString path)
return;
if(path == "")
- path = settings->subValue("festival-server",RbSettings::TtsPath).toString();
+ path = RbSettings::subValue("festival-server",RbSettings::TtsPath).toString();
serverProcess.start(QString("%1 --server").arg(path));
serverProcess.waitForStarted();
@@ -444,9 +445,9 @@ bool TTSFestival::start(QString* errStr)
{
(void) errStr;
ensureServerRunning();
- if (!settings->subValue("festival",RbSettings::TtsVoice).toString().isEmpty())
+ if (!RbSettings::subValue("festival",RbSettings::TtsVoice).toString().isEmpty())
queryServer(QString("(voice.select '%1)")
- .arg(settings->subValue("festival", RbSettings::TtsVoice).toString()));
+ .arg(RbSettings::subValue("festival", RbSettings::TtsVoice).toString()));
return true;
}
@@ -463,7 +464,7 @@ TTSStatus TTSFestival::voice(QString text, QString wavfile, QString* errStr)
{
qDebug() << text << "->" << wavfile;
- QString path = settings->subValue("festival-client",RbSettings::TtsPath).toString();
+ QString path = RbSettings::subValue("festival-client",RbSettings::TtsPath).toString();
QString cmd = QString("%1 --server localhost --otype riff --ttw --withlisp --output \"%2\" - ").arg(path).arg(wavfile);
qDebug() << cmd;
@@ -493,13 +494,13 @@ TTSStatus TTSFestival::voice(QString text, QString wavfile, QString* errStr)
bool TTSFestival::configOk()
{
- QString serverPath = settings->subValue("festival-server",RbSettings::TtsPath).toString();
- QString clientPath = settings->subValue("festival-client",RbSettings::TtsVoice).toString();
+ QString serverPath = RbSettings::subValue("festival-server",RbSettings::TtsPath).toString();
+ QString clientPath = RbSettings::subValue("festival-client",RbSettings::TtsVoice).toString();
bool ret = QFileInfo(serverPath).isExecutable() &&
QFileInfo(clientPath).isExecutable();
- if(settings->subValue("festival",RbSettings::TtsVoice).toString().size() > 0 && voices.size() > 0)
- ret = ret && (voices.indexOf(settings->subValue("festival",RbSettings::TtsVoice).toString()) != -1);
+ if(RbSettings::subValue("festival",RbSettings::TtsVoice).toString().size() > 0 && voices.size() > 0)
+ ret = ret && (voices.indexOf(RbSettings::subValue("festival",RbSettings::TtsVoice).toString()) != -1);
return ret;
}
diff --git a/rbutil/rbutilqt/base/tts.h b/rbutil/rbutilqt/base/tts.h
index 093ccd6138..f665ed2865 100644
--- a/rbutil/rbutilqt/base/tts.h
+++ b/rbutil/rbutilqt/base/tts.h
@@ -23,7 +23,6 @@
#ifndef TTS_H
#define TTS_H
-#include "rbsettings.h"
#include <QtCore>
#include <QProcess>
#include <QDateTime>
@@ -58,16 +57,12 @@ class TTSBase : public EncTtsSettingInterface
static TTSBase* getTTS(QObject* parent,QString ttsname);
static QStringList getTTSList();
static QString getTTSName(QString tts);
-
- // sets the config. Users of TTS classes, always have to call this first
- void setCfg(RbSettings* sett) { settings = sett; }
-
+
private:
//inits the tts List
static void initTTSList();
protected:
- RbSettings* settings;
static QMap<QString,QString> ttsList;
};
diff --git a/rbutil/rbutilqt/configure.cpp b/rbutil/rbutilqt/configure.cpp
index 00a899abb4..0752b1f2a5 100644
--- a/rbutil/rbutilqt/configure.cpp
+++ b/rbutil/rbutilqt/configure.cpp
@@ -28,6 +28,7 @@
#include "tts.h"
#include "detect.h"
#include "encttscfggui.h"
+#include "rbsettings.h"
#include <stdio.h>
#if defined(Q_OS_WIN32)
@@ -85,10 +86,10 @@ Config::Config(QWidget *parent,int index) : QDialog(parent)
connect(ui.comboTts, SIGNAL(currentIndexChanged(int)), this, SLOT(updateTtsState(int)));
connect(ui.treeDevices, SIGNAL(itemSelectionChanged()), this, SLOT(updateEncState()));
+ setUserSettings();
+ setDevices();
}
-
-
void Config::accept()
{
qDebug() << "Config::accept()";
@@ -104,20 +105,20 @@ void Config::accept()
proxy.setPort(ui.proxyPort->text().toInt());
}
- settings->setValue(RbSettings::Proxy, proxy.toString());
+ RbSettings::setValue(RbSettings::Proxy, proxy.toString());
qDebug() << "new proxy:" << proxy;
// proxy type
QString proxyType;
if(ui.radioNoProxy->isChecked()) proxyType = "none";
else if(ui.radioSystemProxy->isChecked()) proxyType = "system";
else proxyType = "manual";
- settings->setValue(RbSettings::ProxyType, proxyType);
+ RbSettings::setValue(RbSettings::ProxyType, proxyType);
// language
- if(settings->value(RbSettings::Language).toString() != language && !language.isEmpty()) {
+ if(RbSettings::value(RbSettings::Language).toString() != language && !language.isEmpty()) {
QMessageBox::information(this, tr("Language changed"),
tr("You need to restart the application for the changed language to take effect."));
- settings->setValue(RbSettings::Language, language);
+ RbSettings::setValue(RbSettings::Language, language);
}
// mountpoint
@@ -139,14 +140,14 @@ void Config::accept()
error = true;
}
else {
- settings->setValue(RbSettings::Mountpoint, QDir::fromNativeSeparators(mp));
+ RbSettings::setValue(RbSettings::Mountpoint, QDir::fromNativeSeparators(mp));
}
// platform
QString nplat;
if(ui.treeDevices->selectedItems().size() != 0) {
nplat = ui.treeDevices->selectedItems().at(0)->data(0, Qt::UserRole).toString();
- settings->setValue(RbSettings::Platform, nplat);
+ RbSettings::setValue(RbSettings::Platform, nplat);
}
else {
errormsg += "<li>" + tr("No player selected") + "</li>";
@@ -161,18 +162,18 @@ void Config::accept()
error = true;
}
else
- settings->setValue(RbSettings::CachePath, ui.cachePath->text());
+ RbSettings::setValue(RbSettings::CachePath, ui.cachePath->text());
}
else // default to system temp path
- settings->setValue(RbSettings::CachePath, QDir::tempPath());
- settings->setValue(RbSettings::CacheDisabled, ui.cacheDisable->isChecked());
- settings->setValue(RbSettings::CacheOffline, ui.cacheOfflineMode->isChecked());
+ RbSettings::setValue(RbSettings::CachePath, QDir::tempPath());
+ RbSettings::setValue(RbSettings::CacheDisabled, ui.cacheDisable->isChecked());
+ RbSettings::setValue(RbSettings::CacheOffline, ui.cacheOfflineMode->isChecked());
// tts settings
int i = ui.comboTts->currentIndex();
- settings->setValue(RbSettings::Tts, ui.comboTts->itemData(i).toString());
+ RbSettings::setValue(RbSettings::Tts, ui.comboTts->itemData(i).toString());
- settings->setValue(RbSettings::RbutilVersion, PUREVERSION);
+ RbSettings::setValue(RbSettings::RbutilVersion, PUREVERSION);
errormsg += "</ul>";
errormsg += tr("You need to fix the above errors before you can continue.");
@@ -182,7 +183,7 @@ void Config::accept()
}
else {
// sync settings
- settings->sync();
+ RbSettings::sync();
this->close();
emit settingsUpdated();
}
@@ -195,18 +196,10 @@ void Config::abort()
this->close();
}
-void Config::setSettings(RbSettings* sett)
-{
- settings = sett;
-
- setUserSettings();
- setDevices();
-}
-
void Config::setUserSettings()
{
// set proxy
- proxy = settings->value(RbSettings::Proxy).toString();
+ proxy = RbSettings::value(RbSettings::Proxy).toString();
if(proxy.port() > 0)
ui.proxyPort->setText(QString("%1").arg(proxy.port()));
@@ -215,7 +208,7 @@ void Config::setUserSettings()
ui.proxyUser->setText(proxy.userName());
ui.proxyPass->setText(proxy.password());
- QString proxyType = settings->value(RbSettings::ProxyType).toString();
+ QString proxyType = RbSettings::value(RbSettings::ProxyType).toString();
if(proxyType == "manual") ui.radioManualProxy->setChecked(true);
else if(proxyType == "system") ui.radioSystemProxy->setChecked(true);
else ui.radioNoProxy->setChecked(true);
@@ -225,7 +218,7 @@ void Config::setUserSettings()
QString b;
// find key for lang value
QMap<QString, QString>::const_iterator i = lang.constBegin();
- QString l = settings->value(RbSettings::Language).toString();
+ QString l = RbSettings::value(RbSettings::Language).toString();
if(l.isEmpty())
l = QLocale::system().name();
while (i != lang.constEnd()) {
@@ -248,15 +241,15 @@ void Config::setUserSettings()
connect(ui.listLanguages, SIGNAL(itemSelectionChanged()), this, SLOT(updateLanguage()));
// devices tab
- ui.mountPoint->setText(QDir::toNativeSeparators(settings->value(RbSettings::Mountpoint).toString()));
+ ui.mountPoint->setText(QDir::toNativeSeparators(RbSettings::value(RbSettings::Mountpoint).toString()));
// cache tab
- if(!QFileInfo(settings->value(RbSettings::CachePath).toString()).isDir())
- settings->setValue(RbSettings::CachePath, QDir::tempPath());
- ui.cachePath->setText(QDir::toNativeSeparators(settings->value(RbSettings::CachePath).toString()));
- ui.cacheDisable->setChecked(settings->value(RbSettings::CacheDisabled).toBool());
- ui.cacheOfflineMode->setChecked(settings->value(RbSettings::CacheOffline).toBool());
- updateCacheInfo(settings->value(RbSettings::CachePath).toString());
+ if(!QFileInfo(RbSettings::value(RbSettings::CachePath).toString()).isDir())
+ RbSettings::setValue(RbSettings::CachePath, QDir::tempPath());
+ ui.cachePath->setText(QDir::toNativeSeparators(RbSettings::value(RbSettings::CachePath).toString()));
+ ui.cacheDisable->setChecked(RbSettings::value(RbSettings::CacheDisabled).toBool());
+ ui.cacheOfflineMode->setChecked(RbSettings::value(RbSettings::CacheOffline).toBool());
+ updateCacheInfo(RbSettings::value(RbSettings::CachePath).toString());
}
@@ -280,20 +273,20 @@ void Config::setDevices()
// setup devices table
qDebug() << "Config::setDevices()";
- QStringList platformList = settings->platforms();
+ QStringList platformList = RbSettings::platforms();
QMap <QString, QString> manuf;
QMap <QString, QString> devcs;
for(int it = 0; it < platformList.size(); it++)
{
- QString curname = settings->name(platformList.at(it));
- QString curbrand = settings->brand(platformList.at(it));
+ QString curname = RbSettings::name(platformList.at(it));
+ QString curbrand = RbSettings::brand(platformList.at(it));
manuf.insertMulti(curbrand, platformList.at(it));
devcs.insert(platformList.at(it), curname);
}
QString platform;
- platform = devcs.value(settings->value(RbSettings::Platform).toString());
+ platform = devcs.value(RbSettings::value(RbSettings::Platform).toString());
// set up devices table
ui.treeDevices->header()->hide();
@@ -316,8 +309,8 @@ void Config::setDevices()
// go through platforms again for sake of order
for(int it = 0; it < platformList.size(); it++) {
- QString curname = settings->name(platformList.at(it));
- QString curbrand = settings->brand(platformList.at(it));
+ QString curname = RbSettings::name(platformList.at(it));
+ QString curbrand = RbSettings::brand(platformList.at(it));
if(curbrand != brands.at(c)) continue;
qDebug() << "adding:" << brands.at(c) << curname;
@@ -346,7 +339,7 @@ void Config::setDevices()
for(int a = 0; a < ttslist.size(); a++)
ui.comboTts->addItem(TTSBase::getTTSName(ttslist.at(a)), ttslist.at(a));
//update index of combobox
- int index = ui.comboTts->findData(settings->value(RbSettings::Tts).toString());
+ int index = ui.comboTts->findData(RbSettings::value(RbSettings::Tts).toString());
if(index < 0) index = 0;
ui.comboTts->setCurrentIndex(index);
updateTtsState(index);
@@ -358,7 +351,6 @@ void Config::updateTtsState(int index)
{
QString ttsName = ui.comboTts->itemData(index).toString();
TTSBase* tts = TTSBase::getTTS(this,ttsName);
- tts->setCfg(settings);
if(tts->configOk())
{
@@ -381,14 +373,13 @@ void Config::updateEncState()
return;
QString devname = ui.treeDevices->selectedItems().at(0)->data(0, Qt::UserRole).toString();
- QString olddevice = settings->value(RbSettings::Platform).toString();
- settings->setValue(RbSettings::Platform, devname);
- QString encoder = settings->value(RbSettings::CurEncoder).toString();
- ui.encoderName->setText(EncBase::getEncoderName(settings->value(RbSettings::CurEncoder).toString()));
- settings->setValue(RbSettings::Platform, olddevice);
+ QString olddevice = RbSettings::value(RbSettings::Platform).toString();
+ RbSettings::setValue(RbSettings::Platform, devname);
+ QString encoder = RbSettings::value(RbSettings::CurEncoder).toString();
+ ui.encoderName->setText(EncBase::getEncoderName(RbSettings::value(RbSettings::CurEncoder).toString()));
+ RbSettings::setValue(RbSettings::Platform, olddevice);
EncBase* enc = EncBase::getEncoder(this,encoder);
- enc->setCfg(settings);
if(enc->configOk())
{
@@ -546,7 +537,6 @@ void Config::setCache(QString c)
void Config::autodetect()
{
Autodetection detector(this);
- detector.setSettings(settings);
// disable tree during detection as "working" feedback.
// TODO: replace the tree view with a splash screen during this time.
ui.treeDevices->setEnabled(false);
@@ -601,10 +591,10 @@ void Config::autodetect()
QString text;
// we need to set the platform here to get the brand from the
// settings object
- settings->setValue(RbSettings::Platform, detector.incompatdev());
+ RbSettings::setValue(RbSettings::Platform, detector.incompatdev());
text = tr("Detected an unsupported %1 player variant. Sorry, "
"Rockbox doesn't run on your player.")
- .arg(settings->value(RbSettings::CurBrand).toString());
+ .arg(RbSettings::value(RbSettings::CurBrand).toString());
QMessageBox::critical(this, tr("Fatal error: incompatible player found"),
text, QMessageBox::Ok);
@@ -660,7 +650,7 @@ void Config::cacheClear()
QFile::remove(f);
qDebug() << "removed:" << f;
}
- updateCacheInfo(settings->value(RbSettings::CachePath).toString());
+ updateCacheInfo(RbSettings::value(RbSettings::CachePath).toString());
}
@@ -669,8 +659,7 @@ void Config::configTts()
int index = ui.comboTts->currentIndex();
TTSBase* tts = TTSBase::getTTS(this,ui.comboTts->itemData(index).toString());
- tts->setCfg(settings);
- EncTtsCfgGui gui(this,tts,TTSBase::getTTSName(settings->value(RbSettings::Tts).toString()));
+ EncTtsCfgGui gui(this,tts,TTSBase::getTTSName(RbSettings::value(RbSettings::Tts).toString()));
gui.exec();
updateTtsState(ui.comboTts->currentIndex());
}
@@ -685,16 +674,15 @@ void Config::configEnc()
return;
QString devname = ui.treeDevices->selectedItems().at(0)->data(0, Qt::UserRole).toString();
- QString olddevice = settings->value(RbSettings::CurrentPlatform).toString();
- settings->setValue(RbSettings::CurrentPlatform,devname);
- QString encoder = settings->value(RbSettings::CurEncoder).toString();
- ui.encoderName->setText(EncBase::getEncoderName(settings->value(RbSettings::CurEncoder).toString()));
- settings->setValue(RbSettings::CurrentPlatform,olddevice);
+ QString olddevice = RbSettings::value(RbSettings::CurrentPlatform).toString();
+ RbSettings::setValue(RbSettings::CurrentPlatform,devname);
+ QString encoder = RbSettings::value(RbSettings::CurEncoder).toString();
+ ui.encoderName->setText(EncBase::getEncoderName(RbSettings::value(RbSettings::CurEncoder).toString()));
+ RbSettings::setValue(RbSettings::CurrentPlatform,olddevice);
EncBase* enc = EncBase::getEncoder(this,encoder);
-
- enc->setCfg(settings);
+
EncTtsCfgGui gui(this,enc,EncBase::getEncoderName(encoder));
gui.exec();
diff --git a/rbutil/rbutilqt/configure.h b/rbutil/rbutilqt/configure.h
index 9655952244..15e2d1b31c 100644
--- a/rbutil/rbutilqt/configure.h
+++ b/rbutil/rbutilqt/configure.h
@@ -24,7 +24,6 @@
#include "ui_configurefrm.h"
#include "browsedirtree.h"
-#include "rbsettings.h"
#include <QtGui>
class Config : public QDialog
@@ -32,7 +31,6 @@ class Config : public QDialog
Q_OBJECT
public:
Config(QWidget *parent = 0,int index=0);
- void setSettings(RbSettings* sett);
signals:
void settingsUpdated(void);
@@ -46,8 +44,7 @@ class Config : public QDialog
void setDevices();
Ui::ConfigForm ui;
- RbSettings* settings;
-
+
QStringList findLanguageFiles(void);
QString languageName(const QString&);
QMap<QString, QString> lang;
diff --git a/rbutil/rbutilqt/createvoicewindow.cpp b/rbutil/rbutilqt/createvoicewindow.cpp
index efd9f6a93f..c8c6b85435 100644
--- a/rbutil/rbutilqt/createvoicewindow.cpp
+++ b/rbutil/rbutilqt/createvoicewindow.cpp
@@ -22,6 +22,7 @@
#include "browsedirtree.h"
#include "configure.h"
+#include "rbsettings.h"
CreateVoiceWindow::CreateVoiceWindow(QWidget *parent) : QDialog(parent)
{
@@ -34,7 +35,6 @@ CreateVoiceWindow::CreateVoiceWindow(QWidget *parent) : QDialog(parent)
void CreateVoiceWindow::change()
{
Config *cw = new Config(this,4);
- cw->setSettings(settings);
connect(cw, SIGNAL(settingsUpdated()), this, SLOT(updateSettings()));
cw->show();
}
@@ -49,14 +49,13 @@ void CreateVoiceWindow::accept()
int wvThreshold = ui.wavtrimthreshold->value();
//safe selected language
- settings->setValue(RbSettings::Language, lang);
- settings->setValue(RbSettings::WavtrimThreshold, wvThreshold);
- settings->sync();
+ RbSettings::setValue(RbSettings::Language, lang);
+ RbSettings::setValue(RbSettings::WavtrimThreshold, wvThreshold);
+ RbSettings::sync();
//configure voicecreator
- voicecreator->setSettings(settings);
- voicecreator->setMountPoint(settings->value(RbSettings::Mountpoint).toString());
- voicecreator->setTargetId(settings->value(RbSettings::CurTargetId).toInt());
+ voicecreator->setMountPoint(RbSettings::value(RbSettings::Mountpoint).toString());
+ voicecreator->setTargetId(RbSettings::value(RbSettings::CurTargetId).toInt());
voicecreator->setLang(lang);
voicecreator->setWavtrimThreshold(wvThreshold);
@@ -65,28 +64,19 @@ void CreateVoiceWindow::accept()
}
-/** @brief set settings object
- */
-void CreateVoiceWindow::setSettings(RbSettings* sett)
-{
- settings = sett;
- updateSettings();
-}
-
-
/** @brief update displayed settings
*/
void CreateVoiceWindow::updateSettings(void)
{
// fill in language combobox
- QStringList languages = settings->languages();
+ QStringList languages = RbSettings::languages();
languages.sort();
ui.comboLanguage->addItems(languages);
// set saved lang
- int sel = ui.comboLanguage->findText(settings->value(RbSettings::VoiceLanguage).toString());
+ int sel = ui.comboLanguage->findText(RbSettings::value(RbSettings::VoiceLanguage).toString());
// if no saved language is found try to figure the language from the UI lang
if(sel == -1) {
- QString f = settings->value(RbSettings::Language).toString();
+ QString f = RbSettings::value(RbSettings::Language).toString();
// if no language is set default to english. Make sure not to check an empty string.
if(f.isEmpty()) f = "english";
sel = ui.comboLanguage->findText(f, Qt::MatchStartsWith);
@@ -97,9 +87,8 @@ void CreateVoiceWindow::updateSettings(void)
}
ui.comboLanguage->setCurrentIndex(sel);
- QString ttsName = settings->value(RbSettings::Tts).toString();
+ QString ttsName = RbSettings::value(RbSettings::Tts).toString();
TTSBase* tts = TTSBase::getTTS(this,ttsName);
- tts->setCfg(settings);
if(tts->configOk())
ui.labelTtsProfile->setText(tr("Selected TTS engine: <b>%1</b>")
.arg(TTSBase::getTTSName(ttsName)));
@@ -107,11 +96,10 @@ void CreateVoiceWindow::updateSettings(void)
ui.labelTtsProfile->setText(tr("Selected TTS engine: <b>%1</b>")
.arg("Invalid TTS configuration!"));
- QString encoder = settings->value(RbSettings::CurEncoder).toString();
+ QString encoder = RbSettings::value(RbSettings::CurEncoder).toString();
// only proceed if encoder setting is set
EncBase* enc = EncBase::getEncoder(this,encoder);
if(enc != NULL) {
- enc->setCfg(settings);
if(enc->configOk())
ui.labelEncProfile->setText(tr("Selected encoder: <b>%1</b>")
.arg(EncBase::getEncoderName(encoder)));
@@ -122,7 +110,7 @@ void CreateVoiceWindow::updateSettings(void)
else
ui.labelEncProfile->setText(tr("Selected encoder: <b>%1</b>")
.arg("Invalid encoder configuration!"));
- ui.wavtrimthreshold->setValue(settings->value(RbSettings::WavtrimThreshold).toInt());
+ ui.wavtrimthreshold->setValue(RbSettings::value(RbSettings::WavtrimThreshold).toInt());
emit settingsUpdated();
}
diff --git a/rbutil/rbutilqt/createvoicewindow.h b/rbutil/rbutilqt/createvoicewindow.h
index ab98bf985b..237f21975e 100644
--- a/rbutil/rbutilqt/createvoicewindow.h
+++ b/rbutil/rbutilqt/createvoicewindow.h
@@ -27,14 +27,13 @@
#include "ui_createvoicefrm.h"
#include "progressloggergui.h"
#include "voicefile.h"
-#include "rbsettings.h"
+
class CreateVoiceWindow : public QDialog
{
Q_OBJECT
public:
CreateVoiceWindow(QWidget *parent);
- void setSettings(RbSettings* sett);
void setProxy(QUrl proxy){m_proxy = proxy;}
public slots:
@@ -49,7 +48,6 @@ class CreateVoiceWindow : public QDialog
VoiceFileCreator* voicecreator;
Ui::CreateVoiceFrm ui;
ProgressLoggerGui* logger;
- RbSettings* settings;
QUrl m_proxy;
};
diff --git a/rbutil/rbutilqt/install.cpp b/rbutil/rbutilqt/install.cpp
index 69d5823258..d3854b06fc 100644
--- a/rbutil/rbutilqt/install.cpp
+++ b/rbutil/rbutilqt/install.cpp
@@ -21,10 +21,10 @@
#include "ui_installfrm.h"
#include "rbzip.h"
#include "detect.h"
+#include "rbsettings.h"
-Install::Install(RbSettings *sett,QWidget *parent) : QDialog(parent)
+Install::Install(QWidget *parent) : QDialog(parent)
{
- settings = sett;
ui.setupUi(this);
connect(ui.radioStable, SIGNAL(toggled(bool)), this, SLOT(setDetailsStable(bool)));
@@ -34,12 +34,12 @@ Install::Install(RbSettings *sett,QWidget *parent) : QDialog(parent)
connect(ui.backup, SIGNAL(stateChanged(int)), this, SLOT(backupCheckboxChanged(int)));
//! check if rockbox is already installed
- QString version = Detect::installedVersion(settings->value(RbSettings::Mountpoint).toString());
+ QString version = Detect::installedVersion(RbSettings::value(RbSettings::Mountpoint).toString());
if(version != "")
{
ui.Backupgroup->show();
- m_backupName = settings->value(RbSettings::Mountpoint).toString();
+ m_backupName = RbSettings::value(RbSettings::Mountpoint).toString();
if(!m_backupName.endsWith("/")) m_backupName += "/";
m_backupName += ".backup/rockbox-backup-"+version+".zip";
// for some reason the label doesn't return its final size yet.
@@ -91,8 +91,8 @@ void Install::accept()
{
logger = new ProgressLoggerGui(this);
logger->show();
- QString mountPoint = settings->value(RbSettings::Mountpoint).toString();
- qDebug() << "mountpoint:" << settings->value(RbSettings::Mountpoint).toString();
+ QString mountPoint = RbSettings::value(RbSettings::Mountpoint).toString();
+ qDebug() << "mountpoint:" << RbSettings::value(RbSettings::Mountpoint).toString();
// show dialog with error if mount point is wrong
if(!QFileInfo(mountPoint).isDir()) {
logger->addItem(tr("Mount point is wrong!"),LOGERROR);
@@ -101,39 +101,39 @@ void Install::accept()
}
QString myversion;
- QString buildname = settings->value(RbSettings::CurBuildserverModel).toString();
+ QString buildname = RbSettings::value(RbSettings::CurBuildserverModel).toString();
if(ui.radioStable->isChecked()) {
file = QString("%1/%2/rockbox-%3-%4.zip")
- .arg(settings->value(RbSettings::ReleaseUrl).toString(), version.value("rel_rev"),
+ .arg(RbSettings::value(RbSettings::ReleaseUrl).toString(), version.value("rel_rev"),
buildname, version.value("rel_rev"));
fileName = QString("rockbox-%1-%2.zip")
.arg(version.value("rel_rev"), buildname);
- settings->setValue(RbSettings::Build, "stable");
+ RbSettings::setValue(RbSettings::Build, "stable");
myversion = version.value("rel_rev");
}
else if(ui.radioArchived->isChecked()) {
file = QString("%1%2/rockbox-%3-%4.zip")
- .arg(settings->value(RbSettings::DailyUrl).toString(),
+ .arg(RbSettings::value(RbSettings::DailyUrl).toString(),
buildname, buildname, version.value("arch_date"));
fileName = QString("rockbox-%1-%2.zip")
.arg(buildname, version.value("arch_date"));
- settings->setValue(RbSettings::Build, "archived");
+ RbSettings::setValue(RbSettings::Build, "archived");
myversion = "r" + version.value("arch_rev") + "-" + version.value("arch_date");
}
else if(ui.radioCurrent->isChecked()) {
file = QString("%1%2/rockbox.zip")
- .arg(settings->value(RbSettings::BleedingUrl).toString(), buildname);
+ .arg(RbSettings::value(RbSettings::BleedingUrl).toString(), buildname);
fileName = QString("rockbox.zip");
- settings->setValue(RbSettings::Build, "current");
+ RbSettings::setValue(RbSettings::Build, "current");
myversion = "r" + version.value("bleed_rev");
}
else {
qDebug() << "no build selected -- this shouldn't happen";
return;
}
- settings->sync();
+ RbSettings::sync();
- QString warning = Detect::check(settings, false);
+ QString warning = Detect::check(false);
if(!warning.isEmpty())
{
if(QMessageBox::warning(this, tr("Really continue?"), warning,
@@ -163,7 +163,7 @@ void Install::accept()
RbZip backup;
connect(&backup,SIGNAL(zipProgress(int,int)),logger,SLOT(setProgress(int,int)));
if(backup.createZip(m_backupName,
- settings->value(RbSettings::Mountpoint).toString() + "/.rockbox") == Zip::Ok)
+ RbSettings::value(RbSettings::Mountpoint).toString() + "/.rockbox") == Zip::Ok)
{
logger->addItem(tr("Backup successful"),LOGOK);
}
@@ -179,7 +179,7 @@ void Install::accept()
installer = new ZipInstaller(this);
installer->setUrl(file);
installer->setLogSection("Rockbox (Base)");
- if(!settings->value(RbSettings::CacheDisabled).toBool()
+ if(!RbSettings::value(RbSettings::CacheDisabled).toBool()
&& !ui.checkBoxCache->isChecked())
{
installer->setCache(true);
@@ -223,9 +223,9 @@ void Install::done(bool error)
// no error, close the window, when the logger is closed
connect(logger,SIGNAL(closed()),this,SLOT(close()));
// add platform info to log file for later detection
- QSettings installlog(settings->value(RbSettings::Mountpoint).toString()
+ QSettings installlog(RbSettings::value(RbSettings::Mountpoint).toString()
+ "/.rockbox/rbutil.log", QSettings::IniFormat, 0);
- installlog.setValue("platform", settings->value(RbSettings::Platform).toString());
+ installlog.setValue("platform", RbSettings::value(RbSettings::Platform).toString());
installlog.sync();
}
@@ -293,12 +293,12 @@ void Install::setVersionStrings(QMap<QString, QString>& ver)
// try to use the old selection first. If no selection has been made
// in the past, use a preselection based on released status.
- if(settings->value(RbSettings::Build).toString() == "stable"
+ if(RbSettings::value(RbSettings::Build).toString() == "stable"
&& !version.value("rel_rev").isEmpty())
ui.radioStable->setChecked(true);
- else if(settings->value(RbSettings::Build).toString() == "archived")
+ else if(RbSettings::value(RbSettings::Build).toString() == "archived")
ui.radioArchived->setChecked(true);
- else if(settings->value(RbSettings::Build).toString() == "current")
+ else if(RbSettings::value(RbSettings::Build).toString() == "current")
ui.radioCurrent->setChecked(true);
else if(!version.value("rel_rev").isEmpty()) {
ui.radioStable->setChecked(true);
diff --git a/rbutil/rbutilqt/install.h b/rbutil/rbutilqt/install.h
index 6c7a44939d..2a8ec891de 100644
--- a/rbutil/rbutilqt/install.h
+++ b/rbutil/rbutilqt/install.h
@@ -27,13 +27,12 @@
#include "ui_installfrm.h"
#include "zipinstaller.h"
#include "progressloggergui.h"
-#include "rbsettings.h"
class Install : public QDialog
{
Q_OBJECT
public:
- Install(RbSettings* sett,QWidget *parent = 0);
+ Install(QWidget *parent);
void setVersionStrings(QMap<QString, QString>&);
public slots:
@@ -42,7 +41,6 @@ class Install : public QDialog
private:
Ui::InstallFrm ui;
ProgressLoggerGui* logger;
- RbSettings* settings;
QHttp *download;
QFile *target;
QString file;
diff --git a/rbutil/rbutilqt/installtalkwindow.cpp b/rbutil/rbutilqt/installtalkwindow.cpp
index cfe38ed2b9..6277313d3a 100644
--- a/rbutil/rbutilqt/installtalkwindow.cpp
+++ b/rbutil/rbutilqt/installtalkwindow.cpp
@@ -22,6 +22,7 @@
#include "browsedirtree.h"
#include "configure.h"
+#include "rbsettings.h"
InstallTalkWindow::InstallTalkWindow(QWidget *parent) : QDialog(parent)
{
@@ -34,6 +35,8 @@ InstallTalkWindow::InstallTalkWindow(QWidget *parent) : QDialog(parent)
ui.recursive->setChecked(true);
ui.OverwriteTalk->setChecked(true);
ui.StripExtensions->setChecked(true);
+
+ updateSettings();
}
void InstallTalkWindow::browseFolder()
@@ -64,7 +67,6 @@ void InstallTalkWindow::setTalkFolder(QString folder)
void InstallTalkWindow::change()
{
Config *cw = new Config(this,4);
- cw->setSettings(settings);
connect(cw, SIGNAL(settingsUpdated()), this, SLOT(updateSettings()));
@@ -88,13 +90,12 @@ void InstallTalkWindow::accept()
return;
}
- settings->setValue(RbSettings::LastTalkedFolder, folderToTalk);
+ RbSettings::setValue(RbSettings::LastTalkedFolder, folderToTalk);
- settings->sync();
+ RbSettings::sync();
- talkcreator->setSettings(settings);
talkcreator->setDir(QDir(folderToTalk));
- talkcreator->setMountPoint(settings->value(RbSettings::Mountpoint).toString());
+ talkcreator->setMountPoint(RbSettings::value(RbSettings::Mountpoint).toString());
talkcreator->setOverwriteTalk(ui.OverwriteTalk->isChecked());
talkcreator->setRecursive(ui.recursive->isChecked());
@@ -106,18 +107,10 @@ void InstallTalkWindow::accept()
}
-void InstallTalkWindow::setSettings(RbSettings* sett)
-{
- settings = sett;
- updateSettings();
-}
-
-
void InstallTalkWindow::updateSettings(void)
{
- QString ttsName = settings->value(RbSettings::Tts).toString();
+ QString ttsName = RbSettings::value(RbSettings::Tts).toString();
TTSBase* tts = TTSBase::getTTS(this,ttsName);
- tts->setCfg(settings);
if(tts->configOk())
ui.labelTtsProfile->setText(tr("Selected TTS engine: <b>%1</b>")
.arg(TTSBase::getTTSName(ttsName)));
@@ -125,10 +118,9 @@ void InstallTalkWindow::updateSettings(void)
ui.labelTtsProfile->setText(tr("Selected TTS engine: <b>%1</b>")
.arg("Invalid TTS configuration!"));
- QString encoder = settings->value(RbSettings::CurEncoder).toString();
+ QString encoder = RbSettings::value(RbSettings::CurEncoder).toString();
EncBase* enc = EncBase::getEncoder(this,encoder);
if(enc != NULL) {
- enc->setCfg(settings);
if(enc->configOk())
ui.labelEncProfile->setText(tr("Selected encoder: <b>%1</b>")
.arg(EncBase::getEncoderName(encoder)));
@@ -140,7 +132,7 @@ void InstallTalkWindow::updateSettings(void)
ui.labelEncProfile->setText(tr("Selected encoder: <b>%1</b>")
.arg("Invalid encoder configuration!"));
- setTalkFolder(settings->value(RbSettings::LastTalkedFolder).toString());
+ setTalkFolder(RbSettings::value(RbSettings::LastTalkedFolder).toString());
emit settingsUpdated();
}
diff --git a/rbutil/rbutilqt/installtalkwindow.h b/rbutil/rbutilqt/installtalkwindow.h
index fb9a49f63f..e7cc85aac7 100644
--- a/rbutil/rbutilqt/installtalkwindow.h
+++ b/rbutil/rbutilqt/installtalkwindow.h
@@ -27,15 +27,13 @@
#include "ui_installtalkfrm.h"
#include "progressloggergui.h"
#include "talkfile.h"
-#include "rbsettings.h"
class InstallTalkWindow : public QDialog
{
Q_OBJECT
public:
InstallTalkWindow(QWidget *parent = 0);
- void setSettings(RbSettings* sett);
-
+
public slots:
void accept(void);
void change(void);
@@ -52,8 +50,6 @@ class InstallTalkWindow : public QDialog
TalkFileCreator* talkcreator;
Ui::InstallTalkFrm ui;
ProgressLoggerGui* logger;
- RbSettings* settings;
-
};
#endif
diff --git a/rbutil/rbutilqt/rbutilqt.cpp b/rbutil/rbutilqt/rbutilqt.cpp
index 3412b47ff9..34a1990aa6 100644
--- a/rbutil/rbutilqt/rbutilqt.cpp
+++ b/rbutil/rbutilqt/rbutilqt.cpp
@@ -34,6 +34,7 @@
#include "rbzip.h"
#include "sysinfo.h"
#include "detect.h"
+#include "rbsettings.h"
#include "progressloggerinterface.h"
@@ -60,8 +61,6 @@ RbUtilQt::RbUtilQt(QWidget *parent) : QMainWindow(parent)
{
absolutePath = qApp->applicationDirPath();
- settings = new RbSettings();
- settings->open();
HttpGet::setGlobalUserAgent("rbutil/"VERSION);
// init startup & autodetection
ui.setupUi(this);
@@ -154,13 +153,13 @@ void RbUtilQt::downloadInfo()
connect(daily, SIGNAL(done(bool)), this, SLOT(downloadDone(bool)));
connect(daily, SIGNAL(requestFinished(int, bool)), this, SLOT(downloadDone(int, bool)));
connect(qApp, SIGNAL(lastWindowClosed()), daily, SLOT(abort()));
- if(settings->value(RbSettings::CacheOffline).toBool())
+ if(RbSettings::value(RbSettings::CacheOffline).toBool())
daily->setCache(true);
else
daily->setCache(false);
qDebug() << "downloading build info";
daily->setFile(&buildInfo);
- daily->getFile(QUrl(settings->value(RbSettings::ServerConfUrl).toString()));
+ daily->getFile(QUrl(RbSettings::value(RbSettings::ServerConfUrl).toString()));
}
@@ -181,7 +180,7 @@ void RbUtilQt::downloadDone(bool error)
versmap.insert("arch_date", info.value("dailies/date").toString());
info.beginGroup("release");
- versmap.insert("rel_rev", info.value(settings->value(RbSettings::CurBuildserverModel).toString()).toString());
+ versmap.insert("rel_rev", info.value(RbSettings::value(RbSettings::CurBuildserverModel).toString()).toString());
info.endGroup();
if(versmap.value("rel_rev").isEmpty()) {
@@ -197,12 +196,12 @@ void RbUtilQt::downloadDone(bool error)
connect(bleeding, SIGNAL(done(bool)), this, SLOT(downloadBleedingDone(bool)));
connect(bleeding, SIGNAL(requestFinished(int, bool)), this, SLOT(downloadDone(int, bool)));
connect(qApp, SIGNAL(lastWindowClosed()), daily, SLOT(abort()));
- if(settings->value(RbSettings::CacheOffline).toBool())
+ if(RbSettings::value(RbSettings::CacheOffline).toBool())
bleeding->setCache(true);
bleeding->setFile(&bleedingInfo);
- bleeding->getFile(QUrl(settings->value(RbSettings::BleedingInfo).toString()));
+ bleeding->getFile(QUrl(RbSettings::value(RbSettings::BleedingInfo).toString()));
- if(settings->value(RbSettings::RbutilVersion) != PUREVERSION) {
+ if(RbSettings::value(RbSettings::RbutilVersion) != PUREVERSION) {
QApplication::processEvents();
QMessageBox::information(this, tr("New installation"),
tr("This is a new installation of Rockbox Utility, or a new version. "
@@ -291,7 +290,6 @@ void RbUtilQt::help()
void RbUtilQt::configDialog()
{
Config *cw = new Config(this);
- cw->setSettings(settings);
connect(cw, SIGNAL(settingsUpdated()), this, SLOT(updateSettings()));
connect(cw, SIGNAL(settingsUpdated()), this, SLOT(downloadInfo()));
cw->show();
@@ -303,23 +301,23 @@ void RbUtilQt::updateSettings()
qDebug() << "updateSettings()";
updateDevice();
updateManual();
- if(settings->value(RbSettings::ProxyType) == "system") {
+ if(RbSettings::value(RbSettings::ProxyType) == "system") {
HttpGet::setGlobalProxy(Detect::systemProxy());
}
- else if(settings->value(RbSettings::ProxyType) == "manual") {
- HttpGet::setGlobalProxy(settings->value(RbSettings::Proxy).toString());
+ else if(RbSettings::value(RbSettings::ProxyType) == "manual") {
+ HttpGet::setGlobalProxy(RbSettings::value(RbSettings::Proxy).toString());
}
else {
HttpGet::setGlobalProxy(QUrl(""));
}
- HttpGet::setGlobalCache(settings->value(RbSettings::CachePath).toString());
- HttpGet::setGlobalDumbCache(settings->value(RbSettings::CacheOffline).toBool());
+ HttpGet::setGlobalCache(RbSettings::value(RbSettings::CachePath).toString());
+ HttpGet::setGlobalDumbCache(RbSettings::value(RbSettings::CacheOffline).toBool());
}
void RbUtilQt::updateDevice()
{
- if(settings->value(RbSettings::CurBootloaderMethod) == "none" ) {
+ if(RbSettings::value(RbSettings::CurBootloaderMethod) == "none" ) {
ui.buttonBootloader->setEnabled(false);
ui.buttonRemoveBootloader->setEnabled(false);
ui.labelBootloader->setEnabled(false);
@@ -328,7 +326,7 @@ void RbUtilQt::updateDevice()
else {
ui.buttonBootloader->setEnabled(true);
ui.labelBootloader->setEnabled(true);
- if(settings->value(RbSettings::CurBootloaderMethod) == "fwpatcher") {
+ if(RbSettings::value(RbSettings::CurBootloaderMethod) == "fwpatcher") {
ui.labelRemoveBootloader->setEnabled(false);
ui.buttonRemoveBootloader->setEnabled(false);
}
@@ -339,9 +337,9 @@ void RbUtilQt::updateDevice()
}
// displayed device info
- QString mountpoint = settings->value(RbSettings::Mountpoint).toString();
- QString brand = settings->value(RbSettings::CurBrand).toString();
- QString name = settings->value(RbSettings::CurName).toString();
+ QString mountpoint = RbSettings::value(RbSettings::Mountpoint).toString();
+ QString brand = RbSettings::value(RbSettings::CurBrand).toString();
+ QString name = RbSettings::value(RbSettings::CurName).toString();
if(name.isEmpty()) name = "&lt;none&gt;";
if(mountpoint.isEmpty()) mountpoint = "&lt;invalid&gt;";
ui.labelDevice->setText(tr("<b>%1 %2</b> at <b>%3</b>")
@@ -351,17 +349,17 @@ void RbUtilQt::updateDevice()
void RbUtilQt::updateManual()
{
- if(settings->value(RbSettings::Platform) != "")
+ if(RbSettings::value(RbSettings::Platform) != "")
{
- QString manual= settings->value(RbSettings::CurManual).toString();
+ QString manual= RbSettings::value(RbSettings::CurManual).toString();
if(manual == "")
- manual = "rockbox-" + settings->value(RbSettings::Platform).toString();
+ manual = "rockbox-" + RbSettings::value(RbSettings::Platform).toString();
QString pdfmanual;
- pdfmanual = settings->value(RbSettings::ManualUrl).toString()
+ pdfmanual = RbSettings::value(RbSettings::ManualUrl).toString()
+ "/" + manual + ".pdf";
QString htmlmanual;
- htmlmanual = settings->value(RbSettings::ManualUrl).toString()
+ htmlmanual = RbSettings::value(RbSettings::ManualUrl).toString()
+ "/" + manual + "/rockbox-build.html";
ui.labelPdfManual->setText(tr("<a href='%1'>PDF Manual</a>")
.arg(pdfmanual));
@@ -455,7 +453,7 @@ void RbUtilQt::smallInstall()
bool RbUtilQt::smallInstallInner()
{
- QString mountpoint = settings->value(RbSettings::Mountpoint).toString();
+ QString mountpoint = RbSettings::value(RbSettings::Mountpoint).toString();
// show dialog with error if mount point is wrong
if(!QFileInfo(mountpoint).isDir()) {
logger->addItem(tr("Mount point is wrong!"),LOGERROR);
@@ -463,7 +461,7 @@ bool RbUtilQt::smallInstallInner()
return true;
}
// Bootloader
- if(settings->value(RbSettings::CurBootloaderMethod) != "none")
+ if(RbSettings::value(RbSettings::CurBootloaderMethod) != "none")
{
m_error = false;
m_installed = false;
@@ -515,17 +513,17 @@ void RbUtilQt::installBtn()
bool RbUtilQt::installAuto()
{
QString file = QString("%1/%2/rockbox-%3-%4.zip")
- .arg(settings->value(RbSettings::ReleaseUrl).toString(),
+ .arg(RbSettings::value(RbSettings::ReleaseUrl).toString(),
versmap.value("rel_rev"),
- settings->value(RbSettings::CurBuildserverModel).toString(),
+ RbSettings::value(RbSettings::CurBuildserverModel).toString(),
versmap.value("rel_rev"));
buildInfo.open();
QSettings info(buildInfo.fileName(), QSettings::IniFormat, this);
buildInfo.close();
// check installed Version and Target
- QString rbVersion = Detect::installedVersion(settings->value(RbSettings::Mountpoint).toString());
- QString warning = Detect::check(settings, false);
+ QString rbVersion = Detect::installedVersion(RbSettings::value(RbSettings::Mountpoint).toString());
+ QString warning = Detect::check(false);
if(!warning.isEmpty())
{
@@ -546,7 +544,7 @@ bool RbUtilQt::installAuto()
QMessageBox::Yes | QMessageBox::No) == QMessageBox::Yes)
{
logger->addItem(tr("Starting backup..."),LOGINFO);
- QString backupName = settings->value(RbSettings::Mountpoint).toString()
+ QString backupName = RbSettings::value(RbSettings::Mountpoint).toString()
+ "/.backup/rockbox-backup-" + rbVersion + ".zip";
//! create dir, if it doesnt exist
@@ -561,7 +559,7 @@ bool RbUtilQt::installAuto()
RbZip backup;
connect(&backup,SIGNAL(zipProgress(int,int)),logger, SLOT(setProgress(int,int)));
if(backup.createZip(backupName,
- settings->value(RbSettings::Mountpoint).toString() + "/.rockbox") == Zip::Ok)
+ RbSettings::value(RbSettings::Mountpoint).toString() + "/.rockbox") == Zip::Ok)
{
logger->addItem(tr("Backup successful"),LOGOK);
}
@@ -579,9 +577,9 @@ bool RbUtilQt::installAuto()
installer->setUrl(file);
installer->setLogSection("Rockbox (Base)");
installer->setLogVersion(versmap.value("rel_rev"));
- if(!settings->value(RbSettings::CacheDisabled).toBool())
+ if(!RbSettings::value(RbSettings::CacheDisabled).toBool())
installer->setCache(true);
- installer->setMountPoint(settings->value(RbSettings::Mountpoint).toString());
+ installer->setMountPoint(RbSettings::value(RbSettings::Mountpoint).toString());
connect(installer, SIGNAL(done(bool)), this, SLOT(installdone(bool)));
connect(installer, SIGNAL(logItem(QString, int)), logger, SLOT(addItem(QString, int)));
@@ -595,7 +593,7 @@ bool RbUtilQt::installAuto()
void RbUtilQt::install()
{
- Install *installWindow = new Install(settings,this);
+ Install *installWindow = new Install(this);
buildInfo.open();
QSettings info(buildInfo.fileName(), QSettings::IniFormat, this);
@@ -626,13 +624,13 @@ void RbUtilQt::installBootloaderBtn()
void RbUtilQt::installBootloader()
{
- QString platform = settings->value(RbSettings::Platform).toString();
+ QString platform = RbSettings::value(RbSettings::Platform).toString();
QString backupDestination = "";
m_error = false;
// create installer
BootloaderInstallBase *bl;
- QString type = settings->value(RbSettings::CurBootloaderMethod).toString();
+ QString type = RbSettings::value(RbSettings::CurBootloaderMethod).toString();
if(type == "mi4") {
bl = new BootloaderInstallMi4(this);
}
@@ -656,23 +654,23 @@ void RbUtilQt::installBootloader()
// set bootloader filename. Do this now as installed() needs it.
QString blfile;
- blfile = settings->value(RbSettings::Mountpoint).toString()
- + settings->value(RbSettings::CurBootloaderFile).toString();
+ blfile = RbSettings::value(RbSettings::Mountpoint).toString()
+ + RbSettings::value(RbSettings::CurBootloaderFile).toString();
// special case for H10 pure: this player can have a different
// bootloader file filename. This is handled here to keep the install
// class clean, though having it here is also not the nicest solution.
- if(settings->value(RbSettings::Platform).toString() == "h10_ums"
- || settings->value(RbSettings::Platform) == "h10_mtp") {
+ if(RbSettings::value(RbSettings::Platform).toString() == "h10_ums"
+ || RbSettings::value(RbSettings::Platform) == "h10_mtp") {
if(resolvePathCase(blfile).isEmpty())
- blfile = settings->value(RbSettings::Mountpoint).toString()
- + settings->value(RbSettings::CurBootloaderName).toString()
+ blfile = RbSettings::value(RbSettings::Mountpoint).toString()
+ + RbSettings::value(RbSettings::CurBootloaderName).toString()
.replace("H10", "H10EMP", Qt::CaseInsensitive);
}
bl->setBlFile(blfile);
- QUrl url(settings->value(RbSettings::BootloaderUrl).toString()
- + settings->value(RbSettings::CurBootloaderName).toString());
+ QUrl url(RbSettings::value(RbSettings::BootloaderUrl).toString()
+ + RbSettings::value(RbSettings::CurBootloaderName).toString());
bl->setBlUrl(url);
- bl->setLogfile(settings->value(RbSettings::Mountpoint).toString()
+ bl->setLogfile(RbSettings::value(RbSettings::Mountpoint).toString()
+ "/.rockbox/rbutil.log");
if(bl->installed() == BootloaderInstallBase::BootloaderRockbox) {
@@ -695,7 +693,7 @@ void RbUtilQt::installBootloader()
else if(bl->installed() == BootloaderInstallBase::BootloaderOther
&& bl->capabilities() & BootloaderInstallBase::Backup)
{
- QString targetFolder = settings->value(RbSettings::CurPlatformName).toString()
+ QString targetFolder = RbSettings::value(RbSettings::CurPlatformName).toString()
+ " Firmware Backup";
// remove invalid character(s)
targetFolder.remove(QRegExp("[:/]"));
@@ -790,7 +788,7 @@ void RbUtilQt::installBootloaderPost(bool error)
return;
QString msg = BootloaderInstallBase::postinstallHints(
- settings->value(RbSettings::Platform).toString());
+ RbSettings::value(RbSettings::Platform).toString());
if(!msg.isEmpty()) {
QMessageBox::information(this, tr("Manual steps required"), msg);
logger->close();
@@ -822,11 +820,11 @@ void RbUtilQt::installFonts()
// create zip installer
installer = new ZipInstaller(this);
- installer->setUrl(settings->value(RbSettings::FontUrl).toString());
+ installer->setUrl(RbSettings::value(RbSettings::FontUrl).toString());
installer->setLogSection("Fonts");
installer->setLogVersion(versmap.value("arch_date"));
- installer->setMountPoint(settings->value(RbSettings::Mountpoint).toString());
- if(!settings->value(RbSettings::CacheDisabled).toBool())
+ installer->setMountPoint(RbSettings::value(RbSettings::Mountpoint).toString());
+ if(!RbSettings::value(RbSettings::CacheDisabled).toBool())
installer->setCache(true);
connect(installer, SIGNAL(done(bool)), this, SLOT(installdone(bool)));
@@ -860,17 +858,17 @@ void RbUtilQt::installVoice()
// create zip installer
installer = new ZipInstaller(this);
- QString voiceurl = settings->value(RbSettings::VoiceUrl).toString();
+ QString voiceurl = RbSettings::value(RbSettings::VoiceUrl).toString();
- voiceurl += settings->value(RbSettings::CurConfigureModel).toString() + "-" +
+ voiceurl += RbSettings::value(RbSettings::CurConfigureModel).toString() + "-" +
versmap.value("arch_date") + "-english.zip";
qDebug() << voiceurl;
installer->setUrl(voiceurl);
installer->setLogSection("Voice");
installer->setLogVersion(versmap.value("arch_date"));
- installer->setMountPoint(settings->value(RbSettings::Mountpoint).toString());
- if(!settings->value(RbSettings::CacheDisabled).toBool())
+ installer->setMountPoint(RbSettings::value(RbSettings::Mountpoint).toString());
+ if(!RbSettings::value(RbSettings::CacheDisabled).toBool())
installer->setCache(true);
connect(installer, SIGNAL(logItem(QString, int)), logger, SLOT(addItem(QString, int)));
connect(installer, SIGNAL(logProgress(int, int)), logger, SLOT(setProgress(int, int)));
@@ -906,7 +904,7 @@ bool RbUtilQt::installDoomAuto()
bool RbUtilQt::hasDoom()
{
- QFile doomrock(settings->value(RbSettings::Mountpoint).toString()
+ QFile doomrock(RbSettings::value(RbSettings::Mountpoint).toString()
+"/.rockbox/rocks/games/doom.rock");
return doomrock.exists();
}
@@ -916,11 +914,11 @@ void RbUtilQt::installDoom()
// create zip installer
installer = new ZipInstaller(this);
- installer->setUrl(settings->value(RbSettings::DoomUrl).toString());
+ installer->setUrl(RbSettings::value(RbSettings::DoomUrl).toString());
installer->setLogSection("Game Addons");
installer->setLogVersion(versmap.value("arch_date"));
- installer->setMountPoint(settings->value(RbSettings::Mountpoint).toString());
- if(!settings->value(RbSettings::CacheDisabled).toBool())
+ installer->setMountPoint(RbSettings::value(RbSettings::Mountpoint).toString());
+ if(!RbSettings::value(RbSettings::CacheDisabled).toBool())
installer->setCache(true);
connect(installer, SIGNAL(done(bool)), this, SLOT(installdone(bool)));
connect(installer, SIGNAL(logItem(QString, int)), logger, SLOT(addItem(QString, int)));
@@ -935,7 +933,6 @@ void RbUtilQt::installThemes()
{
if(chkConfig(true)) return;
ThemesInstallWindow* tw = new ThemesInstallWindow(this);
- tw->setSettings(settings);
tw->setModal(true);
tw->show();
}
@@ -944,7 +941,6 @@ void RbUtilQt::createTalkFiles(void)
{
if(chkConfig(true)) return;
InstallTalkWindow *installWindow = new InstallTalkWindow(this);
- installWindow->setSettings(settings);
connect(installWindow, SIGNAL(settingsUpdated()), this, SLOT(downloadInfo()));
connect(installWindow, SIGNAL(settingsUpdated()), this, SLOT(updateSettings()));
@@ -956,8 +952,7 @@ void RbUtilQt::createVoiceFile(void)
{
if(chkConfig(true)) return;
CreateVoiceWindow *installWindow = new CreateVoiceWindow(this);
- installWindow->setSettings(settings);
-
+
connect(installWindow, SIGNAL(settingsUpdated()), this, SLOT(downloadInfo()));
connect(installWindow, SIGNAL(settingsUpdated()), this, SLOT(updateSettings()));
installWindow->show();
@@ -967,7 +962,6 @@ void RbUtilQt::uninstall(void)
{
if(chkConfig(true)) return;
UninstallWindow *uninstallWindow = new UninstallWindow(this);
- uninstallWindow->setSettings(settings);
uninstallWindow->show();
}
@@ -983,11 +977,11 @@ void RbUtilQt::uninstallBootloader(void)
logger->setProgressVisible(false);
logger->show();
- QString platform = settings->value(RbSettings::Platform).toString();
+ QString platform = RbSettings::value(RbSettings::Platform).toString();
// create installer
BootloaderInstallBase *bl;
- QString type = settings->value(RbSettings::CurBootloaderMethod).toString();
+ QString type = RbSettings::value(RbSettings::CurBootloaderMethod).toString();
if(type == "mi4") {
bl = new BootloaderInstallMi4();
}
@@ -1009,13 +1003,13 @@ void RbUtilQt::uninstallBootloader(void)
return;
}
- QString blfile = settings->value(RbSettings::Mountpoint).toString()
- + settings->value(RbSettings::CurBootloaderFile).toString();
- if(settings->value(RbSettings::Platform).toString() == "h10_ums"
- || settings->value(RbSettings::Platform).toString() == "h10_mtp") {
+ QString blfile = RbSettings::value(RbSettings::Mountpoint).toString()
+ + RbSettings::value(RbSettings::CurBootloaderFile).toString();
+ if(RbSettings::value(RbSettings::Platform).toString() == "h10_ums"
+ || RbSettings::value(RbSettings::Platform).toString() == "h10_mtp") {
if(resolvePathCase(blfile).isEmpty())
- blfile = settings->value(RbSettings::Mountpoint).toString()
- + settings->value(RbSettings::CurBootloaderName).toString()
+ blfile = RbSettings::value(RbSettings::Mountpoint).toString()
+ + RbSettings::value(RbSettings::CurBootloaderName).toString()
.replace("H10", "H10EMP", Qt::CaseInsensitive);
}
bl->setBlFile(blfile);
@@ -1044,7 +1038,7 @@ void RbUtilQt::downloadManual(void)
QSettings info(buildInfo.fileName(), QSettings::IniFormat, this);
buildInfo.close();
- QString manual = settings->value(RbSettings::CurManual).toString();
+ QString manual = RbSettings::value(RbSettings::CurManual).toString();
QString date = (info.value("dailies/date").toString());
@@ -1059,14 +1053,14 @@ void RbUtilQt::downloadManual(void)
target = "/" + manual + "-" + date + "-html.zip";
section = "Manual (HTML)";
}
- manualurl = settings->value(RbSettings::ManualUrl).toString() + "/" + target;
+ manualurl = RbSettings::value(RbSettings::ManualUrl).toString() + "/" + target;
qDebug() << "manualurl =" << manualurl;
ProgressLoggerGui* logger = new ProgressLoggerGui(this);
logger->show();
installer = new ZipInstaller(this);
- installer->setMountPoint(settings->value(RbSettings::Mountpoint).toString());
- if(!settings->value(RbSettings::CacheDisabled).toBool())
+ installer->setMountPoint(RbSettings::value(RbSettings::Mountpoint).toString());
+ if(!RbSettings::value(RbSettings::CacheDisabled).toBool())
installer->setCache(true);
installer->setLogSection(section);
installer->setLogVersion(date);
@@ -1096,28 +1090,28 @@ void RbUtilQt::installPortable(void)
logger->addItem(tr("Installing Rockbox Utility"), LOGINFO);
// check mountpoint
- if(!QFileInfo(settings->value(RbSettings::Mountpoint).toString()).isDir()) {
+ if(!QFileInfo(RbSettings::value(RbSettings::Mountpoint).toString()).isDir()) {
logger->addItem(tr("Mount point is wrong!"),LOGERROR);
logger->setFinished();
return;
}
// remove old files first.
- QFile::remove(settings->value(RbSettings::Mountpoint).toString()
+ QFile::remove(RbSettings::value(RbSettings::Mountpoint).toString()
+ "/RockboxUtility.exe");
- QFile::remove(settings->value(RbSettings::Mountpoint).toString()
+ QFile::remove(RbSettings::value(RbSettings::Mountpoint).toString()
+ "/RockboxUtility.ini");
// copy currently running binary and currently used settings file
if(!QFile::copy(qApp->applicationFilePath(),
- settings->value(RbSettings::Mountpoint).toString()
+ RbSettings::value(RbSettings::Mountpoint).toString()
+ "/RockboxUtility.exe")) {
logger->addItem(tr("Error installing Rockbox Utility"), LOGERROR);
logger->setFinished();
return;
}
logger->addItem(tr("Installing user configuration"), LOGINFO);
- if(!QFile::copy(settings->userSettingFilename(),
- settings->value(RbSettings::Mountpoint).toString()
+ if(!QFile::copy(RbSettings::userSettingFilename(),
+ RbSettings::value(RbSettings::Mountpoint).toString()
+ "/RockboxUtility.ini")) {
logger->addItem(tr("Error installing user configuration"), LOGERROR);
logger->setFinished();
@@ -1135,7 +1129,7 @@ void RbUtilQt::updateInfo()
{
qDebug() << "RbUtilQt::updateInfo()";
- QSettings log(settings->value(RbSettings::Mountpoint).toString()
+ QSettings log(RbSettings::value(RbSettings::Mountpoint).toString()
+ "/.rockbox/rbutil.log", QSettings::IniFormat, this);
QStringList groups = log.childGroups();
QList<QTreeWidgetItem *> items;
@@ -1172,7 +1166,7 @@ void RbUtilQt::updateInfo()
for(int b = 0; b < keys.size(); b++) {
QString file;
- file = settings->value(RbSettings::Mountpoint).toString() + "/" + keys.at(b);
+ file = RbSettings::value(RbSettings::Mountpoint).toString() + "/" + keys.at(b);
if(QFileInfo(file).isDir())
continue;
w2 = new QTreeWidgetItem(w, QStringList() << "/"
@@ -1197,9 +1191,9 @@ void RbUtilQt::updateInfo()
QUrl RbUtilQt::proxy()
{
- if(settings->value(RbSettings::ProxyType) == "manual")
- return QUrl(settings->value(RbSettings::Proxy).toString());
- else if(settings->value(RbSettings::ProxyType) == "system")
+ if(RbSettings::value(RbSettings::ProxyType) == "manual")
+ return QUrl(RbSettings::value(RbSettings::Proxy).toString());
+ else if(RbSettings::value(RbSettings::ProxyType) == "system")
return Detect::systemProxy();
return QUrl("");
}
@@ -1208,9 +1202,9 @@ QUrl RbUtilQt::proxy()
bool RbUtilQt::chkConfig(bool warn)
{
bool error = false;
- if(settings->value(RbSettings::Platform).toString().isEmpty()
- || settings->value(RbSettings::Mountpoint).toString().isEmpty()
- || !QFileInfo(settings->value(RbSettings::Mountpoint).toString()).isWritable()) {
+ if(RbSettings::value(RbSettings::Platform).toString().isEmpty()
+ || RbSettings::value(RbSettings::Mountpoint).toString().isEmpty()
+ || !QFileInfo(RbSettings::value(RbSettings::Mountpoint).toString()).isWritable()) {
error = true;
if(warn) QMessageBox::critical(this, tr("Configuration error"),
diff --git a/rbutil/rbutilqt/rbutilqt.h b/rbutil/rbutilqt/rbutilqt.h
index 7b9bf8018c..10bef6e8b8 100644
--- a/rbutil/rbutilqt/rbutilqt.h
+++ b/rbutil/rbutilqt/rbutilqt.h
@@ -32,8 +32,6 @@
#include "progressloggergui.h"
#include "bootloaderinstallbase.h"
-#include "rbsettings.h"
-
class RbUtilQt : public QMainWindow
{
Q_OBJECT
@@ -43,8 +41,7 @@ class RbUtilQt : public QMainWindow
private:
Ui::RbUtilQtFrm ui;
- RbSettings* settings;
-
+
void initDeviceNames(void);
QString deviceName(QString);
QString platform;
diff --git a/rbutil/rbutilqt/talkfile.cpp b/rbutil/rbutilqt/talkfile.cpp
index d41cb4f440..815c2824fb 100644
--- a/rbutil/rbutilqt/talkfile.cpp
+++ b/rbutil/rbutilqt/talkfile.cpp
@@ -18,6 +18,7 @@
****************************************************************************/
#include "talkfile.h"
+#include "rbsettings.h"
TalkFileCreator::TalkFileCreator(QObject* parent): QObject(parent)
{
@@ -40,8 +41,7 @@ bool TalkFileCreator::createTalkFiles(ProgressloggerInterface* logger)
m_logger->addItem(tr("Starting Talk file generation"),LOGINFO);
//tts
- m_tts = TTSBase::getTTS(this,settings->value(RbSettings::Tts).toString());
- m_tts->setCfg(settings);
+ m_tts = TTSBase::getTTS(this,RbSettings::value(RbSettings::Tts).toString());
if(!m_tts->start(&errStr))
{
@@ -52,8 +52,7 @@ bool TalkFileCreator::createTalkFiles(ProgressloggerInterface* logger)
}
// Encoder
- m_enc = EncBase::getEncoder(this,settings->value(RbSettings::CurEncoder).toString());
- m_enc->setCfg(settings);
+ m_enc = EncBase::getEncoder(this,RbSettings::value(RbSettings::CurEncoder).toString());
if(!m_enc->start())
{
diff --git a/rbutil/rbutilqt/talkfile.h b/rbutil/rbutilqt/talkfile.h
index ae69acfd78..a6b9bb5490 100644
--- a/rbutil/rbutilqt/talkfile.h
+++ b/rbutil/rbutilqt/talkfile.h
@@ -37,8 +37,6 @@ public:
TalkFileCreator(QObject* parent);
bool createTalkFiles(ProgressloggerInterface* logger);
-
- void setSettings(RbSettings* sett) { settings = sett;}
void setDir(QDir dir){m_dir = dir; }
void setMountPoint(QString mountpoint) {m_mountpoint =mountpoint; }
@@ -65,7 +63,6 @@ private:
TTSBase* m_tts;
EncBase* m_enc;
- RbSettings* settings;
QDir m_dir;
QString m_mountpoint;
diff --git a/rbutil/rbutilqt/themesinstallwindow.cpp b/rbutil/rbutilqt/themesinstallwindow.cpp
index a112e6d748..8b525546b3 100644
--- a/rbutil/rbutilqt/themesinstallwindow.cpp
+++ b/rbutil/rbutilqt/themesinstallwindow.cpp
@@ -24,6 +24,7 @@
#include "zipinstaller.h"
#include "progressloggergui.h"
#include "utils.h"
+#include "rbsettings.h"
ThemesInstallWindow::ThemesInstallWindow(QWidget *parent) : QDialog(parent)
{
@@ -61,11 +62,11 @@ void ThemesInstallWindow::downloadInfo()
themesInfo.close();
QUrl url;
- url = QUrl(settings->value(RbSettings::ThemesUrl).toString() + "/rbutilqt.php?target="
- + settings->value(RbSettings::CurConfigureModel).toString());
+ url = QUrl(RbSettings::value(RbSettings::ThemesUrl).toString() + "/rbutilqt.php?target="
+ + RbSettings::value(RbSettings::CurConfigureModel).toString());
qDebug() << "downloadInfo()" << url;
qDebug() << url.queryItems();
- if(settings->value(RbSettings::CacheOffline).toBool())
+ if(RbSettings::value(RbSettings::CacheOffline).toBool())
getter->setCache(true);
getter->setFile(&themesInfo);
@@ -144,7 +145,7 @@ void ThemesInstallWindow::downloadDone(bool error)
// check if there's a themes "MOTD" available
if(iniDetails.contains("status/msg")) {
// check if there's a localized msg available
- QString lang = settings->value(RbSettings::Language).toString().split("_").at(0);
+ QString lang = RbSettings::value(RbSettings::Language).toString().split("_").at(0);
QString msg;
if(iniDetails.contains("status/msg." + lang))
msg = iniDetails.value("status/msg." + lang).toString();
@@ -191,9 +192,9 @@ void ThemesInstallWindow::updateDetails(QListWidgetItem* cur, QListWidgetItem* p
iniDetails.beginGroup(cur->data(Qt::UserRole).toString());
QUrl img, txt;
- txt = QUrl(QString(settings->value(RbSettings::ThemesUrl).toString() + "/"
+ txt = QUrl(QString(RbSettings::value(RbSettings::ThemesUrl).toString() + "/"
+ iniDetails.value("descriptionfile").toString()));
- img = QUrl(QString(settings->value(RbSettings::ThemesUrl).toString() + "/"
+ img = QUrl(QString(RbSettings::value(RbSettings::ThemesUrl).toString() + "/"
+ iniDetails.value("image").toString()));
QString text;
@@ -211,7 +212,7 @@ void ThemesInstallWindow::updateDetails(QListWidgetItem* cur, QListWidgetItem* p
iniDetails.endGroup();
igetter.abort();
- if(!settings->value(RbSettings::CacheDisabled).toBool())
+ if(!RbSettings::value(RbSettings::CacheDisabled).toBool())
igetter.setCache(true);
else
{
@@ -307,7 +308,7 @@ void ThemesInstallWindow::accept()
QSettings iniDetails(themesInfo.fileName(), QSettings::IniFormat, this);
for(int i = 0; i < ui.listThemes->selectedItems().size(); i++) {
iniDetails.beginGroup(ui.listThemes->selectedItems().at(i)->data(Qt::UserRole).toString());
- zip = settings->value(RbSettings::ThemesUrl).toString()
+ zip = RbSettings::value(RbSettings::ThemesUrl).toString()
+ "/" + iniDetails.value("archive").toString();
themes.append(zip);
names.append("Theme: " +
@@ -321,7 +322,7 @@ void ThemesInstallWindow::accept()
logger = new ProgressLoggerGui(this);
logger->show();
- QString mountPoint = settings->value(RbSettings::Mountpoint).toString();
+ QString mountPoint = RbSettings::value(RbSettings::Mountpoint).toString();
qDebug() << "mountpoint:" << mountPoint;
// show dialog with error if mount point is wrong
if(!QFileInfo(mountPoint).isDir()) {
@@ -335,7 +336,7 @@ void ThemesInstallWindow::accept()
installer->setLogSection(names);
installer->setLogVersion(version);
installer->setMountPoint(mountPoint);
- if(!settings->value(RbSettings::CacheDisabled).toBool())
+ if(!RbSettings::value(RbSettings::CacheDisabled).toBool())
installer->setCache(true);
connect(logger, SIGNAL(closed()), this, SLOT(close()));
diff --git a/rbutil/rbutilqt/themesinstallwindow.h b/rbutil/rbutilqt/themesinstallwindow.h
index e337e8c998..949ffce4d5 100644
--- a/rbutil/rbutilqt/themesinstallwindow.h
+++ b/rbutil/rbutilqt/themesinstallwindow.h
@@ -29,7 +29,6 @@
#include "httpget.h"
#include "zipinstaller.h"
#include "progressloggergui.h"
-#include "rbsettings.h"
class ThemesInstallWindow : public QDialog
{
@@ -38,7 +37,6 @@ class ThemesInstallWindow : public QDialog
public:
ThemesInstallWindow(QWidget* parent = 0);
~ThemesInstallWindow();
- void setSettings(RbSettings* sett){settings=sett;}
void downloadInfo(void);
void show(void);
@@ -47,7 +45,6 @@ class ThemesInstallWindow : public QDialog
private:
Ui::ThemeInstallFrm ui;
- RbSettings* settings;
HttpGet *getter;
HttpGet igetter;
QTemporaryFile themesInfo;
diff --git a/rbutil/rbutilqt/uninstallwindow.cpp b/rbutil/rbutilqt/uninstallwindow.cpp
index 7d70f46170..4abfe93b1e 100644
--- a/rbutil/rbutilqt/uninstallwindow.cpp
+++ b/rbutil/rbutilqt/uninstallwindow.cpp
@@ -19,7 +19,7 @@
#include "uninstallwindow.h"
#include "ui_uninstallfrm.h"
-
+#include "rbsettings.h"
UninstallWindow::UninstallWindow(QWidget *parent) : QDialog(parent)
{
@@ -27,6 +27,24 @@ UninstallWindow::UninstallWindow(QWidget *parent) : QDialog(parent)
ui.UninstalllistWidget->setAlternatingRowColors(true);
connect(ui.UninstalllistWidget,SIGNAL(itemSelectionChanged()),this,SLOT(selectionChanged()));
connect(ui.CompleteRadioBtn,SIGNAL(toggled(bool)),this,SLOT(UninstallMethodChanged(bool)));
+
+ QString mountpoint = RbSettings::value(RbSettings::Mountpoint).toString();
+
+ uninstaller = new Uninstaller(this,mountpoint);
+
+ // disable smart uninstall, if not possible
+ if(!uninstaller->uninstallPossible())
+ {
+ ui.smartRadioButton->setEnabled(false);
+ ui.smartGroupBox->setEnabled(false);
+ ui.CompleteRadioBtn->setChecked(true);
+ }
+ else // fill in installed parts
+ {
+ ui.smartRadioButton->setChecked(true);
+ ui.UninstalllistWidget->addItems(uninstaller->getAllSections());
+ }
+
}
@@ -68,24 +86,3 @@ void UninstallWindow::UninstallMethodChanged(bool complete)
ui.smartGroupBox->setEnabled(true);
}
-
-void UninstallWindow::setSettings(RbSettings *sett)
-{
- settings = sett;
-
- QString mountpoint = settings->value(RbSettings::Mountpoint).toString();
- uninstaller = new Uninstaller(this,mountpoint);
-
- // disable smart uninstall, if not possible
- if(!uninstaller->uninstallPossible())
- {
- ui.smartRadioButton->setEnabled(false);
- ui.smartGroupBox->setEnabled(false);
- ui.CompleteRadioBtn->setChecked(true);
- }
- else // fill in installed parts
- {
- ui.smartRadioButton->setChecked(true);
- ui.UninstalllistWidget->addItems(uninstaller->getAllSections());
- }
-}
diff --git a/rbutil/rbutilqt/uninstallwindow.h b/rbutil/rbutilqt/uninstallwindow.h
index 8bb7fce48c..7ac20b4d1e 100644
--- a/rbutil/rbutilqt/uninstallwindow.h
+++ b/rbutil/rbutilqt/uninstallwindow.h
@@ -27,14 +27,12 @@
#include "ui_uninstallfrm.h"
#include "progressloggergui.h"
#include "uninstall.h"
-#include "rbsettings.h"
class UninstallWindow : public QDialog
{
Q_OBJECT
public:
UninstallWindow(QWidget *parent = 0);
- void setSettings(RbSettings* sett);
public slots:
void accept(void);
@@ -46,8 +44,6 @@ class UninstallWindow : public QDialog
Uninstaller* uninstaller;
Ui::UninstallFrm ui;
ProgressLoggerGui* logger;
- RbSettings* settings;
-
};
diff --git a/rbutil/rbutilqt/voicefile.cpp b/rbutil/rbutilqt/voicefile.cpp
index dd547773b8..4de9b87f34 100644
--- a/rbutil/rbutilqt/voicefile.cpp
+++ b/rbutil/rbutilqt/voicefile.cpp
@@ -19,6 +19,7 @@
#include "voicefile.h"
#include "utils.h"
+#include "rbsettings.h"
#define STATE_INVALID 0
#define STATE_PHRASE 1
@@ -65,7 +66,7 @@ bool VoiceFileCreator::createVoiceFile(ProgressloggerInterface* logger)
version = version.left(version.indexOf("-")).remove(0,1);
//prepare download url
- QUrl genlangUrl = settings->value(RbSettings::GenlangUrl).toString()
+ QUrl genlangUrl = RbSettings::value(RbSettings::GenlangUrl).toString()
+"?lang=" + m_lang + "&t=" + target + "&rev=" + version + "&f=" + features;
qDebug() << "downloading " << genlangUrl;
@@ -128,8 +129,7 @@ void VoiceFileCreator::downloadDone(bool error)
}
//tts
- m_tts = TTSBase::getTTS(this,settings->value(RbSettings::Tts).toString());
- m_tts->setCfg(settings);
+ m_tts = TTSBase::getTTS(this,RbSettings::value(RbSettings::Tts).toString());
QString errStr;
if(!m_tts->start(&errStr))
@@ -142,8 +142,7 @@ void VoiceFileCreator::downloadDone(bool error)
}
// Encoder
- m_enc = EncBase::getEncoder(this,settings->value(RbSettings::CurEncoder).toString());
- m_enc->setCfg(settings);
+ m_enc = EncBase::getEncoder(this,RbSettings::value(RbSettings::CurEncoder).toString());
if(!m_enc->start())
{
diff --git a/rbutil/rbutilqt/voicefile.h b/rbutil/rbutilqt/voicefile.h
index 1a5d267b1f..0bc4df8312 100644
--- a/rbutil/rbutilqt/voicefile.h
+++ b/rbutil/rbutilqt/voicefile.h
@@ -29,7 +29,6 @@
#include "encoders.h"
#include "tts.h"
#include "httpget.h"
-#include "rbsettings.h"
#include "wavtrim.h"
#include "voicefont.h"
@@ -43,9 +42,6 @@ public:
//start creation
bool createVoiceFile(ProgressloggerInterface* logger);
- // set infos
- void setSettings(RbSettings* sett) { settings = sett;}
-
void setMountPoint(QString mountpoint) {m_mountpoint =mountpoint; }
void setTargetId(int id){m_targetid = id;}
void setLang(QString name){m_lang =name;}
@@ -64,7 +60,6 @@ private:
// ptr to encoder, tts and settings
TTSBase* m_tts;
EncBase* m_enc;
- RbSettings* settings;
HttpGet *getter;
QString filename; //the temporary file