1 /***************************************************************************
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
9 * Copyright (C) 2007 by Dominik Riebeling
12 * All files in this archive are subject to the GNU General Public License.
13 * See the file COPYING in the source tree root for full license agreement.
15 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
16 * KIND, either express or implied.
18 ****************************************************************************/
24 #include "ui_rbutilqtfrm.h"
25 #include "ui_aboutbox.h"
26 #include "configure.h"
28 #include "installtalkwindow.h"
29 #include "createvoicewindow.h"
31 #include "installbootloader.h"
32 #include "installthemes.h"
33 #include "uninstallwindow.h"
37 #if defined(Q_OS_LINUX)
40 #if defined(Q_OS_WIN32)
49 RbUtilQt::RbUtilQt(QWidget
*parent
) : QMainWindow(parent
)
51 absolutePath
= qApp
->applicationDirPath();
55 settings
= new RbSettings();
62 ui
.radioPdf
->setChecked(true);
65 ui
.treeInfo
->setAlternatingRowColors(true);
66 ui
.treeInfo
->setHeaderLabels(QStringList() << tr("File") << tr("Version"));
67 ui
.treeInfo
->expandAll();
68 ui
.treeInfo
->setColumnCount(2);
70 connect(ui
.tabWidget
, SIGNAL(currentChanged(int)), this, SLOT(updateTabs(int)));
71 connect(ui
.actionAbout_Qt
, SIGNAL(triggered()), qApp
, SLOT(aboutQt()));
72 connect(ui
.action_About
, SIGNAL(triggered()), this, SLOT(about()));
73 connect(ui
.action_Help
, SIGNAL(triggered()), this, SLOT(help()));
74 connect(ui
.action_Configure
, SIGNAL(triggered()), this, SLOT(configDialog()));
75 connect(ui
.buttonChangeDevice
, SIGNAL(clicked()), this, SLOT(configDialog()));
76 connect(ui
.buttonRockbox
, SIGNAL(clicked()), this, SLOT(installBtn()));
77 connect(ui
.buttonBootloader
, SIGNAL(clicked()), this, SLOT(installBootloaderBtn()));
78 connect(ui
.buttonFonts
, SIGNAL(clicked()), this, SLOT(installFontsBtn()));
79 connect(ui
.buttonGames
, SIGNAL(clicked()), this, SLOT(installDoomBtn()));
80 connect(ui
.buttonTalk
, SIGNAL(clicked()), this, SLOT(createTalkFiles()));
81 connect(ui
.buttonCreateVoice
, SIGNAL(clicked()), this, SLOT(createVoiceFile()));
82 connect(ui
.buttonVoice
, SIGNAL(clicked()), this, SLOT(installVoice()));
83 connect(ui
.buttonThemes
, SIGNAL(clicked()), this, SLOT(installThemes()));
84 connect(ui
.buttonRemoveRockbox
, SIGNAL(clicked()), this, SLOT(uninstall()));
85 connect(ui
.buttonRemoveBootloader
, SIGNAL(clicked()), this, SLOT(uninstallBootloader()));
86 connect(ui
.buttonDownloadManual
, SIGNAL(clicked()), this, SLOT(downloadManual()));
87 connect(ui
.buttonSmall
, SIGNAL(clicked()), this, SLOT(smallInstall()));
88 connect(ui
.buttonComplete
, SIGNAL(clicked()), this, SLOT(completeInstall()));
90 // actions accessible from the menu
91 connect(ui
.actionComplete_Installation
, SIGNAL(triggered()), this, SLOT(completeInstall()));
92 connect(ui
.actionSmall_Installation
, SIGNAL(triggered()), this, SLOT(smallInstall()));
93 connect(ui
.actionInstall_Bootloader
, SIGNAL(triggered()), this, SLOT(installBootloaderBtn()));
94 connect(ui
.actionInstall_Rockbox
, SIGNAL(triggered()), this, SLOT(installBtn()));
95 connect(ui
.actionFonts_Package
, SIGNAL(triggered()), this, SLOT(installFontsBtn()));
96 connect(ui
.actionInstall_Themes
, SIGNAL(triggered()), this, SLOT(installThemes()));
97 connect(ui
.actionInstall_Game_Files
, SIGNAL(triggered()), this, SLOT(installDoomBtn()));
98 connect(ui
.actionInstall_Voice_File
, SIGNAL(triggered()), this, SLOT(installVoice()));
99 connect(ui
.actionCreate_Voice_File
, SIGNAL(triggered()), this, SLOT(createVoiceFile()));
100 connect(ui
.actionCreate_Talk_Files
, SIGNAL(triggered()), this, SLOT(createTalkFiles()));
101 connect(ui
.actionRemove_bootloader
, SIGNAL(triggered()), this, SLOT(uninstallBootloader()));
102 connect(ui
.actionUninstall_Rockbox
, SIGNAL(triggered()), this, SLOT(uninstall()));
105 ui
.actionInstall_Rockbox_Utility_on_player
->setEnabled(false);
107 connect(ui
.actionInstall_Rockbox_Utility_on_player
, SIGNAL(triggered()), this, SLOT(installPortable()));
117 void RbUtilQt::updateTabs(int count
)
129 void RbUtilQt::downloadInfo()
131 // try to get the current build information
132 daily
= new HttpGet(this);
133 connect(daily
, SIGNAL(done(bool)), this, SLOT(downloadDone(bool)));
134 connect(daily
, SIGNAL(requestFinished(int, bool)), this, SLOT(downloadDone(int, bool)));
135 connect(qApp
, SIGNAL(lastWindowClosed()), daily
, SLOT(abort()));
136 if(settings
->cacheOffline())
137 daily
->setCache(true);
139 daily
->setCache(false);
140 qDebug() << "downloading build info";
141 daily
->setFile(&buildInfo
);
142 daily
->getFile(QUrl(settings
->serverConfUrl()));
146 void RbUtilQt::downloadDone(bool error
)
149 qDebug() << "network error:" << daily
->error();
152 qDebug() << "network status:" << daily
->error();
155 QSettings
info(buildInfo
.fileName(), QSettings::IniFormat
, this);
157 versmap
.insert("arch_rev", info
.value("dailies/rev").toString());
158 versmap
.insert("arch_date", info
.value("dailies/date").toString());
160 bleeding
= new HttpGet(this);
161 connect(bleeding
, SIGNAL(done(bool)), this, SLOT(downloadBleedingDone(bool)));
162 connect(bleeding
, SIGNAL(requestFinished(int, bool)), this, SLOT(downloadDone(int, bool)));
163 connect(qApp
, SIGNAL(lastWindowClosed()), daily
, SLOT(abort()));
164 if(settings
->cacheOffline())
165 bleeding
->setCache(true);
166 bleeding
->setFile(&bleedingInfo
);
167 bleeding
->getFile(QUrl(settings
->bleedingInfo()));
169 if(chkConfig(false)) {
170 QApplication::processEvents();
171 QMessageBox::critical(this, tr("Configuration error"),
172 tr("Your configuration is invalid. This is most likely due "
173 "to a new installation of Rockbox Utility or a changed device "
174 "path. The configuation dialog will now open to allow you "
175 "correcting the problem."));
181 void RbUtilQt::downloadBleedingDone(bool error
)
183 if(error
) qDebug() << "network error:" << bleeding
->error();
186 QSettings
info(bleedingInfo
.fileName(), QSettings::IniFormat
, this);
187 bleedingInfo
.close();
188 versmap
.insert("bleed_rev", info
.value("bleeding/rev").toString());
189 versmap
.insert("bleed_date", info
.value("bleeding/timestamp").toString());
190 qDebug() << "versmap =" << versmap
;
196 void RbUtilQt::downloadDone(int id
, bool error
)
199 errorString
= tr("Network error: %1. Please check your network and proxy settings.")
200 .arg(daily
->errorString());
202 QMessageBox::about(this, "Network Error", errorString
);
204 qDebug() << "downloadDone:" << id
<< error
;
208 void RbUtilQt::about()
210 QDialog
*window
= new QDialog(this);
212 about
.setupUi(window
);
213 window
->setModal(true);
215 QFile
licence(":/docs/gpl-2.0.html");
216 licence
.open(QIODevice::ReadOnly
);
217 QTextStream
c(&licence
);
218 QString cline
= c
.readAll();
219 about
.browserLicense
->insertHtml(cline
);
220 about
.browserLicense
->moveCursor(QTextCursor::Start
, QTextCursor::MoveAnchor
);
221 QFile
credits(":/docs/CREDITS");
222 credits
.open(QIODevice::ReadOnly
);
223 QTextStream
r(&credits
);
224 QString rline
= r
.readAll();
225 about
.browserCredits
->insertPlainText(rline
);
226 about
.browserCredits
->moveCursor(QTextCursor::Start
, QTextCursor::MoveAnchor
);
227 QString title
= QString("<b>The Rockbox Utility</b><br/>Version %1").arg(VERSION
);
228 about
.labelTitle
->setText(title
);
229 about
.labelHomepage
->setText("<a href='http://www.rockbox.org'>http://www.rockbox.org</a>");
236 void RbUtilQt::help()
238 QUrl
helpurl("http://www.rockbox.org/wiki/RockboxUtility");
239 QDesktopServices::openUrl(helpurl
);
243 void RbUtilQt::configDialog()
245 Config
*cw
= new Config(this);
246 cw
->setSettings(settings
);
247 connect(cw
, SIGNAL(settingsUpdated()), this, SLOT(updateSettings()));
248 connect(cw
, SIGNAL(settingsUpdated()), this, SLOT(downloadInfo()));
253 void RbUtilQt::updateSettings()
255 qDebug() << "updateSettings()";
258 if(settings
->proxyType() == "system") {
259 HttpGet::setGlobalProxy(systemProxy());
261 else if(settings
->proxyType() == "manual") {
262 HttpGet::setGlobalProxy(settings
->proxy());
265 HttpGet::setGlobalProxy(QUrl(""));
267 HttpGet::setGlobalCache(settings
->cachePath());
271 void RbUtilQt::updateDevice()
273 if(!settings
->curNeedsBootloader() ) {
274 ui
.buttonBootloader
->setEnabled(false);
275 ui
.buttonRemoveBootloader
->setEnabled(false);
276 ui
.labelBootloader
->setEnabled(false);
277 ui
.labelRemoveBootloader
->setEnabled(false);
280 ui
.buttonBootloader
->setEnabled(true);
281 ui
.labelBootloader
->setEnabled(true);
282 if(settings
->curBootloaderMethod() == "fwpatcher") {
283 ui
.labelRemoveBootloader
->setEnabled(false);
284 ui
.buttonRemoveBootloader
->setEnabled(false);
287 ui
.labelRemoveBootloader
->setEnabled(true);
288 ui
.buttonRemoveBootloader
->setEnabled(true);
292 // displayed device info
293 QString mountpoint
= settings
->mountpoint();
294 QString brand
= settings
->curBrand();
295 QString name
= settings
->curName();
296 if(name
.isEmpty()) name
= "<none>";
297 if(mountpoint
.isEmpty()) mountpoint
= "<invalid>";
298 ui
.labelDevice
->setText(tr("<b>%1 %2</b> at <b>%3</b>")
299 .arg(brand
, name
, QDir::toNativeSeparators(mountpoint
)));
303 void RbUtilQt::updateManual()
305 if(settings
->curPlatform() != "")
307 QString manual
= settings
->curManual();
310 manual
= "rockbox-" + settings
->curPlatform();
312 pdfmanual
= settings
->manualUrl() + "/" + manual
+ ".pdf";
314 htmlmanual
= settings
->manualUrl() + "/" + manual
+ "/rockbox-build.html";
315 ui
.labelPdfManual
->setText(tr("<a href='%1'>PDF Manual</a>")
317 ui
.labelHtmlManual
->setText(tr("<a href='%1'>HTML Manual (opens in browser)</a>")
321 ui
.labelPdfManual
->setText(tr("Select a device for a link to the correct manual"));
322 ui
.labelHtmlManual
->setText(tr("<a href='%1'>Manual Overview</a>")
323 .arg("http://www.rockbox.org/manual.shtml"));
328 void RbUtilQt::completeInstall()
330 if(chkConfig(true)) return;
331 if(QMessageBox::question(this, tr("Confirm Installation"),
332 tr("Do you really want to make a complete Installation?"),
333 QMessageBox::Yes
| QMessageBox::No
) != QMessageBox::Yes
) return;
336 logger
= new ProgressLoggerGui(this);
339 if(smallInstallInner())
345 if(!installFontsAuto())
349 // wait for installation finished
351 QApplication::processEvents();
361 if(!installDoomAuto())
365 // wait for installation finished
367 QApplication::processEvents();
374 // it has its own logger window,so close our.
380 void RbUtilQt::smallInstall()
382 if(chkConfig(true)) return;
383 if(QMessageBox::question(this, tr("Confirm Installation"),
384 tr("Do you really want to make a small Installation?"),
385 QMessageBox::Yes
| QMessageBox::No
) != QMessageBox::Yes
) return;
388 logger
= new ProgressLoggerGui(this);
394 bool RbUtilQt::smallInstallInner()
396 QString mountpoint
= settings
->mountpoint();
397 // show dialog with error if mount point is wrong
398 if(!QFileInfo(mountpoint
).isDir()) {
399 logger
->addItem(tr("Mount point is wrong!"),LOGERROR
);
404 if(settings
->curNeedsBootloader())
408 if(!installBootloaderAuto())
412 // wait for boot loader installation finished
414 QApplication::processEvents();
416 if(m_error
) return true;
427 // wait for installation finished
429 QApplication::processEvents();
435 void RbUtilQt::installdone(bool error
)
437 qDebug() << "install done";
442 void RbUtilQt::installBtn()
444 if(chkConfig(true)) return;
448 bool RbUtilQt::installAuto()
450 QString file
= QString("%1%2/rockbox.zip")
451 .arg(settings
->bleedingUrl(), settings
->curPlatform());
454 QSettings
info(buildInfo
.fileName(), QSettings::IniFormat
, this);
457 if(settings
->curReleased()) {
458 // only set the keys if needed -- querying will yield an empty string
460 versmap
.insert("rel_rev", settings
->lastRelease());
461 versmap
.insert("rel_date", ""); // FIXME: provide the release timestamp
464 QString myversion
= "r" + versmap
.value("bleed_rev");
466 ZipInstaller
* installer
= new ZipInstaller(this);
467 installer
->setUrl(file
);
468 installer
->setLogSection("Rockbox (Base)");
469 installer
->setLogVersion(myversion
);
470 if(!settings
->cacheDisabled())
471 installer
->setCache(true);
472 installer
->setMountPoint(settings
->mountpoint());
474 connect(installer
, SIGNAL(done(bool)), this, SLOT(installdone(bool)));
476 installer
->install(logger
);
480 void RbUtilQt::install()
482 Install
*installWindow
= new Install(this);
483 installWindow
->setSettings(settings
);
486 QSettings
info(buildInfo
.fileName(), QSettings::IniFormat
, this);
489 if(settings
->curReleased()) {
490 // only set the keys if needed -- querying will yield an empty string
492 versmap
.insert("rel_rev", settings
->lastRelease());
493 versmap
.insert("rel_date", ""); // FIXME: provide the release timestamp
495 installWindow
->setVersionStrings(versmap
);
497 installWindow
->show();
500 bool RbUtilQt::installBootloaderAuto()
506 void RbUtilQt::installBootloaderBtn()
508 if(chkConfig(true)) return;
509 if(QMessageBox::question(this, tr("Confirm Installation"),
510 tr("Do you really want to install the Bootloader?"),
511 QMessageBox::Yes
| QMessageBox::No
) != QMessageBox::Yes
) return;
514 logger
= new ProgressLoggerGui(this);
520 void RbUtilQt::installBootloader()
522 QString platform
= settings
->curPlatform();
525 blinstaller
= new BootloaderInstaller(this);
527 blinstaller
->setMountPoint(settings
->mountpoint());
529 blinstaller
->setDevice(platform
);
530 blinstaller
->setBootloaderMethod(settings
->curBootloaderMethod());
531 blinstaller
->setBootloaderName(settings
->curBootloaderName());
532 blinstaller
->setBootloaderBaseUrl(settings
->bootloaderUrl());
533 blinstaller
->setBootloaderInfoUrl(settings
->bootloaderInfoUrl());
534 if(!blinstaller
->downloadInfo())
536 logger
->addItem(tr("Could not get the bootloader info file!"),LOGERROR
);
542 if(blinstaller
->uptodate())
544 int ret
= QMessageBox::question(this, tr("Bootloader Installation"),
545 tr("The bootloader is already installed and up to date.\n"
546 "Do want to replace the current bootloader?"),
547 QMessageBox::Yes
| QMessageBox::No
, QMessageBox::No
);
548 if(ret
== QMessageBox::No
)
550 logger
->addItem(tr("Bootloader installation skipped!"), LOGINFO
);
557 // if fwpatcher , ask for extra file
559 if(settings
->curBootloaderMethod() == "fwpatcher")
561 BrowseOF
ofbrowser(this);
562 ofbrowser
.setFile(settings
->ofPath());
563 if(ofbrowser
.exec() == QDialog::Accepted
)
565 offirmware
= ofbrowser
.getFile();
566 qDebug() << offirmware
;
567 if(!QFileInfo(offirmware
).exists())
569 logger
->addItem(tr("Original Firmware Path is wrong!"),LOGERROR
);
576 settings
->setOfPath(offirmware
);
582 logger
->addItem(tr("Original Firmware selection Canceled!"),LOGERROR
);
588 blinstaller
->setOrigFirmwarePath(offirmware
);
589 connect(blinstaller
,SIGNAL(done(bool)),this,SLOT(installdone(bool)));
590 blinstaller
->install(logger
);
593 void RbUtilQt::installFontsBtn()
595 if(chkConfig(true)) return;
596 if(QMessageBox::question(this, tr("Confirm Installation"),
597 tr("Do you really want to install the fonts package?"),
598 QMessageBox::Yes
| QMessageBox::No
) != QMessageBox::Yes
) return;
600 logger
= new ProgressLoggerGui(this);
605 bool RbUtilQt::installFontsAuto()
612 void RbUtilQt::installFonts()
614 // create zip installer
615 installer
= new ZipInstaller(this);
617 installer
->setUrl(settings
->fontUrl());
618 installer
->setLogSection("Fonts");
619 installer
->setLogVersion(versmap
.value("arch_date"));
620 installer
->setMountPoint(settings
->mountpoint());
621 if(!settings
->cacheDisabled())
622 installer
->setCache(true);
624 connect(installer
, SIGNAL(done(bool)), this, SLOT(installdone(bool)));
625 installer
->install(logger
);
629 void RbUtilQt::installVoice()
631 if(chkConfig(true)) return;
633 if(m_gotInfo
== false)
635 QMessageBox::warning(this, tr("Warning"),
636 tr("The Application is still downloading Information about new Builds. Please try again shortly."));
640 if(QMessageBox::question(this, tr("Confirm Installation"),
641 tr("Do you really want to install the voice file?"),
642 QMessageBox::Yes
| QMessageBox::No
) != QMessageBox::Yes
) return;
644 logger
= new ProgressLoggerGui(this);
647 // create zip installer
648 installer
= new ZipInstaller(this);
650 QString voiceurl
= settings
->voiceUrl();
652 voiceurl
+= settings
->curVoiceName() + "-" +
653 versmap
.value("arch_date") + "-english.zip";
654 qDebug() << voiceurl
;
656 installer
->setUrl(voiceurl
);
657 installer
->setLogSection("Voice");
658 installer
->setLogVersion(versmap
.value("arch_date"));
659 installer
->setMountPoint(settings
->mountpoint());
660 if(!settings
->cacheDisabled())
661 installer
->setCache(true);
662 installer
->install(logger
);
666 void RbUtilQt::installDoomBtn()
668 if(chkConfig(true)) return;
670 QMessageBox::critical(this, tr("Error"), tr("Your device doesn't have a doom plugin. Aborting."));
674 if(QMessageBox::question(this, tr("Confirm Installation"),
675 tr("Do you really want to install the game addon files?"),
676 QMessageBox::Yes
| QMessageBox::No
) != QMessageBox::Yes
) return;
678 logger
= new ProgressLoggerGui(this);
683 bool RbUtilQt::installDoomAuto()
689 bool RbUtilQt::hasDoom()
691 QFile
doomrock(settings
->mountpoint() +"/.rockbox/rocks/games/doom.rock");
692 return doomrock
.exists();
695 void RbUtilQt::installDoom()
697 // create zip installer
698 installer
= new ZipInstaller(this);
700 installer
->setUrl(settings
->doomUrl());
701 installer
->setLogSection("Game Addons");
702 installer
->setLogVersion(versmap
.value("arch_date"));
703 installer
->setMountPoint(settings
->mountpoint());
704 if(!settings
->cacheDisabled())
705 installer
->setCache(true);
706 connect(installer
, SIGNAL(done(bool)), this, SLOT(installdone(bool)));
707 installer
->install(logger
);
711 void RbUtilQt::installThemes()
713 if(chkConfig(true)) return;
714 ThemesInstallWindow
* tw
= new ThemesInstallWindow(this);
715 tw
->setSettings(settings
);
720 void RbUtilQt::createTalkFiles(void)
722 if(chkConfig(true)) return;
723 InstallTalkWindow
*installWindow
= new InstallTalkWindow(this);
724 installWindow
->setSettings(settings
);
726 connect(installWindow
, SIGNAL(settingsUpdated()), this, SLOT(downloadInfo()));
727 connect(installWindow
, SIGNAL(settingsUpdated()), this, SLOT(updateSettings()));
728 installWindow
->show();
732 void RbUtilQt::createVoiceFile(void)
734 if(chkConfig(true)) return;
735 CreateVoiceWindow
*installWindow
= new CreateVoiceWindow(this);
736 installWindow
->setSettings(settings
);
738 connect(installWindow
, SIGNAL(settingsUpdated()), this, SLOT(downloadInfo()));
739 connect(installWindow
, SIGNAL(settingsUpdated()), this, SLOT(updateSettings()));
740 installWindow
->show();
743 void RbUtilQt::uninstall(void)
745 if(chkConfig(true)) return;
746 UninstallWindow
*uninstallWindow
= new UninstallWindow(this);
747 uninstallWindow
->setSettings(settings
);
748 uninstallWindow
->show();
752 void RbUtilQt::uninstallBootloader(void)
754 if(chkConfig(true)) return;
755 if(QMessageBox::question(this, tr("Confirm Uninstallation"),
756 tr("Do you really want to uninstall the Bootloader?"),
757 QMessageBox::Yes
| QMessageBox::No
) != QMessageBox::Yes
) return;
759 ProgressLoggerGui
* logger
= new ProgressLoggerGui(this);
762 BootloaderInstaller
blinstaller(this);
763 blinstaller
.setMountPoint(settings
->mountpoint());
764 blinstaller
.setDevice(settings
->curPlatform());
765 blinstaller
.setBootloaderMethod(settings
->curBootloaderMethod());
766 blinstaller
.setBootloaderName(settings
->curBootloaderName());
767 blinstaller
.setBootloaderBaseUrl(settings
->bootloaderUrl());
768 blinstaller
.setBootloaderInfoUrl(settings
->bootloaderInfoUrl());
769 if(!blinstaller
.downloadInfo())
771 logger
->addItem(tr("Could not get the bootloader info file!"),LOGERROR
);
776 blinstaller
.uninstall(logger
);
781 void RbUtilQt::downloadManual(void)
783 if(chkConfig(true)) return;
784 if(QMessageBox::question(this, tr("Confirm download"),
785 tr("Do you really want to download the manual? The manual will be saved "
786 "to the root folder of your player."),
787 QMessageBox::Yes
| QMessageBox::No
) != QMessageBox::Yes
)
791 QSettings
info(buildInfo
.fileName(), QSettings::IniFormat
, this);
794 QString manual
= settings
->curManual();
796 QString date
= (info
.value("dailies/date").toString());
801 if(ui
.radioPdf
->isChecked()) {
802 target
= "/" + manual
+ ".pdf";
803 section
= "Manual (PDF)";
806 target
= "/" + manual
+ "-" + date
+ "-html.zip";
807 section
= "Manual (HTML)";
809 manualurl
= settings
->manualUrl() + "/" + target
;
810 qDebug() << "manualurl =" << manualurl
;
812 ProgressLoggerGui
* logger
= new ProgressLoggerGui(this);
814 installer
= new ZipInstaller(this);
815 installer
->setMountPoint(settings
->mountpoint());
816 if(!settings
->cacheDisabled())
817 installer
->setCache(true);
818 installer
->setLogSection(section
);
819 installer
->setLogVersion(date
);
820 installer
->setUrl(manualurl
);
821 installer
->setUnzip(false);
822 installer
->setTarget(target
);
823 installer
->install(logger
);
827 void RbUtilQt::installPortable(void)
829 if(QMessageBox::question(this, tr("Confirm installation"),
830 tr("Do you really want to install Rockbox Utility to your player? "
831 "After installation you can run it from the players hard drive."),
832 QMessageBox::Yes
| QMessageBox::No
) != QMessageBox::Yes
)
835 ProgressLoggerGui
* logger
= new ProgressLoggerGui(this);
836 logger
->setProgressMax(0);
837 logger
->setProgressValue(0);
839 logger
->addItem(tr("Installing Rockbox Utility"), LOGINFO
);
842 if(!QFileInfo(settings
->mountpoint()).isDir()) {
843 logger
->addItem(tr("Mount point is wrong!"),LOGERROR
);
848 // remove old files first.
849 QFile::remove(settings
->mountpoint() + "/RockboxUtility.exe");
850 QFile::remove(settings
->mountpoint() + "/RockboxUtility.ini");
851 // copy currently running binary and currently used settings file
852 if(!QFile::copy(qApp
->applicationFilePath(), settings
->mountpoint() + "/RockboxUtility.exe")) {
853 logger
->addItem(tr("Error installing Rockbox Utility"), LOGERROR
);
857 logger
->addItem(tr("Installing user configuration"), LOGINFO
);
858 if(!QFile::copy(settings
->userSettingFilename(), settings
->mountpoint() + "/RockboxUtility.ini")) {
859 logger
->addItem(tr("Error installing user configuration"), LOGERROR
);
863 logger
->addItem(tr("Successfully installed Rockbox Utility."), LOGOK
);
865 logger
->setProgressMax(1);
866 logger
->setProgressValue(1);
871 void RbUtilQt::updateInfo()
873 qDebug() << "RbUtilQt::updateInfo()";
875 QSettings
log(settings
->mountpoint() + "/.rockbox/rbutil.log", QSettings::IniFormat
, this);
876 QStringList groups
= log
.childGroups();
877 QList
<QTreeWidgetItem
*> items
;
878 QTreeWidgetItem
*w
, *w2
;
882 // remove old list entries (if any)
883 int l
= ui
.treeInfo
->topLevelItemCount();
886 m
= ui
.treeInfo
->takeTopLevelItem(l
);
887 // delete childs (single level deep, no recursion here)
888 int n
= m
->childCount();
892 // get and populate new items
893 for(int a
= 0; a
< groups
.size(); a
++) {
894 log
.beginGroup(groups
.at(a
));
895 QStringList keys
= log
.allKeys();
896 w
= new QTreeWidgetItem
;
897 w
->setFlags(Qt::ItemIsEnabled
);
898 w
->setText(0, groups
.at(a
));
900 // get minimum and maximum version information so we can hilight old files
901 min
= max
= log
.value(keys
.at(0)).toString();
902 for(int b
= 0; b
< keys
.size(); b
++) {
903 if(log
.value(keys
.at(b
)).toString() > max
)
904 max
= log
.value(keys
.at(b
)).toString();
905 if(log
.value(keys
.at(b
)).toString() < min
)
906 min
= log
.value(keys
.at(b
)).toString();
909 for(int b
= 0; b
< keys
.size(); b
++) {
911 file
= settings
->mountpoint() + "/" + keys
.at(b
);
912 if(QFileInfo(file
).isDir())
914 w2
= new QTreeWidgetItem(w
, QStringList() << "/"
915 + keys
.at(b
) << log
.value(keys
.at(b
)).toString());
916 if(log
.value(keys
.at(b
)).toString() != max
) {
917 w2
->setForeground(0, QBrush(QColor(255, 0, 0)));
918 w2
->setForeground(1, QBrush(QColor(255, 0, 0)));
925 w
->setData(1, Qt::DisplayRole
, QString("%1 / %2").arg(min
, max
));
927 w
->setData(1, Qt::DisplayRole
, max
);
929 ui
.treeInfo
->insertTopLevelItems(0, items
);
930 ui
.treeInfo
->resizeColumnToContents(0);
934 QUrl
RbUtilQt::proxy()
936 if(settings
->proxyType() == "manual")
937 return QUrl(settings
->proxy());
938 else if(settings
->proxy() == "system")
940 return systemProxy();
946 bool RbUtilQt::chkConfig(bool warn
)
949 if(settings
->curPlatform().isEmpty()
950 || settings
->mountpoint().isEmpty()
951 || !QFileInfo(settings
->mountpoint()).isWritable()) {
954 if(warn
) QMessageBox::critical(this, tr("Configuration error"),
955 tr("Your configuration is invalid. Please go to the configuration "
956 "dialog and make sure the selected values are correct."));