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"
30 #include "installbootloader.h"
31 #include "installthemes.h"
32 #include "uninstallwindow.h"
39 RbUtilQt::RbUtilQt(QWidget
*parent
) : QMainWindow(parent
)
41 absolutePath
= qApp
->applicationDirPath();
42 // use built-in rbutil.ini if no external file in binary folder
43 QString iniFile
= absolutePath
+ "/rbutil.ini";
44 if(QFileInfo(iniFile
).isFile()) {
45 qDebug() << "using external rbutil.ini";
46 devices
= new QSettings(iniFile
, QSettings::IniFormat
, 0);
49 qDebug() << "using built-in rbutil.ini";
50 devices
= new QSettings(":/ini/rbutil.ini", QSettings::IniFormat
, 0);
55 // portable installation:
56 // check for a configuration file in the program folder.
58 config
.setFile(absolutePath
+ "/RockboxUtility.ini");
60 userSettings
= new QSettings(absolutePath
+ "/RockboxUtility.ini",
61 QSettings::IniFormat
, 0);
62 qDebug() << "config: portable";
65 userSettings
= new QSettings(QSettings::IniFormat
,
66 QSettings::UserScope
, "rockbox.org", "RockboxUtility");
67 qDebug() << "config: system";
73 ui
.radioPdf
->setChecked(true);
76 ui
.treeInfo
->setAlternatingRowColors(true);
77 ui
.treeInfo
->setHeaderLabels(QStringList() << tr("File") << tr("Version"));
78 ui
.treeInfo
->expandAll();
79 ui
.treeInfo
->setColumnCount(2);
81 connect(ui
.tabWidget
, SIGNAL(currentChanged(int)), this, SLOT(updateTabs(int)));
82 connect(ui
.actionAbout_Qt
, SIGNAL(triggered()), qApp
, SLOT(aboutQt()));
83 connect(ui
.action_About
, SIGNAL(triggered()), this, SLOT(about()));
84 connect(ui
.action_Help
, SIGNAL(triggered()), this, SLOT(help()));
85 connect(ui
.action_Configure
, SIGNAL(triggered()), this, SLOT(configDialog()));
86 connect(ui
.buttonChangeDevice
, SIGNAL(clicked()), this, SLOT(configDialog()));
87 connect(ui
.buttonRockbox
, SIGNAL(clicked()), this, SLOT(installBtn()));
88 connect(ui
.buttonBootloader
, SIGNAL(clicked()), this, SLOT(installBootloaderBtn()));
89 connect(ui
.buttonFonts
, SIGNAL(clicked()), this, SLOT(installFontsBtn()));
90 connect(ui
.buttonGames
, SIGNAL(clicked()), this, SLOT(installDoomBtn()));
91 connect(ui
.buttonTalk
, SIGNAL(clicked()), this, SLOT(createTalkFiles()));
92 connect(ui
.buttonVoice
, SIGNAL(clicked()), this, SLOT(installVoice()));
93 connect(ui
.buttonThemes
, SIGNAL(clicked()), this, SLOT(installThemes()));
94 connect(ui
.buttonRemoveRockbox
, SIGNAL(clicked()), this, SLOT(uninstall()));
95 connect(ui
.buttonRemoveBootloader
, SIGNAL(clicked()), this, SLOT(uninstallBootloader()));
96 connect(ui
.buttonDownloadManual
, SIGNAL(clicked()), this, SLOT(downloadManual()));
97 connect(ui
.buttonSmall
, SIGNAL(clicked()), this, SLOT(smallInstall()));
98 connect(ui
.buttonComplete
, SIGNAL(clicked()), this, SLOT(completeInstall()));
101 ui
.actionInstall_Rockbox_Utility_on_player
->setEnabled(false);
103 connect(ui
.actionInstall_Rockbox_Utility_on_player
, SIGNAL(triggered()), this, SLOT(installPortable()));
113 void RbUtilQt::updateTabs(int count
)
125 void RbUtilQt::downloadInfo()
127 // try to get the current build information
128 daily
= new HttpGet(this);
129 connect(daily
, SIGNAL(done(bool)), this, SLOT(downloadDone(bool)));
130 connect(daily
, SIGNAL(requestFinished(int, bool)), this, SLOT(downloadDone(int, bool)));
131 connect(qApp
, SIGNAL(lastWindowClosed()), daily
, SLOT(abort()));
132 daily
->setProxy(proxy());
133 if(userSettings
->value("offline").toBool())
134 daily
->setCache(userSettings
->value("cachepath", QDir::tempPath()).toString());
135 qDebug() << "downloading build info";
136 daily
->setFile(&buildInfo
);
137 daily
->getFile(QUrl(devices
->value("server_conf_url").toString()));
141 void RbUtilQt::downloadDone(bool error
)
144 qDebug() << "network error:" << daily
->error();
147 qDebug() << "network status:" << daily
->error();
150 QSettings
info(buildInfo
.fileName(), QSettings::IniFormat
, this);
152 versmap
.insert("arch_rev", info
.value("dailies/rev").toString());
153 versmap
.insert("arch_date", info
.value("dailies/date").toString());
155 bleeding
= new HttpGet(this);
156 connect(bleeding
, SIGNAL(done(bool)), this, SLOT(downloadBleedingDone(bool)));
157 connect(bleeding
, SIGNAL(requestFinished(int, bool)), this, SLOT(downloadDone(int, bool)));
158 connect(qApp
, SIGNAL(lastWindowClosed()), daily
, SLOT(abort()));
159 bleeding
->setProxy(proxy());
160 if(userSettings
->value("offline").toBool())
161 bleeding
->setCache(userSettings
->value("cachepath", QDir::tempPath()).toString());
162 bleeding
->setFile(&bleedingInfo
);
163 bleeding
->getFile(QUrl(devices
->value("bleeding_info").toString()));
167 void RbUtilQt::downloadBleedingDone(bool error
)
169 if(error
) qDebug() << "network error:" << bleeding
->error();
172 QSettings
info(bleedingInfo
.fileName(), QSettings::IniFormat
, this);
173 bleedingInfo
.close();
174 versmap
.insert("bleed_rev", info
.value("bleeding/rev").toString());
175 versmap
.insert("bleed_date", info
.value("bleeding/timestamp").toString());
176 qDebug() << "versmap =" << versmap
;
180 void RbUtilQt::downloadDone(int id
, bool error
)
183 errorString
= tr("Network error: %1. Please check your network and proxy settings.")
184 .arg(daily
->errorString());
186 QMessageBox::about(this, "Network Error", errorString
);
188 qDebug() << "downloadDone:" << id
<< error
;
192 void RbUtilQt::about()
194 QDialog
*window
= new QDialog(this);
196 about
.setupUi(window
);
197 window
->setModal(true);
199 QFile
licence(":/docs/gpl-2.0.html");
200 licence
.open(QIODevice::ReadOnly
);
201 QTextStream
c(&licence
);
202 QString cline
= c
.readAll();
203 about
.browserLicense
->insertHtml(cline
);
204 about
.browserLicense
->moveCursor(QTextCursor::Start
, QTextCursor::MoveAnchor
);
205 QFile
credits(":/docs/CREDITS");
206 credits
.open(QIODevice::ReadOnly
);
207 QTextStream
r(&credits
);
208 QString rline
= r
.readAll();
209 about
.browserCredits
->insertPlainText(rline
);
210 about
.browserCredits
->moveCursor(QTextCursor::Start
, QTextCursor::MoveAnchor
);
211 QString title
= QString("<b>The Rockbox Utility</b><br/>Version %1").arg(VERSION
);
212 about
.labelTitle
->setText(title
);
213 about
.labelHomepage
->setText("<a href='http://www.rockbox.org'>http://www.rockbox.org</a>");
220 void RbUtilQt::help()
222 QUrl
helpurl("http://www.rockbox.org/wiki/RockboxUtilityQt");
223 QDesktopServices::openUrl(helpurl
);
227 void RbUtilQt::configDialog()
229 Config
*cw
= new Config(this);
230 cw
->setUserSettings(userSettings
);
231 cw
->setDevices(devices
);
233 connect(cw
, SIGNAL(settingsUpdated()), this, SLOT(downloadInfo()));
234 connect(cw
, SIGNAL(settingsUpdated()), this, SLOT(updateSettings()));
238 void RbUtilQt::updateSettings()
240 qDebug() << "updateSettings()";
246 void RbUtilQt::updateDevice()
248 platform
= userSettings
->value("platform").toString();
250 devices
->beginGroup(platform
);
251 if(devices
->value("needsbootloader", "") == "no") {
252 ui
.buttonBootloader
->setEnabled(false);
253 ui
.buttonRemoveBootloader
->setEnabled(false);
254 ui
.labelBootloader
->setEnabled(false);
255 ui
.labelRemoveBootloader
->setEnabled(false);
258 ui
.buttonBootloader
->setEnabled(true);
259 ui
.labelBootloader
->setEnabled(true);
260 if(devices
->value("bootloadermethod") == "fwpatcher") {
261 ui
.labelRemoveBootloader
->setEnabled(false);
262 ui
.buttonRemoveBootloader
->setEnabled(false);
265 ui
.labelRemoveBootloader
->setEnabled(true);
266 ui
.buttonRemoveBootloader
->setEnabled(true);
270 // displayed device info
271 platform
= userSettings
->value("platform").toString();
272 QString mountpoint
= userSettings
->value("mountpoint").toString();
273 devices
->beginGroup(platform
);
274 QString brand
= devices
->value("brand").toString();
275 QString name
= devices
->value("name").toString();
277 if(name
.isEmpty()) name
= "<none>";
278 if(mountpoint
.isEmpty()) mountpoint
= "<invalid>";
279 ui
.labelDevice
->setText(tr("<b>%1 %2</b> at <b>%3</b>")
280 .arg(brand
, name
, mountpoint
));
284 void RbUtilQt::updateManual()
286 if(userSettings
->value("platform").toString() != "")
288 devices
->beginGroup(userSettings
->value("platform").toString());
290 manual
= devices
->value("manualname", "").toString();
293 manual
= "rockbox-" + devices
->value("platform").toString();
296 pdfmanual
= devices
->value("manual_url").toString() + "/" + manual
+ ".pdf";
298 htmlmanual
= devices
->value("manual_url").toString() + "/" + manual
+ "/rockbox-build.html";
299 ui
.labelPdfManual
->setText(tr("<a href='%1'>PDF Manual</a>")
301 ui
.labelHtmlManual
->setText(tr("<a href='%1'>HTML Manual (opens in browser)</a>")
305 ui
.labelPdfManual
->setText(tr("Select a device for a link to the correct manual"));
306 ui
.labelHtmlManual
->setText(tr("<a href='%1'>Manual Overview</a>")
307 .arg("http://www.rockbox.org/manual.shtml"));
312 void RbUtilQt::completeInstall()
314 if(QMessageBox::question(this, tr("Confirm Installation"),
315 tr("Do you really want to make a complete Installation?"),
316 QMessageBox::Yes
| QMessageBox::No
) != QMessageBox::Yes
) return;
319 logger
= new ProgressLoggerGui(this);
322 QString mountpoint
= userSettings
->value("mountpoint").toString();
323 // show dialog with error if mount point is wrong
324 if(!QFileInfo(mountpoint
).isDir()) {
325 logger
->addItem(tr("Mount point is wrong!"),LOGERROR
);
332 if(!installBootloaderAuto())
336 // wait for boot loader installation finished
338 QApplication::processEvents();
350 // wait for boot loader installation finished
352 QApplication::processEvents();
360 if(!installFontsAuto())
364 // wait for boot loader installation finished
366 QApplication::processEvents();
374 if(!installDoomAuto())
378 // wait for boot loader installation finished
380 QApplication::processEvents();
387 // it has its own logger window,so close our.
393 void RbUtilQt::smallInstall()
395 if(QMessageBox::question(this, tr("Confirm Installation"),
396 tr("Do you really want to make a small Installation?"),
397 QMessageBox::Yes
| QMessageBox::No
) != QMessageBox::Yes
) return;
400 logger
= new ProgressLoggerGui(this);
403 QString mountpoint
= userSettings
->value("mountpoint").toString();
404 // show dialog with error if mount point is wrong
405 if(!QFileInfo(mountpoint
).isDir()) {
406 logger
->addItem(tr("Mount point is wrong!"),LOGERROR
);
413 if(!installBootloaderAuto())
417 // wait for boot loader installation finished
419 QApplication::processEvents();
431 // wait for boot loader installation finished
433 QApplication::processEvents();
437 void RbUtilQt::installdone(bool error
)
439 qDebug() << "install done";
444 void RbUtilQt::installBtn()
449 bool RbUtilQt::installAuto()
451 QString file
= QString("%1%2/rockbox.zip")
452 .arg(devices
->value("bleeding_url").toString(),
453 userSettings
->value("platform").toString());
456 QSettings
info(buildInfo
.fileName(), QSettings::IniFormat
, this);
459 devices
->beginGroup(platform
);
460 QString released
= devices
->value("released").toString();
462 if(released
== "yes") {
463 // only set the keys if needed -- querying will yield an empty string
465 versmap
.insert("rel_rev", devices
->value("last_release").toString());
466 versmap
.insert("rel_date", ""); // FIXME: provide the release timestamp
469 QString myversion
= "r" + versmap
.value("bleed_rev");
471 ZipInstaller
* installer
= new ZipInstaller(this);
472 installer
->setUrl(file
);
473 installer
->setProxy(proxy());
474 installer
->setLogSection("Rockbox (Base)");
475 installer
->setLogVersion(myversion
);
476 if(!userSettings
->value("cachedisable").toBool())
477 installer
->setCache(userSettings
->value("cachepath", QDir::tempPath()).toString());
478 installer
->setMountPoint(userSettings
->value("mountpoint").toString());
479 installer
->install(logger
);
481 connect(installer
, SIGNAL(done(bool)), this, SLOT(installdone(bool)));
486 void RbUtilQt::install()
488 Install
*installWindow
= new Install(this);
489 installWindow
->setUserSettings(userSettings
);
490 installWindow
->setDeviceSettings(devices
);
491 installWindow
->setProxy(proxy());
494 QSettings
info(buildInfo
.fileName(), QSettings::IniFormat
, this);
497 devices
->beginGroup(platform
);
498 QString released
= devices
->value("released").toString();
500 if(released
== "yes") {
501 // only set the keys if needed -- querying will yield an empty string
503 versmap
.insert("rel_rev", devices
->value("last_release").toString());
504 versmap
.insert("rel_date", ""); // FIXME: provide the release timestamp
506 installWindow
->setVersionStrings(versmap
);
508 installWindow
->show();
511 bool RbUtilQt::installBootloaderAuto()
514 connect(blinstaller
,SIGNAL(done(bool)),this,SLOT(installdone(bool)));
518 void RbUtilQt::installBootloaderBtn()
520 if(QMessageBox::question(this, tr("Confirm Installation"),
521 tr("Do you really want to install the Bootloader?"),
522 QMessageBox::Yes
| QMessageBox::No
) != QMessageBox::Yes
) return;
525 logger
= new ProgressLoggerGui(this);
531 void RbUtilQt::installBootloader()
533 QString platform
= userSettings
->value("platform").toString();
536 blinstaller
= new BootloaderInstaller(this);
538 blinstaller
->setMountPoint(userSettings
->value("mountpoint").toString());
540 blinstaller
->setProxy(proxy());
541 blinstaller
->setDevice(platform
);
542 blinstaller
->setBootloaderMethod(devices
->value(platform
+ "/bootloadermethod").toString());
543 blinstaller
->setBootloaderName(devices
->value(platform
+ "/bootloadername").toString());
544 blinstaller
->setBootloaderBaseUrl(devices
->value("bootloader_url").toString());
545 blinstaller
->setBootloaderInfoUrl(devices
->value("bootloader_info_url").toString());
546 if(!blinstaller
->downloadInfo())
548 logger
->addItem(tr("Could not get the bootloader info file!"),LOGERROR
);
554 if(blinstaller
->uptodate())
556 int ret
= QMessageBox::question(this, tr("Bootloader Installation"),
557 tr("It seem your Bootloader is already uptodate.\n"
558 "Do really want to install it?"),
559 QMessageBox::Ok
| QMessageBox::Ignore
|QMessageBox::Cancel
,
560 QMessageBox::Cancel
);
561 if(ret
== QMessageBox::Cancel
)
563 logger
->addItem(tr("Bootloader installation Canceled!"),LOGERROR
);
568 else if(ret
== QMessageBox::Ignore
)
570 logger
->addItem(tr("Bootloader installation Skipped!"),LOGERROR
);
577 // if fwpatcher , ask for extra file
579 if(devices
->value(platform
+ "/bootloadermethod").toString() == "fwpatcher")
581 BrowseOF
ofbrowser(this);
582 ofbrowser
.setFile(userSettings
->value("ofpath").toString());
583 if(ofbrowser
.exec() == QDialog::Accepted
)
585 offirmware
= ofbrowser
.getFile();
586 qDebug() << offirmware
;
587 if(!QFileInfo(offirmware
).exists())
589 logger
->addItem(tr("Original Firmware Path is wrong!"),LOGERROR
);
596 userSettings
->setValue("ofpath",offirmware
);
597 userSettings
->sync();
602 logger
->addItem(tr("Original Firmware selection Canceled!"),LOGERROR
);
608 blinstaller
->setOrigFirmwarePath(offirmware
);
610 blinstaller
->install(logger
);
613 void RbUtilQt::installFontsBtn()
615 if(QMessageBox::question(this, tr("Confirm Installation"),
616 tr("Do you really want to install the fonts package?"),
617 QMessageBox::Yes
| QMessageBox::No
) != QMessageBox::Yes
) return;
619 logger
= new ProgressLoggerGui(this);
624 bool RbUtilQt::installFontsAuto()
627 connect(installer
, SIGNAL(done(bool)), this, SLOT(installdone(bool)));
631 void RbUtilQt::installFonts()
633 // create zip installer
634 installer
= new ZipInstaller(this);
636 installer
->setUrl(devices
->value("font_url").toString());
637 installer
->setProxy(proxy());
638 installer
->setLogSection("Fonts");
639 installer
->setLogVersion(versmap
.value("arch_date"));
640 installer
->setMountPoint(userSettings
->value("mountpoint").toString());
641 if(!userSettings
->value("cachedisable").toBool())
642 installer
->setCache(userSettings
->value("cachepath", QDir::tempPath()).toString());
643 installer
->install(logger
);
647 void RbUtilQt::installVoice()
649 if(QMessageBox::question(this, tr("Confirm Installation"),
650 tr("Do you really want to install the voice file?"),
651 QMessageBox::Yes
| QMessageBox::No
) != QMessageBox::Yes
) return;
653 logger
= new ProgressLoggerGui(this);
656 // create zip installer
657 installer
= new ZipInstaller(this);
658 installer
->setUnzip(false);
660 QString voiceurl
= devices
->value("voice_url").toString() + "/" +
661 userSettings
->value("platform").toString() + "-" +
662 versmap
.value("arch_date") + "-english.voice";
663 qDebug() << voiceurl
;
665 installer
->setProxy(proxy());
666 installer
->setUrl(voiceurl
);
667 installer
->setLogSection("Voice");
668 installer
->setLogVersion(versmap
.value("arch_date"));
669 installer
->setMountPoint(userSettings
->value("mountpoint").toString());
670 installer
->setTarget("/.rockbox/langs/english.voice");
671 if(!userSettings
->value("cachedisable").toBool())
672 installer
->setCache(userSettings
->value("cachepath", QDir::tempPath()).toString());
673 installer
->install(logger
);
675 //connect(installer, SIGNAL(done(bool)), this, SLOT(done(bool)));
678 void RbUtilQt::installDoomBtn()
680 QFile
doomrock(userSettings
->value("mountpoint").toString()+"/.rockbox/rocks/games/doom.rock");
681 if(!doomrock
.exists()){
682 QMessageBox::critical(this, tr("Error"), tr("Your device doesn't have a doom plugin. Aborting."));
686 if(QMessageBox::question(this, tr("Confirm Installation"),
687 tr("Do you really want to install the game addon files?"),
688 QMessageBox::Yes
| QMessageBox::No
) != QMessageBox::Yes
) return;
690 logger
= new ProgressLoggerGui(this);
695 bool RbUtilQt::installDoomAuto()
698 connect(installer
, SIGNAL(done(bool)), this, SLOT(installdone(bool)));
702 void RbUtilQt::installDoom()
704 // create zip installer
705 installer
= new ZipInstaller(this);
707 installer
->setUrl(devices
->value("doom_url").toString());
708 installer
->setProxy(proxy());
709 installer
->setLogSection("Game Addons");
710 installer
->setLogVersion(versmap
.value("arch_date"));
711 installer
->setMountPoint(userSettings
->value("mountpoint").toString());
712 if(!userSettings
->value("cachedisable").toBool())
713 installer
->setCache(userSettings
->value("cachepath", QDir::tempPath()).toString());
714 installer
->install(logger
);
719 void RbUtilQt::installThemes()
721 ThemesInstallWindow
* tw
= new ThemesInstallWindow(this);
722 tw
->setDeviceSettings(devices
);
723 tw
->setUserSettings(userSettings
);
724 tw
->setProxy(proxy());
730 void RbUtilQt::createTalkFiles(void)
732 InstallTalkWindow
*installWindow
= new InstallTalkWindow(this);
733 installWindow
->setUserSettings(userSettings
);
734 installWindow
->setDeviceSettings(devices
);
735 installWindow
->show();
739 void RbUtilQt::uninstall(void)
741 UninstallWindow
*uninstallWindow
= new UninstallWindow(this);
742 uninstallWindow
->setUserSettings(userSettings
);
743 uninstallWindow
->setDeviceSettings(devices
);
744 uninstallWindow
->show();
747 void RbUtilQt::uninstallBootloader(void)
749 if(QMessageBox::question(this, tr("Confirm Uninstallation"),
750 tr("Do you really want to uninstall the Bootloader?"),
751 QMessageBox::Yes
| QMessageBox::No
) != QMessageBox::Yes
) return;
753 ProgressLoggerGui
* logger
= new ProgressLoggerGui(this);
756 QString plattform
= userSettings
->value("platform").toString();
757 BootloaderInstaller
blinstaller(this);
758 blinstaller
.setMountPoint(userSettings
->value("mountpoint").toString());
759 blinstaller
.setDevice(userSettings
->value("platform").toString());
760 blinstaller
.setBootloaderMethod(devices
->value(plattform
+ "/bootloadermethod").toString());
761 blinstaller
.setBootloaderName(devices
->value(plattform
+ "/bootloadername").toString());
762 blinstaller
.setBootloaderBaseUrl(devices
->value("bootloader_url").toString());
763 blinstaller
.setBootloaderInfoUrl(devices
->value("bootloader_info_url").toString());
764 if(!blinstaller
.downloadInfo())
766 logger
->addItem(tr("Could not get the bootloader info file!"),LOGERROR
);
771 blinstaller
.uninstall(logger
);
776 void RbUtilQt::downloadManual(void)
778 if(QMessageBox::question(this, tr("Confirm download"),
779 tr("Do you really want to download the manual? The manual will be saved "
780 "to the root folder of your player."),
781 QMessageBox::Yes
| QMessageBox::No
) != QMessageBox::Yes
)
785 QSettings
info(buildInfo
.fileName(), QSettings::IniFormat
, this);
788 devices
->beginGroup(userSettings
->value("platform").toString());
790 manual
= devices
->value("manualname", "rockbox-" + devices
->value("platform").toString()).toString();
793 QString date
= (info
.value("dailies/date").toString());
798 if(ui
.radioPdf
->isChecked()) {
799 target
= "/" + manual
+ ".pdf";
800 section
= "Manual (PDF)";
803 target
= "/" + manual
+ "-" + date
+ "-html.zip";
804 section
= "Manual (HTML)";
806 manualurl
= devices
->value("manual_url").toString() + "/" + target
;
807 qDebug() << "manualurl =" << manualurl
;
809 ProgressLoggerGui
* logger
= new ProgressLoggerGui(this);
811 installer
= new ZipInstaller(this);
812 installer
->setMountPoint(userSettings
->value("mountpoint").toString());
813 if(!userSettings
->value("cachedisable").toBool())
814 installer
->setCache(userSettings
->value("cachepath", QDir::tempPath()).toString());
815 installer
->setProxy(proxy());
816 installer
->setLogSection(section
);
817 installer
->setUrl(manualurl
);
818 installer
->setUnzip(false);
819 installer
->setTarget(target
);
820 installer
->install(logger
);
824 void RbUtilQt::installPortable(void)
826 if(QMessageBox::question(this, tr("Confirm installation"),
827 tr("Do you really want to install Rockbox Utility to your player? "
828 "After installation you can run it from the players hard drive."),
829 QMessageBox::Yes
| QMessageBox::No
) != QMessageBox::Yes
)
832 ProgressLoggerGui
* logger
= new ProgressLoggerGui(this);
834 logger
->addItem(tr("Installing Rockbox Utility"), LOGINFO
);
837 if(!QFileInfo(userSettings
->value("mountpoint").toString()).isDir()) {
838 logger
->addItem(tr("Mount point is wrong!"),LOGERROR
);
843 // remove old files first.
844 QFile::remove(userSettings
->value("mountpoint").toString() + "/RockboxUtility.exe");
845 QFile::remove(userSettings
->value("mountpoint").toString() + "/RockboxUtility.ini");
846 // copy currently running binary and currently used settings file
847 if(!QFile::copy(qApp
->applicationFilePath(), userSettings
->value("mountpoint").toString() + "/RockboxUtility.exe")) {
848 logger
->addItem(tr("Error installing Rockbox Utility"), LOGERROR
);
852 logger
->addItem(tr("Installing user configuration"), LOGINFO
);
853 if(!QFile::copy(userSettings
->fileName(), userSettings
->value("mountpoint").toString() + "/RockboxUtility.ini")) {
854 logger
->addItem(tr("Error installing user configuration"), LOGERROR
);
858 logger
->addItem(tr("Successfully installed Rockbox Utility."), LOGOK
);
864 void RbUtilQt::updateInfo()
866 qDebug() << "RbUtilQt::updateInfo()";
868 QSettings
log(userSettings
->value("mountpoint").toString() + "/.rockbox/rbutil.log", QSettings::IniFormat
, this);
869 QStringList groups
= log
.childGroups();
870 QList
<QTreeWidgetItem
*> items
;
871 QTreeWidgetItem
*w
, *w2
;
875 // remove old list entries (if any)
876 int l
= ui
.treeInfo
->topLevelItemCount();
879 m
= ui
.treeInfo
->takeTopLevelItem(l
);
880 // delete childs (single level deep, no recursion here)
881 int n
= m
->childCount();
885 // get and populate new items
886 for(int a
= 0; a
< groups
.size(); a
++) {
887 log
.beginGroup(groups
.at(a
));
888 QStringList keys
= log
.allKeys();
889 w
= new QTreeWidgetItem
;
890 w
->setFlags(Qt::ItemIsEnabled
);
891 w
->setText(0, groups
.at(a
));
893 // get minimum and maximum version information so we can hilight old files
894 min
= max
= log
.value(keys
.at(0)).toString();
895 for(int b
= 0; b
< keys
.size(); b
++) {
896 if(log
.value(keys
.at(b
)).toString() > max
)
897 max
= log
.value(keys
.at(b
)).toString();
898 if(log
.value(keys
.at(b
)).toString() < min
)
899 min
= log
.value(keys
.at(b
)).toString();
902 for(int b
= 0; b
< keys
.size(); b
++) {
904 file
= userSettings
->value("mountpoint").toString() + "/" + keys
.at(b
);
905 if(QFileInfo(file
).isDir())
907 w2
= new QTreeWidgetItem(w
, QStringList() << "/"
908 + keys
.at(b
) << log
.value(keys
.at(b
)).toString());
909 if(log
.value(keys
.at(b
)).toString() != max
) {
910 w2
->setForeground(0, QBrush(QColor(255, 0, 0)));
911 w2
->setForeground(1, QBrush(QColor(255, 0, 0)));
918 w
->setData(1, Qt::DisplayRole
, QString("%1 / %2").arg(min
, max
));
920 w
->setData(1, Qt::DisplayRole
, max
);
922 ui
.treeInfo
->insertTopLevelItems(0, items
);
923 ui
.treeInfo
->resizeColumnToContents(0);
927 QUrl
RbUtilQt::proxy()
929 if(userSettings
->value("proxytype") == "manual")
930 return QUrl(userSettings
->value("proxy").toString());
932 else if(userSettings
->value("proxytype") == "system")
933 return QUrl(getenv("http_proxy"));