summaryrefslogtreecommitdiff
path: root/rbutil/rbutilqt/rbutilqt.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'rbutil/rbutilqt/rbutilqt.cpp')
-rw-r--r--rbutil/rbutilqt/rbutilqt.cpp106
1 files changed, 59 insertions, 47 deletions
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
168void RbUtilQt::downloadInfo() 168void 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 = "&lt;invalid&gt;"; 381 if(mountpoint.isEmpty()) mountpoint = "&lt;invalid&gt;";
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
618void RbUtilQt::install() 633void 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;