diff options
author | Dominik Wenger <domonoky@googlemail.com> | 2009-05-09 16:59:14 +0000 |
---|---|---|
committer | Dominik Wenger <domonoky@googlemail.com> | 2009-05-09 16:59:14 +0000 |
commit | 33d9cf091a62cb217987092d03bf110c35444845 (patch) | |
tree | 4ee6be3018e0b71c38d4857f86ad17a08668afdd | |
parent | 8e63df19cbeee2de9470049feae8ae0f9c5a339e (diff) | |
download | rockbox-33d9cf091a62cb217987092d03bf110c35444845.tar.gz 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
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 @@ | |||
19 | 19 | ||
20 | #include <QtCore> | 20 | #include <QtCore> |
21 | #include "autodetection.h" | 21 | #include "autodetection.h" |
22 | #include "rbsettings.h" | ||
22 | 23 | ||
23 | #include "../ipodpatcher/ipodpatcher.h" | 24 | #include "../ipodpatcher/ipodpatcher.h" |
24 | #include "../sansapatcher/sansapatcher.h" | 25 | #include "../sansapatcher/sansapatcher.h" |
@@ -396,9 +397,9 @@ bool Autodetection::detectUsb() | |||
396 | // usbids holds the mapping in the form | 397 | // usbids holds the mapping in the form |
397 | // ((VID<<16)|(PID)), targetname | 398 | // ((VID<<16)|(PID)), targetname |
398 | // the ini file needs to hold the IDs as hex values. | 399 | // the ini file needs to hold the IDs as hex values. |
399 | QMap<int, QString> usbids = settings->usbIdMap(RbSettings::MapDevice); | 400 | QMap<int, QString> usbids = RbSettings::usbIdMap(RbSettings::MapDevice); |
400 | QMap<int, QString> usberror = settings->usbIdMap(RbSettings::MapError); | 401 | QMap<int, QString> usberror = RbSettings::usbIdMap(RbSettings::MapError); |
401 | QMap<int, QString> usbincompat = settings->usbIdMap(RbSettings::MapIncompatible); | 402 | QMap<int, QString> usbincompat = RbSettings::usbIdMap(RbSettings::MapIncompatible); |
402 | 403 | ||
403 | // usb pid detection | 404 | // usb pid detection |
404 | QList<uint32_t> attached; | 405 | 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 @@ | |||
24 | #define AUTODETECTION_H_ | 24 | #define AUTODETECTION_H_ |
25 | 25 | ||
26 | #include <QtCore> | 26 | #include <QtCore> |
27 | #include "rbsettings.h" | ||
28 | 27 | ||
29 | class Autodetection :public QObject | 28 | class Autodetection :public QObject |
30 | { | 29 | { |
@@ -33,8 +32,6 @@ class Autodetection :public QObject | |||
33 | public: | 32 | public: |
34 | Autodetection(QObject* parent=0); | 33 | Autodetection(QObject* parent=0); |
35 | 34 | ||
36 | void setSettings(RbSettings* sett) {settings = sett;} | ||
37 | |||
38 | bool detect(); | 35 | bool detect(); |
39 | 36 | ||
40 | QString getDevice() {return m_device;} | 37 | QString getDevice() {return m_device;} |
@@ -54,7 +51,6 @@ private: | |||
54 | QString m_errdev; | 51 | QString m_errdev; |
55 | QString m_incompat; | 52 | QString m_incompat; |
56 | QList<int> m_usbconid; | 53 | QList<int> m_usbconid; |
57 | RbSettings* settings; | ||
58 | }; | 54 | }; |
59 | 55 | ||
60 | 56 | ||
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 @@ | |||
59 | #endif | 59 | #endif |
60 | 60 | ||
61 | #include "utils.h" | 61 | #include "utils.h" |
62 | #include "rbsettings.h" | ||
62 | 63 | ||
63 | /** @brief detect permission of user (only Windows at moment). | 64 | /** @brief detect permission of user (only Windows at moment). |
64 | * @return enum userlevel. | 65 | * @return enum userlevel. |
@@ -384,7 +385,7 @@ QString Detect::installedTarget(QString mountpoint) | |||
384 | * @param targetId the targetID to check for. if it is -1 no check is done. | 385 | * @param targetId the targetID to check for. if it is -1 no check is done. |
385 | * @return string with error messages if problems occurred, empty strings if none. | 386 | * @return string with error messages if problems occurred, empty strings if none. |
386 | */ | 387 | */ |
387 | QString Detect::check(RbSettings* settings, bool permission) | 388 | QString Detect::check(bool permission) |
388 | { | 389 | { |
389 | QString text = ""; | 390 | QString text = ""; |
390 | 391 | ||
@@ -401,12 +402,12 @@ QString Detect::check(RbSettings* settings, bool permission) | |||
401 | } | 402 | } |
402 | 403 | ||
403 | // Check TargetId | 404 | // Check TargetId |
404 | QString installed = installedTarget(settings->value(RbSettings::Mountpoint).toString()); | 405 | QString installed = installedTarget(RbSettings::value(RbSettings::Mountpoint).toString()); |
405 | if(!installed.isEmpty() && installed != settings->value(RbSettings::CurConfigureModel).toString()) | 406 | if(!installed.isEmpty() && installed != RbSettings::value(RbSettings::CurConfigureModel).toString()) |
406 | { | 407 | { |
407 | text += QObject::tr("<li>Target mismatch detected.\n" | 408 | text += QObject::tr("<li>Target mismatch detected.\n" |
408 | "Installed target: %1, selected target: %2.</li>") | 409 | "Installed target: %1, selected target: %2.</li>") |
409 | .arg(installed, settings->value(RbSettings::CurPlatformName).toString()); | 410 | .arg(installed, RbSettings::value(RbSettings::CurPlatformName).toString()); |
410 | // FIXME: replace installed by human-friendly name | 411 | // FIXME: replace installed by human-friendly name |
411 | } | 412 | } |
412 | 413 | ||
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 @@ | |||
27 | 27 | ||
28 | #include <QString> | 28 | #include <QString> |
29 | #include <QUrl> | 29 | #include <QUrl> |
30 | #include "rbsettings.h" | ||
31 | 30 | ||
32 | class Detect | 31 | class Detect |
33 | { | 32 | { |
@@ -49,7 +48,7 @@ public: | |||
49 | static QString installedVersion(QString mountpoint); | 48 | static QString installedVersion(QString mountpoint); |
50 | static QString installedTarget(QString mountpoint); | 49 | static QString installedTarget(QString mountpoint); |
51 | 50 | ||
52 | static QString check(RbSettings* settings, bool permission); | 51 | static QString check(bool permission); |
53 | 52 | ||
54 | }; | 53 | }; |
55 | #endif | 54 | #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 @@ | |||
19 | 19 | ||
20 | #include "encoders.h" | 20 | #include "encoders.h" |
21 | #include "utils.h" | 21 | #include "utils.h" |
22 | #include "rbsettings.h" | ||
22 | 23 | ||
23 | /********************************************************************* | 24 | /********************************************************************* |
24 | * Encoder Base | 25 | * Encoder Base |
@@ -87,24 +88,24 @@ EncExes::EncExes(QString name,QObject *parent) : EncBase(parent) | |||
87 | 88 | ||
88 | void EncExes::generateSettings() | 89 | void EncExes::generateSettings() |
89 | { | 90 | { |
90 | QString exepath =settings->subValue(m_name,RbSettings::EncoderPath).toString(); | 91 | QString exepath =RbSettings::subValue(m_name,RbSettings::EncoderPath).toString(); |
91 | if(exepath == "") exepath = findExecutable(m_name); | 92 | if(exepath == "") exepath = findExecutable(m_name); |
92 | 93 | ||
93 | insertSetting(eEXEPATH,new EncTtsSetting(this,EncTtsSetting::eSTRING,"Path to Encoder:",exepath,EncTtsSetting::eBROWSEBTN)); | 94 | insertSetting(eEXEPATH,new EncTtsSetting(this,EncTtsSetting::eSTRING,"Path to Encoder:",exepath,EncTtsSetting::eBROWSEBTN)); |
94 | insertSetting(eEXEOPTIONS,new EncTtsSetting(this,EncTtsSetting::eSTRING,"Encoder options:",settings->subValue(m_name,RbSettings::EncoderOptions))); | 95 | insertSetting(eEXEOPTIONS,new EncTtsSetting(this,EncTtsSetting::eSTRING,"Encoder options:",RbSettings::subValue(m_name,RbSettings::EncoderOptions))); |
95 | } | 96 | } |
96 | 97 | ||
97 | void EncExes::saveSettings() | 98 | void EncExes::saveSettings() |
98 | { | 99 | { |
99 | settings->setSubValue(m_name,RbSettings::EncoderPath,getSetting(eEXEPATH)->current().toString()); | 100 | RbSettings::setSubValue(m_name,RbSettings::EncoderPath,getSetting(eEXEPATH)->current().toString()); |
100 | settings->setSubValue(m_name,RbSettings::EncoderOptions,getSetting(eEXEOPTIONS)->current().toString()); | 101 | RbSettings::setSubValue(m_name,RbSettings::EncoderOptions,getSetting(eEXEOPTIONS)->current().toString()); |
101 | settings->sync(); | 102 | RbSettings::sync(); |
102 | } | 103 | } |
103 | 104 | ||
104 | bool EncExes::start() | 105 | bool EncExes::start() |
105 | { | 106 | { |
106 | m_EncExec = settings->subValue(m_name, RbSettings::EncoderPath).toString(); | 107 | m_EncExec = RbSettings::subValue(m_name, RbSettings::EncoderPath).toString(); |
107 | m_EncOpts = settings->subValue(m_name, RbSettings::EncoderOptions).toString(); | 108 | m_EncOpts = RbSettings::subValue(m_name, RbSettings::EncoderOptions).toString(); |
108 | 109 | ||
109 | m_EncTemplate = m_TemplateMap.value(m_name); | 110 | m_EncTemplate = m_TemplateMap.value(m_name); |
110 | 111 | ||
@@ -136,7 +137,7 @@ bool EncExes::encode(QString input,QString output) | |||
136 | 137 | ||
137 | bool EncExes::configOk() | 138 | bool EncExes::configOk() |
138 | { | 139 | { |
139 | QString path = settings->subValue(m_name, RbSettings::EncoderPath).toString(); | 140 | QString path = RbSettings::subValue(m_name, RbSettings::EncoderPath).toString(); |
140 | 141 | ||
141 | if (QFileInfo(path).exists()) | 142 | if (QFileInfo(path).exists()) |
142 | return true; | 143 | return true; |
@@ -154,31 +155,31 @@ EncRbSpeex::EncRbSpeex(QObject *parent) : EncBase(parent) | |||
154 | 155 | ||
155 | void EncRbSpeex::generateSettings() | 156 | void EncRbSpeex::generateSettings() |
156 | { | 157 | { |
157 | insertSetting(eVOLUME,new EncTtsSetting(this,EncTtsSetting::eDOUBLE,"Volume:",settings->subValue("rbspeex",RbSettings::EncoderVolume),1.0,10.0)); | 158 | insertSetting(eVOLUME,new EncTtsSetting(this,EncTtsSetting::eDOUBLE,"Volume:",RbSettings::subValue("rbspeex",RbSettings::EncoderVolume),1.0,10.0)); |
158 | insertSetting(eQUALITY,new EncTtsSetting(this,EncTtsSetting::eDOUBLE,"Quality:",settings->subValue("rbspeex",RbSettings::EncoderQuality),0,10.0)); | 159 | insertSetting(eQUALITY,new EncTtsSetting(this,EncTtsSetting::eDOUBLE,"Quality:",RbSettings::subValue("rbspeex",RbSettings::EncoderQuality),0,10.0)); |
159 | insertSetting(eCOMPLEXITY,new EncTtsSetting(this,EncTtsSetting::eINT,"Complexity:",settings->subValue("rbspeex",RbSettings::EncoderComplexity),0,10)); | 160 | insertSetting(eCOMPLEXITY,new EncTtsSetting(this,EncTtsSetting::eINT,"Complexity:",RbSettings::subValue("rbspeex",RbSettings::EncoderComplexity),0,10)); |
160 | insertSetting(eNARROWBAND,new EncTtsSetting(this,EncTtsSetting::eBOOL,"Use Narrowband:",settings->subValue("rbspeex",RbSettings::EncoderNarrowBand))); | 161 | insertSetting(eNARROWBAND,new EncTtsSetting(this,EncTtsSetting::eBOOL,"Use Narrowband:",RbSettings::subValue("rbspeex",RbSettings::EncoderNarrowBand))); |
161 | } | 162 | } |
162 | 163 | ||
163 | void EncRbSpeex::saveSettings() | 164 | void EncRbSpeex::saveSettings() |
164 | { | 165 | { |
165 | //save settings in user config | 166 | //save settings in user config |
166 | settings->setSubValue("rbspeex",RbSettings::EncoderVolume,getSetting(eVOLUME)->current().toDouble()); | 167 | RbSettings::setSubValue("rbspeex",RbSettings::EncoderVolume,getSetting(eVOLUME)->current().toDouble()); |
167 | settings->setSubValue("rbspeex",RbSettings::EncoderQuality,getSetting(eQUALITY)->current().toDouble()); | 168 | RbSettings::setSubValue("rbspeex",RbSettings::EncoderQuality,getSetting(eQUALITY)->current().toDouble()); |
168 | settings->setSubValue("rbspeex",RbSettings::EncoderComplexity,getSetting(eCOMPLEXITY)->current().toInt()); | 169 | RbSettings::setSubValue("rbspeex",RbSettings::EncoderComplexity,getSetting(eCOMPLEXITY)->current().toInt()); |
169 | settings->setSubValue("rbspeex",RbSettings::EncoderNarrowBand,getSetting(eNARROWBAND)->current().toBool()); | 170 | RbSettings::setSubValue("rbspeex",RbSettings::EncoderNarrowBand,getSetting(eNARROWBAND)->current().toBool()); |
170 | 171 | ||
171 | settings->sync(); | 172 | RbSettings::sync(); |
172 | } | 173 | } |
173 | 174 | ||
174 | bool EncRbSpeex::start() | 175 | bool EncRbSpeex::start() |
175 | { | 176 | { |
176 | 177 | ||
177 | // try to get config from settings | 178 | // try to get config from settings |
178 | quality = settings->subValue("rbspeex", RbSettings::EncoderQuality).toDouble(); | 179 | quality = RbSettings::subValue("rbspeex", RbSettings::EncoderQuality).toDouble(); |
179 | complexity = settings->subValue("rbspeex", RbSettings::EncoderComplexity).toInt(); | 180 | complexity = RbSettings::subValue("rbspeex", RbSettings::EncoderComplexity).toInt(); |
180 | volume = settings->subValue("rbspeex", RbSettings::EncoderVolume).toDouble(); | 181 | volume = RbSettings::subValue("rbspeex", RbSettings::EncoderVolume).toDouble(); |
181 | narrowband = settings->subValue("rbspeex", RbSettings::EncoderNarrowBand).toBool(); | 182 | narrowband = RbSettings::subValue("rbspeex", RbSettings::EncoderNarrowBand).toBool(); |
182 | 183 | ||
183 | 184 | ||
184 | return true; | 185 | return true; |
@@ -219,13 +220,13 @@ bool EncRbSpeex::configOk() | |||
219 | bool result=true; | 220 | bool result=true; |
220 | // check config | 221 | // check config |
221 | 222 | ||
222 | if(settings->subValue("rbspeex", RbSettings::EncoderVolume).toDouble() <= 0) | 223 | if(RbSettings::subValue("rbspeex", RbSettings::EncoderVolume).toDouble() <= 0) |
223 | result =false; | 224 | result =false; |
224 | 225 | ||
225 | if(settings->subValue("rbspeex", RbSettings::EncoderQuality).toDouble() <= 0) | 226 | if(RbSettings::subValue("rbspeex", RbSettings::EncoderQuality).toDouble() <= 0) |
226 | result =false; | 227 | result =false; |
227 | 228 | ||
228 | if(settings->subValue("rbspeex", RbSettings::EncoderComplexity).toInt() <= 0) | 229 | if(RbSettings::subValue("rbspeex", RbSettings::EncoderComplexity).toInt() <= 0) |
229 | result =false; | 230 | result =false; |
230 | 231 | ||
231 | return result; | 232 | 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 @@ | |||
24 | 24 | ||
25 | #include <QtCore> | 25 | #include <QtCore> |
26 | 26 | ||
27 | #include "rbsettings.h" | ||
28 | #include "encttssettings.h" | 27 | #include "encttssettings.h" |
29 | #include "rbspeex.h" | 28 | #include "rbspeex.h" |
30 | 29 | ||
@@ -54,15 +53,11 @@ class EncBase : public EncTtsSettingInterface | |||
54 | static QString getEncoderName(QString name); | 53 | static QString getEncoderName(QString name); |
55 | static EncBase* getEncoder(QObject* parent,QString name); | 54 | static EncBase* getEncoder(QObject* parent,QString name); |
56 | static QStringList getEncoderList(void); | 55 | static QStringList getEncoderList(void); |
57 | 56 | ||
58 | //set the config. users of Encoder classes, always have to call this first | ||
59 | void setCfg(RbSettings *sett){settings = sett;} | ||
60 | private: | 57 | private: |
61 | static void initEncodernamesList(void); | 58 | static void initEncodernamesList(void); |
62 | 59 | ||
63 | protected: | 60 | protected: |
64 | RbSettings* settings; | ||
65 | |||
66 | static QMap<QString,QString> encoderList; | 61 | static QMap<QString,QString> encoderList; |
67 | }; | 62 | }; |
68 | 63 | ||
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 @@ | |||
25 | #include <unistd.h> | 25 | #include <unistd.h> |
26 | #endif | 26 | #endif |
27 | 27 | ||
28 | |||
28 | // device settings | 29 | // device settings |
29 | const static struct { | 30 | const static struct { |
30 | RbSettings::SystemSettings setting; | 31 | RbSettings::SystemSettings setting; |
@@ -94,31 +95,45 @@ const static struct { | |||
94 | { RbSettings::EncoderVolume, ":encoder:/volume", "1.0" }, | 95 | { RbSettings::EncoderVolume, ":encoder:/volume", "1.0" }, |
95 | }; | 96 | }; |
96 | 97 | ||
97 | void RbSettings::open() | 98 | //! pointer to setting object to NULL |
99 | QSettings* RbSettings::systemSettings = NULL; | ||
100 | QSettings* RbSettings::userSettings = NULL; | ||
101 | |||
102 | void RbSettings::ensureRbSettingsExists() | ||
98 | { | 103 | { |
99 | // only use built-in rbutil.ini | 104 | //check and create settings object |
100 | systemSettings = new QSettings(":/ini/rbutil.ini", QSettings::IniFormat, 0); | 105 | if(systemSettings == NULL) |
101 | // portable installation: | ||
102 | // check for a configuration file in the program folder. | ||
103 | QFileInfo config; | ||
104 | config.setFile(QCoreApplication::instance()->applicationDirPath() | ||
105 | + "/RockboxUtility.ini"); | ||
106 | if(config.isFile()) | ||
107 | { | 106 | { |
108 | userSettings = new QSettings(QCoreApplication::instance()->applicationDirPath() | 107 | // only use built-in rbutil.ini |
109 | + "/RockboxUtility.ini", QSettings::IniFormat, this); | 108 | systemSettings = new QSettings(":/ini/rbutil.ini", QSettings::IniFormat, 0); |
110 | qDebug() << "config: portable"; | ||
111 | } | 109 | } |
112 | else | 110 | |
111 | if(userSettings == NULL) | ||
113 | { | 112 | { |
114 | userSettings = new QSettings(QSettings::IniFormat, | 113 | // portable installation: |
115 | QSettings::UserScope, "rockbox.org", "RockboxUtility",this); | 114 | // check for a configuration file in the program folder. |
116 | qDebug() << "config: system"; | 115 | QFileInfo config; |
116 | config.setFile(QCoreApplication::instance()->applicationDirPath() | ||
117 | + "/RockboxUtility.ini"); | ||
118 | if(config.isFile()) | ||
119 | { | ||
120 | userSettings = new QSettings(QCoreApplication::instance()->applicationDirPath() | ||
121 | + "/RockboxUtility.ini", QSettings::IniFormat, NULL); | ||
122 | qDebug() << "config: portable"; | ||
123 | } | ||
124 | else | ||
125 | { | ||
126 | userSettings = new QSettings(QSettings::IniFormat, | ||
127 | QSettings::UserScope, "rockbox.org", "RockboxUtility",NULL); | ||
128 | qDebug() << "config: system"; | ||
129 | } | ||
117 | } | 130 | } |
118 | } | 131 | } |
119 | 132 | ||
120 | void RbSettings::sync() | 133 | void RbSettings::sync() |
121 | { | 134 | { |
135 | ensureRbSettingsExists(); | ||
136 | |||
122 | userSettings->sync(); | 137 | userSettings->sync(); |
123 | #if defined(Q_OS_LINUX) | 138 | #if defined(Q_OS_LINUX) |
124 | // when using sudo it runs rbutil with uid 0 but unfortunately without a | 139 | // when using sudo it runs rbutil with uid 0 but unfortunately without a |
@@ -143,9 +158,16 @@ void RbSettings::sync() | |||
143 | #endif | 158 | #endif |
144 | } | 159 | } |
145 | 160 | ||
161 | QString RbSettings::userSettingFilename() | ||
162 | { | ||
163 | ensureRbSettingsExists(); | ||
164 | return userSettings->fileName(); | ||
165 | } | ||
146 | 166 | ||
147 | QVariant RbSettings::value(enum SystemSettings setting) | 167 | QVariant RbSettings::value(enum SystemSettings setting) |
148 | { | 168 | { |
169 | ensureRbSettingsExists(); | ||
170 | |||
149 | // locate setting item | 171 | // locate setting item |
150 | int i = 0; | 172 | int i = 0; |
151 | while(SystemSettingsList[i].setting != setting) | 173 | while(SystemSettingsList[i].setting != setting) |
@@ -158,15 +180,16 @@ QVariant RbSettings::value(enum SystemSettings setting) | |||
158 | return systemSettings->value(s, d); | 180 | return systemSettings->value(s, d); |
159 | } | 181 | } |
160 | 182 | ||
161 | 183 | QVariant RbSettings::value(enum UserSettings setting) | |
162 | QString RbSettings::userSettingFilename() | 184 | { |
163 | { | 185 | QString empty; |
164 | return userSettings->fileName(); | 186 | return subValue(empty, setting); |
165 | } | 187 | } |
166 | 188 | ||
167 | 189 | QVariant RbSettings::subValue(QString sub, enum UserSettings setting) | |
168 | QVariant RbSettings::subValue(QString& sub, enum UserSettings setting) | ||
169 | { | 190 | { |
191 | ensureRbSettingsExists(); | ||
192 | |||
170 | // locate setting item | 193 | // locate setting item |
171 | int i = 0; | 194 | int i = 0; |
172 | while(UserSettingsList[i].setting != setting) | 195 | while(UserSettingsList[i].setting != setting) |
@@ -177,9 +200,16 @@ QVariant RbSettings::subValue(QString& sub, enum UserSettings setting) | |||
177 | return userSettings->value(s, UserSettingsList[i].def); | 200 | return userSettings->value(s, UserSettingsList[i].def); |
178 | } | 201 | } |
179 | 202 | ||
203 | void RbSettings::setValue(enum UserSettings setting , QVariant value) | ||
204 | { | ||
205 | QString empty; | ||
206 | return setSubValue(empty, setting, value); | ||
207 | } | ||
180 | 208 | ||
181 | void RbSettings::setSubValue(QString& sub, enum UserSettings setting, QVariant value) | 209 | void RbSettings::setSubValue(QString sub, enum UserSettings setting, QVariant value) |
182 | { | 210 | { |
211 | ensureRbSettingsExists(); | ||
212 | |||
183 | // locate setting item | 213 | // locate setting item |
184 | int i = 0; | 214 | int i = 0; |
185 | while(UserSettingsList[i].setting != setting) | 215 | while(UserSettingsList[i].setting != setting) |
@@ -190,10 +220,10 @@ void RbSettings::setSubValue(QString& sub, enum UserSettings setting, QVariant v | |||
190 | userSettings->setValue(s, value); | 220 | userSettings->setValue(s, value); |
191 | } | 221 | } |
192 | 222 | ||
193 | |||
194 | |||
195 | QStringList RbSettings::platforms() | 223 | QStringList RbSettings::platforms() |
196 | { | 224 | { |
225 | ensureRbSettingsExists(); | ||
226 | |||
197 | QStringList result; | 227 | QStringList result; |
198 | systemSettings->beginGroup("platforms"); | 228 | systemSettings->beginGroup("platforms"); |
199 | QStringList a = systemSettings->childKeys(); | 229 | QStringList a = systemSettings->childKeys(); |
@@ -207,6 +237,8 @@ QStringList RbSettings::platforms() | |||
207 | 237 | ||
208 | QStringList RbSettings::languages() | 238 | QStringList RbSettings::languages() |
209 | { | 239 | { |
240 | ensureRbSettingsExists(); | ||
241 | |||
210 | QStringList result; | 242 | QStringList result; |
211 | systemSettings->beginGroup("languages"); | 243 | systemSettings->beginGroup("languages"); |
212 | QStringList a = systemSettings->childKeys(); | 244 | QStringList a = systemSettings->childKeys(); |
@@ -220,16 +252,20 @@ QStringList RbSettings::languages() | |||
220 | 252 | ||
221 | QString RbSettings::name(QString platform) | 253 | QString RbSettings::name(QString platform) |
222 | { | 254 | { |
255 | ensureRbSettingsExists(); | ||
223 | return systemSettings->value(platform + "/name").toString(); | 256 | return systemSettings->value(platform + "/name").toString(); |
224 | } | 257 | } |
225 | 258 | ||
226 | QString RbSettings::brand(QString platform) | 259 | QString RbSettings::brand(QString platform) |
227 | { | 260 | { |
261 | ensureRbSettingsExists(); | ||
228 | return systemSettings->value(platform + "/brand").toString(); | 262 | return systemSettings->value(platform + "/brand").toString(); |
229 | } | 263 | } |
230 | 264 | ||
231 | QMap<int, QString> RbSettings::usbIdMap(enum MapType type) | 265 | QMap<int, QString> RbSettings::usbIdMap(enum MapType type) |
232 | { | 266 | { |
267 | ensureRbSettingsExists(); | ||
268 | |||
233 | QMap<int, QString> map; | 269 | QMap<int, QString> map; |
234 | // get a list of ID -> target name | 270 | // get a list of ID -> target name |
235 | QStringList platforms; | 271 | 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; | |||
29 | class RbSettings : public QObject | 29 | class RbSettings : public QObject |
30 | { | 30 | { |
31 | Q_OBJECT | 31 | Q_OBJECT |
32 | |||
33 | public: | 32 | public: |
34 | RbSettings() {} | 33 | //! Type of requested usb-id map |
35 | |||
36 | //! open the settings files | ||
37 | void open(); | ||
38 | //! call this to flush the user Settings | ||
39 | void sync(); | ||
40 | |||
41 | // returns the filename of the usersettings file | ||
42 | QString userSettingFilename(); | ||
43 | |||
44 | enum MapType { | 34 | enum MapType { |
45 | MapDevice, | 35 | MapDevice, |
46 | MapError, | 36 | MapError, |
47 | MapIncompatible, | 37 | MapIncompatible, |
48 | }; | 38 | }; |
39 | |||
40 | //! All user settings | ||
49 | enum UserSettings { | 41 | enum UserSettings { |
50 | RbutilVersion, | 42 | RbutilVersion, |
51 | CurrentPlatform, | 43 | CurrentPlatform, |
@@ -76,6 +68,8 @@ class RbSettings : public QObject | |||
76 | EncoderQuality, | 68 | EncoderQuality, |
77 | EncoderVolume, | 69 | EncoderVolume, |
78 | }; | 70 | }; |
71 | |||
72 | //! All system settings | ||
79 | enum SystemSettings { | 73 | enum SystemSettings { |
80 | ManualUrl, | 74 | ManualUrl, |
81 | BleedingUrl, | 75 | BleedingUrl, |
@@ -103,40 +97,43 @@ class RbSettings : public QObject | |||
103 | CurConfigureModel, | 97 | CurConfigureModel, |
104 | CurTargetId, | 98 | CurTargetId, |
105 | }; | 99 | }; |
106 | 100 | ||
107 | QVariant value(enum SystemSettings setting); | 101 | //! call this to flush the user Settings |
108 | // generic and "current selection" values -- getters | 102 | static void sync(); |
109 | QVariant value(enum UserSettings setting) | 103 | //! returns the filename of the usersettings file |
110 | { QString empty; return subValue(empty, setting); } | 104 | static QString userSettingFilename(); |
111 | void setValue(enum UserSettings setting , QVariant value) | 105 | //! return a list of all platforms (rbutil internal names) |
112 | { QString empty; return setSubValue(empty, setting, value); } | 106 | static QStringList platforms(void); |
113 | 107 | //! returns a list of all languages | |
114 | QVariant subValue(QString& sub, enum UserSettings setting); | 108 | static QStringList languages(void); |
115 | QVariant subValue(const char* sub, enum UserSettings setting) | 109 | //! maps a platform to its name |
116 | { QString s = sub; return subValue(s, setting); } | 110 | static QString name(QString plattform); |
117 | void setSubValue(QString& sub, enum UserSettings setting, QVariant value); | 111 | //! maps a platform to its brand |
118 | void setSubValue(const char* sub, enum UserSettings setting, QVariant value) | 112 | static QString brand(QString plattform); |
119 | { QString s = sub; return setSubValue(s, setting, value); } | 113 | //! returns a map of usb-ids and their targets |
120 | 114 | static QMap<int, QString> usbIdMap(enum MapType); | |
121 | QStringList platforms(void); | 115 | //! get a value from system settings |
122 | QStringList languages(void); | 116 | static QVariant value(enum SystemSettings setting); |
123 | 117 | //! get a vaulue from user settings | |
124 | QString name(QString plattform); | 118 | static QVariant value(enum UserSettings setting); |
125 | QString brand(QString plattform); | 119 | //! set a user setting value |
126 | 120 | static void setValue(enum UserSettings setting , QVariant value); | |
127 | QMap<int, QString> usbIdMap(enum MapType); | 121 | //! get a user setting from a subvalue (ie for encoders and tts engines) |
122 | static QVariant subValue(QString sub, enum UserSettings setting); | ||
123 | //! set a user setting from a subvalue (ie for encoders and tts engines) | ||
124 | static void setSubValue(QString sub, enum UserSettings setting, QVariant value); | ||
128 | 125 | ||
129 | private: | 126 | private: |
130 | //! private copy constructors to prvent copying | 127 | //! you shouldnt call this, its a fully static calls |
131 | RbSettings& operator= (const RbSettings& other) | 128 | RbSettings() {} |
132 | { (void)other; return *this; } | 129 | //! create the setting objects if neccessary |
133 | RbSettings(const RbSettings& other) :QObject() | 130 | static void ensureRbSettingsExists(); |
134 | { (void)other; } | 131 | //! create a settings path, substitute platform, tts and encoder |
135 | QString constructSettingPath(QString path, QString substitute = QString()); | 132 | static QString constructSettingPath(QString path, QString substitute = QString()); |
136 | 133 | ||
137 | //! pointers to our setting objects | 134 | //! pointers to our setting objects |
138 | QSettings *systemSettings; | 135 | static QSettings *systemSettings; |
139 | QSettings *userSettings; | 136 | static QSettings *userSettings; |
140 | }; | 137 | }; |
141 | 138 | ||
142 | #endif | 139 | #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 @@ | |||
19 | 19 | ||
20 | #include "tts.h" | 20 | #include "tts.h" |
21 | #include "utils.h" | 21 | #include "utils.h" |
22 | #include "rbsettings.h" | ||
22 | /********************************************************************* | 23 | /********************************************************************* |
23 | * TTS Base | 24 | * TTS Base |
24 | **********************************************************************/ | 25 | **********************************************************************/ |
@@ -105,24 +106,24 @@ TTSExes::TTSExes(QString name,QObject* parent) : TTSBase(parent) | |||
105 | 106 | ||
106 | void TTSExes::generateSettings() | 107 | void TTSExes::generateSettings() |
107 | { | 108 | { |
108 | QString exepath =settings->subValue(m_name,RbSettings::TtsPath).toString(); | 109 | QString exepath =RbSettings::subValue(m_name,RbSettings::TtsPath).toString(); |
109 | if(exepath == "") exepath = findExecutable(m_name); | 110 | if(exepath == "") exepath = findExecutable(m_name); |
110 | 111 | ||
111 | insertSetting(eEXEPATH,new EncTtsSetting(this,EncTtsSetting::eSTRING,"Path to TTS engine:",exepath,EncTtsSetting::eBROWSEBTN)); | 112 | insertSetting(eEXEPATH,new EncTtsSetting(this,EncTtsSetting::eSTRING,"Path to TTS engine:",exepath,EncTtsSetting::eBROWSEBTN)); |
112 | insertSetting(eOPTIONS,new EncTtsSetting(this,EncTtsSetting::eSTRING,"TTS enginge options:",settings->subValue(m_name,RbSettings::TtsOptions))); | 113 | insertSetting(eOPTIONS,new EncTtsSetting(this,EncTtsSetting::eSTRING,"TTS enginge options:",RbSettings::subValue(m_name,RbSettings::TtsOptions))); |
113 | } | 114 | } |
114 | 115 | ||
115 | void TTSExes::saveSettings() | 116 | void TTSExes::saveSettings() |
116 | { | 117 | { |
117 | settings->setSubValue(m_name,RbSettings::TtsPath,getSetting(eEXEPATH)->current().toString()); | 118 | RbSettings::setSubValue(m_name,RbSettings::TtsPath,getSetting(eEXEPATH)->current().toString()); |
118 | settings->setSubValue(m_name,RbSettings::TtsOptions,getSetting(eOPTIONS)->current().toString()); | 119 | RbSettings::setSubValue(m_name,RbSettings::TtsOptions,getSetting(eOPTIONS)->current().toString()); |
119 | settings->sync(); | 120 | RbSettings::sync(); |
120 | } | 121 | } |
121 | 122 | ||
122 | bool TTSExes::start(QString *errStr) | 123 | bool TTSExes::start(QString *errStr) |
123 | { | 124 | { |
124 | m_TTSexec = settings->subValue(m_name,RbSettings::TtsPath).toString(); | 125 | m_TTSexec = RbSettings::subValue(m_name,RbSettings::TtsPath).toString(); |
125 | m_TTSOpts = settings->subValue(m_name,RbSettings::TtsOptions).toString(); | 126 | m_TTSOpts = RbSettings::subValue(m_name,RbSettings::TtsOptions).toString(); |
126 | 127 | ||
127 | m_TTSTemplate = m_TemplateMap.value(m_name); | 128 | m_TTSTemplate = m_TemplateMap.value(m_name); |
128 | 129 | ||
@@ -155,7 +156,7 @@ TTSStatus TTSExes::voice(QString text,QString wavfile, QString *errStr) | |||
155 | 156 | ||
156 | bool TTSExes::configOk() | 157 | bool TTSExes::configOk() |
157 | { | 158 | { |
158 | QString path = settings->subValue(m_name,RbSettings::TtsPath).toString(); | 159 | QString path = RbSettings::subValue(m_name,RbSettings::TtsPath).toString(); |
159 | 160 | ||
160 | if (QFileInfo(path).exists()) | 161 | if (QFileInfo(path).exists()) |
161 | return true; | 162 | return true; |
@@ -176,31 +177,31 @@ TTSSapi::TTSSapi(QObject* parent) : TTSBase(parent) | |||
176 | void TTSSapi::generateSettings() | 177 | void TTSSapi::generateSettings() |
177 | { | 178 | { |
178 | // language | 179 | // language |
179 | QStringList languages = settings->languages(); | 180 | QStringList languages = RbSettings::languages(); |
180 | languages.sort(); | 181 | languages.sort(); |
181 | EncTtsSetting* setting =new EncTtsSetting(this,EncTtsSetting::eSTRINGLIST,"Language:",settings->subValue("sapi",RbSettings::TtsLanguage),languages); | 182 | EncTtsSetting* setting =new EncTtsSetting(this,EncTtsSetting::eSTRINGLIST,"Language:",RbSettings::subValue("sapi",RbSettings::TtsLanguage),languages); |
182 | connect(setting,SIGNAL(dataChanged()),this,SLOT(updateVoiceList())); | 183 | connect(setting,SIGNAL(dataChanged()),this,SLOT(updateVoiceList())); |
183 | insertSetting(eLANGUAGE,setting); | 184 | insertSetting(eLANGUAGE,setting); |
184 | // voice | 185 | // voice |
185 | setting = new EncTtsSetting(this,EncTtsSetting::eSTRINGLIST,"Voice:",settings->subValue("sapi",RbSettings::TtsVoice),getVoiceList(settings->subValue("sapi",RbSettings::TtsLanguage).toString()),EncTtsSetting::eREFRESHBTN); | 186 | setting = new EncTtsSetting(this,EncTtsSetting::eSTRINGLIST,"Voice:",RbSettings::subValue("sapi",RbSettings::TtsVoice),getVoiceList(RbSettings::subValue("sapi",RbSettings::TtsLanguage).toString()),EncTtsSetting::eREFRESHBTN); |
186 | connect(setting,SIGNAL(refresh()),this,SLOT(updateVoiceList())); | 187 | connect(setting,SIGNAL(refresh()),this,SLOT(updateVoiceList())); |
187 | insertSetting(eVOICE,setting); | 188 | insertSetting(eVOICE,setting); |
188 | //speed | 189 | //speed |
189 | insertSetting(eSPEED,new EncTtsSetting(this,EncTtsSetting::eINT,"Speed:",settings->subValue("sapi",RbSettings::TtsSpeed),-10,10)); | 190 | insertSetting(eSPEED,new EncTtsSetting(this,EncTtsSetting::eINT,"Speed:",RbSettings::subValue("sapi",RbSettings::TtsSpeed),-10,10)); |
190 | // options | 191 | // options |
191 | insertSetting(eOPTIONS,new EncTtsSetting(this,EncTtsSetting::eSTRING,"Options:",settings->subValue("sapi",RbSettings::TtsOptions))); | 192 | insertSetting(eOPTIONS,new EncTtsSetting(this,EncTtsSetting::eSTRING,"Options:",RbSettings::subValue("sapi",RbSettings::TtsOptions))); |
192 | 193 | ||
193 | } | 194 | } |
194 | 195 | ||
195 | void TTSSapi::saveSettings() | 196 | void TTSSapi::saveSettings() |
196 | { | 197 | { |
197 | //save settings in user config | 198 | //save settings in user config |
198 | settings->setSubValue("sapi",RbSettings::TtsLanguage,getSetting(eLANGUAGE)->current().toString()); | 199 | RbSettings::setSubValue("sapi",RbSettings::TtsLanguage,getSetting(eLANGUAGE)->current().toString()); |
199 | settings->setSubValue("sapi",RbSettings::TtsVoice,getSetting(eVOICE)->current().toString()); | 200 | RbSettings::setSubValue("sapi",RbSettings::TtsVoice,getSetting(eVOICE)->current().toString()); |
200 | settings->setSubValue("sapi",RbSettings::TtsSpeed,getSetting(eSPEED)->current().toInt()); | 201 | RbSettings::setSubValue("sapi",RbSettings::TtsSpeed,getSetting(eSPEED)->current().toInt()); |
201 | settings->setSubValue("sapi",RbSettings::TtsOptions,getSetting(eOPTIONS)->current().toString()); | 202 | RbSettings::setSubValue("sapi",RbSettings::TtsOptions,getSetting(eOPTIONS)->current().toString()); |
202 | 203 | ||
203 | settings->sync(); | 204 | RbSettings::sync(); |
204 | } | 205 | } |
205 | 206 | ||
206 | void TTSSapi::updateVoiceList() | 207 | void TTSSapi::updateVoiceList() |
@@ -215,11 +216,11 @@ void TTSSapi::updateVoiceList() | |||
215 | bool TTSSapi::start(QString *errStr) | 216 | bool TTSSapi::start(QString *errStr) |
216 | { | 217 | { |
217 | 218 | ||
218 | m_TTSOpts = settings->subValue("sapi",RbSettings::TtsOptions).toString(); | 219 | m_TTSOpts = RbSettings::subValue("sapi",RbSettings::TtsOptions).toString(); |
219 | m_TTSLanguage =settings->subValue("sapi",RbSettings::TtsLanguage).toString(); | 220 | m_TTSLanguage =RbSettings::subValue("sapi",RbSettings::TtsLanguage).toString(); |
220 | m_TTSVoice=settings->subValue("sapi",RbSettings::TtsVoice).toString(); | 221 | m_TTSVoice=RbSettings::subValue("sapi",RbSettings::TtsVoice).toString(); |
221 | m_TTSSpeed=settings->subValue("sapi",RbSettings::TtsSpeed).toString(); | 222 | m_TTSSpeed=RbSettings::subValue("sapi",RbSettings::TtsSpeed).toString(); |
222 | m_sapi4 = settings->subValue("sapi",RbSettings::TtsUseSapi4).toBool(); | 223 | m_sapi4 = RbSettings::subValue("sapi",RbSettings::TtsUseSapi4).toBool(); |
223 | 224 | ||
224 | QFile::remove(QDir::tempPath() +"/sapi_voice.vbs"); | 225 | QFile::remove(QDir::tempPath() +"/sapi_voice.vbs"); |
225 | QFile::copy(":/builtin/sapi_voice.vbs",QDir::tempPath() + "/sapi_voice.vbs"); | 226 | QFile::copy(":/builtin/sapi_voice.vbs",QDir::tempPath() + "/sapi_voice.vbs"); |
@@ -283,7 +284,7 @@ QStringList TTSSapi::getVoiceList(QString language) | |||
283 | execstring.replace("%exe",m_TTSexec); | 284 | execstring.replace("%exe",m_TTSexec); |
284 | execstring.replace("%lang",language); | 285 | execstring.replace("%lang",language); |
285 | 286 | ||
286 | if(settings->value(RbSettings::TtsUseSapi4).toBool()) | 287 | if(RbSettings::value(RbSettings::TtsUseSapi4).toBool()) |
287 | execstring.append(" /sapi4 "); | 288 | execstring.append(" /sapi4 "); |
288 | 289 | ||
289 | qDebug() << "init" << execstring; | 290 | qDebug() << "init" << execstring; |
@@ -348,7 +349,7 @@ bool TTSSapi::stop() | |||
348 | 349 | ||
349 | bool TTSSapi::configOk() | 350 | bool TTSSapi::configOk() |
350 | { | 351 | { |
351 | if(settings->subValue("sapi",RbSettings::TtsVoice).toString().isEmpty()) | 352 | if(RbSettings::subValue("sapi",RbSettings::TtsVoice).toString().isEmpty()) |
352 | return false; | 353 | return false; |
353 | return true; | 354 | return true; |
354 | } | 355 | } |
@@ -363,17 +364,17 @@ TTSFestival::~TTSFestival() | |||
363 | void TTSFestival::generateSettings() | 364 | void TTSFestival::generateSettings() |
364 | { | 365 | { |
365 | // server path | 366 | // server path |
366 | QString exepath = settings->subValue("festival-server",RbSettings::TtsPath).toString(); | 367 | QString exepath = RbSettings::subValue("festival-server",RbSettings::TtsPath).toString(); |
367 | if(exepath == "" ) exepath = findExecutable("festival"); | 368 | if(exepath == "" ) exepath = findExecutable("festival"); |
368 | insertSetting(eSERVERPATH,new EncTtsSetting(this,EncTtsSetting::eSTRING,"Path to Festival server:",exepath,EncTtsSetting::eBROWSEBTN)); | 369 | insertSetting(eSERVERPATH,new EncTtsSetting(this,EncTtsSetting::eSTRING,"Path to Festival server:",exepath,EncTtsSetting::eBROWSEBTN)); |
369 | 370 | ||
370 | // client path | 371 | // client path |
371 | QString clientpath = settings->subValue("festival-client",RbSettings::TtsPath).toString(); | 372 | QString clientpath = RbSettings::subValue("festival-client",RbSettings::TtsPath).toString(); |
372 | if(clientpath == "" ) clientpath = findExecutable("festival_client"); | 373 | if(clientpath == "" ) clientpath = findExecutable("festival_client"); |
373 | insertSetting(eCLIENTPATH,new EncTtsSetting(this,EncTtsSetting::eSTRING,"Path to Festival client:",clientpath,EncTtsSetting::eBROWSEBTN)); | 374 | insertSetting(eCLIENTPATH,new EncTtsSetting(this,EncTtsSetting::eSTRING,"Path to Festival client:",clientpath,EncTtsSetting::eBROWSEBTN)); |
374 | 375 | ||
375 | // voice | 376 | // voice |
376 | EncTtsSetting* setting = new EncTtsSetting(this,EncTtsSetting::eSTRINGLIST,"Voice:",settings->subValue("festival",RbSettings::TtsVoice),getVoiceList(exepath),EncTtsSetting::eREFRESHBTN); | 377 | EncTtsSetting* setting = new EncTtsSetting(this,EncTtsSetting::eSTRINGLIST,"Voice:",RbSettings::subValue("festival",RbSettings::TtsVoice),getVoiceList(exepath),EncTtsSetting::eREFRESHBTN); |
377 | connect(setting,SIGNAL(refresh()),this,SLOT(updateVoiceList())); | 378 | connect(setting,SIGNAL(refresh()),this,SLOT(updateVoiceList())); |
378 | connect(setting,SIGNAL(dataChanged()),this,SLOT(clearVoiceDescription())); | 379 | connect(setting,SIGNAL(dataChanged()),this,SLOT(clearVoiceDescription())); |
379 | insertSetting(eVOICE,setting); | 380 | insertSetting(eVOICE,setting); |
@@ -387,11 +388,11 @@ void TTSFestival::generateSettings() | |||
387 | void TTSFestival::saveSettings() | 388 | void TTSFestival::saveSettings() |
388 | { | 389 | { |
389 | //save settings in user config | 390 | //save settings in user config |
390 | settings->setSubValue("festival-server",RbSettings::TtsPath,getSetting(eSERVERPATH)->current().toString()); | 391 | RbSettings::setSubValue("festival-server",RbSettings::TtsPath,getSetting(eSERVERPATH)->current().toString()); |
391 | settings->setSubValue("festival-client",RbSettings::TtsPath,getSetting(eCLIENTPATH)->current().toString()); | 392 | RbSettings::setSubValue("festival-client",RbSettings::TtsPath,getSetting(eCLIENTPATH)->current().toString()); |
392 | settings->setSubValue("festival",RbSettings::TtsVoice,getSetting(eVOICE)->current().toString()); | 393 | RbSettings::setSubValue("festival",RbSettings::TtsVoice,getSetting(eVOICE)->current().toString()); |
393 | 394 | ||
394 | settings->sync(); | 395 | RbSettings::sync(); |
395 | } | 396 | } |
396 | 397 | ||
397 | void TTSFestival::updateVoiceDescription() | 398 | void TTSFestival::updateVoiceDescription() |
@@ -420,7 +421,7 @@ void TTSFestival::startServer(QString path) | |||
420 | return; | 421 | return; |
421 | 422 | ||
422 | if(path == "") | 423 | if(path == "") |
423 | path = settings->subValue("festival-server",RbSettings::TtsPath).toString(); | 424 | path = RbSettings::subValue("festival-server",RbSettings::TtsPath).toString(); |
424 | 425 | ||
425 | serverProcess.start(QString("%1 --server").arg(path)); | 426 | serverProcess.start(QString("%1 --server").arg(path)); |
426 | serverProcess.waitForStarted(); | 427 | serverProcess.waitForStarted(); |
@@ -444,9 +445,9 @@ bool TTSFestival::start(QString* errStr) | |||
444 | { | 445 | { |
445 | (void) errStr; | 446 | (void) errStr; |
446 | ensureServerRunning(); | 447 | ensureServerRunning(); |
447 | if (!settings->subValue("festival",RbSettings::TtsVoice).toString().isEmpty()) | 448 | if (!RbSettings::subValue("festival",RbSettings::TtsVoice).toString().isEmpty()) |
448 | queryServer(QString("(voice.select '%1)") | 449 | queryServer(QString("(voice.select '%1)") |
449 | .arg(settings->subValue("festival", RbSettings::TtsVoice).toString())); | 450 | .arg(RbSettings::subValue("festival", RbSettings::TtsVoice).toString())); |
450 | 451 | ||
451 | return true; | 452 | return true; |
452 | } | 453 | } |
@@ -463,7 +464,7 @@ TTSStatus TTSFestival::voice(QString text, QString wavfile, QString* errStr) | |||
463 | { | 464 | { |
464 | qDebug() << text << "->" << wavfile; | 465 | qDebug() << text << "->" << wavfile; |
465 | 466 | ||
466 | QString path = settings->subValue("festival-client",RbSettings::TtsPath).toString(); | 467 | QString path = RbSettings::subValue("festival-client",RbSettings::TtsPath).toString(); |
467 | QString cmd = QString("%1 --server localhost --otype riff --ttw --withlisp --output \"%2\" - ").arg(path).arg(wavfile); | 468 | QString cmd = QString("%1 --server localhost --otype riff --ttw --withlisp --output \"%2\" - ").arg(path).arg(wavfile); |
468 | qDebug() << cmd; | 469 | qDebug() << cmd; |
469 | 470 | ||
@@ -493,13 +494,13 @@ TTSStatus TTSFestival::voice(QString text, QString wavfile, QString* errStr) | |||
493 | 494 | ||
494 | bool TTSFestival::configOk() | 495 | bool TTSFestival::configOk() |
495 | { | 496 | { |
496 | QString serverPath = settings->subValue("festival-server",RbSettings::TtsPath).toString(); | 497 | QString serverPath = RbSettings::subValue("festival-server",RbSettings::TtsPath).toString(); |
497 | QString clientPath = settings->subValue("festival-client",RbSettings::TtsVoice).toString(); | 498 | QString clientPath = RbSettings::subValue("festival-client",RbSettings::TtsVoice).toString(); |
498 | 499 | ||
499 | bool ret = QFileInfo(serverPath).isExecutable() && | 500 | bool ret = QFileInfo(serverPath).isExecutable() && |
500 | QFileInfo(clientPath).isExecutable(); | 501 | QFileInfo(clientPath).isExecutable(); |
501 | if(settings->subValue("festival",RbSettings::TtsVoice).toString().size() > 0 && voices.size() > 0) | 502 | if(RbSettings::subValue("festival",RbSettings::TtsVoice).toString().size() > 0 && voices.size() > 0) |
502 | ret = ret && (voices.indexOf(settings->subValue("festival",RbSettings::TtsVoice).toString()) != -1); | 503 | ret = ret && (voices.indexOf(RbSettings::subValue("festival",RbSettings::TtsVoice).toString()) != -1); |
503 | return ret; | 504 | return ret; |
504 | } | 505 | } |
505 | 506 | ||
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 @@ | |||
23 | #ifndef TTS_H | 23 | #ifndef TTS_H |
24 | #define TTS_H | 24 | #define TTS_H |
25 | 25 | ||
26 | #include "rbsettings.h" | ||
27 | #include <QtCore> | 26 | #include <QtCore> |
28 | #include <QProcess> | 27 | #include <QProcess> |
29 | #include <QDateTime> | 28 | #include <QDateTime> |
@@ -58,16 +57,12 @@ class TTSBase : public EncTtsSettingInterface | |||
58 | static TTSBase* getTTS(QObject* parent,QString ttsname); | 57 | static TTSBase* getTTS(QObject* parent,QString ttsname); |
59 | static QStringList getTTSList(); | 58 | static QStringList getTTSList(); |
60 | static QString getTTSName(QString tts); | 59 | static QString getTTSName(QString tts); |
61 | 60 | ||
62 | // sets the config. Users of TTS classes, always have to call this first | ||
63 | void setCfg(RbSettings* sett) { settings = sett; } | ||
64 | |||
65 | private: | 61 | private: |
66 | //inits the tts List | 62 | //inits the tts List |
67 | static void initTTSList(); | 63 | static void initTTSList(); |
68 | 64 | ||
69 | protected: | 65 | protected: |
70 | RbSettings* settings; | ||
71 | static QMap<QString,QString> ttsList; | 66 | static QMap<QString,QString> ttsList; |
72 | }; | 67 | }; |
73 | 68 | ||
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 @@ | |||
28 | #include "tts.h" | 28 | #include "tts.h" |
29 | #include "detect.h" | 29 | #include "detect.h" |
30 | #include "encttscfggui.h" | 30 | #include "encttscfggui.h" |
31 | #include "rbsettings.h" | ||
31 | 32 | ||
32 | #include <stdio.h> | 33 | #include <stdio.h> |
33 | #if defined(Q_OS_WIN32) | 34 | #if defined(Q_OS_WIN32) |
@@ -85,10 +86,10 @@ Config::Config(QWidget *parent,int index) : QDialog(parent) | |||
85 | connect(ui.comboTts, SIGNAL(currentIndexChanged(int)), this, SLOT(updateTtsState(int))); | 86 | connect(ui.comboTts, SIGNAL(currentIndexChanged(int)), this, SLOT(updateTtsState(int))); |
86 | connect(ui.treeDevices, SIGNAL(itemSelectionChanged()), this, SLOT(updateEncState())); | 87 | connect(ui.treeDevices, SIGNAL(itemSelectionChanged()), this, SLOT(updateEncState())); |
87 | 88 | ||
89 | setUserSettings(); | ||
90 | setDevices(); | ||
88 | } | 91 | } |
89 | 92 | ||
90 | |||
91 | |||
92 | void Config::accept() | 93 | void Config::accept() |
93 | { | 94 | { |
94 | qDebug() << "Config::accept()"; | 95 | qDebug() << "Config::accept()"; |
@@ -104,20 +105,20 @@ void Config::accept() | |||
104 | proxy.setPort(ui.proxyPort->text().toInt()); | 105 | proxy.setPort(ui.proxyPort->text().toInt()); |
105 | } | 106 | } |
106 | 107 | ||
107 | settings->setValue(RbSettings::Proxy, proxy.toString()); | 108 | RbSettings::setValue(RbSettings::Proxy, proxy.toString()); |
108 | qDebug() << "new proxy:" << proxy; | 109 | qDebug() << "new proxy:" << proxy; |
109 | // proxy type | 110 | // proxy type |
110 | QString proxyType; | 111 | QString proxyType; |
111 | if(ui.radioNoProxy->isChecked()) proxyType = "none"; | 112 | if(ui.radioNoProxy->isChecked()) proxyType = "none"; |
112 | else if(ui.radioSystemProxy->isChecked()) proxyType = "system"; | 113 | else if(ui.radioSystemProxy->isChecked()) proxyType = "system"; |
113 | else proxyType = "manual"; | 114 | else proxyType = "manual"; |
114 | settings->setValue(RbSettings::ProxyType, proxyType); | 115 | RbSettings::setValue(RbSettings::ProxyType, proxyType); |
115 | 116 | ||
116 | // language | 117 | // language |
117 | if(settings->value(RbSettings::Language).toString() != language && !language.isEmpty()) { | 118 | if(RbSettings::value(RbSettings::Language).toString() != language && !language.isEmpty()) { |
118 | QMessageBox::information(this, tr("Language changed"), | 119 | QMessageBox::information(this, tr("Language changed"), |
119 | tr("You need to restart the application for the changed language to take effect.")); | 120 | tr("You need to restart the application for the changed language to take effect.")); |
120 | settings->setValue(RbSettings::Language, language); | 121 | RbSettings::setValue(RbSettings::Language, language); |
121 | } | 122 | } |
122 | 123 | ||
123 | // mountpoint | 124 | // mountpoint |
@@ -139,14 +140,14 @@ void Config::accept() | |||
139 | error = true; | 140 | error = true; |
140 | } | 141 | } |
141 | else { | 142 | else { |
142 | settings->setValue(RbSettings::Mountpoint, QDir::fromNativeSeparators(mp)); | 143 | RbSettings::setValue(RbSettings::Mountpoint, QDir::fromNativeSeparators(mp)); |
143 | } | 144 | } |
144 | 145 | ||
145 | // platform | 146 | // platform |
146 | QString nplat; | 147 | QString nplat; |
147 | if(ui.treeDevices->selectedItems().size() != 0) { | 148 | if(ui.treeDevices->selectedItems().size() != 0) { |
148 | nplat = ui.treeDevices->selectedItems().at(0)->data(0, Qt::UserRole).toString(); | 149 | nplat = ui.treeDevices->selectedItems().at(0)->data(0, Qt::UserRole).toString(); |
149 | settings->setValue(RbSettings::Platform, nplat); | 150 | RbSettings::setValue(RbSettings::Platform, nplat); |
150 | } | 151 | } |
151 | else { | 152 | else { |
152 | errormsg += "<li>" + tr("No player selected") + "</li>"; | 153 | errormsg += "<li>" + tr("No player selected") + "</li>"; |
@@ -161,18 +162,18 @@ void Config::accept() | |||
161 | error = true; | 162 | error = true; |
162 | } | 163 | } |
163 | else | 164 | else |
164 | settings->setValue(RbSettings::CachePath, ui.cachePath->text()); | 165 | RbSettings::setValue(RbSettings::CachePath, ui.cachePath->text()); |
165 | } | 166 | } |
166 | else // default to system temp path | 167 | else // default to system temp path |
167 | settings->setValue(RbSettings::CachePath, QDir::tempPath()); | 168 | RbSettings::setValue(RbSettings::CachePath, QDir::tempPath()); |
168 | settings->setValue(RbSettings::CacheDisabled, ui.cacheDisable->isChecked()); | 169 | RbSettings::setValue(RbSettings::CacheDisabled, ui.cacheDisable->isChecked()); |
169 | settings->setValue(RbSettings::CacheOffline, ui.cacheOfflineMode->isChecked()); | 170 | RbSettings::setValue(RbSettings::CacheOffline, ui.cacheOfflineMode->isChecked()); |
170 | 171 | ||
171 | // tts settings | 172 | // tts settings |
172 | int i = ui.comboTts->currentIndex(); | 173 | int i = ui.comboTts->currentIndex(); |
173 | settings->setValue(RbSettings::Tts, ui.comboTts->itemData(i).toString()); | 174 | RbSettings::setValue(RbSettings::Tts, ui.comboTts->itemData(i).toString()); |
174 | 175 | ||
175 | settings->setValue(RbSettings::RbutilVersion, PUREVERSION); | 176 | RbSettings::setValue(RbSettings::RbutilVersion, PUREVERSION); |
176 | 177 | ||
177 | errormsg += "</ul>"; | 178 | errormsg += "</ul>"; |
178 | errormsg += tr("You need to fix the above errors before you can continue."); | 179 | errormsg += tr("You need to fix the above errors before you can continue."); |
@@ -182,7 +183,7 @@ void Config::accept() | |||
182 | } | 183 | } |
183 | else { | 184 | else { |
184 | // sync settings | 185 | // sync settings |
185 | settings->sync(); | 186 | RbSettings::sync(); |
186 | this->close(); | 187 | this->close(); |
187 | emit settingsUpdated(); | 188 | emit settingsUpdated(); |
188 | } | 189 | } |
@@ -195,18 +196,10 @@ void Config::abort() | |||
195 | this->close(); | 196 | this->close(); |
196 | } | 197 | } |
197 | 198 | ||
198 | void Config::setSettings(RbSettings* sett) | ||
199 | { | ||
200 | settings = sett; | ||
201 | |||
202 | setUserSettings(); | ||
203 | setDevices(); | ||
204 | } | ||
205 | |||
206 | void Config::setUserSettings() | 199 | void Config::setUserSettings() |
207 | { | 200 | { |
208 | // set proxy | 201 | // set proxy |
209 | proxy = settings->value(RbSettings::Proxy).toString(); | 202 | proxy = RbSettings::value(RbSettings::Proxy).toString(); |
210 | 203 | ||
211 | if(proxy.port() > 0) | 204 | if(proxy.port() > 0) |
212 | ui.proxyPort->setText(QString("%1").arg(proxy.port())); | 205 | ui.proxyPort->setText(QString("%1").arg(proxy.port())); |
@@ -215,7 +208,7 @@ void Config::setUserSettings() | |||
215 | ui.proxyUser->setText(proxy.userName()); | 208 | ui.proxyUser->setText(proxy.userName()); |
216 | ui.proxyPass->setText(proxy.password()); | 209 | ui.proxyPass->setText(proxy.password()); |
217 | 210 | ||
218 | QString proxyType = settings->value(RbSettings::ProxyType).toString(); | 211 | QString proxyType = RbSettings::value(RbSettings::ProxyType).toString(); |
219 | if(proxyType == "manual") ui.radioManualProxy->setChecked(true); | 212 | if(proxyType == "manual") ui.radioManualProxy->setChecked(true); |
220 | else if(proxyType == "system") ui.radioSystemProxy->setChecked(true); | 213 | else if(proxyType == "system") ui.radioSystemProxy->setChecked(true); |
221 | else ui.radioNoProxy->setChecked(true); | 214 | else ui.radioNoProxy->setChecked(true); |
@@ -225,7 +218,7 @@ void Config::setUserSettings() | |||
225 | QString b; | 218 | QString b; |
226 | // find key for lang value | 219 | // find key for lang value |
227 | QMap<QString, QString>::const_iterator i = lang.constBegin(); | 220 | QMap<QString, QString>::const_iterator i = lang.constBegin(); |
228 | QString l = settings->value(RbSettings::Language).toString(); | 221 | QString l = RbSettings::value(RbSettings::Language).toString(); |
229 | if(l.isEmpty()) | 222 | if(l.isEmpty()) |
230 | l = QLocale::system().name(); | 223 | l = QLocale::system().name(); |
231 | while (i != lang.constEnd()) { | 224 | while (i != lang.constEnd()) { |
@@ -248,15 +241,15 @@ void Config::setUserSettings() | |||
248 | connect(ui.listLanguages, SIGNAL(itemSelectionChanged()), this, SLOT(updateLanguage())); | 241 | connect(ui.listLanguages, SIGNAL(itemSelectionChanged()), this, SLOT(updateLanguage())); |
249 | 242 | ||
250 | // devices tab | 243 | // devices tab |
251 | ui.mountPoint->setText(QDir::toNativeSeparators(settings->value(RbSettings::Mountpoint).toString())); | 244 | ui.mountPoint->setText(QDir::toNativeSeparators(RbSettings::value(RbSettings::Mountpoint).toString())); |
252 | 245 | ||
253 | // cache tab | 246 | // cache tab |
254 | if(!QFileInfo(settings->value(RbSettings::CachePath).toString()).isDir()) | 247 | if(!QFileInfo(RbSettings::value(RbSettings::CachePath).toString()).isDir()) |
255 | settings->setValue(RbSettings::CachePath, QDir::tempPath()); | 248 | RbSettings::setValue(RbSettings::CachePath, QDir::tempPath()); |
256 | ui.cachePath->setText(QDir::toNativeSeparators(settings->value(RbSettings::CachePath).toString())); | 249 | ui.cachePath->setText(QDir::toNativeSeparators(RbSettings::value(RbSettings::CachePath).toString())); |
257 | ui.cacheDisable->setChecked(settings->value(RbSettings::CacheDisabled).toBool()); | 250 | ui.cacheDisable->setChecked(RbSettings::value(RbSettings::CacheDisabled).toBool()); |
258 | ui.cacheOfflineMode->setChecked(settings->value(RbSettings::CacheOffline).toBool()); | 251 | ui.cacheOfflineMode->setChecked(RbSettings::value(RbSettings::CacheOffline).toBool()); |
259 | updateCacheInfo(settings->value(RbSettings::CachePath).toString()); | 252 | updateCacheInfo(RbSettings::value(RbSettings::CachePath).toString()); |
260 | } | 253 | } |
261 | 254 | ||
262 | 255 | ||
@@ -280,20 +273,20 @@ void Config::setDevices() | |||
280 | // setup devices table | 273 | // setup devices table |
281 | qDebug() << "Config::setDevices()"; | 274 | qDebug() << "Config::setDevices()"; |
282 | 275 | ||
283 | QStringList platformList = settings->platforms(); | 276 | QStringList platformList = RbSettings::platforms(); |
284 | 277 | ||
285 | QMap <QString, QString> manuf; | 278 | QMap <QString, QString> manuf; |
286 | QMap <QString, QString> devcs; | 279 | QMap <QString, QString> devcs; |
287 | for(int it = 0; it < platformList.size(); it++) | 280 | for(int it = 0; it < platformList.size(); it++) |
288 | { | 281 | { |
289 | QString curname = settings->name(platformList.at(it)); | 282 | QString curname = RbSettings::name(platformList.at(it)); |
290 | QString curbrand = settings->brand(platformList.at(it)); | 283 | QString curbrand = RbSettings::brand(platformList.at(it)); |
291 | manuf.insertMulti(curbrand, platformList.at(it)); | 284 | manuf.insertMulti(curbrand, platformList.at(it)); |
292 | devcs.insert(platformList.at(it), curname); | 285 | devcs.insert(platformList.at(it), curname); |
293 | } | 286 | } |
294 | 287 | ||
295 | QString platform; | 288 | QString platform; |
296 | platform = devcs.value(settings->value(RbSettings::Platform).toString()); | 289 | platform = devcs.value(RbSettings::value(RbSettings::Platform).toString()); |
297 | 290 | ||
298 | // set up devices table | 291 | // set up devices table |
299 | ui.treeDevices->header()->hide(); | 292 | ui.treeDevices->header()->hide(); |
@@ -316,8 +309,8 @@ void Config::setDevices() | |||
316 | // go through platforms again for sake of order | 309 | // go through platforms again for sake of order |
317 | for(int it = 0; it < platformList.size(); it++) { | 310 | for(int it = 0; it < platformList.size(); it++) { |
318 | 311 | ||
319 | QString curname = settings->name(platformList.at(it)); | 312 | QString curname = RbSettings::name(platformList.at(it)); |
320 | QString curbrand = settings->brand(platformList.at(it)); | 313 | QString curbrand = RbSettings::brand(platformList.at(it)); |
321 | 314 | ||
322 | if(curbrand != brands.at(c)) continue; | 315 | if(curbrand != brands.at(c)) continue; |
323 | qDebug() << "adding:" << brands.at(c) << curname; | 316 | qDebug() << "adding:" << brands.at(c) << curname; |
@@ -346,7 +339,7 @@ void Config::setDevices() | |||
346 | for(int a = 0; a < ttslist.size(); a++) | 339 | for(int a = 0; a < ttslist.size(); a++) |
347 | ui.comboTts->addItem(TTSBase::getTTSName(ttslist.at(a)), ttslist.at(a)); | 340 | ui.comboTts->addItem(TTSBase::getTTSName(ttslist.at(a)), ttslist.at(a)); |
348 | //update index of combobox | 341 | //update index of combobox |
349 | int index = ui.comboTts->findData(settings->value(RbSettings::Tts).toString()); | 342 | int index = ui.comboTts->findData(RbSettings::value(RbSettings::Tts).toString()); |
350 | if(index < 0) index = 0; | 343 | if(index < 0) index = 0; |
351 | ui.comboTts->setCurrentIndex(index); | 344 | ui.comboTts->setCurrentIndex(index); |
352 | updateTtsState(index); | 345 | updateTtsState(index); |
@@ -358,7 +351,6 @@ void Config::updateTtsState(int index) | |||
358 | { | 351 | { |
359 | QString ttsName = ui.comboTts->itemData(index).toString(); | 352 | QString ttsName = ui.comboTts->itemData(index).toString(); |
360 | TTSBase* tts = TTSBase::getTTS(this,ttsName); | 353 | TTSBase* tts = TTSBase::getTTS(this,ttsName); |
361 | tts->setCfg(settings); | ||
362 | 354 | ||
363 | if(tts->configOk()) | 355 | if(tts->configOk()) |
364 | { | 356 | { |
@@ -381,14 +373,13 @@ void Config::updateEncState() | |||
381 | return; | 373 | return; |
382 | 374 | ||
383 | QString devname = ui.treeDevices->selectedItems().at(0)->data(0, Qt::UserRole).toString(); | 375 | QString devname = ui.treeDevices->selectedItems().at(0)->data(0, Qt::UserRole).toString(); |
384 | QString olddevice = settings->value(RbSettings::Platform).toString(); | 376 | QString olddevice = RbSettings::value(RbSettings::Platform).toString(); |
385 | settings->setValue(RbSettings::Platform, devname); | 377 | RbSettings::setValue(RbSettings::Platform, devname); |
386 | QString encoder = settings->value(RbSettings::CurEncoder).toString(); | 378 | QString encoder = RbSettings::value(RbSettings::CurEncoder).toString(); |
387 | ui.encoderName->setText(EncBase::getEncoderName(settings->value(RbSettings::CurEncoder).toString())); | 379 | ui.encoderName->setText(EncBase::getEncoderName(RbSettings::value(RbSettings::CurEncoder).toString())); |
388 | settings->setValue(RbSettings::Platform, olddevice); | 380 | RbSettings::setValue(RbSettings::Platform, olddevice); |
389 | 381 | ||
390 | EncBase* enc = EncBase::getEncoder(this,encoder); | 382 | EncBase* enc = EncBase::getEncoder(this,encoder); |
391 | enc->setCfg(settings); | ||
392 | 383 | ||
393 | if(enc->configOk()) | 384 | if(enc->configOk()) |
394 | { | 385 | { |
@@ -546,7 +537,6 @@ void Config::setCache(QString c) | |||
546 | void Config::autodetect() | 537 | void Config::autodetect() |
547 | { | 538 | { |
548 | Autodetection detector(this); | 539 | Autodetection detector(this); |
549 | detector.setSettings(settings); | ||
550 | // disable tree during detection as "working" feedback. | 540 | // disable tree during detection as "working" feedback. |
551 | // TODO: replace the tree view with a splash screen during this time. | 541 | // TODO: replace the tree view with a splash screen during this time. |
552 | ui.treeDevices->setEnabled(false); | 542 | ui.treeDevices->setEnabled(false); |
@@ -601,10 +591,10 @@ void Config::autodetect() | |||
601 | QString text; | 591 | QString text; |
602 | // we need to set the platform here to get the brand from the | 592 | // we need to set the platform here to get the brand from the |
603 | // settings object | 593 | // settings object |
604 | settings->setValue(RbSettings::Platform, detector.incompatdev()); | 594 | RbSettings::setValue(RbSettings::Platform, detector.incompatdev()); |
605 | text = tr("Detected an unsupported %1 player variant. Sorry, " | 595 | text = tr("Detected an unsupported %1 player variant. Sorry, " |
606 | "Rockbox doesn't run on your player.") | 596 | "Rockbox doesn't run on your player.") |
607 | .arg(settings->value(RbSettings::CurBrand).toString()); | 597 | .arg(RbSettings::value(RbSettings::CurBrand).toString()); |
608 | 598 | ||
609 | QMessageBox::critical(this, tr("Fatal error: incompatible player found"), | 599 | QMessageBox::critical(this, tr("Fatal error: incompatible player found"), |
610 | text, QMessageBox::Ok); | 600 | text, QMessageBox::Ok); |
@@ -660,7 +650,7 @@ void Config::cacheClear() | |||
660 | QFile::remove(f); | 650 | QFile::remove(f); |
661 | qDebug() << "removed:" << f; | 651 | qDebug() << "removed:" << f; |
662 | } | 652 | } |
663 | updateCacheInfo(settings->value(RbSettings::CachePath).toString()); | 653 | updateCacheInfo(RbSettings::value(RbSettings::CachePath).toString()); |
664 | } | 654 | } |
665 | 655 | ||
666 | 656 | ||
@@ -669,8 +659,7 @@ void Config::configTts() | |||
669 | int index = ui.comboTts->currentIndex(); | 659 | int index = ui.comboTts->currentIndex(); |
670 | TTSBase* tts = TTSBase::getTTS(this,ui.comboTts->itemData(index).toString()); | 660 | TTSBase* tts = TTSBase::getTTS(this,ui.comboTts->itemData(index).toString()); |
671 | 661 | ||
672 | tts->setCfg(settings); | 662 | EncTtsCfgGui gui(this,tts,TTSBase::getTTSName(RbSettings::value(RbSettings::Tts).toString())); |
673 | EncTtsCfgGui gui(this,tts,TTSBase::getTTSName(settings->value(RbSettings::Tts).toString())); | ||
674 | gui.exec(); | 663 | gui.exec(); |
675 | updateTtsState(ui.comboTts->currentIndex()); | 664 | updateTtsState(ui.comboTts->currentIndex()); |
676 | } | 665 | } |
@@ -685,16 +674,15 @@ void Config::configEnc() | |||
685 | return; | 674 | return; |
686 | 675 | ||
687 | QString devname = ui.treeDevices->selectedItems().at(0)->data(0, Qt::UserRole).toString(); | 676 | QString devname = ui.treeDevices->selectedItems().at(0)->data(0, Qt::UserRole).toString(); |
688 | QString olddevice = settings->value(RbSettings::CurrentPlatform).toString(); | 677 | QString olddevice = RbSettings::value(RbSettings::CurrentPlatform).toString(); |
689 | settings->setValue(RbSettings::CurrentPlatform,devname); | 678 | RbSettings::setValue(RbSettings::CurrentPlatform,devname); |
690 | QString encoder = settings->value(RbSettings::CurEncoder).toString(); | 679 | QString encoder = RbSettings::value(RbSettings::CurEncoder).toString(); |
691 | ui.encoderName->setText(EncBase::getEncoderName(settings->value(RbSettings::CurEncoder).toString())); | 680 | ui.encoderName->setText(EncBase::getEncoderName(RbSettings::value(RbSettings::CurEncoder).toString())); |
692 | settings->setValue(RbSettings::CurrentPlatform,olddevice); | 681 | RbSettings::setValue(RbSettings::CurrentPlatform,olddevice); |
693 | 682 | ||
694 | 683 | ||
695 | EncBase* enc = EncBase::getEncoder(this,encoder); | 684 | EncBase* enc = EncBase::getEncoder(this,encoder); |
696 | 685 | ||
697 | enc->setCfg(settings); | ||
698 | EncTtsCfgGui gui(this,enc,EncBase::getEncoderName(encoder)); | 686 | EncTtsCfgGui gui(this,enc,EncBase::getEncoderName(encoder)); |
699 | gui.exec(); | 687 | gui.exec(); |
700 | 688 | ||
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 @@ | |||
24 | 24 | ||
25 | #include "ui_configurefrm.h" | 25 | #include "ui_configurefrm.h" |
26 | #include "browsedirtree.h" | 26 | #include "browsedirtree.h" |
27 | #include "rbsettings.h" | ||
28 | #include <QtGui> | 27 | #include <QtGui> |
29 | 28 | ||
30 | class Config : public QDialog | 29 | class Config : public QDialog |
@@ -32,7 +31,6 @@ class Config : public QDialog | |||
32 | Q_OBJECT | 31 | Q_OBJECT |
33 | public: | 32 | public: |
34 | Config(QWidget *parent = 0,int index=0); | 33 | Config(QWidget *parent = 0,int index=0); |
35 | void setSettings(RbSettings* sett); | ||
36 | 34 | ||
37 | signals: | 35 | signals: |
38 | void settingsUpdated(void); | 36 | void settingsUpdated(void); |
@@ -46,8 +44,7 @@ class Config : public QDialog | |||
46 | void setDevices(); | 44 | void setDevices(); |
47 | 45 | ||
48 | Ui::ConfigForm ui; | 46 | Ui::ConfigForm ui; |
49 | RbSettings* settings; | 47 | |
50 | |||
51 | QStringList findLanguageFiles(void); | 48 | QStringList findLanguageFiles(void); |
52 | QString languageName(const QString&); | 49 | QString languageName(const QString&); |
53 | QMap<QString, QString> lang; | 50 | 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 @@ | |||
22 | 22 | ||
23 | #include "browsedirtree.h" | 23 | #include "browsedirtree.h" |
24 | #include "configure.h" | 24 | #include "configure.h" |
25 | #include "rbsettings.h" | ||
25 | 26 | ||
26 | CreateVoiceWindow::CreateVoiceWindow(QWidget *parent) : QDialog(parent) | 27 | CreateVoiceWindow::CreateVoiceWindow(QWidget *parent) : QDialog(parent) |
27 | { | 28 | { |
@@ -34,7 +35,6 @@ CreateVoiceWindow::CreateVoiceWindow(QWidget *parent) : QDialog(parent) | |||
34 | void CreateVoiceWindow::change() | 35 | void CreateVoiceWindow::change() |
35 | { | 36 | { |
36 | Config *cw = new Config(this,4); | 37 | Config *cw = new Config(this,4); |
37 | cw->setSettings(settings); | ||
38 | connect(cw, SIGNAL(settingsUpdated()), this, SLOT(updateSettings())); | 38 | connect(cw, SIGNAL(settingsUpdated()), this, SLOT(updateSettings())); |
39 | cw->show(); | 39 | cw->show(); |
40 | } | 40 | } |
@@ -49,14 +49,13 @@ void CreateVoiceWindow::accept() | |||
49 | int wvThreshold = ui.wavtrimthreshold->value(); | 49 | int wvThreshold = ui.wavtrimthreshold->value(); |
50 | 50 | ||
51 | //safe selected language | 51 | //safe selected language |
52 | settings->setValue(RbSettings::Language, lang); | 52 | RbSettings::setValue(RbSettings::Language, lang); |
53 | settings->setValue(RbSettings::WavtrimThreshold, wvThreshold); | 53 | RbSettings::setValue(RbSettings::WavtrimThreshold, wvThreshold); |
54 | settings->sync(); | 54 | RbSettings::sync(); |
55 | 55 | ||
56 | //configure voicecreator | 56 | //configure voicecreator |
57 | voicecreator->setSettings(settings); | 57 | voicecreator->setMountPoint(RbSettings::value(RbSettings::Mountpoint).toString()); |
58 | voicecreator->setMountPoint(settings->value(RbSettings::Mountpoint).toString()); | 58 | voicecreator->setTargetId(RbSettings::value(RbSettings::CurTargetId).toInt()); |
59 | voicecreator->setTargetId(settings->value(RbSettings::CurTargetId).toInt()); | ||
60 | voicecreator->setLang(lang); | 59 | voicecreator->setLang(lang); |
61 | voicecreator->setWavtrimThreshold(wvThreshold); | 60 | voicecreator->setWavtrimThreshold(wvThreshold); |
62 | 61 | ||
@@ -65,28 +64,19 @@ void CreateVoiceWindow::accept() | |||
65 | } | 64 | } |
66 | 65 | ||
67 | 66 | ||
68 | /** @brief set settings object | ||
69 | */ | ||
70 | void CreateVoiceWindow::setSettings(RbSettings* sett) | ||
71 | { | ||
72 | settings = sett; | ||
73 | updateSettings(); | ||
74 | } | ||
75 | |||
76 | |||
77 | /** @brief update displayed settings | 67 | /** @brief update displayed settings |
78 | */ | 68 | */ |
79 | void CreateVoiceWindow::updateSettings(void) | 69 | void CreateVoiceWindow::updateSettings(void) |
80 | { | 70 | { |
81 | // fill in language combobox | 71 | // fill in language combobox |
82 | QStringList languages = settings->languages(); | 72 | QStringList languages = RbSettings::languages(); |
83 | languages.sort(); | 73 | languages.sort(); |
84 | ui.comboLanguage->addItems(languages); | 74 | ui.comboLanguage->addItems(languages); |
85 | // set saved lang | 75 | // set saved lang |
86 | int sel = ui.comboLanguage->findText(settings->value(RbSettings::VoiceLanguage).toString()); | 76 | int sel = ui.comboLanguage->findText(RbSettings::value(RbSettings::VoiceLanguage).toString()); |
87 | // if no saved language is found try to figure the language from the UI lang | 77 | // if no saved language is found try to figure the language from the UI lang |
88 | if(sel == -1) { | 78 | if(sel == -1) { |
89 | QString f = settings->value(RbSettings::Language).toString(); | 79 | QString f = RbSettings::value(RbSettings::Language).toString(); |
90 | // if no language is set default to english. Make sure not to check an empty string. | 80 | // if no language is set default to english. Make sure not to check an empty string. |
91 | if(f.isEmpty()) f = "english"; | 81 | if(f.isEmpty()) f = "english"; |
92 | sel = ui.comboLanguage->findText(f, Qt::MatchStartsWith); | 82 | sel = ui.comboLanguage->findText(f, Qt::MatchStartsWith); |
@@ -97,9 +87,8 @@ void CreateVoiceWindow::updateSettings(void) | |||
97 | } | 87 | } |
98 | ui.comboLanguage->setCurrentIndex(sel); | 88 | ui.comboLanguage->setCurrentIndex(sel); |
99 | 89 | ||
100 | QString ttsName = settings->value(RbSettings::Tts).toString(); | 90 | QString ttsName = RbSettings::value(RbSettings::Tts).toString(); |
101 | TTSBase* tts = TTSBase::getTTS(this,ttsName); | 91 | TTSBase* tts = TTSBase::getTTS(this,ttsName); |
102 | tts->setCfg(settings); | ||
103 | if(tts->configOk()) | 92 | if(tts->configOk()) |
104 | ui.labelTtsProfile->setText(tr("Selected TTS engine: <b>%1</b>") | 93 | ui.labelTtsProfile->setText(tr("Selected TTS engine: <b>%1</b>") |
105 | .arg(TTSBase::getTTSName(ttsName))); | 94 | .arg(TTSBase::getTTSName(ttsName))); |
@@ -107,11 +96,10 @@ void CreateVoiceWindow::updateSettings(void) | |||
107 | ui.labelTtsProfile->setText(tr("Selected TTS engine: <b>%1</b>") | 96 | ui.labelTtsProfile->setText(tr("Selected TTS engine: <b>%1</b>") |
108 | .arg("Invalid TTS configuration!")); | 97 | .arg("Invalid TTS configuration!")); |
109 | 98 | ||
110 | QString encoder = settings->value(RbSettings::CurEncoder).toString(); | 99 | QString encoder = RbSettings::value(RbSettings::CurEncoder).toString(); |
111 | // only proceed if encoder setting is set | 100 | // only proceed if encoder setting is set |
112 | EncBase* enc = EncBase::getEncoder(this,encoder); | 101 | EncBase* enc = EncBase::getEncoder(this,encoder); |
113 | if(enc != NULL) { | 102 | if(enc != NULL) { |
114 | enc->setCfg(settings); | ||
115 | if(enc->configOk()) | 103 | if(enc->configOk()) |
116 | ui.labelEncProfile->setText(tr("Selected encoder: <b>%1</b>") | 104 | ui.labelEncProfile->setText(tr("Selected encoder: <b>%1</b>") |
117 | .arg(EncBase::getEncoderName(encoder))); | 105 | .arg(EncBase::getEncoderName(encoder))); |
@@ -122,7 +110,7 @@ void CreateVoiceWindow::updateSettings(void) | |||
122 | else | 110 | else |
123 | ui.labelEncProfile->setText(tr("Selected encoder: <b>%1</b>") | 111 | ui.labelEncProfile->setText(tr("Selected encoder: <b>%1</b>") |
124 | .arg("Invalid encoder configuration!")); | 112 | .arg("Invalid encoder configuration!")); |
125 | ui.wavtrimthreshold->setValue(settings->value(RbSettings::WavtrimThreshold).toInt()); | 113 | ui.wavtrimthreshold->setValue(RbSettings::value(RbSettings::WavtrimThreshold).toInt()); |
126 | emit settingsUpdated(); | 114 | emit settingsUpdated(); |
127 | } | 115 | } |
128 | 116 | ||
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 @@ | |||
27 | #include "ui_createvoicefrm.h" | 27 | #include "ui_createvoicefrm.h" |
28 | #include "progressloggergui.h" | 28 | #include "progressloggergui.h" |
29 | #include "voicefile.h" | 29 | #include "voicefile.h" |
30 | #include "rbsettings.h" | 30 | |
31 | 31 | ||
32 | class CreateVoiceWindow : public QDialog | 32 | class CreateVoiceWindow : public QDialog |
33 | { | 33 | { |
34 | Q_OBJECT | 34 | Q_OBJECT |
35 | public: | 35 | public: |
36 | CreateVoiceWindow(QWidget *parent); | 36 | CreateVoiceWindow(QWidget *parent); |
37 | void setSettings(RbSettings* sett); | ||
38 | void setProxy(QUrl proxy){m_proxy = proxy;} | 37 | void setProxy(QUrl proxy){m_proxy = proxy;} |
39 | 38 | ||
40 | public slots: | 39 | public slots: |
@@ -49,7 +48,6 @@ class CreateVoiceWindow : public QDialog | |||
49 | VoiceFileCreator* voicecreator; | 48 | VoiceFileCreator* voicecreator; |
50 | Ui::CreateVoiceFrm ui; | 49 | Ui::CreateVoiceFrm ui; |
51 | ProgressLoggerGui* logger; | 50 | ProgressLoggerGui* logger; |
52 | RbSettings* settings; | ||
53 | QUrl m_proxy; | 51 | QUrl m_proxy; |
54 | }; | 52 | }; |
55 | 53 | ||
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 @@ | |||
21 | #include "ui_installfrm.h" | 21 | #include "ui_installfrm.h" |
22 | #include "rbzip.h" | 22 | #include "rbzip.h" |
23 | #include "detect.h" | 23 | #include "detect.h" |
24 | #include "rbsettings.h" | ||
24 | 25 | ||
25 | Install::Install(RbSettings *sett,QWidget *parent) : QDialog(parent) | 26 | Install::Install(QWidget *parent) : QDialog(parent) |
26 | { | 27 | { |
27 | settings = sett; | ||
28 | ui.setupUi(this); | 28 | ui.setupUi(this); |
29 | 29 | ||
30 | connect(ui.radioStable, SIGNAL(toggled(bool)), this, SLOT(setDetailsStable(bool))); | 30 | connect(ui.radioStable, SIGNAL(toggled(bool)), this, SLOT(setDetailsStable(bool))); |
@@ -34,12 +34,12 @@ Install::Install(RbSettings *sett,QWidget *parent) : QDialog(parent) | |||
34 | connect(ui.backup, SIGNAL(stateChanged(int)), this, SLOT(backupCheckboxChanged(int))); | 34 | connect(ui.backup, SIGNAL(stateChanged(int)), this, SLOT(backupCheckboxChanged(int))); |
35 | 35 | ||
36 | //! check if rockbox is already installed | 36 | //! check if rockbox is already installed |
37 | QString version = Detect::installedVersion(settings->value(RbSettings::Mountpoint).toString()); | 37 | QString version = Detect::installedVersion(RbSettings::value(RbSettings::Mountpoint).toString()); |
38 | 38 | ||
39 | if(version != "") | 39 | if(version != "") |
40 | { | 40 | { |
41 | ui.Backupgroup->show(); | 41 | ui.Backupgroup->show(); |
42 | m_backupName = settings->value(RbSettings::Mountpoint).toString(); | 42 | m_backupName = RbSettings::value(RbSettings::Mountpoint).toString(); |
43 | if(!m_backupName.endsWith("/")) m_backupName += "/"; | 43 | if(!m_backupName.endsWith("/")) m_backupName += "/"; |
44 | m_backupName += ".backup/rockbox-backup-"+version+".zip"; | 44 | m_backupName += ".backup/rockbox-backup-"+version+".zip"; |
45 | // for some reason the label doesn't return its final size yet. | 45 | // for some reason the label doesn't return its final size yet. |
@@ -91,8 +91,8 @@ void Install::accept() | |||
91 | { | 91 | { |
92 | logger = new ProgressLoggerGui(this); | 92 | logger = new ProgressLoggerGui(this); |
93 | logger->show(); | 93 | logger->show(); |
94 | QString mountPoint = settings->value(RbSettings::Mountpoint).toString(); | 94 | QString mountPoint = RbSettings::value(RbSettings::Mountpoint).toString(); |
95 | qDebug() << "mountpoint:" << settings->value(RbSettings::Mountpoint).toString(); | 95 | qDebug() << "mountpoint:" << RbSettings::value(RbSettings::Mountpoint).toString(); |
96 | // show dialog with error if mount point is wrong | 96 | // show dialog with error if mount point is wrong |
97 | if(!QFileInfo(mountPoint).isDir()) { | 97 | if(!QFileInfo(mountPoint).isDir()) { |
98 | logger->addItem(tr("Mount point is wrong!"),LOGERROR); | 98 | logger->addItem(tr("Mount point is wrong!"),LOGERROR); |
@@ -101,39 +101,39 @@ void Install::accept() | |||
101 | } | 101 | } |
102 | 102 | ||
103 | QString myversion; | 103 | QString myversion; |
104 | QString buildname = settings->value(RbSettings::CurBuildserverModel).toString(); | 104 | QString buildname = RbSettings::value(RbSettings::CurBuildserverModel).toString(); |
105 | if(ui.radioStable->isChecked()) { | 105 | if(ui.radioStable->isChecked()) { |
106 | file = QString("%1/%2/rockbox-%3-%4.zip") | 106 | file = QString("%1/%2/rockbox-%3-%4.zip") |
107 | .arg(settings->value(RbSettings::ReleaseUrl).toString(), version.value("rel_rev"), | 107 | .arg(RbSettings::value(RbSettings::ReleaseUrl).toString(), version.value("rel_rev"), |
108 | buildname, version.value("rel_rev")); | 108 | buildname, version.value("rel_rev")); |
109 | fileName = QString("rockbox-%1-%2.zip") | 109 | fileName = QString("rockbox-%1-%2.zip") |
110 | .arg(version.value("rel_rev"), buildname); | 110 | .arg(version.value("rel_rev"), buildname); |
111 | settings->setValue(RbSettings::Build, "stable"); | 111 | RbSettings::setValue(RbSettings::Build, "stable"); |
112 | myversion = version.value("rel_rev"); | 112 | myversion = version.value("rel_rev"); |
113 | } | 113 | } |
114 | else if(ui.radioArchived->isChecked()) { | 114 | else if(ui.radioArchived->isChecked()) { |
115 | file = QString("%1%2/rockbox-%3-%4.zip") | 115 | file = QString("%1%2/rockbox-%3-%4.zip") |
116 | .arg(settings->value(RbSettings::DailyUrl).toString(), | 116 | .arg(RbSettings::value(RbSettings::DailyUrl).toString(), |
117 | buildname, buildname, version.value("arch_date")); | 117 | buildname, buildname, version.value("arch_date")); |
118 | fileName = QString("rockbox-%1-%2.zip") | 118 | fileName = QString("rockbox-%1-%2.zip") |
119 | .arg(buildname, version.value("arch_date")); | 119 | .arg(buildname, version.value("arch_date")); |
120 | settings->setValue(RbSettings::Build, "archived"); | 120 | RbSettings::setValue(RbSettings::Build, "archived"); |
121 | myversion = "r" + version.value("arch_rev") + "-" + version.value("arch_date"); | 121 | myversion = "r" + version.value("arch_rev") + "-" + version.value("arch_date"); |
122 | } | 122 | } |
123 | else if(ui.radioCurrent->isChecked()) { | 123 | else if(ui.radioCurrent->isChecked()) { |
124 | file = QString("%1%2/rockbox.zip") | 124 | file = QString("%1%2/rockbox.zip") |
125 | .arg(settings->value(RbSettings::BleedingUrl).toString(), buildname); | 125 | .arg(RbSettings::value(RbSettings::BleedingUrl).toString(), buildname); |
126 | fileName = QString("rockbox.zip"); | 126 | fileName = QString("rockbox.zip"); |
127 | settings->setValue(RbSettings::Build, "current"); | 127 | RbSettings::setValue(RbSettings::Build, "current"); |
128 | myversion = "r" + version.value("bleed_rev"); | 128 | myversion = "r" + version.value("bleed_rev"); |
129 | } | 129 | } |
130 | else { | 130 | else { |
131 | qDebug() << "no build selected -- this shouldn't happen"; | 131 | qDebug() << "no build selected -- this shouldn't happen"; |
132 | return; | 132 | return; |
133 | } | 133 | } |
134 | settings->sync(); | 134 | RbSettings::sync(); |
135 | 135 | ||
136 | QString warning = Detect::check(settings, false); | 136 | QString warning = Detect::check(false); |
137 | if(!warning.isEmpty()) | 137 | if(!warning.isEmpty()) |
138 | { | 138 | { |
139 | if(QMessageBox::warning(this, tr("Really continue?"), warning, | 139 | if(QMessageBox::warning(this, tr("Really continue?"), warning, |
@@ -163,7 +163,7 @@ void Install::accept() | |||
163 | RbZip backup; | 163 | RbZip backup; |
164 | connect(&backup,SIGNAL(zipProgress(int,int)),logger,SLOT(setProgress(int,int))); | 164 | connect(&backup,SIGNAL(zipProgress(int,int)),logger,SLOT(setProgress(int,int))); |
165 | if(backup.createZip(m_backupName, | 165 | if(backup.createZip(m_backupName, |
166 | settings->value(RbSettings::Mountpoint).toString() + "/.rockbox") == Zip::Ok) | 166 | RbSettings::value(RbSettings::Mountpoint).toString() + "/.rockbox") == Zip::Ok) |
167 | { | 167 | { |
168 | logger->addItem(tr("Backup successful"),LOGOK); | 168 | logger->addItem(tr("Backup successful"),LOGOK); |
169 | } | 169 | } |
@@ -179,7 +179,7 @@ void Install::accept() | |||
179 | installer = new ZipInstaller(this); | 179 | installer = new ZipInstaller(this); |
180 | installer->setUrl(file); | 180 | installer->setUrl(file); |
181 | installer->setLogSection("Rockbox (Base)"); | 181 | installer->setLogSection("Rockbox (Base)"); |
182 | if(!settings->value(RbSettings::CacheDisabled).toBool() | 182 | if(!RbSettings::value(RbSettings::CacheDisabled).toBool() |
183 | && !ui.checkBoxCache->isChecked()) | 183 | && !ui.checkBoxCache->isChecked()) |
184 | { | 184 | { |
185 | installer->setCache(true); | 185 | installer->setCache(true); |
@@ -223,9 +223,9 @@ void Install::done(bool error) | |||
223 | // no error, close the window, when the logger is closed | 223 | // no error, close the window, when the logger is closed |
224 | connect(logger,SIGNAL(closed()),this,SLOT(close())); | 224 | connect(logger,SIGNAL(closed()),this,SLOT(close())); |
225 | // add platform info to log file for later detection | 225 | // add platform info to log file for later detection |
226 | QSettings installlog(settings->value(RbSettings::Mountpoint).toString() | 226 | QSettings installlog(RbSettings::value(RbSettings::Mountpoint).toString() |
227 | + "/.rockbox/rbutil.log", QSettings::IniFormat, 0); | 227 | + "/.rockbox/rbutil.log", QSettings::IniFormat, 0); |
228 | installlog.setValue("platform", settings->value(RbSettings::Platform).toString()); | 228 | installlog.setValue("platform", RbSettings::value(RbSettings::Platform).toString()); |
229 | installlog.sync(); | 229 | installlog.sync(); |
230 | } | 230 | } |
231 | 231 | ||
@@ -293,12 +293,12 @@ void Install::setVersionStrings(QMap<QString, QString>& ver) | |||
293 | 293 | ||
294 | // try to use the old selection first. If no selection has been made | 294 | // try to use the old selection first. If no selection has been made |
295 | // in the past, use a preselection based on released status. | 295 | // in the past, use a preselection based on released status. |
296 | if(settings->value(RbSettings::Build).toString() == "stable" | 296 | if(RbSettings::value(RbSettings::Build).toString() == "stable" |
297 | && !version.value("rel_rev").isEmpty()) | 297 | && !version.value("rel_rev").isEmpty()) |
298 | ui.radioStable->setChecked(true); | 298 | ui.radioStable->setChecked(true); |
299 | else if(settings->value(RbSettings::Build).toString() == "archived") | 299 | else if(RbSettings::value(RbSettings::Build).toString() == "archived") |
300 | ui.radioArchived->setChecked(true); | 300 | ui.radioArchived->setChecked(true); |
301 | else if(settings->value(RbSettings::Build).toString() == "current") | 301 | else if(RbSettings::value(RbSettings::Build).toString() == "current") |
302 | ui.radioCurrent->setChecked(true); | 302 | ui.radioCurrent->setChecked(true); |
303 | else if(!version.value("rel_rev").isEmpty()) { | 303 | else if(!version.value("rel_rev").isEmpty()) { |
304 | ui.radioStable->setChecked(true); | 304 | 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 @@ | |||
27 | #include "ui_installfrm.h" | 27 | #include "ui_installfrm.h" |
28 | #include "zipinstaller.h" | 28 | #include "zipinstaller.h" |
29 | #include "progressloggergui.h" | 29 | #include "progressloggergui.h" |
30 | #include "rbsettings.h" | ||
31 | 30 | ||
32 | class Install : public QDialog | 31 | class Install : public QDialog |
33 | { | 32 | { |
34 | Q_OBJECT | 33 | Q_OBJECT |
35 | public: | 34 | public: |
36 | Install(RbSettings* sett,QWidget *parent = 0); | 35 | Install(QWidget *parent); |
37 | void setVersionStrings(QMap<QString, QString>&); | 36 | void setVersionStrings(QMap<QString, QString>&); |
38 | 37 | ||
39 | public slots: | 38 | public slots: |
@@ -42,7 +41,6 @@ class Install : public QDialog | |||
42 | private: | 41 | private: |
43 | Ui::InstallFrm ui; | 42 | Ui::InstallFrm ui; |
44 | ProgressLoggerGui* logger; | 43 | ProgressLoggerGui* logger; |
45 | RbSettings* settings; | ||
46 | QHttp *download; | 44 | QHttp *download; |
47 | QFile *target; | 45 | QFile *target; |
48 | QString file; | 46 | 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 @@ | |||
22 | 22 | ||
23 | #include "browsedirtree.h" | 23 | #include "browsedirtree.h" |
24 | #include "configure.h" | 24 | #include "configure.h" |
25 | #include "rbsettings.h" | ||
25 | 26 | ||
26 | InstallTalkWindow::InstallTalkWindow(QWidget *parent) : QDialog(parent) | 27 | InstallTalkWindow::InstallTalkWindow(QWidget *parent) : QDialog(parent) |
27 | { | 28 | { |
@@ -34,6 +35,8 @@ InstallTalkWindow::InstallTalkWindow(QWidget *parent) : QDialog(parent) | |||
34 | ui.recursive->setChecked(true); | 35 | ui.recursive->setChecked(true); |
35 | ui.OverwriteTalk->setChecked(true); | 36 | ui.OverwriteTalk->setChecked(true); |
36 | ui.StripExtensions->setChecked(true); | 37 | ui.StripExtensions->setChecked(true); |
38 | |||
39 | updateSettings(); | ||
37 | } | 40 | } |
38 | 41 | ||
39 | void InstallTalkWindow::browseFolder() | 42 | void InstallTalkWindow::browseFolder() |
@@ -64,7 +67,6 @@ void InstallTalkWindow::setTalkFolder(QString folder) | |||
64 | void InstallTalkWindow::change() | 67 | void InstallTalkWindow::change() |
65 | { | 68 | { |
66 | Config *cw = new Config(this,4); | 69 | Config *cw = new Config(this,4); |
67 | cw->setSettings(settings); | ||
68 | 70 | ||
69 | connect(cw, SIGNAL(settingsUpdated()), this, SLOT(updateSettings())); | 71 | connect(cw, SIGNAL(settingsUpdated()), this, SLOT(updateSettings())); |
70 | 72 | ||
@@ -88,13 +90,12 @@ void InstallTalkWindow::accept() | |||
88 | return; | 90 | return; |
89 | } | 91 | } |
90 | 92 | ||
91 | settings->setValue(RbSettings::LastTalkedFolder, folderToTalk); | 93 | RbSettings::setValue(RbSettings::LastTalkedFolder, folderToTalk); |
92 | 94 | ||
93 | settings->sync(); | 95 | RbSettings::sync(); |
94 | 96 | ||
95 | talkcreator->setSettings(settings); | ||
96 | talkcreator->setDir(QDir(folderToTalk)); | 97 | talkcreator->setDir(QDir(folderToTalk)); |
97 | talkcreator->setMountPoint(settings->value(RbSettings::Mountpoint).toString()); | 98 | talkcreator->setMountPoint(RbSettings::value(RbSettings::Mountpoint).toString()); |
98 | 99 | ||
99 | talkcreator->setOverwriteTalk(ui.OverwriteTalk->isChecked()); | 100 | talkcreator->setOverwriteTalk(ui.OverwriteTalk->isChecked()); |
100 | talkcreator->setRecursive(ui.recursive->isChecked()); | 101 | talkcreator->setRecursive(ui.recursive->isChecked()); |
@@ -106,18 +107,10 @@ void InstallTalkWindow::accept() | |||
106 | } | 107 | } |
107 | 108 | ||
108 | 109 | ||
109 | void InstallTalkWindow::setSettings(RbSettings* sett) | ||
110 | { | ||
111 | settings = sett; | ||
112 | updateSettings(); | ||
113 | } | ||
114 | |||
115 | |||
116 | void InstallTalkWindow::updateSettings(void) | 110 | void InstallTalkWindow::updateSettings(void) |
117 | { | 111 | { |
118 | QString ttsName = settings->value(RbSettings::Tts).toString(); | 112 | QString ttsName = RbSettings::value(RbSettings::Tts).toString(); |
119 | TTSBase* tts = TTSBase::getTTS(this,ttsName); | 113 | TTSBase* tts = TTSBase::getTTS(this,ttsName); |
120 | tts->setCfg(settings); | ||
121 | if(tts->configOk()) | 114 | if(tts->configOk()) |
122 | ui.labelTtsProfile->setText(tr("Selected TTS engine: <b>%1</b>") | 115 | ui.labelTtsProfile->setText(tr("Selected TTS engine: <b>%1</b>") |
123 | .arg(TTSBase::getTTSName(ttsName))); | 116 | .arg(TTSBase::getTTSName(ttsName))); |
@@ -125,10 +118,9 @@ void InstallTalkWindow::updateSettings(void) | |||
125 | ui.labelTtsProfile->setText(tr("Selected TTS engine: <b>%1</b>") | 118 | ui.labelTtsProfile->setText(tr("Selected TTS engine: <b>%1</b>") |
126 | .arg("Invalid TTS configuration!")); | 119 | .arg("Invalid TTS configuration!")); |
127 | 120 | ||
128 | QString encoder = settings->value(RbSettings::CurEncoder).toString(); | 121 | QString encoder = RbSettings::value(RbSettings::CurEncoder).toString(); |
129 | EncBase* enc = EncBase::getEncoder(this,encoder); | 122 | EncBase* enc = EncBase::getEncoder(this,encoder); |
130 | if(enc != NULL) { | 123 | if(enc != NULL) { |
131 | enc->setCfg(settings); | ||
132 | if(enc->configOk()) | 124 | if(enc->configOk()) |
133 | ui.labelEncProfile->setText(tr("Selected encoder: <b>%1</b>") | 125 | ui.labelEncProfile->setText(tr("Selected encoder: <b>%1</b>") |
134 | .arg(EncBase::getEncoderName(encoder))); | 126 | .arg(EncBase::getEncoderName(encoder))); |
@@ -140,7 +132,7 @@ void InstallTalkWindow::updateSettings(void) | |||
140 | ui.labelEncProfile->setText(tr("Selected encoder: <b>%1</b>") | 132 | ui.labelEncProfile->setText(tr("Selected encoder: <b>%1</b>") |
141 | .arg("Invalid encoder configuration!")); | 133 | .arg("Invalid encoder configuration!")); |
142 | 134 | ||
143 | setTalkFolder(settings->value(RbSettings::LastTalkedFolder).toString()); | 135 | setTalkFolder(RbSettings::value(RbSettings::LastTalkedFolder).toString()); |
144 | emit settingsUpdated(); | 136 | emit settingsUpdated(); |
145 | } | 137 | } |
146 | 138 | ||
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 @@ | |||
27 | #include "ui_installtalkfrm.h" | 27 | #include "ui_installtalkfrm.h" |
28 | #include "progressloggergui.h" | 28 | #include "progressloggergui.h" |
29 | #include "talkfile.h" | 29 | #include "talkfile.h" |
30 | #include "rbsettings.h" | ||
31 | 30 | ||
32 | class InstallTalkWindow : public QDialog | 31 | class InstallTalkWindow : public QDialog |
33 | { | 32 | { |
34 | Q_OBJECT | 33 | Q_OBJECT |
35 | public: | 34 | public: |
36 | InstallTalkWindow(QWidget *parent = 0); | 35 | InstallTalkWindow(QWidget *parent = 0); |
37 | void setSettings(RbSettings* sett); | 36 | |
38 | |||
39 | public slots: | 37 | public slots: |
40 | void accept(void); | 38 | void accept(void); |
41 | void change(void); | 39 | void change(void); |
@@ -52,8 +50,6 @@ class InstallTalkWindow : public QDialog | |||
52 | TalkFileCreator* talkcreator; | 50 | TalkFileCreator* talkcreator; |
53 | Ui::InstallTalkFrm ui; | 51 | Ui::InstallTalkFrm ui; |
54 | ProgressLoggerGui* logger; | 52 | ProgressLoggerGui* logger; |
55 | RbSettings* settings; | ||
56 | |||
57 | }; | 53 | }; |
58 | 54 | ||
59 | #endif | 55 | #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 @@ | |||
34 | #include "rbzip.h" | 34 | #include "rbzip.h" |
35 | #include "sysinfo.h" | 35 | #include "sysinfo.h" |
36 | #include "detect.h" | 36 | #include "detect.h" |
37 | #include "rbsettings.h" | ||
37 | 38 | ||
38 | #include "progressloggerinterface.h" | 39 | #include "progressloggerinterface.h" |
39 | 40 | ||
@@ -60,8 +61,6 @@ RbUtilQt::RbUtilQt(QWidget *parent) : QMainWindow(parent) | |||
60 | { | 61 | { |
61 | absolutePath = qApp->applicationDirPath(); | 62 | absolutePath = qApp->applicationDirPath(); |
62 | 63 | ||
63 | settings = new RbSettings(); | ||
64 | settings->open(); | ||
65 | HttpGet::setGlobalUserAgent("rbutil/"VERSION); | 64 | HttpGet::setGlobalUserAgent("rbutil/"VERSION); |
66 | // init startup & autodetection | 65 | // init startup & autodetection |
67 | ui.setupUi(this); | 66 | ui.setupUi(this); |
@@ -154,13 +153,13 @@ void RbUtilQt::downloadInfo() | |||
154 | connect(daily, SIGNAL(done(bool)), this, SLOT(downloadDone(bool))); | 153 | connect(daily, SIGNAL(done(bool)), this, SLOT(downloadDone(bool))); |
155 | connect(daily, SIGNAL(requestFinished(int, bool)), this, SLOT(downloadDone(int, bool))); | 154 | connect(daily, SIGNAL(requestFinished(int, bool)), this, SLOT(downloadDone(int, bool))); |
156 | connect(qApp, SIGNAL(lastWindowClosed()), daily, SLOT(abort())); | 155 | connect(qApp, SIGNAL(lastWindowClosed()), daily, SLOT(abort())); |
157 | if(settings->value(RbSettings::CacheOffline).toBool()) | 156 | if(RbSettings::value(RbSettings::CacheOffline).toBool()) |
158 | daily->setCache(true); | 157 | daily->setCache(true); |
159 | else | 158 | else |
160 | daily->setCache(false); | 159 | daily->setCache(false); |
161 | qDebug() << "downloading build info"; | 160 | qDebug() << "downloading build info"; |
162 | daily->setFile(&buildInfo); | 161 | daily->setFile(&buildInfo); |
163 | daily->getFile(QUrl(settings->value(RbSettings::ServerConfUrl).toString())); | 162 | daily->getFile(QUrl(RbSettings::value(RbSettings::ServerConfUrl).toString())); |
164 | } | 163 | } |
165 | 164 | ||
166 | 165 | ||
@@ -181,7 +180,7 @@ void RbUtilQt::downloadDone(bool error) | |||
181 | versmap.insert("arch_date", info.value("dailies/date").toString()); | 180 | versmap.insert("arch_date", info.value("dailies/date").toString()); |
182 | 181 | ||
183 | info.beginGroup("release"); | 182 | info.beginGroup("release"); |
184 | versmap.insert("rel_rev", info.value(settings->value(RbSettings::CurBuildserverModel).toString()).toString()); | 183 | versmap.insert("rel_rev", info.value(RbSettings::value(RbSettings::CurBuildserverModel).toString()).toString()); |
185 | info.endGroup(); | 184 | info.endGroup(); |
186 | 185 | ||
187 | if(versmap.value("rel_rev").isEmpty()) { | 186 | if(versmap.value("rel_rev").isEmpty()) { |
@@ -197,12 +196,12 @@ void RbUtilQt::downloadDone(bool error) | |||
197 | connect(bleeding, SIGNAL(done(bool)), this, SLOT(downloadBleedingDone(bool))); | 196 | connect(bleeding, SIGNAL(done(bool)), this, SLOT(downloadBleedingDone(bool))); |
198 | connect(bleeding, SIGNAL(requestFinished(int, bool)), this, SLOT(downloadDone(int, bool))); | 197 | connect(bleeding, SIGNAL(requestFinished(int, bool)), this, SLOT(downloadDone(int, bool))); |
199 | connect(qApp, SIGNAL(lastWindowClosed()), daily, SLOT(abort())); | 198 | connect(qApp, SIGNAL(lastWindowClosed()), daily, SLOT(abort())); |
200 | if(settings->value(RbSettings::CacheOffline).toBool()) | 199 | if(RbSettings::value(RbSettings::CacheOffline).toBool()) |
201 | bleeding->setCache(true); | 200 | bleeding->setCache(true); |
202 | bleeding->setFile(&bleedingInfo); | 201 | bleeding->setFile(&bleedingInfo); |
203 | bleeding->getFile(QUrl(settings->value(RbSettings::BleedingInfo).toString())); | 202 | bleeding->getFile(QUrl(RbSettings::value(RbSettings::BleedingInfo).toString())); |
204 | 203 | ||
205 | if(settings->value(RbSettings::RbutilVersion) != PUREVERSION) { | 204 | if(RbSettings::value(RbSettings::RbutilVersion) != PUREVERSION) { |
206 | QApplication::processEvents(); | 205 | QApplication::processEvents(); |
207 | QMessageBox::information(this, tr("New installation"), | 206 | QMessageBox::information(this, tr("New installation"), |
208 | tr("This is a new installation of Rockbox Utility, or a new version. " | 207 | tr("This is a new installation of Rockbox Utility, or a new version. " |
@@ -291,7 +290,6 @@ void RbUtilQt::help() | |||
291 | void RbUtilQt::configDialog() | 290 | void RbUtilQt::configDialog() |
292 | { | 291 | { |
293 | Config *cw = new Config(this); | 292 | Config *cw = new Config(this); |
294 | cw->setSettings(settings); | ||
295 | connect(cw, SIGNAL(settingsUpdated()), this, SLOT(updateSettings())); | 293 | connect(cw, SIGNAL(settingsUpdated()), this, SLOT(updateSettings())); |
296 | connect(cw, SIGNAL(settingsUpdated()), this, SLOT(downloadInfo())); | 294 | connect(cw, SIGNAL(settingsUpdated()), this, SLOT(downloadInfo())); |
297 | cw->show(); | 295 | cw->show(); |
@@ -303,23 +301,23 @@ void RbUtilQt::updateSettings() | |||
303 | qDebug() << "updateSettings()"; | 301 | qDebug() << "updateSettings()"; |
304 | updateDevice(); | 302 | updateDevice(); |
305 | updateManual(); | 303 | updateManual(); |
306 | if(settings->value(RbSettings::ProxyType) == "system") { | 304 | if(RbSettings::value(RbSettings::ProxyType) == "system") { |
307 | HttpGet::setGlobalProxy(Detect::systemProxy()); | 305 | HttpGet::setGlobalProxy(Detect::systemProxy()); |
308 | } | 306 | } |
309 | else if(settings->value(RbSettings::ProxyType) == "manual") { | 307 | else if(RbSettings::value(RbSettings::ProxyType) == "manual") { |
310 | HttpGet::setGlobalProxy(settings->value(RbSettings::Proxy).toString()); | 308 | HttpGet::setGlobalProxy(RbSettings::value(RbSettings::Proxy).toString()); |
311 | } | 309 | } |
312 | else { | 310 | else { |
313 | HttpGet::setGlobalProxy(QUrl("")); | 311 | HttpGet::setGlobalProxy(QUrl("")); |
314 | } | 312 | } |
315 | HttpGet::setGlobalCache(settings->value(RbSettings::CachePath).toString()); | 313 | HttpGet::setGlobalCache(RbSettings::value(RbSettings::CachePath).toString()); |
316 | HttpGet::setGlobalDumbCache(settings->value(RbSettings::CacheOffline).toBool()); | 314 | HttpGet::setGlobalDumbCache(RbSettings::value(RbSettings::CacheOffline).toBool()); |
317 | } | 315 | } |
318 | 316 | ||
319 | 317 | ||
320 | void RbUtilQt::updateDevice() | 318 | void RbUtilQt::updateDevice() |
321 | { | 319 | { |
322 | if(settings->value(RbSettings::CurBootloaderMethod) == "none" ) { | 320 | if(RbSettings::value(RbSettings::CurBootloaderMethod) == "none" ) { |
323 | ui.buttonBootloader->setEnabled(false); | 321 | ui.buttonBootloader->setEnabled(false); |
324 | ui.buttonRemoveBootloader->setEnabled(false); | 322 | ui.buttonRemoveBootloader->setEnabled(false); |
325 | ui.labelBootloader->setEnabled(false); | 323 | ui.labelBootloader->setEnabled(false); |
@@ -328,7 +326,7 @@ void RbUtilQt::updateDevice() | |||
328 | else { | 326 | else { |
329 | ui.buttonBootloader->setEnabled(true); | 327 | ui.buttonBootloader->setEnabled(true); |
330 | ui.labelBootloader->setEnabled(true); | 328 | ui.labelBootloader->setEnabled(true); |
331 | if(settings->value(RbSettings::CurBootloaderMethod) == "fwpatcher") { | 329 | if(RbSettings::value(RbSettings::CurBootloaderMethod) == "fwpatcher") { |
332 | ui.labelRemoveBootloader->setEnabled(false); | 330 | ui.labelRemoveBootloader->setEnabled(false); |
333 | ui.buttonRemoveBootloader->setEnabled(false); | 331 | ui.buttonRemoveBootloader->setEnabled(false); |
334 | } | 332 | } |
@@ -339,9 +337,9 @@ void RbUtilQt::updateDevice() | |||
339 | } | 337 | } |
340 | 338 | ||
341 | // displayed device info | 339 | // displayed device info |
342 | QString mountpoint = settings->value(RbSettings::Mountpoint).toString(); | 340 | QString mountpoint = RbSettings::value(RbSettings::Mountpoint).toString(); |
343 | QString brand = settings->value(RbSettings::CurBrand).toString(); | 341 | QString brand = RbSettings::value(RbSettings::CurBrand).toString(); |
344 | QString name = settings->value(RbSettings::CurName).toString(); | 342 | QString name = RbSettings::value(RbSettings::CurName).toString(); |
345 | if(name.isEmpty()) name = "<none>"; | 343 | if(name.isEmpty()) name = "<none>"; |
346 | if(mountpoint.isEmpty()) mountpoint = "<invalid>"; | 344 | if(mountpoint.isEmpty()) mountpoint = "<invalid>"; |
347 | ui.labelDevice->setText(tr("<b>%1 %2</b> at <b>%3</b>") | 345 | ui.labelDevice->setText(tr("<b>%1 %2</b> at <b>%3</b>") |
@@ -351,17 +349,17 @@ void RbUtilQt::updateDevice() | |||
351 | 349 | ||
352 | void RbUtilQt::updateManual() | 350 | void RbUtilQt::updateManual() |
353 | { | 351 | { |
354 | if(settings->value(RbSettings::Platform) != "") | 352 | if(RbSettings::value(RbSettings::Platform) != "") |
355 | { | 353 | { |
356 | QString manual= settings->value(RbSettings::CurManual).toString(); | 354 | QString manual= RbSettings::value(RbSettings::CurManual).toString(); |
357 | 355 | ||
358 | if(manual == "") | 356 | if(manual == "") |
359 | manual = "rockbox-" + settings->value(RbSettings::Platform).toString(); | 357 | manual = "rockbox-" + RbSettings::value(RbSettings::Platform).toString(); |
360 | QString pdfmanual; | 358 | QString pdfmanual; |
361 | pdfmanual = settings->value(RbSettings::ManualUrl).toString() | 359 | pdfmanual = RbSettings::value(RbSettings::ManualUrl).toString() |
362 | + "/" + manual + ".pdf"; | 360 | + "/" + manual + ".pdf"; |
363 | QString htmlmanual; | 361 | QString htmlmanual; |
364 | htmlmanual = settings->value(RbSettings::ManualUrl).toString() | 362 | htmlmanual = RbSettings::value(RbSettings::ManualUrl).toString() |
365 | + "/" + manual + "/rockbox-build.html"; | 363 | + "/" + manual + "/rockbox-build.html"; |
366 | ui.labelPdfManual->setText(tr("<a href='%1'>PDF Manual</a>") | 364 | ui.labelPdfManual->setText(tr("<a href='%1'>PDF Manual</a>") |
367 | .arg(pdfmanual)); | 365 | .arg(pdfmanual)); |
@@ -455,7 +453,7 @@ void RbUtilQt::smallInstall() | |||
455 | 453 | ||
456 | bool RbUtilQt::smallInstallInner() | 454 | bool RbUtilQt::smallInstallInner() |
457 | { | 455 | { |
458 | QString mountpoint = settings->value(RbSettings::Mountpoint).toString(); | 456 | QString mountpoint = RbSettings::value(RbSettings::Mountpoint).toString(); |
459 | // show dialog with error if mount point is wrong | 457 | // show dialog with error if mount point is wrong |
460 | if(!QFileInfo(mountpoint).isDir()) { | 458 | if(!QFileInfo(mountpoint).isDir()) { |
461 | logger->addItem(tr("Mount point is wrong!"),LOGERROR); | 459 | logger->addItem(tr("Mount point is wrong!"),LOGERROR); |
@@ -463,7 +461,7 @@ bool RbUtilQt::smallInstallInner() | |||
463 | return true; | 461 | return true; |
464 | } | 462 | } |
465 | // Bootloader | 463 | // Bootloader |
466 | if(settings->value(RbSettings::CurBootloaderMethod) != "none") | 464 | if(RbSettings::value(RbSettings::CurBootloaderMethod) != "none") |
467 | { | 465 | { |
468 | m_error = false; | 466 | m_error = false; |
469 | m_installed = false; | 467 | m_installed = false; |
@@ -515,17 +513,17 @@ void RbUtilQt::installBtn() | |||
515 | bool RbUtilQt::installAuto() | 513 | bool RbUtilQt::installAuto() |
516 | { | 514 | { |
517 | QString file = QString("%1/%2/rockbox-%3-%4.zip") | 515 | QString file = QString("%1/%2/rockbox-%3-%4.zip") |
518 | .arg(settings->value(RbSettings::ReleaseUrl).toString(), | 516 | .arg(RbSettings::value(RbSettings::ReleaseUrl).toString(), |
519 | versmap.value("rel_rev"), | 517 | versmap.value("rel_rev"), |
520 | settings->value(RbSettings::CurBuildserverModel).toString(), | 518 | RbSettings::value(RbSettings::CurBuildserverModel).toString(), |
521 | versmap.value("rel_rev")); | 519 | versmap.value("rel_rev")); |
522 | buildInfo.open(); | 520 | buildInfo.open(); |
523 | QSettings info(buildInfo.fileName(), QSettings::IniFormat, this); | 521 | QSettings info(buildInfo.fileName(), QSettings::IniFormat, this); |
524 | buildInfo.close(); | 522 | buildInfo.close(); |
525 | 523 | ||
526 | // check installed Version and Target | 524 | // check installed Version and Target |
527 | QString rbVersion = Detect::installedVersion(settings->value(RbSettings::Mountpoint).toString()); | 525 | QString rbVersion = Detect::installedVersion(RbSettings::value(RbSettings::Mountpoint).toString()); |
528 | QString warning = Detect::check(settings, false); | 526 | QString warning = Detect::check(false); |
529 | 527 | ||
530 | if(!warning.isEmpty()) | 528 | if(!warning.isEmpty()) |
531 | { | 529 | { |
@@ -546,7 +544,7 @@ bool RbUtilQt::installAuto() | |||
546 | QMessageBox::Yes | QMessageBox::No) == QMessageBox::Yes) | 544 | QMessageBox::Yes | QMessageBox::No) == QMessageBox::Yes) |
547 | { | 545 | { |
548 | logger->addItem(tr("Starting backup..."),LOGINFO); | 546 | logger->addItem(tr("Starting backup..."),LOGINFO); |
549 | QString backupName = settings->value(RbSettings::Mountpoint).toString() | 547 | QString backupName = RbSettings::value(RbSettings::Mountpoint).toString() |
550 | + "/.backup/rockbox-backup-" + rbVersion + ".zip"; | 548 | + "/.backup/rockbox-backup-" + rbVersion + ".zip"; |
551 | 549 | ||
552 | //! create dir, if it doesnt exist | 550 | //! create dir, if it doesnt exist |
@@ -561,7 +559,7 @@ bool RbUtilQt::installAuto() | |||
561 | RbZip backup; | 559 | RbZip backup; |
562 | connect(&backup,SIGNAL(zipProgress(int,int)),logger, SLOT(setProgress(int,int))); | 560 | connect(&backup,SIGNAL(zipProgress(int,int)),logger, SLOT(setProgress(int,int))); |
563 | if(backup.createZip(backupName, | 561 | if(backup.createZip(backupName, |
564 | settings->value(RbSettings::Mountpoint).toString() + "/.rockbox") == Zip::Ok) | 562 | RbSettings::value(RbSettings::Mountpoint).toString() + "/.rockbox") == Zip::Ok) |
565 | { | 563 | { |
566 | logger->addItem(tr("Backup successful"),LOGOK); | 564 | logger->addItem(tr("Backup successful"),LOGOK); |
567 | } | 565 | } |
@@ -579,9 +577,9 @@ bool RbUtilQt::installAuto() | |||
579 | installer->setUrl(file); | 577 | installer->setUrl(file); |
580 | installer->setLogSection("Rockbox (Base)"); | 578 | installer->setLogSection("Rockbox (Base)"); |
581 | installer->setLogVersion(versmap.value("rel_rev")); | 579 | installer->setLogVersion(versmap.value("rel_rev")); |
582 | if(!settings->value(RbSettings::CacheDisabled).toBool()) | 580 | if(!RbSettings::value(RbSettings::CacheDisabled).toBool()) |
583 | installer->setCache(true); | 581 | installer->setCache(true); |
584 | installer->setMountPoint(settings->value(RbSettings::Mountpoint).toString()); | 582 | installer->setMountPoint(RbSettings::value(RbSettings::Mountpoint).toString()); |
585 | 583 | ||
586 | connect(installer, SIGNAL(done(bool)), this, SLOT(installdone(bool))); | 584 | connect(installer, SIGNAL(done(bool)), this, SLOT(installdone(bool))); |
587 | connect(installer, SIGNAL(logItem(QString, int)), logger, SLOT(addItem(QString, int))); | 585 | connect(installer, SIGNAL(logItem(QString, int)), logger, SLOT(addItem(QString, int))); |
@@ -595,7 +593,7 @@ bool RbUtilQt::installAuto() | |||
595 | 593 | ||
596 | void RbUtilQt::install() | 594 | void RbUtilQt::install() |
597 | { | 595 | { |
598 | Install *installWindow = new Install(settings,this); | 596 | Install *installWindow = new Install(this); |
599 | 597 | ||
600 | buildInfo.open(); | 598 | buildInfo.open(); |
601 | QSettings info(buildInfo.fileName(), QSettings::IniFormat, this); | 599 | QSettings info(buildInfo.fileName(), QSettings::IniFormat, this); |
@@ -626,13 +624,13 @@ void RbUtilQt::installBootloaderBtn() | |||
626 | 624 | ||
627 | void RbUtilQt::installBootloader() | 625 | void RbUtilQt::installBootloader() |
628 | { | 626 | { |
629 | QString platform = settings->value(RbSettings::Platform).toString(); | 627 | QString platform = RbSettings::value(RbSettings::Platform).toString(); |
630 | QString backupDestination = ""; | 628 | QString backupDestination = ""; |
631 | m_error = false; | 629 | m_error = false; |
632 | 630 | ||
633 | // create installer | 631 | // create installer |
634 | BootloaderInstallBase *bl; | 632 | BootloaderInstallBase *bl; |
635 | QString type = settings->value(RbSettings::CurBootloaderMethod).toString(); | 633 | QString type = RbSettings::value(RbSettings::CurBootloaderMethod).toString(); |
636 | if(type == "mi4") { | 634 | if(type == "mi4") { |
637 | bl = new BootloaderInstallMi4(this); | 635 | bl = new BootloaderInstallMi4(this); |
638 | } | 636 | } |
@@ -656,23 +654,23 @@ void RbUtilQt::installBootloader() | |||
656 | 654 | ||
657 | // set bootloader filename. Do this now as installed() needs it. | 655 | // set bootloader filename. Do this now as installed() needs it. |
658 | QString blfile; | 656 | QString blfile; |
659 | blfile = settings->value(RbSettings::Mountpoint).toString() | 657 | blfile = RbSettings::value(RbSettings::Mountpoint).toString() |
660 | + settings->value(RbSettings::CurBootloaderFile).toString(); | 658 | + RbSettings::value(RbSettings::CurBootloaderFile).toString(); |
661 | // special case for H10 pure: this player can have a different | 659 | // special case for H10 pure: this player can have a different |
662 | // bootloader file filename. This is handled here to keep the install | 660 | // bootloader file filename. This is handled here to keep the install |
663 | // class clean, though having it here is also not the nicest solution. | 661 | // class clean, though having it here is also not the nicest solution. |
664 | if(settings->value(RbSettings::Platform).toString() == "h10_ums" | 662 | if(RbSettings::value(RbSettings::Platform).toString() == "h10_ums" |
665 | || settings->value(RbSettings::Platform) == "h10_mtp") { | 663 | || RbSettings::value(RbSettings::Platform) == "h10_mtp") { |
666 | if(resolvePathCase(blfile).isEmpty()) | 664 | if(resolvePathCase(blfile).isEmpty()) |
667 | blfile = settings->value(RbSettings::Mountpoint).toString() | 665 | blfile = RbSettings::value(RbSettings::Mountpoint).toString() |
668 | + settings->value(RbSettings::CurBootloaderName).toString() | 666 | + RbSettings::value(RbSettings::CurBootloaderName).toString() |
669 | .replace("H10", "H10EMP", Qt::CaseInsensitive); | 667 | .replace("H10", "H10EMP", Qt::CaseInsensitive); |
670 | } | 668 | } |
671 | bl->setBlFile(blfile); | 669 | bl->setBlFile(blfile); |
672 | QUrl url(settings->value(RbSettings::BootloaderUrl).toString() | 670 | QUrl url(RbSettings::value(RbSettings::BootloaderUrl).toString() |
673 | + settings->value(RbSettings::CurBootloaderName).toString()); | 671 | + RbSettings::value(RbSettings::CurBootloaderName).toString()); |
674 | bl->setBlUrl(url); | 672 | bl->setBlUrl(url); |
675 | bl->setLogfile(settings->value(RbSettings::Mountpoint).toString() | 673 | bl->setLogfile(RbSettings::value(RbSettings::Mountpoint).toString() |
676 | + "/.rockbox/rbutil.log"); | 674 | + "/.rockbox/rbutil.log"); |
677 | 675 | ||
678 | if(bl->installed() == BootloaderInstallBase::BootloaderRockbox) { | 676 | if(bl->installed() == BootloaderInstallBase::BootloaderRockbox) { |
@@ -695,7 +693,7 @@ void RbUtilQt::installBootloader() | |||
695 | else if(bl->installed() == BootloaderInstallBase::BootloaderOther | 693 | else if(bl->installed() == BootloaderInstallBase::BootloaderOther |
696 | && bl->capabilities() & BootloaderInstallBase::Backup) | 694 | && bl->capabilities() & BootloaderInstallBase::Backup) |
697 | { | 695 | { |
698 | QString targetFolder = settings->value(RbSettings::CurPlatformName).toString() | 696 | QString targetFolder = RbSettings::value(RbSettings::CurPlatformName).toString() |
699 | + " Firmware Backup"; | 697 | + " Firmware Backup"; |
700 | // remove invalid character(s) | 698 | // remove invalid character(s) |
701 | targetFolder.remove(QRegExp("[:/]")); | 699 | targetFolder.remove(QRegExp("[:/]")); |
@@ -790,7 +788,7 @@ void RbUtilQt::installBootloaderPost(bool error) | |||
790 | return; | 788 | return; |
791 | 789 | ||
792 | QString msg = BootloaderInstallBase::postinstallHints( | 790 | QString msg = BootloaderInstallBase::postinstallHints( |
793 | settings->value(RbSettings::Platform).toString()); | 791 | RbSettings::value(RbSettings::Platform).toString()); |
794 | if(!msg.isEmpty()) { | 792 | if(!msg.isEmpty()) { |
795 | QMessageBox::information(this, tr("Manual steps required"), msg); | 793 | QMessageBox::information(this, tr("Manual steps required"), msg); |
796 | logger->close(); | 794 | logger->close(); |
@@ -822,11 +820,11 @@ void RbUtilQt::installFonts() | |||
822 | // create zip installer | 820 | // create zip installer |
823 | installer = new ZipInstaller(this); | 821 | installer = new ZipInstaller(this); |
824 | 822 | ||
825 | installer->setUrl(settings->value(RbSettings::FontUrl).toString()); | 823 | installer->setUrl(RbSettings::value(RbSettings::FontUrl).toString()); |
826 | installer->setLogSection("Fonts"); | 824 | installer->setLogSection("Fonts"); |
827 | installer->setLogVersion(versmap.value("arch_date")); | 825 | installer->setLogVersion(versmap.value("arch_date")); |
828 | installer->setMountPoint(settings->value(RbSettings::Mountpoint).toString()); | 826 | installer->setMountPoint(RbSettings::value(RbSettings::Mountpoint).toString()); |
829 | if(!settings->value(RbSettings::CacheDisabled).toBool()) | 827 | if(!RbSettings::value(RbSettings::CacheDisabled).toBool()) |
830 | installer->setCache(true); | 828 | installer->setCache(true); |
831 | 829 | ||
832 | connect(installer, SIGNAL(done(bool)), this, SLOT(installdone(bool))); | 830 | connect(installer, SIGNAL(done(bool)), this, SLOT(installdone(bool))); |
@@ -860,17 +858,17 @@ void RbUtilQt::installVoice() | |||
860 | // create zip installer | 858 | // create zip installer |
861 | installer = new ZipInstaller(this); | 859 | installer = new ZipInstaller(this); |
862 | 860 | ||
863 | QString voiceurl = settings->value(RbSettings::VoiceUrl).toString(); | 861 | QString voiceurl = RbSettings::value(RbSettings::VoiceUrl).toString(); |
864 | 862 | ||
865 | voiceurl += settings->value(RbSettings::CurConfigureModel).toString() + "-" + | 863 | voiceurl += RbSettings::value(RbSettings::CurConfigureModel).toString() + "-" + |
866 | versmap.value("arch_date") + "-english.zip"; | 864 | versmap.value("arch_date") + "-english.zip"; |
867 | qDebug() << voiceurl; | 865 | qDebug() << voiceurl; |
868 | 866 | ||
869 | installer->setUrl(voiceurl); | 867 | installer->setUrl(voiceurl); |
870 | installer->setLogSection("Voice"); | 868 | installer->setLogSection("Voice"); |
871 | installer->setLogVersion(versmap.value("arch_date")); | 869 | installer->setLogVersion(versmap.value("arch_date")); |
872 | installer->setMountPoint(settings->value(RbSettings::Mountpoint).toString()); | 870 | installer->setMountPoint(RbSettings::value(RbSettings::Mountpoint).toString()); |
873 | if(!settings->value(RbSettings::CacheDisabled).toBool()) | 871 | if(!RbSettings::value(RbSettings::CacheDisabled).toBool()) |
874 | installer->setCache(true); | 872 | installer->setCache(true); |
875 | connect(installer, SIGNAL(logItem(QString, int)), logger, SLOT(addItem(QString, int))); | 873 | connect(installer, SIGNAL(logItem(QString, int)), logger, SLOT(addItem(QString, int))); |
876 | connect(installer, SIGNAL(logProgress(int, int)), logger, SLOT(setProgress(int, int))); | 874 | connect(installer, SIGNAL(logProgress(int, int)), logger, SLOT(setProgress(int, int))); |
@@ -906,7 +904,7 @@ bool RbUtilQt::installDoomAuto() | |||
906 | 904 | ||
907 | bool RbUtilQt::hasDoom() | 905 | bool RbUtilQt::hasDoom() |
908 | { | 906 | { |
909 | QFile doomrock(settings->value(RbSettings::Mountpoint).toString() | 907 | QFile doomrock(RbSettings::value(RbSettings::Mountpoint).toString() |
910 | +"/.rockbox/rocks/games/doom.rock"); | 908 | +"/.rockbox/rocks/games/doom.rock"); |
911 | return doomrock.exists(); | 909 | return doomrock.exists(); |
912 | } | 910 | } |
@@ -916,11 +914,11 @@ void RbUtilQt::installDoom() | |||
916 | // create zip installer | 914 | // create zip installer |
917 | installer = new ZipInstaller(this); | 915 | installer = new ZipInstaller(this); |
918 | 916 | ||
919 | installer->setUrl(settings->value(RbSettings::DoomUrl).toString()); | 917 | installer->setUrl(RbSettings::value(RbSettings::DoomUrl).toString()); |
920 | installer->setLogSection("Game Addons"); | 918 | installer->setLogSection("Game Addons"); |
921 | installer->setLogVersion(versmap.value("arch_date")); | 919 | installer->setLogVersion(versmap.value("arch_date")); |
922 | installer->setMountPoint(settings->value(RbSettings::Mountpoint).toString()); | 920 | installer->setMountPoint(RbSettings::value(RbSettings::Mountpoint).toString()); |
923 | if(!settings->value(RbSettings::CacheDisabled).toBool()) | 921 | if(!RbSettings::value(RbSettings::CacheDisabled).toBool()) |
924 | installer->setCache(true); | 922 | installer->setCache(true); |
925 | connect(installer, SIGNAL(done(bool)), this, SLOT(installdone(bool))); | 923 | connect(installer, SIGNAL(done(bool)), this, SLOT(installdone(bool))); |
926 | connect(installer, SIGNAL(logItem(QString, int)), logger, SLOT(addItem(QString, int))); | 924 | connect(installer, SIGNAL(logItem(QString, int)), logger, SLOT(addItem(QString, int))); |
@@ -935,7 +933,6 @@ void RbUtilQt::installThemes() | |||
935 | { | 933 | { |
936 | if(chkConfig(true)) return; | 934 | if(chkConfig(true)) return; |
937 | ThemesInstallWindow* tw = new ThemesInstallWindow(this); | 935 | ThemesInstallWindow* tw = new ThemesInstallWindow(this); |
938 | tw->setSettings(settings); | ||
939 | tw->setModal(true); | 936 | tw->setModal(true); |
940 | tw->show(); | 937 | tw->show(); |
941 | } | 938 | } |
@@ -944,7 +941,6 @@ void RbUtilQt::createTalkFiles(void) | |||
944 | { | 941 | { |
945 | if(chkConfig(true)) return; | 942 | if(chkConfig(true)) return; |
946 | InstallTalkWindow *installWindow = new InstallTalkWindow(this); | 943 | InstallTalkWindow *installWindow = new InstallTalkWindow(this); |
947 | installWindow->setSettings(settings); | ||
948 | 944 | ||
949 | connect(installWindow, SIGNAL(settingsUpdated()), this, SLOT(downloadInfo())); | 945 | connect(installWindow, SIGNAL(settingsUpdated()), this, SLOT(downloadInfo())); |
950 | connect(installWindow, SIGNAL(settingsUpdated()), this, SLOT(updateSettings())); | 946 | connect(installWindow, SIGNAL(settingsUpdated()), this, SLOT(updateSettings())); |
@@ -956,8 +952,7 @@ void RbUtilQt::createVoiceFile(void) | |||
956 | { | 952 | { |
957 | if(chkConfig(true)) return; | 953 | if(chkConfig(true)) return; |
958 | CreateVoiceWindow *installWindow = new CreateVoiceWindow(this); | 954 | CreateVoiceWindow *installWindow = new CreateVoiceWindow(this); |
959 | installWindow->setSettings(settings); | 955 | |
960 | |||
961 | connect(installWindow, SIGNAL(settingsUpdated()), this, SLOT(downloadInfo())); | 956 | connect(installWindow, SIGNAL(settingsUpdated()), this, SLOT(downloadInfo())); |
962 | connect(installWindow, SIGNAL(settingsUpdated()), this, SLOT(updateSettings())); | 957 | connect(installWindow, SIGNAL(settingsUpdated()), this, SLOT(updateSettings())); |
963 | installWindow->show(); | 958 | installWindow->show(); |
@@ -967,7 +962,6 @@ void RbUtilQt::uninstall(void) | |||
967 | { | 962 | { |
968 | if(chkConfig(true)) return; | 963 | if(chkConfig(true)) return; |
969 | UninstallWindow *uninstallWindow = new UninstallWindow(this); | 964 | UninstallWindow *uninstallWindow = new UninstallWindow(this); |
970 | uninstallWindow->setSettings(settings); | ||
971 | uninstallWindow->show(); | 965 | uninstallWindow->show(); |
972 | 966 | ||
973 | } | 967 | } |
@@ -983,11 +977,11 @@ void RbUtilQt::uninstallBootloader(void) | |||
983 | logger->setProgressVisible(false); | 977 | logger->setProgressVisible(false); |
984 | logger->show(); | 978 | logger->show(); |
985 | 979 | ||
986 | QString platform = settings->value(RbSettings::Platform).toString(); | 980 | QString platform = RbSettings::value(RbSettings::Platform).toString(); |
987 | 981 | ||
988 | // create installer | 982 | // create installer |
989 | BootloaderInstallBase *bl; | 983 | BootloaderInstallBase *bl; |
990 | QString type = settings->value(RbSettings::CurBootloaderMethod).toString(); | 984 | QString type = RbSettings::value(RbSettings::CurBootloaderMethod).toString(); |
991 | if(type == "mi4") { | 985 | if(type == "mi4") { |
992 | bl = new BootloaderInstallMi4(); | 986 | bl = new BootloaderInstallMi4(); |
993 | } | 987 | } |
@@ -1009,13 +1003,13 @@ void RbUtilQt::uninstallBootloader(void) | |||
1009 | return; | 1003 | return; |
1010 | } | 1004 | } |
1011 | 1005 | ||
1012 | QString blfile = settings->value(RbSettings::Mountpoint).toString() | 1006 | QString blfile = RbSettings::value(RbSettings::Mountpoint).toString() |
1013 | + settings->value(RbSettings::CurBootloaderFile).toString(); | 1007 | + RbSettings::value(RbSettings::CurBootloaderFile).toString(); |
1014 | if(settings->value(RbSettings::Platform).toString() == "h10_ums" | 1008 | if(RbSettings::value(RbSettings::Platform).toString() == "h10_ums" |
1015 | || settings->value(RbSettings::Platform).toString() == "h10_mtp") { | 1009 | || RbSettings::value(RbSettings::Platform).toString() == "h10_mtp") { |
1016 | if(resolvePathCase(blfile).isEmpty()) | 1010 | if(resolvePathCase(blfile).isEmpty()) |
1017 | blfile = settings->value(RbSettings::Mountpoint).toString() | 1011 | blfile = RbSettings::value(RbSettings::Mountpoint).toString() |
1018 | + settings->value(RbSettings::CurBootloaderName).toString() | 1012 | + RbSettings::value(RbSettings::CurBootloaderName).toString() |
1019 | .replace("H10", "H10EMP", Qt::CaseInsensitive); | 1013 | .replace("H10", "H10EMP", Qt::CaseInsensitive); |
1020 | } | 1014 | } |
1021 | bl->setBlFile(blfile); | 1015 | bl->setBlFile(blfile); |
@@ -1044,7 +1038,7 @@ void RbUtilQt::downloadManual(void) | |||
1044 | QSettings info(buildInfo.fileName(), QSettings::IniFormat, this); | 1038 | QSettings info(buildInfo.fileName(), QSettings::IniFormat, this); |
1045 | buildInfo.close(); | 1039 | buildInfo.close(); |
1046 | 1040 | ||
1047 | QString manual = settings->value(RbSettings::CurManual).toString(); | 1041 | QString manual = RbSettings::value(RbSettings::CurManual).toString(); |
1048 | 1042 | ||
1049 | QString date = (info.value("dailies/date").toString()); | 1043 | QString date = (info.value("dailies/date").toString()); |
1050 | 1044 | ||
@@ -1059,14 +1053,14 @@ void RbUtilQt::downloadManual(void) | |||
1059 | target = "/" + manual + "-" + date + "-html.zip"; | 1053 | target = "/" + manual + "-" + date + "-html.zip"; |
1060 | section = "Manual (HTML)"; | 1054 | section = "Manual (HTML)"; |
1061 | } | 1055 | } |
1062 | manualurl = settings->value(RbSettings::ManualUrl).toString() + "/" + target; | 1056 | manualurl = RbSettings::value(RbSettings::ManualUrl).toString() + "/" + target; |
1063 | qDebug() << "manualurl =" << manualurl; | 1057 | qDebug() << "manualurl =" << manualurl; |
1064 | 1058 | ||
1065 | ProgressLoggerGui* logger = new ProgressLoggerGui(this); | 1059 | ProgressLoggerGui* logger = new ProgressLoggerGui(this); |
1066 | logger->show(); | 1060 | logger->show(); |
1067 | installer = new ZipInstaller(this); | 1061 | installer = new ZipInstaller(this); |
1068 | installer->setMountPoint(settings->value(RbSettings::Mountpoint).toString()); | 1062 | installer->setMountPoint(RbSettings::value(RbSettings::Mountpoint).toString()); |
1069 | if(!settings->value(RbSettings::CacheDisabled).toBool()) | 1063 | if(!RbSettings::value(RbSettings::CacheDisabled).toBool()) |
1070 | installer->setCache(true); | 1064 | installer->setCache(true); |
1071 | installer->setLogSection(section); | 1065 | installer->setLogSection(section); |
1072 | installer->setLogVersion(date); | 1066 | installer->setLogVersion(date); |
@@ -1096,28 +1090,28 @@ void RbUtilQt::installPortable(void) | |||
1096 | logger->addItem(tr("Installing Rockbox Utility"), LOGINFO); | 1090 | logger->addItem(tr("Installing Rockbox Utility"), LOGINFO); |
1097 | 1091 | ||
1098 | // check mountpoint | 1092 | // check mountpoint |
1099 | if(!QFileInfo(settings->value(RbSettings::Mountpoint).toString()).isDir()) { | 1093 | if(!QFileInfo(RbSettings::value(RbSettings::Mountpoint).toString()).isDir()) { |
1100 | logger->addItem(tr("Mount point is wrong!"),LOGERROR); | 1094 | logger->addItem(tr("Mount point is wrong!"),LOGERROR); |
1101 | logger->setFinished(); | 1095 | logger->setFinished(); |
1102 | return; | 1096 | return; |
1103 | } | 1097 | } |
1104 | 1098 | ||
1105 | // remove old files first. | 1099 | // remove old files first. |
1106 | QFile::remove(settings->value(RbSettings::Mountpoint).toString() | 1100 | QFile::remove(RbSettings::value(RbSettings::Mountpoint).toString() |
1107 | + "/RockboxUtility.exe"); | 1101 | + "/RockboxUtility.exe"); |
1108 | QFile::remove(settings->value(RbSettings::Mountpoint).toString() | 1102 | QFile::remove(RbSettings::value(RbSettings::Mountpoint).toString() |
1109 | + "/RockboxUtility.ini"); | 1103 | + "/RockboxUtility.ini"); |
1110 | // copy currently running binary and currently used settings file | 1104 | // copy currently running binary and currently used settings file |
1111 | if(!QFile::copy(qApp->applicationFilePath(), | 1105 | if(!QFile::copy(qApp->applicationFilePath(), |
1112 | settings->value(RbSettings::Mountpoint).toString() | 1106 | RbSettings::value(RbSettings::Mountpoint).toString() |
1113 | + "/RockboxUtility.exe")) { | 1107 | + "/RockboxUtility.exe")) { |
1114 | logger->addItem(tr("Error installing Rockbox Utility"), LOGERROR); | 1108 | logger->addItem(tr("Error installing Rockbox Utility"), LOGERROR); |
1115 | logger->setFinished(); | 1109 | logger->setFinished(); |
1116 | return; | 1110 | return; |
1117 | } | 1111 | } |
1118 | logger->addItem(tr("Installing user configuration"), LOGINFO); | 1112 | logger->addItem(tr("Installing user configuration"), LOGINFO); |
1119 | if(!QFile::copy(settings->userSettingFilename(), | 1113 | if(!QFile::copy(RbSettings::userSettingFilename(), |
1120 | settings->value(RbSettings::Mountpoint).toString() | 1114 | RbSettings::value(RbSettings::Mountpoint).toString() |
1121 | + "/RockboxUtility.ini")) { | 1115 | + "/RockboxUtility.ini")) { |
1122 | logger->addItem(tr("Error installing user configuration"), LOGERROR); | 1116 | logger->addItem(tr("Error installing user configuration"), LOGERROR); |
1123 | logger->setFinished(); | 1117 | logger->setFinished(); |
@@ -1135,7 +1129,7 @@ void RbUtilQt::updateInfo() | |||
1135 | { | 1129 | { |
1136 | qDebug() << "RbUtilQt::updateInfo()"; | 1130 | qDebug() << "RbUtilQt::updateInfo()"; |
1137 | 1131 | ||
1138 | QSettings log(settings->value(RbSettings::Mountpoint).toString() | 1132 | QSettings log(RbSettings::value(RbSettings::Mountpoint).toString() |
1139 | + "/.rockbox/rbutil.log", QSettings::IniFormat, this); | 1133 | + "/.rockbox/rbutil.log", QSettings::IniFormat, this); |
1140 | QStringList groups = log.childGroups(); | 1134 | QStringList groups = log.childGroups(); |
1141 | QList<QTreeWidgetItem *> items; | 1135 | QList<QTreeWidgetItem *> items; |
@@ -1172,7 +1166,7 @@ void RbUtilQt::updateInfo() | |||
1172 | 1166 | ||
1173 | for(int b = 0; b < keys.size(); b++) { | 1167 | for(int b = 0; b < keys.size(); b++) { |
1174 | QString file; | 1168 | QString file; |
1175 | file = settings->value(RbSettings::Mountpoint).toString() + "/" + keys.at(b); | 1169 | file = RbSettings::value(RbSettings::Mountpoint).toString() + "/" + keys.at(b); |
1176 | if(QFileInfo(file).isDir()) | 1170 | if(QFileInfo(file).isDir()) |
1177 | continue; | 1171 | continue; |
1178 | w2 = new QTreeWidgetItem(w, QStringList() << "/" | 1172 | w2 = new QTreeWidgetItem(w, QStringList() << "/" |
@@ -1197,9 +1191,9 @@ void RbUtilQt::updateInfo() | |||
1197 | 1191 | ||
1198 | QUrl RbUtilQt::proxy() | 1192 | QUrl RbUtilQt::proxy() |
1199 | { | 1193 | { |
1200 | if(settings->value(RbSettings::ProxyType) == "manual") | 1194 | if(RbSettings::value(RbSettings::ProxyType) == "manual") |
1201 | return QUrl(settings->value(RbSettings::Proxy).toString()); | 1195 | return QUrl(RbSettings::value(RbSettings::Proxy).toString()); |
1202 | else if(settings->value(RbSettings::ProxyType) == "system") | 1196 | else if(RbSettings::value(RbSettings::ProxyType) == "system") |
1203 | return Detect::systemProxy(); | 1197 | return Detect::systemProxy(); |
1204 | return QUrl(""); | 1198 | return QUrl(""); |
1205 | } | 1199 | } |
@@ -1208,9 +1202,9 @@ QUrl RbUtilQt::proxy() | |||
1208 | bool RbUtilQt::chkConfig(bool warn) | 1202 | bool RbUtilQt::chkConfig(bool warn) |
1209 | { | 1203 | { |
1210 | bool error = false; | 1204 | bool error = false; |
1211 | if(settings->value(RbSettings::Platform).toString().isEmpty() | 1205 | if(RbSettings::value(RbSettings::Platform).toString().isEmpty() |
1212 | || settings->value(RbSettings::Mountpoint).toString().isEmpty() | 1206 | || RbSettings::value(RbSettings::Mountpoint).toString().isEmpty() |
1213 | || !QFileInfo(settings->value(RbSettings::Mountpoint).toString()).isWritable()) { | 1207 | || !QFileInfo(RbSettings::value(RbSettings::Mountpoint).toString()).isWritable()) { |
1214 | error = true; | 1208 | error = true; |
1215 | 1209 | ||
1216 | if(warn) QMessageBox::critical(this, tr("Configuration error"), | 1210 | 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 @@ | |||
32 | #include "progressloggergui.h" | 32 | #include "progressloggergui.h" |
33 | #include "bootloaderinstallbase.h" | 33 | #include "bootloaderinstallbase.h" |
34 | 34 | ||
35 | #include "rbsettings.h" | ||
36 | |||
37 | class RbUtilQt : public QMainWindow | 35 | class RbUtilQt : public QMainWindow |
38 | { | 36 | { |
39 | Q_OBJECT | 37 | Q_OBJECT |
@@ -43,8 +41,7 @@ class RbUtilQt : public QMainWindow | |||
43 | 41 | ||
44 | private: | 42 | private: |
45 | Ui::RbUtilQtFrm ui; | 43 | Ui::RbUtilQtFrm ui; |
46 | RbSettings* settings; | 44 | |
47 | |||
48 | void initDeviceNames(void); | 45 | void initDeviceNames(void); |
49 | QString deviceName(QString); | 46 | QString deviceName(QString); |
50 | QString platform; | 47 | 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 @@ | |||
18 | ****************************************************************************/ | 18 | ****************************************************************************/ |
19 | 19 | ||
20 | #include "talkfile.h" | 20 | #include "talkfile.h" |
21 | #include "rbsettings.h" | ||
21 | 22 | ||
22 | TalkFileCreator::TalkFileCreator(QObject* parent): QObject(parent) | 23 | TalkFileCreator::TalkFileCreator(QObject* parent): QObject(parent) |
23 | { | 24 | { |
@@ -40,8 +41,7 @@ bool TalkFileCreator::createTalkFiles(ProgressloggerInterface* logger) | |||
40 | m_logger->addItem(tr("Starting Talk file generation"),LOGINFO); | 41 | m_logger->addItem(tr("Starting Talk file generation"),LOGINFO); |
41 | 42 | ||
42 | //tts | 43 | //tts |
43 | m_tts = TTSBase::getTTS(this,settings->value(RbSettings::Tts).toString()); | 44 | m_tts = TTSBase::getTTS(this,RbSettings::value(RbSettings::Tts).toString()); |
44 | m_tts->setCfg(settings); | ||
45 | 45 | ||
46 | if(!m_tts->start(&errStr)) | 46 | if(!m_tts->start(&errStr)) |
47 | { | 47 | { |
@@ -52,8 +52,7 @@ bool TalkFileCreator::createTalkFiles(ProgressloggerInterface* logger) | |||
52 | } | 52 | } |
53 | 53 | ||
54 | // Encoder | 54 | // Encoder |
55 | m_enc = EncBase::getEncoder(this,settings->value(RbSettings::CurEncoder).toString()); | 55 | m_enc = EncBase::getEncoder(this,RbSettings::value(RbSettings::CurEncoder).toString()); |
56 | m_enc->setCfg(settings); | ||
57 | 56 | ||
58 | if(!m_enc->start()) | 57 | if(!m_enc->start()) |
59 | { | 58 | { |
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: | |||
37 | TalkFileCreator(QObject* parent); | 37 | TalkFileCreator(QObject* parent); |
38 | 38 | ||
39 | bool createTalkFiles(ProgressloggerInterface* logger); | 39 | bool createTalkFiles(ProgressloggerInterface* logger); |
40 | |||
41 | void setSettings(RbSettings* sett) { settings = sett;} | ||
42 | 40 | ||
43 | void setDir(QDir dir){m_dir = dir; } | 41 | void setDir(QDir dir){m_dir = dir; } |
44 | void setMountPoint(QString mountpoint) {m_mountpoint =mountpoint; } | 42 | void setMountPoint(QString mountpoint) {m_mountpoint =mountpoint; } |
@@ -65,7 +63,6 @@ private: | |||
65 | 63 | ||
66 | TTSBase* m_tts; | 64 | TTSBase* m_tts; |
67 | EncBase* m_enc; | 65 | EncBase* m_enc; |
68 | RbSettings* settings; | ||
69 | 66 | ||
70 | QDir m_dir; | 67 | QDir m_dir; |
71 | QString m_mountpoint; | 68 | 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 @@ | |||
24 | #include "zipinstaller.h" | 24 | #include "zipinstaller.h" |
25 | #include "progressloggergui.h" | 25 | #include "progressloggergui.h" |
26 | #include "utils.h" | 26 | #include "utils.h" |
27 | #include "rbsettings.h" | ||
27 | 28 | ||
28 | ThemesInstallWindow::ThemesInstallWindow(QWidget *parent) : QDialog(parent) | 29 | ThemesInstallWindow::ThemesInstallWindow(QWidget *parent) : QDialog(parent) |
29 | { | 30 | { |
@@ -61,11 +62,11 @@ void ThemesInstallWindow::downloadInfo() | |||
61 | themesInfo.close(); | 62 | themesInfo.close(); |
62 | 63 | ||
63 | QUrl url; | 64 | QUrl url; |
64 | url = QUrl(settings->value(RbSettings::ThemesUrl).toString() + "/rbutilqt.php?target=" | 65 | url = QUrl(RbSettings::value(RbSettings::ThemesUrl).toString() + "/rbutilqt.php?target=" |
65 | + settings->value(RbSettings::CurConfigureModel).toString()); | 66 | + RbSettings::value(RbSettings::CurConfigureModel).toString()); |
66 | qDebug() << "downloadInfo()" << url; | 67 | qDebug() << "downloadInfo()" << url; |
67 | qDebug() << url.queryItems(); | 68 | qDebug() << url.queryItems(); |
68 | if(settings->value(RbSettings::CacheOffline).toBool()) | 69 | if(RbSettings::value(RbSettings::CacheOffline).toBool()) |
69 | getter->setCache(true); | 70 | getter->setCache(true); |
70 | getter->setFile(&themesInfo); | 71 | getter->setFile(&themesInfo); |
71 | 72 | ||
@@ -144,7 +145,7 @@ void ThemesInstallWindow::downloadDone(bool error) | |||
144 | // check if there's a themes "MOTD" available | 145 | // check if there's a themes "MOTD" available |
145 | if(iniDetails.contains("status/msg")) { | 146 | if(iniDetails.contains("status/msg")) { |
146 | // check if there's a localized msg available | 147 | // check if there's a localized msg available |
147 | QString lang = settings->value(RbSettings::Language).toString().split("_").at(0); | 148 | QString lang = RbSettings::value(RbSettings::Language).toString().split("_").at(0); |
148 | QString msg; | 149 | QString msg; |
149 | if(iniDetails.contains("status/msg." + lang)) | 150 | if(iniDetails.contains("status/msg." + lang)) |
150 | msg = iniDetails.value("status/msg." + lang).toString(); | 151 | msg = iniDetails.value("status/msg." + lang).toString(); |
@@ -191,9 +192,9 @@ void ThemesInstallWindow::updateDetails(QListWidgetItem* cur, QListWidgetItem* p | |||
191 | iniDetails.beginGroup(cur->data(Qt::UserRole).toString()); | 192 | iniDetails.beginGroup(cur->data(Qt::UserRole).toString()); |
192 | 193 | ||
193 | QUrl img, txt; | 194 | QUrl img, txt; |
194 | txt = QUrl(QString(settings->value(RbSettings::ThemesUrl).toString() + "/" | 195 | txt = QUrl(QString(RbSettings::value(RbSettings::ThemesUrl).toString() + "/" |
195 | + iniDetails.value("descriptionfile").toString())); | 196 | + iniDetails.value("descriptionfile").toString())); |
196 | img = QUrl(QString(settings->value(RbSettings::ThemesUrl).toString() + "/" | 197 | img = QUrl(QString(RbSettings::value(RbSettings::ThemesUrl).toString() + "/" |
197 | + iniDetails.value("image").toString())); | 198 | + iniDetails.value("image").toString())); |
198 | 199 | ||
199 | QString text; | 200 | QString text; |
@@ -211,7 +212,7 @@ void ThemesInstallWindow::updateDetails(QListWidgetItem* cur, QListWidgetItem* p | |||
211 | iniDetails.endGroup(); | 212 | iniDetails.endGroup(); |
212 | 213 | ||
213 | igetter.abort(); | 214 | igetter.abort(); |
214 | if(!settings->value(RbSettings::CacheDisabled).toBool()) | 215 | if(!RbSettings::value(RbSettings::CacheDisabled).toBool()) |
215 | igetter.setCache(true); | 216 | igetter.setCache(true); |
216 | else | 217 | else |
217 | { | 218 | { |
@@ -307,7 +308,7 @@ void ThemesInstallWindow::accept() | |||
307 | QSettings iniDetails(themesInfo.fileName(), QSettings::IniFormat, this); | 308 | QSettings iniDetails(themesInfo.fileName(), QSettings::IniFormat, this); |
308 | for(int i = 0; i < ui.listThemes->selectedItems().size(); i++) { | 309 | for(int i = 0; i < ui.listThemes->selectedItems().size(); i++) { |
309 | iniDetails.beginGroup(ui.listThemes->selectedItems().at(i)->data(Qt::UserRole).toString()); | 310 | iniDetails.beginGroup(ui.listThemes->selectedItems().at(i)->data(Qt::UserRole).toString()); |
310 | zip = settings->value(RbSettings::ThemesUrl).toString() | 311 | zip = RbSettings::value(RbSettings::ThemesUrl).toString() |
311 | + "/" + iniDetails.value("archive").toString(); | 312 | + "/" + iniDetails.value("archive").toString(); |
312 | themes.append(zip); | 313 | themes.append(zip); |
313 | names.append("Theme: " + | 314 | names.append("Theme: " + |
@@ -321,7 +322,7 @@ void ThemesInstallWindow::accept() | |||
321 | 322 | ||
322 | logger = new ProgressLoggerGui(this); | 323 | logger = new ProgressLoggerGui(this); |
323 | logger->show(); | 324 | logger->show(); |
324 | QString mountPoint = settings->value(RbSettings::Mountpoint).toString(); | 325 | QString mountPoint = RbSettings::value(RbSettings::Mountpoint).toString(); |
325 | qDebug() << "mountpoint:" << mountPoint; | 326 | qDebug() << "mountpoint:" << mountPoint; |
326 | // show dialog with error if mount point is wrong | 327 | // show dialog with error if mount point is wrong |
327 | if(!QFileInfo(mountPoint).isDir()) { | 328 | if(!QFileInfo(mountPoint).isDir()) { |
@@ -335,7 +336,7 @@ void ThemesInstallWindow::accept() | |||
335 | installer->setLogSection(names); | 336 | installer->setLogSection(names); |
336 | installer->setLogVersion(version); | 337 | installer->setLogVersion(version); |
337 | installer->setMountPoint(mountPoint); | 338 | installer->setMountPoint(mountPoint); |
338 | if(!settings->value(RbSettings::CacheDisabled).toBool()) | 339 | if(!RbSettings::value(RbSettings::CacheDisabled).toBool()) |
339 | installer->setCache(true); | 340 | installer->setCache(true); |
340 | 341 | ||
341 | connect(logger, SIGNAL(closed()), this, SLOT(close())); | 342 | 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 @@ | |||
29 | #include "httpget.h" | 29 | #include "httpget.h" |
30 | #include "zipinstaller.h" | 30 | #include "zipinstaller.h" |
31 | #include "progressloggergui.h" | 31 | #include "progressloggergui.h" |
32 | #include "rbsettings.h" | ||
33 | 32 | ||
34 | class ThemesInstallWindow : public QDialog | 33 | class ThemesInstallWindow : public QDialog |
35 | { | 34 | { |
@@ -38,7 +37,6 @@ class ThemesInstallWindow : public QDialog | |||
38 | public: | 37 | public: |
39 | ThemesInstallWindow(QWidget* parent = 0); | 38 | ThemesInstallWindow(QWidget* parent = 0); |
40 | ~ThemesInstallWindow(); | 39 | ~ThemesInstallWindow(); |
41 | void setSettings(RbSettings* sett){settings=sett;} | ||
42 | void downloadInfo(void); | 40 | void downloadInfo(void); |
43 | void show(void); | 41 | void show(void); |
44 | 42 | ||
@@ -47,7 +45,6 @@ class ThemesInstallWindow : public QDialog | |||
47 | 45 | ||
48 | private: | 46 | private: |
49 | Ui::ThemeInstallFrm ui; | 47 | Ui::ThemeInstallFrm ui; |
50 | RbSettings* settings; | ||
51 | HttpGet *getter; | 48 | HttpGet *getter; |
52 | HttpGet igetter; | 49 | HttpGet igetter; |
53 | QTemporaryFile themesInfo; | 50 | 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 @@ | |||
19 | 19 | ||
20 | #include "uninstallwindow.h" | 20 | #include "uninstallwindow.h" |
21 | #include "ui_uninstallfrm.h" | 21 | #include "ui_uninstallfrm.h" |
22 | 22 | #include "rbsettings.h" | |
23 | 23 | ||
24 | UninstallWindow::UninstallWindow(QWidget *parent) : QDialog(parent) | 24 | UninstallWindow::UninstallWindow(QWidget *parent) : QDialog(parent) |
25 | { | 25 | { |
@@ -27,6 +27,24 @@ UninstallWindow::UninstallWindow(QWidget *parent) : QDialog(parent) | |||
27 | ui.UninstalllistWidget->setAlternatingRowColors(true); | 27 | ui.UninstalllistWidget->setAlternatingRowColors(true); |
28 | connect(ui.UninstalllistWidget,SIGNAL(itemSelectionChanged()),this,SLOT(selectionChanged())); | 28 | connect(ui.UninstalllistWidget,SIGNAL(itemSelectionChanged()),this,SLOT(selectionChanged())); |
29 | connect(ui.CompleteRadioBtn,SIGNAL(toggled(bool)),this,SLOT(UninstallMethodChanged(bool))); | 29 | connect(ui.CompleteRadioBtn,SIGNAL(toggled(bool)),this,SLOT(UninstallMethodChanged(bool))); |
30 | |||
31 | QString mountpoint = RbSettings::value(RbSettings::Mountpoint).toString(); | ||
32 | |||
33 | uninstaller = new Uninstaller(this,mountpoint); | ||
34 | |||
35 | // disable smart uninstall, if not possible | ||
36 | if(!uninstaller->uninstallPossible()) | ||
37 | { | ||
38 | ui.smartRadioButton->setEnabled(false); | ||
39 | ui.smartGroupBox->setEnabled(false); | ||
40 | ui.CompleteRadioBtn->setChecked(true); | ||
41 | } | ||
42 | else // fill in installed parts | ||
43 | { | ||
44 | ui.smartRadioButton->setChecked(true); | ||
45 | ui.UninstalllistWidget->addItems(uninstaller->getAllSections()); | ||
46 | } | ||
47 | |||
30 | } | 48 | } |
31 | 49 | ||
32 | 50 | ||
@@ -68,24 +86,3 @@ void UninstallWindow::UninstallMethodChanged(bool complete) | |||
68 | ui.smartGroupBox->setEnabled(true); | 86 | ui.smartGroupBox->setEnabled(true); |
69 | } | 87 | } |
70 | 88 | ||
71 | |||
72 | void UninstallWindow::setSettings(RbSettings *sett) | ||
73 | { | ||
74 | settings = sett; | ||
75 | |||
76 | QString mountpoint = settings->value(RbSettings::Mountpoint).toString(); | ||
77 | uninstaller = new Uninstaller(this,mountpoint); | ||
78 | |||
79 | // disable smart uninstall, if not possible | ||
80 | if(!uninstaller->uninstallPossible()) | ||
81 | { | ||
82 | ui.smartRadioButton->setEnabled(false); | ||
83 | ui.smartGroupBox->setEnabled(false); | ||
84 | ui.CompleteRadioBtn->setChecked(true); | ||
85 | } | ||
86 | else // fill in installed parts | ||
87 | { | ||
88 | ui.smartRadioButton->setChecked(true); | ||
89 | ui.UninstalllistWidget->addItems(uninstaller->getAllSections()); | ||
90 | } | ||
91 | } | ||
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 @@ | |||
27 | #include "ui_uninstallfrm.h" | 27 | #include "ui_uninstallfrm.h" |
28 | #include "progressloggergui.h" | 28 | #include "progressloggergui.h" |
29 | #include "uninstall.h" | 29 | #include "uninstall.h" |
30 | #include "rbsettings.h" | ||
31 | 30 | ||
32 | class UninstallWindow : public QDialog | 31 | class UninstallWindow : public QDialog |
33 | { | 32 | { |
34 | Q_OBJECT | 33 | Q_OBJECT |
35 | public: | 34 | public: |
36 | UninstallWindow(QWidget *parent = 0); | 35 | UninstallWindow(QWidget *parent = 0); |
37 | void setSettings(RbSettings* sett); | ||
38 | 36 | ||
39 | public slots: | 37 | public slots: |
40 | void accept(void); | 38 | void accept(void); |
@@ -46,8 +44,6 @@ class UninstallWindow : public QDialog | |||
46 | Uninstaller* uninstaller; | 44 | Uninstaller* uninstaller; |
47 | Ui::UninstallFrm ui; | 45 | Ui::UninstallFrm ui; |
48 | ProgressLoggerGui* logger; | 46 | ProgressLoggerGui* logger; |
49 | RbSettings* settings; | ||
50 | |||
51 | }; | 47 | }; |
52 | 48 | ||
53 | 49 | ||
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 @@ | |||
19 | 19 | ||
20 | #include "voicefile.h" | 20 | #include "voicefile.h" |
21 | #include "utils.h" | 21 | #include "utils.h" |
22 | #include "rbsettings.h" | ||
22 | 23 | ||
23 | #define STATE_INVALID 0 | 24 | #define STATE_INVALID 0 |
24 | #define STATE_PHRASE 1 | 25 | #define STATE_PHRASE 1 |
@@ -65,7 +66,7 @@ bool VoiceFileCreator::createVoiceFile(ProgressloggerInterface* logger) | |||
65 | version = version.left(version.indexOf("-")).remove(0,1); | 66 | version = version.left(version.indexOf("-")).remove(0,1); |
66 | 67 | ||
67 | //prepare download url | 68 | //prepare download url |
68 | QUrl genlangUrl = settings->value(RbSettings::GenlangUrl).toString() | 69 | QUrl genlangUrl = RbSettings::value(RbSettings::GenlangUrl).toString() |
69 | +"?lang=" + m_lang + "&t=" + target + "&rev=" + version + "&f=" + features; | 70 | +"?lang=" + m_lang + "&t=" + target + "&rev=" + version + "&f=" + features; |
70 | 71 | ||
71 | qDebug() << "downloading " << genlangUrl; | 72 | qDebug() << "downloading " << genlangUrl; |
@@ -128,8 +129,7 @@ void VoiceFileCreator::downloadDone(bool error) | |||
128 | } | 129 | } |
129 | 130 | ||
130 | //tts | 131 | //tts |
131 | m_tts = TTSBase::getTTS(this,settings->value(RbSettings::Tts).toString()); | 132 | m_tts = TTSBase::getTTS(this,RbSettings::value(RbSettings::Tts).toString()); |
132 | m_tts->setCfg(settings); | ||
133 | 133 | ||
134 | QString errStr; | 134 | QString errStr; |
135 | if(!m_tts->start(&errStr)) | 135 | if(!m_tts->start(&errStr)) |
@@ -142,8 +142,7 @@ void VoiceFileCreator::downloadDone(bool error) | |||
142 | } | 142 | } |
143 | 143 | ||
144 | // Encoder | 144 | // Encoder |
145 | m_enc = EncBase::getEncoder(this,settings->value(RbSettings::CurEncoder).toString()); | 145 | m_enc = EncBase::getEncoder(this,RbSettings::value(RbSettings::CurEncoder).toString()); |
146 | m_enc->setCfg(settings); | ||
147 | 146 | ||
148 | if(!m_enc->start()) | 147 | if(!m_enc->start()) |
149 | { | 148 | { |
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 @@ | |||
29 | #include "encoders.h" | 29 | #include "encoders.h" |
30 | #include "tts.h" | 30 | #include "tts.h" |
31 | #include "httpget.h" | 31 | #include "httpget.h" |
32 | #include "rbsettings.h" | ||
33 | 32 | ||
34 | #include "wavtrim.h" | 33 | #include "wavtrim.h" |
35 | #include "voicefont.h" | 34 | #include "voicefont.h" |
@@ -43,9 +42,6 @@ public: | |||
43 | //start creation | 42 | //start creation |
44 | bool createVoiceFile(ProgressloggerInterface* logger); | 43 | bool createVoiceFile(ProgressloggerInterface* logger); |
45 | 44 | ||
46 | // set infos | ||
47 | void setSettings(RbSettings* sett) { settings = sett;} | ||
48 | |||
49 | void setMountPoint(QString mountpoint) {m_mountpoint =mountpoint; } | 45 | void setMountPoint(QString mountpoint) {m_mountpoint =mountpoint; } |
50 | void setTargetId(int id){m_targetid = id;} | 46 | void setTargetId(int id){m_targetid = id;} |
51 | void setLang(QString name){m_lang =name;} | 47 | void setLang(QString name){m_lang =name;} |
@@ -64,7 +60,6 @@ private: | |||
64 | // ptr to encoder, tts and settings | 60 | // ptr to encoder, tts and settings |
65 | TTSBase* m_tts; | 61 | TTSBase* m_tts; |
66 | EncBase* m_enc; | 62 | EncBase* m_enc; |
67 | RbSettings* settings; | ||
68 | HttpGet *getter; | 63 | HttpGet *getter; |
69 | 64 | ||
70 | QString filename; //the temporary file | 65 | QString filename; //the temporary file |