diff options
Diffstat (limited to 'rbutil/rbutilqt/rbutilqt.cpp')
-rw-r--r-- | rbutil/rbutilqt/rbutilqt.cpp | 220 |
1 files changed, 87 insertions, 133 deletions
diff --git a/rbutil/rbutilqt/rbutilqt.cpp b/rbutil/rbutilqt/rbutilqt.cpp index a482daf29e..9d64eac5ea 100644 --- a/rbutil/rbutilqt/rbutilqt.cpp +++ b/rbutil/rbutilqt/rbutilqt.cpp | |||
@@ -49,26 +49,12 @@ | |||
49 | RbUtilQt::RbUtilQt(QWidget *parent) : QMainWindow(parent) | 49 | RbUtilQt::RbUtilQt(QWidget *parent) : QMainWindow(parent) |
50 | { | 50 | { |
51 | absolutePath = qApp->applicationDirPath(); | 51 | absolutePath = qApp->applicationDirPath(); |
52 | // only use built-in rbutil.ini | 52 | |
53 | devices = new QSettings(":/ini/rbutil.ini", QSettings::IniFormat, 0); | ||
54 | |||
55 | ui.setupUi(this); | 53 | ui.setupUi(this); |
56 | 54 | ||
57 | // portable installation: | 55 | settings = new RbSettings(); |
58 | // check for a configuration file in the program folder. | 56 | settings->open(); |
59 | QFileInfo config; | 57 | |
60 | config.setFile(absolutePath + "/RockboxUtility.ini"); | ||
61 | if(config.isFile()) { | ||
62 | userSettings = new QSettings(absolutePath + "/RockboxUtility.ini", | ||
63 | QSettings::IniFormat, 0); | ||
64 | qDebug() << "config: portable"; | ||
65 | } | ||
66 | else { | ||
67 | userSettings = new QSettings(QSettings::IniFormat, | ||
68 | QSettings::UserScope, "rockbox.org", "RockboxUtility"); | ||
69 | qDebug() << "config: system"; | ||
70 | } | ||
71 | |||
72 | // manual tab | 58 | // manual tab |
73 | updateManual(); | 59 | updateManual(); |
74 | updateDevice(); | 60 | updateDevice(); |
@@ -147,11 +133,11 @@ void RbUtilQt::downloadInfo() | |||
147 | connect(daily, SIGNAL(requestFinished(int, bool)), this, SLOT(downloadDone(int, bool))); | 133 | connect(daily, SIGNAL(requestFinished(int, bool)), this, SLOT(downloadDone(int, bool))); |
148 | connect(qApp, SIGNAL(lastWindowClosed()), daily, SLOT(abort())); | 134 | connect(qApp, SIGNAL(lastWindowClosed()), daily, SLOT(abort())); |
149 | daily->setProxy(proxy()); | 135 | daily->setProxy(proxy()); |
150 | if(userSettings->value("offline").toBool()) | 136 | if(settings->cacheOffline()) |
151 | daily->setCache(userSettings->value("cachepath", QDir::tempPath()).toString()); | 137 | daily->setCache(settings->cachePath()); |
152 | qDebug() << "downloading build info"; | 138 | qDebug() << "downloading build info"; |
153 | daily->setFile(&buildInfo); | 139 | daily->setFile(&buildInfo); |
154 | daily->getFile(QUrl(devices->value("server_conf_url").toString())); | 140 | daily->getFile(QUrl(settings->serverConfUrl())); |
155 | } | 141 | } |
156 | 142 | ||
157 | 143 | ||
@@ -174,10 +160,10 @@ void RbUtilQt::downloadDone(bool error) | |||
174 | connect(bleeding, SIGNAL(requestFinished(int, bool)), this, SLOT(downloadDone(int, bool))); | 160 | connect(bleeding, SIGNAL(requestFinished(int, bool)), this, SLOT(downloadDone(int, bool))); |
175 | connect(qApp, SIGNAL(lastWindowClosed()), daily, SLOT(abort())); | 161 | connect(qApp, SIGNAL(lastWindowClosed()), daily, SLOT(abort())); |
176 | bleeding->setProxy(proxy()); | 162 | bleeding->setProxy(proxy()); |
177 | if(userSettings->value("offline").toBool()) | 163 | if(settings->cacheOffline()) |
178 | bleeding->setCache(userSettings->value("cachepath", QDir::tempPath()).toString()); | 164 | bleeding->setCache(settings->cachePath()); |
179 | bleeding->setFile(&bleedingInfo); | 165 | bleeding->setFile(&bleedingInfo); |
180 | bleeding->getFile(QUrl(devices->value("bleeding_info").toString())); | 166 | bleeding->getFile(QUrl(settings->bleedingInfo())); |
181 | 167 | ||
182 | if(chkConfig(false)) { | 168 | if(chkConfig(false)) { |
183 | QApplication::processEvents(); | 169 | QApplication::processEvents(); |
@@ -254,7 +240,7 @@ void RbUtilQt::help() | |||
254 | void RbUtilQt::configDialog() | 240 | void RbUtilQt::configDialog() |
255 | { | 241 | { |
256 | Config *cw = new Config(this); | 242 | Config *cw = new Config(this); |
257 | cw->setSettings(userSettings,devices); | 243 | cw->setSettings(settings); |
258 | cw->show(); | 244 | cw->show(); |
259 | connect(cw, SIGNAL(settingsUpdated()), this, SLOT(downloadInfo())); | 245 | connect(cw, SIGNAL(settingsUpdated()), this, SLOT(downloadInfo())); |
260 | connect(cw, SIGNAL(settingsUpdated()), this, SLOT(updateSettings())); | 246 | connect(cw, SIGNAL(settingsUpdated()), this, SLOT(updateSettings())); |
@@ -271,10 +257,7 @@ void RbUtilQt::updateSettings() | |||
271 | 257 | ||
272 | void RbUtilQt::updateDevice() | 258 | void RbUtilQt::updateDevice() |
273 | { | 259 | { |
274 | platform = userSettings->value("platform").toString(); | 260 | if(!settings->curNeedsBootloader() ) { |
275 | // buttons | ||
276 | devices->beginGroup(platform); | ||
277 | if(devices->value("needsbootloader", "") == "no") { | ||
278 | ui.buttonBootloader->setEnabled(false); | 261 | ui.buttonBootloader->setEnabled(false); |
279 | ui.buttonRemoveBootloader->setEnabled(false); | 262 | ui.buttonRemoveBootloader->setEnabled(false); |
280 | ui.labelBootloader->setEnabled(false); | 263 | ui.labelBootloader->setEnabled(false); |
@@ -283,7 +266,7 @@ void RbUtilQt::updateDevice() | |||
283 | else { | 266 | else { |
284 | ui.buttonBootloader->setEnabled(true); | 267 | ui.buttonBootloader->setEnabled(true); |
285 | ui.labelBootloader->setEnabled(true); | 268 | ui.labelBootloader->setEnabled(true); |
286 | if(devices->value("bootloadermethod") == "fwpatcher") { | 269 | if(settings->curBootloaderMethod() == "fwpatcher") { |
287 | ui.labelRemoveBootloader->setEnabled(false); | 270 | ui.labelRemoveBootloader->setEnabled(false); |
288 | ui.buttonRemoveBootloader->setEnabled(false); | 271 | ui.buttonRemoveBootloader->setEnabled(false); |
289 | } | 272 | } |
@@ -292,14 +275,11 @@ void RbUtilQt::updateDevice() | |||
292 | ui.buttonRemoveBootloader->setEnabled(true); | 275 | ui.buttonRemoveBootloader->setEnabled(true); |
293 | } | 276 | } |
294 | } | 277 | } |
295 | devices->endGroup(); | 278 | |
296 | // displayed device info | 279 | // displayed device info |
297 | platform = userSettings->value("platform").toString(); | 280 | QString mountpoint = settings->mountpoint(); |
298 | QString mountpoint = userSettings->value("mountpoint").toString(); | 281 | QString brand = settings->curBrand(); |
299 | devices->beginGroup(platform); | 282 | QString name = settings->curName(); |
300 | QString brand = devices->value("brand").toString(); | ||
301 | QString name = devices->value("name").toString(); | ||
302 | devices->endGroup(); | ||
303 | if(name.isEmpty()) name = "<none>"; | 283 | if(name.isEmpty()) name = "<none>"; |
304 | if(mountpoint.isEmpty()) mountpoint = "<invalid>"; | 284 | if(mountpoint.isEmpty()) mountpoint = "<invalid>"; |
305 | ui.labelDevice->setText(tr("<b>%1 %2</b> at <b>%3</b>") | 285 | ui.labelDevice->setText(tr("<b>%1 %2</b> at <b>%3</b>") |
@@ -309,19 +289,16 @@ void RbUtilQt::updateDevice() | |||
309 | 289 | ||
310 | void RbUtilQt::updateManual() | 290 | void RbUtilQt::updateManual() |
311 | { | 291 | { |
312 | if(userSettings->value("platform").toString() != "") | 292 | if(settings->curPlatform() != "") |
313 | { | 293 | { |
314 | devices->beginGroup(userSettings->value("platform").toString()); | 294 | QString manual= settings->curManual(); |
315 | QString manual; | ||
316 | manual = devices->value("manualname", "").toString(); | ||
317 | 295 | ||
318 | if(manual == "") | 296 | if(manual == "") |
319 | manual = "rockbox-" + devices->value("platform").toString(); | 297 | manual = "rockbox-" + settings->curPlatform(); |
320 | devices->endGroup(); | ||
321 | QString pdfmanual; | 298 | QString pdfmanual; |
322 | pdfmanual = devices->value("manual_url").toString() + "/" + manual + ".pdf"; | 299 | pdfmanual = settings->manualUrl() + "/" + manual + ".pdf"; |
323 | QString htmlmanual; | 300 | QString htmlmanual; |
324 | htmlmanual = devices->value("manual_url").toString() + "/" + manual + "/rockbox-build.html"; | 301 | htmlmanual = settings->manualUrl() + "/" + manual + "/rockbox-build.html"; |
325 | ui.labelPdfManual->setText(tr("<a href='%1'>PDF Manual</a>") | 302 | ui.labelPdfManual->setText(tr("<a href='%1'>PDF Manual</a>") |
326 | .arg(pdfmanual)); | 303 | .arg(pdfmanual)); |
327 | ui.labelHtmlManual->setText(tr("<a href='%1'>HTML Manual (opens in browser)</a>") | 304 | ui.labelHtmlManual->setText(tr("<a href='%1'>HTML Manual (opens in browser)</a>") |
@@ -403,7 +380,7 @@ void RbUtilQt::smallInstall() | |||
403 | 380 | ||
404 | bool RbUtilQt::smallInstallInner() | 381 | bool RbUtilQt::smallInstallInner() |
405 | { | 382 | { |
406 | QString mountpoint = userSettings->value("mountpoint").toString(); | 383 | QString mountpoint = settings->mountpoint(); |
407 | // show dialog with error if mount point is wrong | 384 | // show dialog with error if mount point is wrong |
408 | if(!QFileInfo(mountpoint).isDir()) { | 385 | if(!QFileInfo(mountpoint).isDir()) { |
409 | logger->addItem(tr("Mount point is wrong!"),LOGERROR); | 386 | logger->addItem(tr("Mount point is wrong!"),LOGERROR); |
@@ -411,10 +388,7 @@ bool RbUtilQt::smallInstallInner() | |||
411 | return true; | 388 | return true; |
412 | } | 389 | } |
413 | // Bootloader | 390 | // Bootloader |
414 | devices->beginGroup(userSettings->value("platform").toString()); | 391 | if(settings->curNeedsBootloader()) |
415 | QString needBootloader = devices->value("needsbootloader", "").toString(); | ||
416 | devices->endGroup(); | ||
417 | if(needBootloader == "yes") | ||
418 | { | 392 | { |
419 | m_error = false; | 393 | m_error = false; |
420 | m_installed = false; | 394 | m_installed = false; |
@@ -461,20 +435,16 @@ void RbUtilQt::installBtn() | |||
461 | bool RbUtilQt::installAuto() | 435 | bool RbUtilQt::installAuto() |
462 | { | 436 | { |
463 | QString file = QString("%1%2/rockbox.zip") | 437 | QString file = QString("%1%2/rockbox.zip") |
464 | .arg(devices->value("bleeding_url").toString(), | 438 | .arg(settings->bleedingUrl(), settings->curPlatform()); |
465 | userSettings->value("platform").toString()); | ||
466 | 439 | ||
467 | buildInfo.open(); | 440 | buildInfo.open(); |
468 | QSettings info(buildInfo.fileName(), QSettings::IniFormat, this); | 441 | QSettings info(buildInfo.fileName(), QSettings::IniFormat, this); |
469 | buildInfo.close(); | 442 | buildInfo.close(); |
470 | 443 | ||
471 | devices->beginGroup(platform); | 444 | if(settings->curReleased()) { |
472 | QString released = devices->value("released").toString(); | ||
473 | devices->endGroup(); | ||
474 | if(released == "yes") { | ||
475 | // only set the keys if needed -- querying will yield an empty string | 445 | // only set the keys if needed -- querying will yield an empty string |
476 | // if not set. | 446 | // if not set. |
477 | versmap.insert("rel_rev", devices->value("last_release").toString()); | 447 | versmap.insert("rel_rev", settings->lastRelease()); |
478 | versmap.insert("rel_date", ""); // FIXME: provide the release timestamp | 448 | versmap.insert("rel_date", ""); // FIXME: provide the release timestamp |
479 | } | 449 | } |
480 | 450 | ||
@@ -485,9 +455,9 @@ bool RbUtilQt::installAuto() | |||
485 | installer->setProxy(proxy()); | 455 | installer->setProxy(proxy()); |
486 | installer->setLogSection("Rockbox (Base)"); | 456 | installer->setLogSection("Rockbox (Base)"); |
487 | installer->setLogVersion(myversion); | 457 | installer->setLogVersion(myversion); |
488 | if(!userSettings->value("cachedisable").toBool()) | 458 | if(!settings->cacheDisabled()) |
489 | installer->setCache(userSettings->value("cachepath", QDir::tempPath()).toString()); | 459 | installer->setCache(settings->cachePath()); |
490 | installer->setMountPoint(userSettings->value("mountpoint").toString()); | 460 | installer->setMountPoint(settings->mountpoint()); |
491 | installer->install(logger); | 461 | installer->install(logger); |
492 | 462 | ||
493 | connect(installer, SIGNAL(done(bool)), this, SLOT(installdone(bool))); | 463 | connect(installer, SIGNAL(done(bool)), this, SLOT(installdone(bool))); |
@@ -498,21 +468,17 @@ bool RbUtilQt::installAuto() | |||
498 | void RbUtilQt::install() | 468 | void RbUtilQt::install() |
499 | { | 469 | { |
500 | Install *installWindow = new Install(this); | 470 | Install *installWindow = new Install(this); |
501 | installWindow->setUserSettings(userSettings); | 471 | installWindow->setSettings(settings); |
502 | installWindow->setDeviceSettings(devices); | ||
503 | installWindow->setProxy(proxy()); | 472 | installWindow->setProxy(proxy()); |
504 | 473 | ||
505 | buildInfo.open(); | 474 | buildInfo.open(); |
506 | QSettings info(buildInfo.fileName(), QSettings::IniFormat, this); | 475 | QSettings info(buildInfo.fileName(), QSettings::IniFormat, this); |
507 | buildInfo.close(); | 476 | buildInfo.close(); |
508 | 477 | ||
509 | devices->beginGroup(platform); | 478 | if(settings->curReleased()) { |
510 | QString released = devices->value("released").toString(); | ||
511 | devices->endGroup(); | ||
512 | if(released == "yes") { | ||
513 | // only set the keys if needed -- querying will yield an empty string | 479 | // only set the keys if needed -- querying will yield an empty string |
514 | // if not set. | 480 | // if not set. |
515 | versmap.insert("rel_rev", devices->value("last_release").toString()); | 481 | versmap.insert("rel_rev", settings->lastRelease()); |
516 | versmap.insert("rel_date", ""); // FIXME: provide the release timestamp | 482 | versmap.insert("rel_date", ""); // FIXME: provide the release timestamp |
517 | } | 483 | } |
518 | installWindow->setVersionStrings(versmap); | 484 | installWindow->setVersionStrings(versmap); |
@@ -543,19 +509,19 @@ void RbUtilQt::installBootloaderBtn() | |||
543 | 509 | ||
544 | void RbUtilQt::installBootloader() | 510 | void RbUtilQt::installBootloader() |
545 | { | 511 | { |
546 | QString platform = userSettings->value("platform").toString(); | 512 | QString platform = settings->curPlatform(); |
547 | 513 | ||
548 | // create installer | 514 | // create installer |
549 | blinstaller = new BootloaderInstaller(this); | 515 | blinstaller = new BootloaderInstaller(this); |
550 | 516 | ||
551 | blinstaller->setMountPoint(userSettings->value("mountpoint").toString()); | 517 | blinstaller->setMountPoint(settings->mountpoint()); |
552 | 518 | ||
553 | blinstaller->setProxy(proxy()); | 519 | blinstaller->setProxy(proxy()); |
554 | blinstaller->setDevice(platform); | 520 | blinstaller->setDevice(platform); |
555 | blinstaller->setBootloaderMethod(devices->value(platform + "/bootloadermethod").toString()); | 521 | blinstaller->setBootloaderMethod(settings->curBootloaderMethod()); |
556 | blinstaller->setBootloaderName(devices->value(platform + "/bootloadername").toString()); | 522 | blinstaller->setBootloaderName(settings->curBootloaderName()); |
557 | blinstaller->setBootloaderBaseUrl(devices->value("bootloader_url").toString()); | 523 | blinstaller->setBootloaderBaseUrl(settings->bootloaderUrl()); |
558 | blinstaller->setBootloaderInfoUrl(devices->value("bootloader_info_url").toString()); | 524 | blinstaller->setBootloaderInfoUrl(settings->bootloaderInfoUrl()); |
559 | if(!blinstaller->downloadInfo()) | 525 | if(!blinstaller->downloadInfo()) |
560 | { | 526 | { |
561 | logger->addItem(tr("Could not get the bootloader info file!"),LOGERROR); | 527 | logger->addItem(tr("Could not get the bootloader info file!"),LOGERROR); |
@@ -581,10 +547,10 @@ void RbUtilQt::installBootloader() | |||
581 | 547 | ||
582 | // if fwpatcher , ask for extra file | 548 | // if fwpatcher , ask for extra file |
583 | QString offirmware; | 549 | QString offirmware; |
584 | if(devices->value(platform + "/bootloadermethod").toString() == "fwpatcher") | 550 | if(settings->curBootloaderMethod() == "fwpatcher") |
585 | { | 551 | { |
586 | BrowseOF ofbrowser(this); | 552 | BrowseOF ofbrowser(this); |
587 | ofbrowser.setFile(userSettings->value("ofpath").toString()); | 553 | ofbrowser.setFile(settings->ofPath()); |
588 | if(ofbrowser.exec() == QDialog::Accepted) | 554 | if(ofbrowser.exec() == QDialog::Accepted) |
589 | { | 555 | { |
590 | offirmware = ofbrowser.getFile(); | 556 | offirmware = ofbrowser.getFile(); |
@@ -598,8 +564,8 @@ void RbUtilQt::installBootloader() | |||
598 | } | 564 | } |
599 | else | 565 | else |
600 | { | 566 | { |
601 | userSettings->setValue("ofpath",offirmware); | 567 | settings->setOfPath(offirmware); |
602 | userSettings->sync(); | 568 | settings->sync(); |
603 | } | 569 | } |
604 | } | 570 | } |
605 | else | 571 | else |
@@ -639,13 +605,13 @@ void RbUtilQt::installFonts() | |||
639 | // create zip installer | 605 | // create zip installer |
640 | installer = new ZipInstaller(this); | 606 | installer = new ZipInstaller(this); |
641 | 607 | ||
642 | installer->setUrl(devices->value("font_url").toString()); | 608 | installer->setUrl(settings->fontUrl()); |
643 | installer->setProxy(proxy()); | 609 | installer->setProxy(proxy()); |
644 | installer->setLogSection("Fonts"); | 610 | installer->setLogSection("Fonts"); |
645 | installer->setLogVersion(versmap.value("arch_date")); | 611 | installer->setLogVersion(versmap.value("arch_date")); |
646 | installer->setMountPoint(userSettings->value("mountpoint").toString()); | 612 | installer->setMountPoint(settings->mountpoint()); |
647 | if(!userSettings->value("cachedisable").toBool()) | 613 | if(!settings->cacheDisabled()) |
648 | installer->setCache(userSettings->value("cachepath", QDir::tempPath()).toString()); | 614 | installer->setCache(settings->cachePath()); |
649 | installer->install(logger); | 615 | installer->install(logger); |
650 | } | 616 | } |
651 | 617 | ||
@@ -664,25 +630,22 @@ void RbUtilQt::installVoice() | |||
664 | installer = new ZipInstaller(this); | 630 | installer = new ZipInstaller(this); |
665 | installer->setUnzip(false); | 631 | installer->setUnzip(false); |
666 | 632 | ||
667 | QString voiceurl = devices->value("voice_url").toString() + "/" ; | 633 | QString voiceurl = settings->voiceUrl() + "/" ; |
668 | 634 | ||
669 | devices->beginGroup(userSettings->value("platform").toString()); | 635 | voiceurl += settings->curVoiceName() + "-" + |
670 | voiceurl += devices->value("voicename").toString() + "-" + | ||
671 | versmap.value("arch_date") + "-english.voice"; | 636 | versmap.value("arch_date") + "-english.voice"; |
672 | devices->endGroup(); | ||
673 | qDebug() << voiceurl; | 637 | qDebug() << voiceurl; |
674 | 638 | ||
675 | installer->setProxy(proxy()); | 639 | installer->setProxy(proxy()); |
676 | installer->setUrl(voiceurl); | 640 | installer->setUrl(voiceurl); |
677 | installer->setLogSection("Voice"); | 641 | installer->setLogSection("Voice"); |
678 | installer->setLogVersion(versmap.value("arch_date")); | 642 | installer->setLogVersion(versmap.value("arch_date")); |
679 | installer->setMountPoint(userSettings->value("mountpoint").toString()); | 643 | installer->setMountPoint(settings->mountpoint()); |
680 | installer->setTarget("/.rockbox/langs/english.voice"); | 644 | installer->setTarget("/.rockbox/langs/english.voice"); |
681 | if(!userSettings->value("cachedisable").toBool()) | 645 | if(!settings->cacheDisabled()) |
682 | installer->setCache(userSettings->value("cachepath", QDir::tempPath()).toString()); | 646 | installer->setCache(settings->cachePath()); |
683 | installer->install(logger); | 647 | installer->install(logger); |
684 | 648 | ||
685 | //connect(installer, SIGNAL(done(bool)), this, SLOT(done(bool))); | ||
686 | } | 649 | } |
687 | 650 | ||
688 | void RbUtilQt::installDoomBtn() | 651 | void RbUtilQt::installDoomBtn() |
@@ -711,7 +674,7 @@ bool RbUtilQt::installDoomAuto() | |||
711 | 674 | ||
712 | bool RbUtilQt::hasDoom() | 675 | bool RbUtilQt::hasDoom() |
713 | { | 676 | { |
714 | QFile doomrock(userSettings->value("mountpoint").toString()+"/.rockbox/rocks/games/doom.rock"); | 677 | QFile doomrock(settings->mountpoint() +"/.rockbox/rocks/games/doom.rock"); |
715 | return doomrock.exists(); | 678 | return doomrock.exists(); |
716 | } | 679 | } |
717 | 680 | ||
@@ -720,35 +683,32 @@ void RbUtilQt::installDoom() | |||
720 | // create zip installer | 683 | // create zip installer |
721 | installer = new ZipInstaller(this); | 684 | installer = new ZipInstaller(this); |
722 | 685 | ||
723 | installer->setUrl(devices->value("doom_url").toString()); | 686 | installer->setUrl(settings->doomUrl()); |
724 | installer->setProxy(proxy()); | 687 | installer->setProxy(proxy()); |
725 | installer->setLogSection("Game Addons"); | 688 | installer->setLogSection("Game Addons"); |
726 | installer->setLogVersion(versmap.value("arch_date")); | 689 | installer->setLogVersion(versmap.value("arch_date")); |
727 | installer->setMountPoint(userSettings->value("mountpoint").toString()); | 690 | installer->setMountPoint(settings->mountpoint()); |
728 | if(!userSettings->value("cachedisable").toBool()) | 691 | if(!settings->cacheDisabled()) |
729 | installer->setCache(userSettings->value("cachepath", QDir::tempPath()).toString()); | 692 | installer->setCache(settings->cachePath()); |
730 | installer->install(logger); | 693 | installer->install(logger); |
731 | 694 | ||
732 | } | 695 | } |
733 | 696 | ||
734 | |||
735 | void RbUtilQt::installThemes() | 697 | void RbUtilQt::installThemes() |
736 | { | 698 | { |
737 | if(chkConfig(true)) return; | 699 | if(chkConfig(true)) return; |
738 | ThemesInstallWindow* tw = new ThemesInstallWindow(this); | 700 | ThemesInstallWindow* tw = new ThemesInstallWindow(this); |
739 | tw->setDeviceSettings(devices); | 701 | tw->setSettings(settings); |
740 | tw->setUserSettings(userSettings); | ||
741 | tw->setProxy(proxy()); | 702 | tw->setProxy(proxy()); |
742 | tw->setModal(true); | 703 | tw->setModal(true); |
743 | tw->show(); | 704 | tw->show(); |
744 | } | 705 | } |
745 | 706 | ||
746 | |||
747 | void RbUtilQt::createTalkFiles(void) | 707 | void RbUtilQt::createTalkFiles(void) |
748 | { | 708 | { |
749 | if(chkConfig(true)) return; | 709 | if(chkConfig(true)) return; |
750 | InstallTalkWindow *installWindow = new InstallTalkWindow(this); | 710 | InstallTalkWindow *installWindow = new InstallTalkWindow(this); |
751 | installWindow->setSettings(userSettings,devices); | 711 | installWindow->setSettings(settings); |
752 | installWindow->show(); | 712 | installWindow->show(); |
753 | connect(installWindow, SIGNAL(settingsUpdated()), this, SLOT(downloadInfo())); | 713 | connect(installWindow, SIGNAL(settingsUpdated()), this, SLOT(downloadInfo())); |
754 | connect(installWindow, SIGNAL(settingsUpdated()), this, SLOT(updateSettings())); | 714 | connect(installWindow, SIGNAL(settingsUpdated()), this, SLOT(updateSettings())); |
@@ -759,7 +719,7 @@ void RbUtilQt::createVoiceFile(void) | |||
759 | { | 719 | { |
760 | if(chkConfig(true)) return; | 720 | if(chkConfig(true)) return; |
761 | CreateVoiceWindow *installWindow = new CreateVoiceWindow(this); | 721 | CreateVoiceWindow *installWindow = new CreateVoiceWindow(this); |
762 | installWindow->setSettings(userSettings,devices); | 722 | installWindow->setSettings(settings); |
763 | installWindow->setProxy(proxy()); | 723 | installWindow->setProxy(proxy()); |
764 | 724 | ||
765 | installWindow->show(); | 725 | installWindow->show(); |
@@ -771,8 +731,7 @@ void RbUtilQt::uninstall(void) | |||
771 | { | 731 | { |
772 | if(chkConfig(true)) return; | 732 | if(chkConfig(true)) return; |
773 | UninstallWindow *uninstallWindow = new UninstallWindow(this); | 733 | UninstallWindow *uninstallWindow = new UninstallWindow(this); |
774 | uninstallWindow->setUserSettings(userSettings); | 734 | uninstallWindow->setSettings(settings); |
775 | uninstallWindow->setDeviceSettings(devices); | ||
776 | uninstallWindow->show(); | 735 | uninstallWindow->show(); |
777 | 736 | ||
778 | } | 737 | } |
@@ -787,15 +746,14 @@ void RbUtilQt::uninstallBootloader(void) | |||
787 | ProgressLoggerGui* logger = new ProgressLoggerGui(this); | 746 | ProgressLoggerGui* logger = new ProgressLoggerGui(this); |
788 | logger->show(); | 747 | logger->show(); |
789 | 748 | ||
790 | QString plattform = userSettings->value("platform").toString(); | ||
791 | BootloaderInstaller blinstaller(this); | 749 | BootloaderInstaller blinstaller(this); |
792 | blinstaller.setProxy(proxy()); | 750 | blinstaller.setProxy(proxy()); |
793 | blinstaller.setMountPoint(userSettings->value("mountpoint").toString()); | 751 | blinstaller.setMountPoint(settings->mountpoint()); |
794 | blinstaller.setDevice(userSettings->value("platform").toString()); | 752 | blinstaller.setDevice(settings->curPlatform()); |
795 | blinstaller.setBootloaderMethod(devices->value(plattform + "/bootloadermethod").toString()); | 753 | blinstaller.setBootloaderMethod(settings->curBootloaderMethod()); |
796 | blinstaller.setBootloaderName(devices->value(plattform + "/bootloadername").toString()); | 754 | blinstaller.setBootloaderName(settings->curBootloaderName()); |
797 | blinstaller.setBootloaderBaseUrl(devices->value("bootloader_url").toString()); | 755 | blinstaller.setBootloaderBaseUrl(settings->bootloaderUrl()); |
798 | blinstaller.setBootloaderInfoUrl(devices->value("bootloader_info_url").toString()); | 756 | blinstaller.setBootloaderInfoUrl(settings->bootloaderInfoUrl()); |
799 | if(!blinstaller.downloadInfo()) | 757 | if(!blinstaller.downloadInfo()) |
800 | { | 758 | { |
801 | logger->addItem(tr("Could not get the bootloader info file!"),LOGERROR); | 759 | logger->addItem(tr("Could not get the bootloader info file!"),LOGERROR); |
@@ -821,12 +779,8 @@ void RbUtilQt::downloadManual(void) | |||
821 | QSettings info(buildInfo.fileName(), QSettings::IniFormat, this); | 779 | QSettings info(buildInfo.fileName(), QSettings::IniFormat, this); |
822 | buildInfo.close(); | 780 | buildInfo.close(); |
823 | 781 | ||
824 | devices->beginGroup(userSettings->value("platform").toString()); | 782 | QString manual = settings->curManual(); |
825 | QString manual; | 783 | |
826 | manual = devices->value("manualname", "rockbox-" + | ||
827 | devices->value("platform").toString()).toString(); | ||
828 | devices->endGroup(); | ||
829 | |||
830 | QString date = (info.value("dailies/date").toString()); | 784 | QString date = (info.value("dailies/date").toString()); |
831 | 785 | ||
832 | QString manualurl; | 786 | QString manualurl; |
@@ -840,15 +794,15 @@ void RbUtilQt::downloadManual(void) | |||
840 | target = "/" + manual + "-" + date + "-html.zip"; | 794 | target = "/" + manual + "-" + date + "-html.zip"; |
841 | section = "Manual (HTML)"; | 795 | section = "Manual (HTML)"; |
842 | } | 796 | } |
843 | manualurl = devices->value("manual_url").toString() + "/" + target; | 797 | manualurl = settings->manualUrl() + "/" + target; |
844 | qDebug() << "manualurl =" << manualurl; | 798 | qDebug() << "manualurl =" << manualurl; |
845 | 799 | ||
846 | ProgressLoggerGui* logger = new ProgressLoggerGui(this); | 800 | ProgressLoggerGui* logger = new ProgressLoggerGui(this); |
847 | logger->show(); | 801 | logger->show(); |
848 | installer = new ZipInstaller(this); | 802 | installer = new ZipInstaller(this); |
849 | installer->setMountPoint(userSettings->value("mountpoint").toString()); | 803 | installer->setMountPoint(settings->mountpoint()); |
850 | if(!userSettings->value("cachedisable").toBool()) | 804 | if(!settings->cacheDisabled()) |
851 | installer->setCache(userSettings->value("cachepath", QDir::tempPath()).toString()); | 805 | installer->setCache(settings->cachePath()); |
852 | installer->setProxy(proxy()); | 806 | installer->setProxy(proxy()); |
853 | installer->setLogSection(section); | 807 | installer->setLogSection(section); |
854 | installer->setLogVersion(date); | 808 | installer->setLogVersion(date); |
@@ -874,23 +828,23 @@ void RbUtilQt::installPortable(void) | |||
874 | logger->addItem(tr("Installing Rockbox Utility"), LOGINFO); | 828 | logger->addItem(tr("Installing Rockbox Utility"), LOGINFO); |
875 | 829 | ||
876 | // check mountpoint | 830 | // check mountpoint |
877 | if(!QFileInfo(userSettings->value("mountpoint").toString()).isDir()) { | 831 | if(!QFileInfo(settings->mountpoint()).isDir()) { |
878 | logger->addItem(tr("Mount point is wrong!"),LOGERROR); | 832 | logger->addItem(tr("Mount point is wrong!"),LOGERROR); |
879 | logger->abort(); | 833 | logger->abort(); |
880 | return; | 834 | return; |
881 | } | 835 | } |
882 | 836 | ||
883 | // remove old files first. | 837 | // remove old files first. |
884 | QFile::remove(userSettings->value("mountpoint").toString() + "/RockboxUtility.exe"); | 838 | QFile::remove(settings->mountpoint() + "/RockboxUtility.exe"); |
885 | QFile::remove(userSettings->value("mountpoint").toString() + "/RockboxUtility.ini"); | 839 | QFile::remove(settings->mountpoint() + "/RockboxUtility.ini"); |
886 | // copy currently running binary and currently used settings file | 840 | // copy currently running binary and currently used settings file |
887 | if(!QFile::copy(qApp->applicationFilePath(), userSettings->value("mountpoint").toString() + "/RockboxUtility.exe")) { | 841 | if(!QFile::copy(qApp->applicationFilePath(), settings->mountpoint() + "/RockboxUtility.exe")) { |
888 | logger->addItem(tr("Error installing Rockbox Utility"), LOGERROR); | 842 | logger->addItem(tr("Error installing Rockbox Utility"), LOGERROR); |
889 | logger->abort(); | 843 | logger->abort(); |
890 | return; | 844 | return; |
891 | } | 845 | } |
892 | logger->addItem(tr("Installing user configuration"), LOGINFO); | 846 | logger->addItem(tr("Installing user configuration"), LOGINFO); |
893 | if(!QFile::copy(userSettings->fileName(), userSettings->value("mountpoint").toString() + "/RockboxUtility.ini")) { | 847 | if(!QFile::copy(settings->userSettingFilename(), settings->mountpoint() + "/RockboxUtility.ini")) { |
894 | logger->addItem(tr("Error installing user configuration"), LOGERROR); | 848 | logger->addItem(tr("Error installing user configuration"), LOGERROR); |
895 | logger->abort(); | 849 | logger->abort(); |
896 | return; | 850 | return; |
@@ -907,7 +861,7 @@ void RbUtilQt::updateInfo() | |||
907 | { | 861 | { |
908 | qDebug() << "RbUtilQt::updateInfo()"; | 862 | qDebug() << "RbUtilQt::updateInfo()"; |
909 | 863 | ||
910 | QSettings log(userSettings->value("mountpoint").toString() + "/.rockbox/rbutil.log", QSettings::IniFormat, this); | 864 | QSettings log(settings->mountpoint() + "/.rockbox/rbutil.log", QSettings::IniFormat, this); |
911 | QStringList groups = log.childGroups(); | 865 | QStringList groups = log.childGroups(); |
912 | QList<QTreeWidgetItem *> items; | 866 | QList<QTreeWidgetItem *> items; |
913 | QTreeWidgetItem *w, *w2; | 867 | QTreeWidgetItem *w, *w2; |
@@ -943,7 +897,7 @@ void RbUtilQt::updateInfo() | |||
943 | 897 | ||
944 | for(int b = 0; b < keys.size(); b++) { | 898 | for(int b = 0; b < keys.size(); b++) { |
945 | QString file; | 899 | QString file; |
946 | file = userSettings->value("mountpoint").toString() + "/" + keys.at(b); | 900 | file = settings->mountpoint() + "/" + keys.at(b); |
947 | if(QFileInfo(file).isDir()) | 901 | if(QFileInfo(file).isDir()) |
948 | continue; | 902 | continue; |
949 | w2 = new QTreeWidgetItem(w, QStringList() << "/" | 903 | w2 = new QTreeWidgetItem(w, QStringList() << "/" |
@@ -968,9 +922,9 @@ void RbUtilQt::updateInfo() | |||
968 | 922 | ||
969 | QUrl RbUtilQt::proxy() | 923 | QUrl RbUtilQt::proxy() |
970 | { | 924 | { |
971 | if(userSettings->value("proxytype", "system").toString() == "manual") | 925 | if(settings->proxyType() == "manual") |
972 | return QUrl(userSettings->value("proxy").toString()); | 926 | return QUrl(settings->proxy()); |
973 | else if(userSettings->value("proxytype", "system").toString() == "system") | 927 | else if(settings->proxy() == "system") |
974 | { | 928 | { |
975 | systemProxy(); | 929 | systemProxy(); |
976 | } | 930 | } |
@@ -981,9 +935,9 @@ QUrl RbUtilQt::proxy() | |||
981 | bool RbUtilQt::chkConfig(bool warn) | 935 | bool RbUtilQt::chkConfig(bool warn) |
982 | { | 936 | { |
983 | bool error = false; | 937 | bool error = false; |
984 | if(userSettings->value("platform").toString().isEmpty() | 938 | if(settings->curPlatform().isEmpty() |
985 | || userSettings->value("mountpoint").toString().isEmpty() | 939 | || settings->mountpoint().isEmpty() |
986 | || !QFileInfo(userSettings->value("mountpoint").toString()).isWritable()) { | 940 | || !QFileInfo(settings->mountpoint()).isWritable()) { |
987 | error = true; | 941 | error = true; |
988 | 942 | ||
989 | if(warn) QMessageBox::critical(this, tr("Configuration error"), | 943 | if(warn) QMessageBox::critical(this, tr("Configuration error"), |