diff options
author | Dominik Wenger <domonoky@googlemail.com> | 2010-01-20 22:18:36 +0000 |
---|---|---|
committer | Dominik Wenger <domonoky@googlemail.com> | 2010-01-20 22:18:36 +0000 |
commit | 8363619e666b37cf8e33f71ea1bfe44676b401e3 (patch) | |
tree | 2090e3f3c2bfbd5908c18b453c6d228de3d5c42e | |
parent | b5d16e79e191af7c4cb34be685770166e8dfcfa6 (diff) | |
download | rockbox-8363619e666b37cf8e33f71ea1bfe44676b401e3.tar.gz rockbox-8363619e666b37cf8e33f71ea1bfe44676b401e3.zip |
rbutil: store the info from the server centrally in RbSetttings. Dont download build-info multiple times. Rename install.cpp
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@24301 a1c6a512-1295-4272-9138-f99709370657
-rw-r--r-- | rbutil/rbutilqt/base/rbsettings.cpp | 60 | ||||
-rw-r--r-- | rbutil/rbutilqt/base/rbsettings.h | 17 | ||||
-rw-r--r-- | rbutil/rbutilqt/installwindow.cpp (renamed from rbutil/rbutilqt/install.cpp) | 124 | ||||
-rw-r--r-- | rbutil/rbutilqt/installwindow.h (renamed from rbutil/rbutilqt/install.h) | 6 | ||||
-rw-r--r-- | rbutil/rbutilqt/rbutilqt.cpp | 106 | ||||
-rw-r--r-- | rbutil/rbutilqt/rbutilqt.h | 1 | ||||
-rw-r--r-- | rbutil/rbutilqt/rbutilqt.pro | 4 |
7 files changed, 195 insertions, 123 deletions
diff --git a/rbutil/rbutilqt/base/rbsettings.cpp b/rbutil/rbutilqt/base/rbsettings.cpp index bd6f94f2f4..527312b108 100644 --- a/rbutil/rbutilqt/base/rbsettings.cpp +++ b/rbutil/rbutilqt/base/rbsettings.cpp | |||
@@ -94,9 +94,24 @@ const static struct { | |||
94 | { RbSettings::EncoderVolume, ":encoder:/volume", "1.0" }, | 94 | { RbSettings::EncoderVolume, ":encoder:/volume", "1.0" }, |
95 | }; | 95 | }; |
96 | 96 | ||
97 | // server settings | ||
98 | const static struct { | ||
99 | RbSettings::ServerSettings setting; | ||
100 | const char* name; | ||
101 | const char* def; | ||
102 | } ServerSettingsList[] = { | ||
103 | { RbSettings::CurReleaseVersion, ":platform:/releaseversion", "" }, | ||
104 | { RbSettings::CurStatus, ":platform:/status", "" }, | ||
105 | { RbSettings::DailyRevision, "dailyrev", "" }, | ||
106 | { RbSettings::DailyDate, "dailydate", "" }, | ||
107 | { RbSettings::BleedingRevision, "bleedingrev", "" }, | ||
108 | { RbSettings::BleedingDate, "bleedingdate", "" }, | ||
109 | }; | ||
110 | |||
97 | //! pointer to setting object to NULL | 111 | //! pointer to setting object to NULL |
98 | QSettings* RbSettings::systemSettings = NULL; | 112 | QSettings* RbSettings::systemSettings = NULL; |
99 | QSettings* RbSettings::userSettings = NULL; | 113 | QSettings* RbSettings::userSettings = NULL; |
114 | QSettings* RbSettings::serverSettings = NULL; | ||
100 | 115 | ||
101 | void RbSettings::ensureRbSettingsExists() | 116 | void RbSettings::ensureRbSettingsExists() |
102 | { | 117 | { |
@@ -106,7 +121,13 @@ void RbSettings::ensureRbSettingsExists() | |||
106 | // only use built-in rbutil.ini | 121 | // only use built-in rbutil.ini |
107 | systemSettings = new QSettings(":/ini/rbutil.ini", QSettings::IniFormat, 0); | 122 | systemSettings = new QSettings(":/ini/rbutil.ini", QSettings::IniFormat, 0); |
108 | } | 123 | } |
109 | 124 | ||
125 | if(serverSettings == NULL) | ||
126 | { | ||
127 | serverSettings = new QSettings(QSettings::IniFormat, | ||
128 | QSettings::UserScope, "rockbox.org", "RockboxUtility",NULL); | ||
129 | } | ||
130 | |||
110 | if(userSettings == NULL) | 131 | if(userSettings == NULL) |
111 | { | 132 | { |
112 | // portable installation: | 133 | // portable installation: |
@@ -200,6 +221,20 @@ QVariant RbSettings::subValue(QString sub, enum UserSettings setting) | |||
200 | return userSettings->value(s, UserSettingsList[i].def); | 221 | return userSettings->value(s, UserSettingsList[i].def); |
201 | } | 222 | } |
202 | 223 | ||
224 | QVariant RbSettings::value(enum ServerSettings setting) | ||
225 | { | ||
226 | ensureRbSettingsExists(); | ||
227 | |||
228 | // locate setting item | ||
229 | int i = 0; | ||
230 | while(ServerSettingsList[i].setting != setting) | ||
231 | i++; | ||
232 | |||
233 | QString s = constructSettingPath(ServerSettingsList[i].name); | ||
234 | qDebug() << "[Settings] GET SERV:" << s << serverSettings->value(s, ServerSettingsList[i].def).toString(); | ||
235 | return serverSettings->value(s, ServerSettingsList[i].def); | ||
236 | } | ||
237 | |||
203 | void RbSettings::setValue(enum UserSettings setting , QVariant value) | 238 | void RbSettings::setValue(enum UserSettings setting , QVariant value) |
204 | { | 239 | { |
205 | QString empty; | 240 | QString empty; |
@@ -216,8 +251,29 @@ void RbSettings::setSubValue(QString sub, enum UserSettings setting, QVariant va | |||
216 | i++; | 251 | i++; |
217 | 252 | ||
218 | QString s = constructSettingPath(UserSettingsList[i].name, sub); | 253 | QString s = constructSettingPath(UserSettingsList[i].name, sub); |
219 | qDebug() << "[Settings] SET U:" << s << userSettings->value(s).toString(); | ||
220 | userSettings->setValue(s, value); | 254 | userSettings->setValue(s, value); |
255 | qDebug() << "[Settings] SET U:" << s << userSettings->value(s).toString(); | ||
256 | } | ||
257 | |||
258 | void RbSettings::setValue(enum ServerSettings setting, QVariant value) | ||
259 | { | ||
260 | QString empty; | ||
261 | return setPlatformValue(empty, setting, value); | ||
262 | } | ||
263 | |||
264 | void RbSettings::setPlatformValue(QString platform, enum ServerSettings setting, QVariant value) | ||
265 | { | ||
266 | ensureRbSettingsExists(); | ||
267 | |||
268 | // locate setting item | ||
269 | int i = 0; | ||
270 | while(ServerSettingsList[i].setting != setting) | ||
271 | i++; | ||
272 | |||
273 | QString s = ServerSettingsList[i].name; | ||
274 | s.replace(":platform:", platform); | ||
275 | serverSettings->setValue(s, value); | ||
276 | qDebug() << "[Settings] SET SERV:" << s << serverSettings->value(s).toString(); | ||
221 | } | 277 | } |
222 | 278 | ||
223 | 279 | ||
diff --git a/rbutil/rbutilqt/base/rbsettings.h b/rbutil/rbutilqt/base/rbsettings.h index b3f0430208..5e128e602d 100644 --- a/rbutil/rbutilqt/base/rbsettings.h +++ b/rbutil/rbutilqt/base/rbsettings.h | |||
@@ -97,6 +97,16 @@ class RbSettings : public QObject | |||
97 | CurConfigureModel, | 97 | CurConfigureModel, |
98 | }; | 98 | }; |
99 | 99 | ||
100 | //! All Server settings | ||
101 | enum ServerSettings { | ||
102 | CurReleaseVersion, | ||
103 | CurStatus, | ||
104 | DailyRevision, | ||
105 | DailyDate, | ||
106 | BleedingRevision, | ||
107 | BleedingDate, | ||
108 | }; | ||
109 | |||
100 | //! call this to flush the user Settings | 110 | //! call this to flush the user Settings |
101 | static void sync(); | 111 | static void sync(); |
102 | //! returns the filename of the usersettings file | 112 | //! returns the filename of the usersettings file |
@@ -115,12 +125,18 @@ class RbSettings : public QObject | |||
115 | static QVariant value(enum SystemSettings setting); | 125 | static QVariant value(enum SystemSettings setting); |
116 | //! get a value from user settings | 126 | //! get a value from user settings |
117 | static QVariant value(enum UserSettings setting); | 127 | static QVariant value(enum UserSettings setting); |
128 | //! get a value from server settings | ||
129 | static QVariant value(enum ServerSettings setting); | ||
118 | //! set a user setting value | 130 | //! set a user setting value |
119 | static void setValue(enum UserSettings setting , QVariant value); | 131 | static void setValue(enum UserSettings setting , QVariant value); |
132 | //! set a server setting value | ||
133 | static void setValue(enum ServerSettings setting , QVariant value); | ||
120 | //! get a user setting from a subvalue (ie for encoders and tts engines) | 134 | //! get a user setting from a subvalue (ie for encoders and tts engines) |
121 | static QVariant subValue(QString sub, enum UserSettings setting); | 135 | static QVariant subValue(QString sub, enum UserSettings setting); |
122 | //! set a user setting from a subvalue (ie for encoders and tts engines) | 136 | //! set a user setting from a subvalue (ie for encoders and tts engines) |
123 | static void setSubValue(QString sub, enum UserSettings setting, QVariant value); | 137 | static void setSubValue(QString sub, enum UserSettings setting, QVariant value); |
138 | //! set a value for a server settings for a named platform. | ||
139 | static void setPlatformValue(QString platform, enum ServerSettings setting, QVariant value); | ||
124 | //! get a value from system settings for a named platform. | 140 | //! get a value from system settings for a named platform. |
125 | static QVariant platformValue(QString platform, enum SystemSettings setting); | 141 | static QVariant platformValue(QString platform, enum SystemSettings setting); |
126 | 142 | ||
@@ -135,6 +151,7 @@ class RbSettings : public QObject | |||
135 | //! pointers to our setting objects | 151 | //! pointers to our setting objects |
136 | static QSettings *systemSettings; | 152 | static QSettings *systemSettings; |
137 | static QSettings *userSettings; | 153 | static QSettings *userSettings; |
154 | static QSettings *serverSettings; | ||
138 | }; | 155 | }; |
139 | 156 | ||
140 | #endif | 157 | #endif |
diff --git a/rbutil/rbutilqt/install.cpp b/rbutil/rbutilqt/installwindow.cpp index 8deaf95c29..eb0dbf228d 100644 --- a/rbutil/rbutilqt/install.cpp +++ b/rbutil/rbutilqt/installwindow.cpp | |||
@@ -17,14 +17,14 @@ | |||
17 | * | 17 | * |
18 | ****************************************************************************/ | 18 | ****************************************************************************/ |
19 | 19 | ||
20 | #include "install.h" | 20 | #include "installwindow.h" |
21 | #include "ui_installfrm.h" | 21 | #include "ui_installfrm.h" |
22 | #include "rbzip.h" | 22 | #include "rbzip.h" |
23 | #include "system.h" | 23 | #include "system.h" |
24 | #include "rbsettings.h" | 24 | #include "rbsettings.h" |
25 | #include "utils.h" | 25 | #include "utils.h" |
26 | 26 | ||
27 | Install::Install(QWidget *parent) : QDialog(parent) | 27 | InstallWindow::InstallWindow(QWidget *parent) : QDialog(parent) |
28 | { | 28 | { |
29 | ui.setupUi(this); | 29 | ui.setupUi(this); |
30 | 30 | ||
@@ -52,10 +52,45 @@ Install::Install(QWidget *parent) : QDialog(parent) | |||
52 | ui.Backupgroup->hide(); | 52 | ui.Backupgroup->hide(); |
53 | } | 53 | } |
54 | backupCheckboxChanged(Qt::Unchecked); | 54 | backupCheckboxChanged(Qt::Unchecked); |
55 | |||
56 | |||
57 | if(RbSettings::value(RbSettings::DailyRevision).toString().isEmpty()) { | ||
58 | ui.radioArchived->setEnabled(false); | ||
59 | qDebug() << "[Install] no information about archived version available!"; | ||
60 | } | ||
61 | if(RbSettings::value(RbSettings::CurReleaseVersion).toString().isEmpty()) { | ||
62 | ui.radioStable->setEnabled(false); | ||
63 | } | ||
64 | |||
65 | // try to use the old selection first. If no selection has been made | ||
66 | // in the past, use a preselection based on released status. | ||
67 | if(RbSettings::value(RbSettings::Build).toString() == "stable" | ||
68 | && !RbSettings::value(RbSettings::CurReleaseVersion).toString().isEmpty()) | ||
69 | ui.radioStable->setChecked(true); | ||
70 | else if(RbSettings::value(RbSettings::Build).toString() == "archived") | ||
71 | ui.radioArchived->setChecked(true); | ||
72 | else if(RbSettings::value(RbSettings::Build).toString() == "current") | ||
73 | ui.radioCurrent->setChecked(true); | ||
74 | else if(!RbSettings::value(RbSettings::CurReleaseVersion).toString().isEmpty()) { | ||
75 | ui.radioStable->setChecked(true); | ||
76 | ui.radioStable->setEnabled(true); | ||
77 | QFont font; | ||
78 | font.setBold(true); | ||
79 | ui.radioStable->setFont(font); | ||
80 | } | ||
81 | else { | ||
82 | ui.radioCurrent->setChecked(true); | ||
83 | ui.radioStable->setEnabled(false); | ||
84 | ui.radioStable->setChecked(false); | ||
85 | QFont font; | ||
86 | font.setBold(true); | ||
87 | ui.radioCurrent->setFont(font); | ||
88 | } | ||
89 | |||
55 | } | 90 | } |
56 | 91 | ||
57 | 92 | ||
58 | void Install::resizeEvent(QResizeEvent *e) | 93 | void InstallWindow::resizeEvent(QResizeEvent *e) |
59 | { | 94 | { |
60 | (void)e; | 95 | (void)e; |
61 | 96 | ||
@@ -64,7 +99,7 @@ void Install::resizeEvent(QResizeEvent *e) | |||
64 | } | 99 | } |
65 | 100 | ||
66 | 101 | ||
67 | void Install::updateBackupLocation(void) | 102 | void InstallWindow::updateBackupLocation(void) |
68 | { | 103 | { |
69 | ui.backupLocation->setText(QDir::toNativeSeparators( | 104 | ui.backupLocation->setText(QDir::toNativeSeparators( |
70 | fontMetrics().elidedText(tr("Backup to %1").arg(m_backupName), | 105 | fontMetrics().elidedText(tr("Backup to %1").arg(m_backupName), |
@@ -72,7 +107,7 @@ void Install::updateBackupLocation(void) | |||
72 | } | 107 | } |
73 | 108 | ||
74 | 109 | ||
75 | void Install::backupCheckboxChanged(int state) | 110 | void InstallWindow::backupCheckboxChanged(int state) |
76 | { | 111 | { |
77 | if(state == Qt::Checked) | 112 | if(state == Qt::Checked) |
78 | { | 113 | { |
@@ -89,7 +124,7 @@ void Install::backupCheckboxChanged(int state) | |||
89 | } | 124 | } |
90 | 125 | ||
91 | 126 | ||
92 | void Install::accept() | 127 | void InstallWindow::accept() |
93 | { | 128 | { |
94 | logger = new ProgressLoggerGui(this); | 129 | logger = new ProgressLoggerGui(this); |
95 | logger->show(); | 130 | logger->show(); |
@@ -107,26 +142,26 @@ void Install::accept() | |||
107 | if(ui.radioStable->isChecked()) { | 142 | if(ui.radioStable->isChecked()) { |
108 | file = RbSettings::value(RbSettings::ReleaseUrl).toString(); | 143 | file = RbSettings::value(RbSettings::ReleaseUrl).toString(); |
109 | RbSettings::setValue(RbSettings::Build, "stable"); | 144 | RbSettings::setValue(RbSettings::Build, "stable"); |
110 | myversion = version.value("rel_rev"); | 145 | myversion = RbSettings::value(RbSettings::CurReleaseVersion).toString(); |
111 | } | 146 | } |
112 | else if(ui.radioArchived->isChecked()) { | 147 | else if(ui.radioArchived->isChecked()) { |
113 | file = RbSettings::value(RbSettings::DailyUrl).toString(); | 148 | file = RbSettings::value(RbSettings::DailyUrl).toString(); |
114 | RbSettings::setValue(RbSettings::Build, "archived"); | 149 | RbSettings::setValue(RbSettings::Build, "archived"); |
115 | myversion = "r" + version.value("arch_rev") + "-" + version.value("arch_date"); | 150 | myversion = "r" + RbSettings::value(RbSettings::DailyRevision).toString() + "-" + RbSettings::value(RbSettings::DailyDate).toString(); |
116 | } | 151 | } |
117 | else if(ui.radioCurrent->isChecked()) { | 152 | else if(ui.radioCurrent->isChecked()) { |
118 | file = RbSettings::value(RbSettings::BleedingUrl).toString(); | 153 | file = RbSettings::value(RbSettings::BleedingUrl).toString(); |
119 | RbSettings::setValue(RbSettings::Build, "current"); | 154 | RbSettings::setValue(RbSettings::Build, "current"); |
120 | myversion = "r" + version.value("bleed_rev"); | 155 | myversion = "r" + RbSettings::value(RbSettings::BleedingRevision).toString(); |
121 | } | 156 | } |
122 | else { | 157 | else { |
123 | qDebug() << "[Install] no build selected -- this shouldn't happen"; | 158 | qDebug() << "[Install] no build selected -- this shouldn't happen"; |
124 | return; | 159 | return; |
125 | } | 160 | } |
126 | file.replace("%MODEL%", buildname); | 161 | file.replace("%MODEL%", buildname); |
127 | file.replace("%RELVERSION%", version.value("rel_rev")); | 162 | file.replace("%RELVERSION%", RbSettings::value(RbSettings::CurReleaseVersion).toString()); |
128 | file.replace("%REVISION%", version.value("arch_rev")); | 163 | file.replace("%REVISION%", RbSettings::value(RbSettings::DailyRevision).toString()); |
129 | file.replace("%DATE%", version.value("arch_date")); | 164 | file.replace("%DATE%", RbSettings::value(RbSettings::DailyDate).toString()); |
130 | 165 | ||
131 | RbSettings::sync(); | 166 | RbSettings::sync(); |
132 | 167 | ||
@@ -194,7 +229,7 @@ void Install::accept() | |||
194 | 229 | ||
195 | } | 230 | } |
196 | 231 | ||
197 | void Install::changeBackupPath() | 232 | void InstallWindow::changeBackupPath() |
198 | { | 233 | { |
199 | QString backupString = QFileDialog::getSaveFileName(this, | 234 | QString backupString = QFileDialog::getSaveFileName(this, |
200 | tr("Select Backup Filename"), m_backupName, "*.zip"); | 235 | tr("Select Backup Filename"), m_backupName, "*.zip"); |
@@ -207,7 +242,7 @@ void Install::changeBackupPath() | |||
207 | 242 | ||
208 | 243 | ||
209 | // Zip installer has finished | 244 | // Zip installer has finished |
210 | void Install::done(bool error) | 245 | void InstallWindow::done(bool error) |
211 | { | 246 | { |
212 | qDebug() << "[Install] done, error:" << error; | 247 | qDebug() << "[Install] done, error:" << error; |
213 | 248 | ||
@@ -227,14 +262,14 @@ void Install::done(bool error) | |||
227 | } | 262 | } |
228 | 263 | ||
229 | 264 | ||
230 | void Install::setDetailsCurrent(bool show) | 265 | void InstallWindow::setDetailsCurrent(bool show) |
231 | { | 266 | { |
232 | if(show) { | 267 | if(show) { |
233 | ui.labelDetails->setText(tr("This is the absolute up to the minute " | 268 | ui.labelDetails->setText(tr("This is the absolute up to the minute " |
234 | "Rockbox built. A current build will get updated every time " | 269 | "Rockbox built. A current build will get updated every time " |
235 | "a change is made. Latest version is r%1 (%2).") | 270 | "a change is made. Latest version is r%1 (%2).") |
236 | .arg(version.value("bleed_rev"), version.value("bleed_date"))); | 271 | .arg(RbSettings::value(RbSettings::BleedingRevision).toString(),RbSettings::value(RbSettings::BleedingDate).toString())); |
237 | if(version.value("rel_rev").isEmpty()) | 272 | if(RbSettings::value(RbSettings::CurReleaseVersion).toString().isEmpty()) |
238 | ui.labelNote->setText(tr("<b>This is the recommended version.</b>")); | 273 | ui.labelNote->setText(tr("<b>This is the recommended version.</b>")); |
239 | else | 274 | else |
240 | ui.labelNote->setText(""); | 275 | ui.labelNote->setText(""); |
@@ -242,23 +277,23 @@ void Install::setDetailsCurrent(bool show) | |||
242 | } | 277 | } |
243 | 278 | ||
244 | 279 | ||
245 | void Install::setDetailsStable(bool show) | 280 | void InstallWindow::setDetailsStable(bool show) |
246 | { | 281 | { |
247 | if(show) { | 282 | if(show) { |
248 | ui.labelDetails->setText( | 283 | ui.labelDetails->setText( |
249 | tr("This is the last released version of Rockbox.")); | 284 | tr("This is the last released version of Rockbox.")); |
250 | 285 | ||
251 | if(!version.value("rel_rev").isEmpty()) | 286 | if(!RbSettings::value(RbSettings::CurReleaseVersion).toString().isEmpty()) |
252 | ui.labelNote->setText(tr("<b>Note:</b> " | 287 | ui.labelNote->setText(tr("<b>Note:</b> " |
253 | "The lastest released version is %1. " | 288 | "The lastest released version is %1. " |
254 | "<b>This is the recommended version.</b>") | 289 | "<b>This is the recommended version.</b>") |
255 | .arg(version.value("rel_rev"))); | 290 | .arg(RbSettings::value(RbSettings::CurReleaseVersion).toString())); |
256 | else ui.labelNote->setText(""); | 291 | else ui.labelNote->setText(""); |
257 | } | 292 | } |
258 | } | 293 | } |
259 | 294 | ||
260 | 295 | ||
261 | void Install::setDetailsArchived(bool show) | 296 | void InstallWindow::setDetailsArchived(bool show) |
262 | { | 297 | { |
263 | if(show) { | 298 | if(show) { |
264 | ui.labelDetails->setText(tr("These are automatically built each day " | 299 | ui.labelDetails->setText(tr("These are automatically built each day " |
@@ -266,54 +301,9 @@ void Install::setDetailsArchived(bool show) | |||
266 | "features than the last stable release but may be much less stable. " | 301 | "features than the last stable release but may be much less stable. " |
267 | "Features may change regularly.")); | 302 | "Features may change regularly.")); |
268 | ui.labelNote->setText(tr("<b>Note:</b> archived version is r%1 (%2).") | 303 | ui.labelNote->setText(tr("<b>Note:</b> archived version is r%1 (%2).") |
269 | .arg(version.value("arch_rev"), version.value("arch_date"))); | 304 | .arg(RbSettings::value(RbSettings::DailyRevision).toString(),RbSettings::value(RbSettings::DailyDate).toString())); |
270 | } | 305 | } |
271 | } | 306 | } |
272 | 307 | ||
273 | 308 | ||
274 | 309 | ||
275 | void Install::setVersionStrings(QMap<QString, QString>& ver) | ||
276 | { | ||
277 | version = ver; | ||
278 | // version strings map is as following: | ||
279 | // rel_rev release version revision id | ||
280 | // rel_date release version release date | ||
281 | // same for arch_* and bleed_* | ||
282 | |||
283 | if(version.value("arch_rev").isEmpty()) { | ||
284 | ui.radioArchived->setEnabled(false); | ||
285 | qDebug() << "[Install] no information about archived version available!"; | ||
286 | } | ||
287 | if(version.value("rel_rev").isEmpty()) { | ||
288 | ui.radioStable->setEnabled(false); | ||
289 | } | ||
290 | |||
291 | // try to use the old selection first. If no selection has been made | ||
292 | // in the past, use a preselection based on released status. | ||
293 | if(RbSettings::value(RbSettings::Build).toString() == "stable" | ||
294 | && !version.value("rel_rev").isEmpty()) | ||
295 | ui.radioStable->setChecked(true); | ||
296 | else if(RbSettings::value(RbSettings::Build).toString() == "archived") | ||
297 | ui.radioArchived->setChecked(true); | ||
298 | else if(RbSettings::value(RbSettings::Build).toString() == "current") | ||
299 | ui.radioCurrent->setChecked(true); | ||
300 | else if(!version.value("rel_rev").isEmpty()) { | ||
301 | ui.radioStable->setChecked(true); | ||
302 | ui.radioStable->setEnabled(true); | ||
303 | QFont font; | ||
304 | font.setBold(true); | ||
305 | ui.radioStable->setFont(font); | ||
306 | } | ||
307 | else { | ||
308 | ui.radioCurrent->setChecked(true); | ||
309 | ui.radioStable->setEnabled(false); | ||
310 | ui.radioStable->setChecked(false); | ||
311 | QFont font; | ||
312 | font.setBold(true); | ||
313 | ui.radioCurrent->setFont(font); | ||
314 | } | ||
315 | |||
316 | qDebug() << "[Install] setting version strings to:" << version; | ||
317 | } | ||
318 | |||
319 | |||
diff --git a/rbutil/rbutilqt/install.h b/rbutil/rbutilqt/installwindow.h index 4ac6f281af..e1a347099e 100644 --- a/rbutil/rbutilqt/install.h +++ b/rbutil/rbutilqt/installwindow.h | |||
@@ -28,12 +28,11 @@ | |||
28 | #include "zipinstaller.h" | 28 | #include "zipinstaller.h" |
29 | #include "progressloggergui.h" | 29 | #include "progressloggergui.h" |
30 | 30 | ||
31 | class Install : public QDialog | 31 | class InstallWindow : public QDialog |
32 | { | 32 | { |
33 | Q_OBJECT | 33 | Q_OBJECT |
34 | public: | 34 | public: |
35 | Install(QWidget *parent); | 35 | InstallWindow(QWidget *parent); |
36 | void setVersionStrings(QMap<QString, QString>&); | ||
37 | 36 | ||
38 | public slots: | 37 | public slots: |
39 | void accept(void); | 38 | void accept(void); |
@@ -45,7 +44,6 @@ class Install : public QDialog | |||
45 | QFile *target; | 44 | QFile *target; |
46 | QString file; | 45 | QString file; |
47 | ZipInstaller* installer; | 46 | ZipInstaller* installer; |
48 | QMap<QString, QString> version; | ||
49 | QString m_backupName; | 47 | QString m_backupName; |
50 | void resizeEvent(QResizeEvent*); | 48 | void resizeEvent(QResizeEvent*); |
51 | 49 | ||
diff --git a/rbutil/rbutilqt/rbutilqt.cpp b/rbutil/rbutilqt/rbutilqt.cpp index 8860acc3bb..85d990a775 100644 --- a/rbutil/rbutilqt/rbutilqt.cpp +++ b/rbutil/rbutilqt/rbutilqt.cpp | |||
@@ -24,7 +24,7 @@ | |||
24 | #include "ui_rbutilqtfrm.h" | 24 | #include "ui_rbutilqtfrm.h" |
25 | #include "ui_aboutbox.h" | 25 | #include "ui_aboutbox.h" |
26 | #include "configure.h" | 26 | #include "configure.h" |
27 | #include "install.h" | 27 | #include "installwindow.h" |
28 | #include "installtalkwindow.h" | 28 | #include "installtalkwindow.h" |
29 | #include "createvoicewindow.h" | 29 | #include "createvoicewindow.h" |
30 | #include "httpget.h" | 30 | #include "httpget.h" |
@@ -167,8 +167,6 @@ void RbUtilQt::updateTabs(int count) | |||
167 | 167 | ||
168 | void RbUtilQt::downloadInfo() | 168 | void RbUtilQt::downloadInfo() |
169 | { | 169 | { |
170 | // make sure the version map is repopulated correctly later. | ||
171 | versmap.clear(); | ||
172 | // try to get the current build information | 170 | // try to get the current build information |
173 | daily = new HttpGet(this); | 171 | daily = new HttpGet(this); |
174 | connect(daily, SIGNAL(done(bool)), this, SLOT(downloadDone(bool))); | 172 | connect(daily, SIGNAL(done(bool)), this, SLOT(downloadDone(bool))); |
@@ -196,23 +194,32 @@ void RbUtilQt::downloadDone(bool error) | |||
196 | } | 194 | } |
197 | qDebug() << "[RbUtil] network status:" << daily->error(); | 195 | qDebug() << "[RbUtil] network status:" << daily->error(); |
198 | 196 | ||
197 | // read info into settings object | ||
199 | buildInfo.open(); | 198 | buildInfo.open(); |
200 | QSettings info(buildInfo.fileName(), QSettings::IniFormat, this); | 199 | QSettings info(buildInfo.fileName(), QSettings::IniFormat, this); |
201 | buildInfo.close(); | 200 | buildInfo.close(); |
202 | versmap.insert("arch_rev", info.value("dailies/rev").toString()); | 201 | RbSettings::setValue(RbSettings::DailyRevision,info.value("dailies/rev")); |
203 | versmap.insert("arch_date", info.value("dailies/date").toString()); | 202 | QDate date = QDate::fromString(info.value("dailies/date").toString(), "yyyyMMdd"); |
204 | 203 | RbSettings::setValue(RbSettings::DailyDate,date.toString()); | |
204 | |||
205 | info.beginGroup("release"); | 205 | info.beginGroup("release"); |
206 | versmap.insert("rel_rev", info.value(RbSettings::value(RbSettings::CurBuildserverModel).toString()).toString()); | 206 | QStringList keys = info.allKeys(); |
207 | for(int i=0; i < keys.size(); i++) | ||
208 | { | ||
209 | RbSettings::setPlatformValue(keys[i],RbSettings::CurReleaseVersion,info.value(keys[i])); | ||
210 | } | ||
207 | info.endGroup(); | 211 | info.endGroup(); |
208 | 212 | ||
209 | bool installable = !versmap.value("rel_rev").isEmpty(); | 213 | info.beginGroup("status"); |
210 | 214 | keys = info.allKeys(); | |
211 | ui.buttonSmall->setEnabled(installable); | 215 | for(int i=0; i < keys.size(); i++) |
212 | ui.buttonComplete->setEnabled(installable); | 216 | { |
213 | ui.actionSmall_Installation->setEnabled(installable); | 217 | RbSettings::setPlatformValue(keys[i],RbSettings::CurStatus,info.value(keys[i])); |
214 | ui.actionComplete_Installation->setEnabled(installable); | 218 | } |
219 | info.endGroup(); | ||
215 | 220 | ||
221 | |||
222 | //start bleeding info download | ||
216 | bleeding = new HttpGet(this); | 223 | bleeding = new HttpGet(this); |
217 | connect(bleeding, SIGNAL(done(bool)), this, SLOT(downloadBleedingDone(bool))); | 224 | connect(bleeding, SIGNAL(done(bool)), this, SLOT(downloadBleedingDone(bool))); |
218 | connect(bleeding, SIGNAL(requestFinished(int, bool)), this, SLOT(downloadDone(int, bool))); | 225 | connect(bleeding, SIGNAL(requestFinished(int, bool)), this, SLOT(downloadDone(int, bool))); |
@@ -223,22 +230,6 @@ void RbUtilQt::downloadDone(bool error) | |||
223 | bleeding->getFile(QUrl(RbSettings::value(RbSettings::BleedingInfo).toString())); | 230 | bleeding->getFile(QUrl(RbSettings::value(RbSettings::BleedingInfo).toString())); |
224 | ui.statusbar->showMessage(tr("Downloading build information, please wait ...")); | 231 | ui.statusbar->showMessage(tr("Downloading build information, please wait ...")); |
225 | 232 | ||
226 | if(RbSettings::value(RbSettings::RbutilVersion) != PUREVERSION) { | ||
227 | QApplication::processEvents(); | ||
228 | QMessageBox::information(this, tr("New installation"), | ||
229 | tr("This is a new installation of Rockbox Utility, or a new version. " | ||
230 | "The configuration dialog will now open to allow you to setup the program, " | ||
231 | " or review your settings.")); | ||
232 | configDialog(); | ||
233 | } | ||
234 | else if(chkConfig(false)) { | ||
235 | QApplication::processEvents(); | ||
236 | QMessageBox::critical(this, tr("Configuration error"), | ||
237 | tr("Your configuration is invalid. This is most likely due " | ||
238 | "to a changed device path. The configuration dialog will " | ||
239 | "now open to allow you to correct the problem.")); | ||
240 | configDialog(); | ||
241 | } | ||
242 | } | 233 | } |
243 | 234 | ||
244 | 235 | ||
@@ -251,11 +242,12 @@ void RbUtilQt::downloadBleedingDone(bool error) | |||
251 | bleedingInfo.open(); | 242 | bleedingInfo.open(); |
252 | QSettings info(bleedingInfo.fileName(), QSettings::IniFormat, this); | 243 | QSettings info(bleedingInfo.fileName(), QSettings::IniFormat, this); |
253 | bleedingInfo.close(); | 244 | bleedingInfo.close(); |
254 | versmap.insert("bleed_rev", info.value("bleeding/rev").toString()); | 245 | RbSettings::setValue(RbSettings::BleedingRevision,info.value("bleeding/rev")); |
255 | versmap.insert("bleed_date", info.value("bleeding/timestamp").toString()); | 246 | QDateTime date = QDateTime::fromString(info.value("bleeding/timestamp").toString(), "yyyyMMddThhmmssZ"); |
256 | qDebug() << "[RbUtil] version map:" << versmap; | 247 | RbSettings::setValue(RbSettings::BleedingDate,date.toString()); |
257 | ui.statusbar->showMessage(tr("Download build information finished."), 5000); | ||
258 | 248 | ||
249 | ui.statusbar->showMessage(tr("Download build information finished."), 5000); | ||
250 | updateSettings(); | ||
259 | m_gotInfo = true; | 251 | m_gotInfo = true; |
260 | 252 | ||
261 | //start check for updates | 253 | //start check for updates |
@@ -317,7 +309,6 @@ void RbUtilQt::configDialog() | |||
317 | { | 309 | { |
318 | Config *cw = new Config(this); | 310 | Config *cw = new Config(this); |
319 | connect(cw, SIGNAL(settingsUpdated()), this, SLOT(updateSettings())); | 311 | connect(cw, SIGNAL(settingsUpdated()), this, SLOT(updateSettings())); |
320 | connect(cw, SIGNAL(settingsUpdated()), this, SLOT(downloadInfo())); | ||
321 | cw->show(); | 312 | cw->show(); |
322 | } | 313 | } |
323 | 314 | ||
@@ -338,6 +329,23 @@ void RbUtilQt::updateSettings() | |||
338 | } | 329 | } |
339 | HttpGet::setGlobalCache(RbSettings::value(RbSettings::CachePath).toString()); | 330 | HttpGet::setGlobalCache(RbSettings::value(RbSettings::CachePath).toString()); |
340 | HttpGet::setGlobalDumbCache(RbSettings::value(RbSettings::CacheOffline).toBool()); | 331 | HttpGet::setGlobalDumbCache(RbSettings::value(RbSettings::CacheOffline).toBool()); |
332 | |||
333 | if(RbSettings::value(RbSettings::RbutilVersion) != PUREVERSION) { | ||
334 | QApplication::processEvents(); | ||
335 | QMessageBox::information(this, tr("New installation"), | ||
336 | tr("This is a new installation of Rockbox Utility, or a new version. " | ||
337 | "The configuration dialog will now open to allow you to setup the program, " | ||
338 | " or review your settings.")); | ||
339 | configDialog(); | ||
340 | } | ||
341 | else if(chkConfig(false)) { | ||
342 | QApplication::processEvents(); | ||
343 | QMessageBox::critical(this, tr("Configuration error"), | ||
344 | tr("Your configuration is invalid. This is most likely due " | ||
345 | "to a changed device path. The configuration dialog will " | ||
346 | "now open to allow you to correct the problem.")); | ||
347 | configDialog(); | ||
348 | } | ||
341 | } | 349 | } |
342 | 350 | ||
343 | 351 | ||
@@ -373,6 +381,13 @@ void RbUtilQt::updateDevice() | |||
373 | if(mountpoint.isEmpty()) mountpoint = "<invalid>"; | 381 | if(mountpoint.isEmpty()) mountpoint = "<invalid>"; |
374 | ui.labelDevice->setText(tr("<b>%1 %2</b> at <b>%3</b>") | 382 | ui.labelDevice->setText(tr("<b>%1 %2</b> at <b>%3</b>") |
375 | .arg(brand, name, QDir::toNativeSeparators(mountpoint))); | 383 | .arg(brand, name, QDir::toNativeSeparators(mountpoint))); |
384 | |||
385 | // hide quickstart buttons if no release available | ||
386 | bool installable = !RbSettings::value(RbSettings::CurReleaseVersion).toString().isEmpty(); | ||
387 | ui.buttonSmall->setEnabled(installable); | ||
388 | ui.buttonComplete->setEnabled(installable); | ||
389 | ui.actionSmall_Installation->setEnabled(installable); | ||
390 | ui.actionComplete_Installation->setEnabled(installable); | ||
376 | } | 391 | } |
377 | 392 | ||
378 | 393 | ||
@@ -411,7 +426,7 @@ void RbUtilQt::completeInstall() | |||
411 | "This will install Rockbox %1. To install the most recent " | 426 | "This will install Rockbox %1. To install the most recent " |
412 | "development build available press \"Cancel\" and " | 427 | "development build available press \"Cancel\" and " |
413 | "use the \"Installation\" tab.") | 428 | "use the \"Installation\" tab.") |
414 | .arg(versmap.value("rel_rev")), | 429 | .arg(RbSettings::value(RbSettings::CurReleaseVersion).toString()), |
415 | QMessageBox::Ok | QMessageBox::Cancel) != QMessageBox::Ok) | 430 | QMessageBox::Ok | QMessageBox::Cancel) != QMessageBox::Ok) |
416 | return; | 431 | return; |
417 | // create logger | 432 | // create logger |
@@ -469,7 +484,7 @@ void RbUtilQt::smallInstall() | |||
469 | "This will install Rockbox %1. To install the most recent " | 484 | "This will install Rockbox %1. To install the most recent " |
470 | "development build available press \"Cancel\" and " | 485 | "development build available press \"Cancel\" and " |
471 | "use the \"Installation\" tab.") | 486 | "use the \"Installation\" tab.") |
472 | .arg(versmap.value("rel_rev")), | 487 | .arg(RbSettings::value(RbSettings::CurReleaseVersion).toString()), |
473 | QMessageBox::Ok | QMessageBox::Cancel) != QMessageBox::Ok) | 488 | QMessageBox::Ok | QMessageBox::Cancel) != QMessageBox::Ok) |
474 | return; | 489 | return; |
475 | 490 | ||
@@ -543,7 +558,7 @@ bool RbUtilQt::installAuto() | |||
543 | { | 558 | { |
544 | QString file = RbSettings::value(RbSettings::ReleaseUrl).toString(); | 559 | QString file = RbSettings::value(RbSettings::ReleaseUrl).toString(); |
545 | file.replace("%MODEL%", RbSettings::value(RbSettings::CurBuildserverModel).toString()); | 560 | file.replace("%MODEL%", RbSettings::value(RbSettings::CurBuildserverModel).toString()); |
546 | file.replace("%RELVERSION%", versmap.value("rel_rev")); | 561 | file.replace("%RELVERSION%", RbSettings::value(RbSettings::CurReleaseVersion).toString()); |
547 | 562 | ||
548 | // check installed Version and Target | 563 | // check installed Version and Target |
549 | QString warning = check(false); | 564 | QString warning = check(false); |
@@ -600,7 +615,7 @@ bool RbUtilQt::installAuto() | |||
600 | ZipInstaller* installer = new ZipInstaller(this); | 615 | ZipInstaller* installer = new ZipInstaller(this); |
601 | installer->setUrl(file); | 616 | installer->setUrl(file); |
602 | installer->setLogSection("Rockbox (Base)"); | 617 | installer->setLogSection("Rockbox (Base)"); |
603 | installer->setLogVersion(versmap.value("rel_rev")); | 618 | installer->setLogVersion(RbSettings::value(RbSettings::CurReleaseVersion).toString()); |
604 | if(!RbSettings::value(RbSettings::CacheDisabled).toBool()) | 619 | if(!RbSettings::value(RbSettings::CacheDisabled).toBool()) |
605 | installer->setCache(true); | 620 | installer->setCache(true); |
606 | installer->setMountPoint(RbSettings::value(RbSettings::Mountpoint).toString()); | 621 | installer->setMountPoint(RbSettings::value(RbSettings::Mountpoint).toString()); |
@@ -617,10 +632,7 @@ bool RbUtilQt::installAuto() | |||
617 | 632 | ||
618 | void RbUtilQt::install() | 633 | void RbUtilQt::install() |
619 | { | 634 | { |
620 | Install *installWindow = new Install(this); | 635 | InstallWindow *installWindow = new InstallWindow(this); |
621 | |||
622 | installWindow->setVersionStrings(versmap); | ||
623 | |||
624 | installWindow->show(); | 636 | installWindow->show(); |
625 | } | 637 | } |
626 | 638 | ||
@@ -837,7 +849,7 @@ void RbUtilQt::installFonts() | |||
837 | 849 | ||
838 | installer->setUrl(RbSettings::value(RbSettings::FontUrl).toString()); | 850 | installer->setUrl(RbSettings::value(RbSettings::FontUrl).toString()); |
839 | installer->setLogSection("Fonts"); | 851 | installer->setLogSection("Fonts"); |
840 | installer->setLogVersion(versmap.value("arch_date")); | 852 | installer->setLogVersion(RbSettings::value(RbSettings::DailyDate).toString()); |
841 | installer->setMountPoint(RbSettings::value(RbSettings::Mountpoint).toString()); | 853 | installer->setMountPoint(RbSettings::value(RbSettings::Mountpoint).toString()); |
842 | if(!RbSettings::value(RbSettings::CacheDisabled).toBool()) | 854 | if(!RbSettings::value(RbSettings::CacheDisabled).toBool()) |
843 | installer->setCache(true); | 855 | installer->setCache(true); |
@@ -876,12 +888,12 @@ void RbUtilQt::installVoice() | |||
876 | QString voiceurl = RbSettings::value(RbSettings::VoiceUrl).toString(); | 888 | QString voiceurl = RbSettings::value(RbSettings::VoiceUrl).toString(); |
877 | 889 | ||
878 | voiceurl += RbSettings::value(RbSettings::CurBuildserverModel).toString() + "-" + | 890 | voiceurl += RbSettings::value(RbSettings::CurBuildserverModel).toString() + "-" + |
879 | versmap.value("arch_date") + "-english.zip"; | 891 | RbSettings::value(RbSettings::DailyDate).toString() + "-english.zip"; |
880 | qDebug() << "[RbUtil] voicefile URL:" << voiceurl; | 892 | qDebug() << "[RbUtil] voicefile URL:" << voiceurl; |
881 | 893 | ||
882 | installer->setUrl(voiceurl); | 894 | installer->setUrl(voiceurl); |
883 | installer->setLogSection("Voice"); | 895 | installer->setLogSection("Voice"); |
884 | installer->setLogVersion(versmap.value("arch_date")); | 896 | installer->setLogVersion(RbSettings::value(RbSettings::DailyDate).toString()); |
885 | installer->setMountPoint(RbSettings::value(RbSettings::Mountpoint).toString()); | 897 | installer->setMountPoint(RbSettings::value(RbSettings::Mountpoint).toString()); |
886 | if(!RbSettings::value(RbSettings::CacheDisabled).toBool()) | 898 | if(!RbSettings::value(RbSettings::CacheDisabled).toBool()) |
887 | installer->setCache(true); | 899 | installer->setCache(true); |
@@ -931,7 +943,7 @@ void RbUtilQt::installDoom() | |||
931 | 943 | ||
932 | installer->setUrl(RbSettings::value(RbSettings::DoomUrl).toString()); | 944 | installer->setUrl(RbSettings::value(RbSettings::DoomUrl).toString()); |
933 | installer->setLogSection("Game Addons"); | 945 | installer->setLogSection("Game Addons"); |
934 | installer->setLogVersion(versmap.value("arch_date")); | 946 | installer->setLogVersion(RbSettings::value(RbSettings::DailyDate).toString()); |
935 | installer->setMountPoint(RbSettings::value(RbSettings::Mountpoint).toString()); | 947 | installer->setMountPoint(RbSettings::value(RbSettings::Mountpoint).toString()); |
936 | if(!RbSettings::value(RbSettings::CacheDisabled).toBool()) | 948 | if(!RbSettings::value(RbSettings::CacheDisabled).toBool()) |
937 | installer->setCache(true); | 949 | installer->setCache(true); |
@@ -1050,7 +1062,7 @@ void RbUtilQt::downloadManual(void) | |||
1050 | if(manual.isEmpty()) | 1062 | if(manual.isEmpty()) |
1051 | manual = "rockbox-" + RbSettings::value(RbSettings::Platform).toString(); | 1063 | manual = "rockbox-" + RbSettings::value(RbSettings::Platform).toString(); |
1052 | 1064 | ||
1053 | QString date = versmap.value("arch_date"); | 1065 | QString date = RbSettings::value(RbSettings::DailyDate).toString(); |
1054 | 1066 | ||
1055 | QString manualurl; | 1067 | QString manualurl; |
1056 | QString target; | 1068 | QString target; |
diff --git a/rbutil/rbutilqt/rbutilqt.h b/rbutil/rbutilqt/rbutilqt.h index 31bae73630..c47926e5a2 100644 --- a/rbutil/rbutilqt/rbutilqt.h +++ b/rbutil/rbutilqt/rbutilqt.h | |||
@@ -55,7 +55,6 @@ class RbUtilQt : public QMainWindow | |||
55 | ProgressLoggerGui *logger; | 55 | ProgressLoggerGui *logger; |
56 | ZipInstaller *installer; | 56 | ZipInstaller *installer; |
57 | QUrl proxy(void); | 57 | QUrl proxy(void); |
58 | QMap<QString, QString> versmap; | ||
59 | bool chkConfig(bool); | 58 | bool chkConfig(bool); |
60 | 59 | ||
61 | volatile bool m_installed; | 60 | volatile bool m_installed; |
diff --git a/rbutil/rbutilqt/rbutilqt.pro b/rbutil/rbutilqt/rbutilqt.pro index e335797409..731a4a24ae 100644 --- a/rbutil/rbutilqt/rbutilqt.pro +++ b/rbutil/rbutilqt/rbutilqt.pro | |||
@@ -65,7 +65,7 @@ QMAKE_EXTRA_TARGETS += lrelease | |||
65 | 65 | ||
66 | SOURCES += rbutilqt.cpp \ | 66 | SOURCES += rbutilqt.cpp \ |
67 | main.cpp \ | 67 | main.cpp \ |
68 | install.cpp \ | 68 | installwindow.cpp \ |
69 | base/httpget.cpp \ | 69 | base/httpget.cpp \ |
70 | configure.cpp \ | 70 | configure.cpp \ |
71 | zip/zip.cpp \ | 71 | zip/zip.cpp \ |
@@ -115,7 +115,7 @@ SOURCES += rbutilqt.cpp \ | |||
115 | ../../tools/iriver.c \ | 115 | ../../tools/iriver.c \ |
116 | 116 | ||
117 | HEADERS += rbutilqt.h \ | 117 | HEADERS += rbutilqt.h \ |
118 | install.h \ | 118 | installwindow.h \ |
119 | base/httpget.h \ | 119 | base/httpget.h \ |
120 | configure.h \ | 120 | configure.h \ |
121 | zip/zip.h \ | 121 | zip/zip.h \ |