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_Configure
, SIGNAL(triggered()), this, SLOT(configDialog()));
85 connect(ui
.buttonChangeDevice
, SIGNAL(clicked()), this, SLOT(configDialog()));
86 connect(ui
.buttonRockbox
, SIGNAL(clicked()), this, SLOT(installBtn()));
87 connect(ui
.buttonBootloader
, SIGNAL(clicked()), this, SLOT(installBootloaderBtn()));
88 connect(ui
.buttonFonts
, SIGNAL(clicked()), this, SLOT(installFontsBtn()));
89 connect(ui
.buttonGames
, SIGNAL(clicked()), this, SLOT(installDoomBtn()));
90 connect(ui
.buttonTalk
, SIGNAL(clicked()), this, SLOT(createTalkFiles()));
91 connect(ui
.buttonVoice
, SIGNAL(clicked()), this, SLOT(installVoice()));
92 connect(ui
.buttonThemes
, SIGNAL(clicked()), this, SLOT(installThemes()));
93 connect(ui
.buttonRemoveRockbox
, SIGNAL(clicked()), this, SLOT(uninstall()));
94 connect(ui
.buttonRemoveBootloader
, SIGNAL(clicked()), this, SLOT(uninstallBootloader()));
95 connect(ui
.buttonDownloadManual
, SIGNAL(clicked()), this, SLOT(downloadManual()));
96 connect(ui
.buttonSmall
, SIGNAL(clicked()), this, SLOT(smallInstall()));
97 connect(ui
.buttonComplete
, SIGNAL(clicked()), this, SLOT(completeInstall()));
100 ui
.actionInstall_Rockbox_Utility_on_player
->setEnabled(false);
102 connect(ui
.actionInstall_Rockbox_Utility_on_player
, SIGNAL(triggered()), this, SLOT(installPortable()));
112 void RbUtilQt::updateTabs(int count
)
124 void RbUtilQt::downloadInfo()
126 // try to get the current build information
127 daily
= new HttpGet(this);
128 connect(daily
, SIGNAL(done(bool)), this, SLOT(downloadDone(bool)));
129 connect(daily
, SIGNAL(requestFinished(int, bool)), this, SLOT(downloadDone(int, bool)));
130 daily
->setProxy(proxy());
131 if(userSettings
->value("defaults/offline").toBool())
132 daily
->setCache(userSettings
->value("defaults/cachepath", QDir::tempPath()).toString());
133 qDebug() << "downloading build info";
134 daily
->setFile(&buildInfo
);
135 daily
->getFile(QUrl(devices
->value("server_conf_url").toString()));
139 void RbUtilQt::downloadDone(bool error
)
142 qDebug() << "network error:" << daily
->error();
145 qDebug() << "network status:" << daily
->error();
148 QSettings
info(buildInfo
.fileName(), QSettings::IniFormat
, this);
150 versmap
.insert("arch_rev", info
.value("dailies/rev").toString());
151 versmap
.insert("arch_date", info
.value("dailies/date").toString());
153 bleeding
= new HttpGet(this);
154 connect(bleeding
, SIGNAL(done(bool)), this, SLOT(downloadBleedingDone(bool)));
155 connect(bleeding
, SIGNAL(requestFinished(int, bool)), this, SLOT(downloadDone(int, bool)));
156 bleeding
->setProxy(proxy());
157 if(userSettings
->value("defaults/offline").toBool())
158 bleeding
->setCache(userSettings
->value("defaults/cachepath", QDir::tempPath()).toString());
159 bleeding
->setFile(&bleedingInfo
);
160 bleeding
->getFile(QUrl(devices
->value("bleeding_info").toString()));
164 void RbUtilQt::downloadBleedingDone(bool error
)
166 if(error
) qDebug() << "network error:" << bleeding
->error();
169 QSettings
info(bleedingInfo
.fileName(), QSettings::IniFormat
, this);
170 bleedingInfo
.close();
171 versmap
.insert("bleed_rev", info
.value("bleeding/rev").toString());
172 versmap
.insert("bleed_date", info
.value("bleeding/timestamp").toString());
173 qDebug() << "versmap =" << versmap
;
177 void RbUtilQt::downloadDone(int id
, bool error
)
180 errorString
= tr("Network error: %1. Please check your network and proxy settings.")
181 .arg(daily
->errorString());
183 QMessageBox::about(this, "Network Error", errorString
);
185 qDebug() << "downloadDone:" << id
<< error
;
189 void RbUtilQt::about()
191 QDialog
*window
= new QDialog(this);
193 about
.setupUi(window
);
194 window
->setModal(true);
196 QFile
licence(":/docs/gpl-2.0.html");
197 licence
.open(QIODevice::ReadOnly
);
198 QTextStream
c(&licence
);
199 QString cline
= c
.readAll();
200 about
.browserLicense
->insertHtml(cline
);
201 about
.browserLicense
->moveCursor(QTextCursor::Start
, QTextCursor::MoveAnchor
);
202 QFile
credits(":/docs/CREDITS");
203 credits
.open(QIODevice::ReadOnly
);
204 QTextStream
r(&credits
);
205 QString rline
= r
.readAll();
206 about
.browserCredits
->insertPlainText(rline
);
207 about
.browserCredits
->moveCursor(QTextCursor::Start
, QTextCursor::MoveAnchor
);
208 QString title
= QString("<b>The Rockbox Utility</b> Version %1").arg(VERSION
);
209 about
.labelTitle
->setText(title
);
210 about
.labelHomepage
->setText("<a href='http://www.rockbox.org'>http://www.rockbox.org</a>");
217 void RbUtilQt::configDialog()
219 Config
*cw
= new Config(this);
220 cw
->setUserSettings(userSettings
);
221 cw
->setDevices(devices
);
223 connect(cw
, SIGNAL(settingsUpdated()), this, SLOT(downloadInfo()));
224 connect(cw
, SIGNAL(settingsUpdated()), this, SLOT(updateSettings()));
228 void RbUtilQt::updateSettings()
230 qDebug() << "updateSettings()";
236 void RbUtilQt::updateDevice()
238 platform
= userSettings
->value("defaults/platform").toString();
240 devices
->beginGroup(platform
);
241 if(devices
->value("needsbootloader", "") == "no") {
242 ui
.buttonBootloader
->setEnabled(false);
243 ui
.buttonRemoveBootloader
->setEnabled(false);
244 ui
.labelBootloader
->setEnabled(false);
245 ui
.labelRemoveBootloader
->setEnabled(false);
248 ui
.buttonBootloader
->setEnabled(true);
249 ui
.labelBootloader
->setEnabled(true);
250 if(devices
->value("bootloadermethod") == "fwpatcher") {
251 ui
.labelRemoveBootloader
->setEnabled(false);
252 ui
.buttonRemoveBootloader
->setEnabled(false);
255 ui
.labelRemoveBootloader
->setEnabled(true);
256 ui
.buttonRemoveBootloader
->setEnabled(true);
260 // displayed device info
261 platform
= userSettings
->value("defaults/platform").toString();
262 QString mountpoint
= userSettings
->value("defaults/mountpoint").toString();
263 devices
->beginGroup(platform
);
264 QString brand
= devices
->value("brand").toString();
265 QString name
= devices
->value("name").toString();
267 if(name
.isEmpty()) name
= "<none>";
268 if(mountpoint
.isEmpty()) mountpoint
= "<invalid>";
269 ui
.labelDevice
->setText(tr("<b>%1 %2</b> at <b>%3</b>")
270 .arg(brand
, name
, mountpoint
));
274 void RbUtilQt::updateManual()
276 if(userSettings
->value("defaults/platform").toString() != "")
278 devices
->beginGroup(userSettings
->value("defaults/platform").toString());
280 manual
= devices
->value("manualname", "").toString();
283 manual
= "rockbox-" + devices
->value("platform").toString();
286 pdfmanual
= devices
->value("manual_url").toString() + "/" + manual
+ ".pdf";
288 htmlmanual
= devices
->value("manual_url").toString() + "/" + manual
+ "/rockbox-build.html";
289 ui
.labelPdfManual
->setText(tr("<a href='%1'>PDF Manual</a>")
291 ui
.labelHtmlManual
->setText(tr("<a href='%1'>HTML Manual (opens in browser)</a>")
295 ui
.labelPdfManual
->setText(tr("Select a device for a link to the correct manual"));
296 ui
.labelHtmlManual
->setText(tr("<a href='%1'>Manual Overview</a>")
297 .arg("http://www.rockbox.org/manual.shtml"));
302 void RbUtilQt::completeInstall()
304 if(QMessageBox::question(this, tr("Confirm Installation"),
305 tr("Do you really want to make a complete Installation?"),
306 QMessageBox::Yes
| QMessageBox::No
) != QMessageBox::Yes
) return;
309 logger
= new ProgressLoggerGui(this);
312 QString mountpoint
= userSettings
->value("defaults/mountpoint").toString();
313 // show dialog with error if mount point is wrong
314 if(!QFileInfo(mountpoint
).isDir()) {
315 logger
->addItem(tr("Mount point is wrong!"),LOGERROR
);
322 if(!installBootloaderAuto())
326 // wait for boot loader installation finished
328 QApplication::processEvents();
340 // wait for boot loader installation finished
342 QApplication::processEvents();
350 if(!installFontsAuto())
354 // wait for boot loader installation finished
356 QApplication::processEvents();
364 if(!installDoomAuto())
368 // wait for boot loader installation finished
370 QApplication::processEvents();
377 // it has its own logger window,so close our.
383 void RbUtilQt::smallInstall()
385 if(QMessageBox::question(this, tr("Confirm Installation"),
386 tr("Do you really want to make a small Installation?"),
387 QMessageBox::Yes
| QMessageBox::No
) != QMessageBox::Yes
) return;
390 logger
= new ProgressLoggerGui(this);
393 QString mountpoint
= userSettings
->value("defaults/mountpoint").toString();
394 // show dialog with error if mount point is wrong
395 if(!QFileInfo(mountpoint
).isDir()) {
396 logger
->addItem(tr("Mount point is wrong!"),LOGERROR
);
403 if(!installBootloaderAuto())
407 // wait for boot loader installation finished
409 QApplication::processEvents();
421 // wait for boot loader installation finished
423 QApplication::processEvents();
427 void RbUtilQt::installdone(bool error
)
429 qDebug() << "install done";
434 void RbUtilQt::installBtn()
439 bool RbUtilQt::installAuto()
441 QString file
= QString("%1%2/rockbox.zip")
442 .arg(devices
->value("bleeding_url").toString(),
443 userSettings
->value("defaults/platform").toString());
446 QSettings
info(buildInfo
.fileName(), QSettings::IniFormat
, this);
449 devices
->beginGroup(platform
);
450 QString released
= devices
->value("released").toString();
452 if(released
== "yes") {
453 // only set the keys if needed -- querying will yield an empty string
455 versmap
.insert("rel_rev", devices
->value("last_release").toString());
456 versmap
.insert("rel_date", ""); // FIXME: provide the release timestamp
459 QString myversion
= "r" + versmap
.value("bleed_rev");
461 ZipInstaller
* installer
= new ZipInstaller(this);
462 installer
->setUrl(file
);
463 installer
->setProxy(proxy());
464 installer
->setLogSection("rockboxbase");
465 installer
->setLogVersion(myversion
);
466 if(!userSettings
->value("defaults/cachedisable").toBool())
467 installer
->setCache(userSettings
->value("defaults/cachepath", QDir::tempPath()).toString());
468 installer
->setMountPoint(userSettings
->value("defaults/mountpoint").toString());
469 installer
->install(logger
);
471 connect(installer
, SIGNAL(done(bool)), this, SLOT(installdone(bool)));
476 void RbUtilQt::install()
478 Install
*installWindow
= new Install(this);
479 installWindow
->setUserSettings(userSettings
);
480 installWindow
->setDeviceSettings(devices
);
481 installWindow
->setProxy(proxy());
484 QSettings
info(buildInfo
.fileName(), QSettings::IniFormat
, this);
487 devices
->beginGroup(platform
);
488 QString released
= devices
->value("released").toString();
490 if(released
== "yes") {
491 // only set the keys if needed -- querying will yield an empty string
493 versmap
.insert("rel_rev", devices
->value("last_release").toString());
494 versmap
.insert("rel_date", ""); // FIXME: provide the release timestamp
496 installWindow
->setVersionStrings(versmap
);
498 installWindow
->show();
501 bool RbUtilQt::installBootloaderAuto()
504 connect(blinstaller
,SIGNAL(done(bool)),this,SLOT(installdone(bool)));
508 void RbUtilQt::installBootloaderBtn()
510 if(QMessageBox::question(this, tr("Confirm Installation"),
511 tr("Do you really want to install the Bootloader?"),
512 QMessageBox::Yes
| QMessageBox::No
) != QMessageBox::Yes
) return;
515 logger
= new ProgressLoggerGui(this);
521 void RbUtilQt::installBootloader()
523 QString platform
= userSettings
->value("defaults/platform").toString();
526 blinstaller
= new BootloaderInstaller(this);
528 blinstaller
->setMountPoint(userSettings
->value("defaults/mountpoint").toString());
530 blinstaller
->setProxy(proxy());
531 blinstaller
->setDevice(platform
);
532 blinstaller
->setBootloaderMethod(devices
->value(platform
+ "/bootloadermethod").toString());
533 blinstaller
->setBootloaderName(devices
->value(platform
+ "/bootloadername").toString());
534 blinstaller
->setBootloaderBaseUrl(devices
->value("bootloader_url").toString());
535 blinstaller
->setBootloaderInfoUrl(devices
->value("bootloader_info_url").toString());
536 if(!blinstaller
->downloadInfo())
538 logger
->addItem(tr("Could not get the bootloader info file!"),LOGERROR
);
544 if(blinstaller
->uptodate())
546 int ret
= QMessageBox::question(this, tr("Bootloader Installation"),
547 tr("It seem your Bootloader is already uptodate.\n"
548 "Do really want to install it?"),
549 QMessageBox::Ok
| QMessageBox::Ignore
|QMessageBox::Cancel
,
550 QMessageBox::Cancel
);
551 if(ret
== QMessageBox::Cancel
)
553 logger
->addItem(tr("Bootloader installation Canceled!"),LOGERROR
);
558 else if(ret
== QMessageBox::Ignore
)
565 // if fwpatcher , ask for extra file
567 if(devices
->value(platform
+ "/bootloadermethod").toString() == "fwpatcher")
569 BrowseOF
ofbrowser(this);
570 ofbrowser
.setFile(userSettings
->value("defaults/ofpath").toString());
571 if(ofbrowser
.exec() == QDialog::Accepted
)
573 offirmware
= ofbrowser
.getFile();
574 qDebug() << offirmware
;
575 if(!QFileInfo(offirmware
).exists())
577 logger
->addItem(tr("Original Firmware Path is wrong!"),LOGERROR
);
584 userSettings
->setValue("defaults/ofpath",offirmware
);
585 userSettings
->sync();
590 logger
->addItem(tr("Original Firmware selection Canceled!"),LOGERROR
);
596 blinstaller
->setOrigFirmwarePath(offirmware
);
598 blinstaller
->install(logger
);
601 void RbUtilQt::installFontsBtn()
603 if(QMessageBox::question(this, tr("Confirm Installation"),
604 tr("Do you really want to install the fonts package?"),
605 QMessageBox::Yes
| QMessageBox::No
) != QMessageBox::Yes
) return;
607 logger
= new ProgressLoggerGui(this);
612 bool RbUtilQt::installFontsAuto()
615 connect(installer
, SIGNAL(done(bool)), this, SLOT(installdone(bool)));
619 void RbUtilQt::installFonts()
621 // create zip installer
622 installer
= new ZipInstaller(this);
624 installer
->setUrl(devices
->value("font_url").toString());
625 installer
->setProxy(proxy());
626 installer
->setLogSection("Fonts");
627 installer
->setLogVersion(versmap
.value("arch_date"));
628 installer
->setMountPoint(userSettings
->value("defaults/mountpoint").toString());
629 if(!userSettings
->value("defaults/cachedisable").toBool())
630 installer
->setCache(userSettings
->value("defaults/cachepath", QDir::tempPath()).toString());
631 installer
->install(logger
);
635 void RbUtilQt::installVoice()
637 if(QMessageBox::question(this, tr("Confirm Installation"),
638 tr("Do you really want to install the voice file?"),
639 QMessageBox::Yes
| QMessageBox::No
) != QMessageBox::Yes
) return;
641 logger
= new ProgressLoggerGui(this);
644 // create zip installer
645 installer
= new ZipInstaller(this);
646 installer
->setUnzip(false);
648 QString voiceurl
= devices
->value("voice_url").toString() + "/" +
649 userSettings
->value("defaults/platform").toString() + "-" +
650 versmap
.value("arch_date") + "-english.voice";
651 qDebug() << voiceurl
;
653 installer
->setProxy(proxy());
654 installer
->setUrl(voiceurl
);
655 installer
->setLogSection("Voice");
656 installer
->setLogVersion(versmap
.value("arch_date"));
657 installer
->setMountPoint(userSettings
->value("defaults/mountpoint").toString());
658 installer
->setTarget("/.rockbox/langs/english.voice");
659 if(!userSettings
->value("defaults/cachedisable").toBool())
660 installer
->setCache(userSettings
->value("defaults/cachepath", QDir::tempPath()).toString());
661 installer
->install(logger
);
663 //connect(installer, SIGNAL(done(bool)), this, SLOT(done(bool)));
666 void RbUtilQt::installDoomBtn()
668 if(QMessageBox::question(this, tr("Confirm Installation"),
669 tr("Do you really want to install the game addon files?"),
670 QMessageBox::Yes
| QMessageBox::No
) != QMessageBox::Yes
) return;
672 logger
= new ProgressLoggerGui(this);
677 bool RbUtilQt::installDoomAuto()
680 connect(installer
, SIGNAL(done(bool)), this, SLOT(installdone(bool)));
684 void RbUtilQt::installDoom()
686 // create zip installer
687 installer
= new ZipInstaller(this);
689 installer
->setUrl(devices
->value("doom_url").toString());
690 installer
->setProxy(proxy());
691 installer
->setLogSection("Game Addons");
692 installer
->setLogVersion(versmap
.value("arch_date"));
693 installer
->setMountPoint(userSettings
->value("defaults/mountpoint").toString());
694 if(!userSettings
->value("defaults/cachedisable").toBool())
695 installer
->setCache(userSettings
->value("defaults/cachepath", QDir::tempPath()).toString());
696 installer
->install(logger
);
701 void RbUtilQt::installThemes()
703 ThemesInstallWindow
* tw
= new ThemesInstallWindow(this);
704 tw
->setDeviceSettings(devices
);
705 tw
->setUserSettings(userSettings
);
706 tw
->setProxy(proxy());
712 void RbUtilQt::createTalkFiles(void)
714 InstallTalkWindow
*installWindow
= new InstallTalkWindow(this);
715 installWindow
->setUserSettings(userSettings
);
716 installWindow
->setDeviceSettings(devices
);
717 installWindow
->show();
721 void RbUtilQt::uninstall(void)
723 UninstallWindow
*uninstallWindow
= new UninstallWindow(this);
724 uninstallWindow
->setUserSettings(userSettings
);
725 uninstallWindow
->setDeviceSettings(devices
);
726 uninstallWindow
->show();
729 void RbUtilQt::uninstallBootloader(void)
731 if(QMessageBox::question(this, tr("Confirm Uninstallation"),
732 tr("Do you really want to uninstall the Bootloader?"),
733 QMessageBox::Yes
| QMessageBox::No
) != QMessageBox::Yes
) return;
735 ProgressLoggerGui
* logger
= new ProgressLoggerGui(this);
738 QString plattform
= userSettings
->value("defaults/platform").toString();
739 BootloaderInstaller
blinstaller(this);
740 blinstaller
.setMountPoint(userSettings
->value("defaults/mountpoint").toString());
741 blinstaller
.setDevice(userSettings
->value("defaults/platform").toString());
742 blinstaller
.setBootloaderMethod(devices
->value(plattform
+ "/bootloadermethod").toString());
743 blinstaller
.setBootloaderName(devices
->value(plattform
+ "/bootloadername").toString());
744 blinstaller
.setBootloaderBaseUrl(devices
->value("bootloader_url").toString());
745 blinstaller
.setBootloaderInfoUrl(devices
->value("bootloader_info_url").toString());
746 if(!blinstaller
.downloadInfo())
748 logger
->addItem(tr("Could not get the bootloader info file!"),LOGERROR
);
753 blinstaller
.uninstall(logger
);
758 void RbUtilQt::downloadManual(void)
760 if(QMessageBox::question(this, tr("Confirm download"),
761 tr("Do you really want to download the manual? The manual will be saved "
762 "to the root folder of your player."),
763 QMessageBox::Yes
| QMessageBox::No
) != QMessageBox::Yes
)
767 QSettings
info(buildInfo
.fileName(), QSettings::IniFormat
, this);
770 devices
->beginGroup(userSettings
->value("defaults/platform").toString());
772 manual
= devices
->value("manualname", "rockbox-" + devices
->value("platform").toString()).toString();
775 QString date
= (info
.value("dailies/date").toString());
780 if(ui
.radioPdf
->isChecked()) {
781 target
= "/" + manual
+ ".pdf";
782 section
= "Manual (PDF)";
785 target
= "/" + manual
+ "-" + date
+ "-html.zip";
786 section
= "Manual (HTML)";
788 manualurl
= devices
->value("manual_url").toString() + "/" + target
;
789 qDebug() << "manualurl =" << manualurl
;
791 ProgressLoggerGui
* logger
= new ProgressLoggerGui(this);
793 installer
= new ZipInstaller(this);
794 installer
->setMountPoint(userSettings
->value("defaults/mountpoint").toString());
795 if(!userSettings
->value("defaults/cachedisable").toBool())
796 installer
->setCache(userSettings
->value("defaults/cachepath", QDir::tempPath()).toString());
797 installer
->setProxy(proxy());
798 installer
->setLogSection(section
);
799 installer
->setUrl(manualurl
);
800 installer
->setUnzip(false);
801 installer
->setTarget(target
);
802 installer
->install(logger
);
806 void RbUtilQt::installPortable(void)
808 if(QMessageBox::question(this, tr("Confirm installation"),
809 tr("Do you really want to install Rockbox Utility to your player? "
810 "After installation you can run it from the players hard drive."),
811 QMessageBox::Yes
| QMessageBox::No
) != QMessageBox::Yes
)
814 ProgressLoggerGui
* logger
= new ProgressLoggerGui(this);
816 logger
->addItem(tr("Installing Rockbox Utility"), LOGINFO
);
819 if(!QFileInfo(userSettings
->value("defaults/mountpoint").toString()).isDir()) {
820 logger
->addItem(tr("Mount point is wrong!"),LOGERROR
);
825 // remove old files first.
826 QFile::remove(userSettings
->value("defaults/mountpoint").toString() + "/RockboxUtility.exe");
827 QFile::remove(userSettings
->value("defaults/mountpoint").toString() + "/RockboxUtility.ini");
828 // copy currently running binary and currently used settings file
829 if(!QFile::copy(qApp
->applicationFilePath(), userSettings
->value("defaults/mountpoint").toString() + "/RockboxUtility.exe")) {
830 logger
->addItem(tr("Error installing Rockbox Utility"), LOGERROR
);
834 logger
->addItem(tr("Installing user configuration"), LOGINFO
);
835 if(!QFile::copy(userSettings
->fileName(), userSettings
->value("defaults/mountpoint").toString() + "/RockboxUtility.ini")) {
836 logger
->addItem(tr("Error installing user configuration"), LOGERROR
);
840 logger
->addItem(tr("Successfully installed Rockbox Utility."), LOGOK
);
846 void RbUtilQt::updateInfo()
848 qDebug() << "RbUtilQt::updateInfo()";
850 QSettings
log(userSettings
->value("defaults/mountpoint").toString() + "/.rockbox/rbutil.log", QSettings::IniFormat
, this);
851 QStringList groups
= log
.childGroups();
852 QList
<QTreeWidgetItem
*> items
;
853 QTreeWidgetItem
*w
, *w2
;
857 // remove old list entries (if any)
858 int l
= ui
.treeInfo
->topLevelItemCount();
861 m
= ui
.treeInfo
->takeTopLevelItem(l
);
862 // delete childs (single level deep, no recursion here)
863 int n
= m
->childCount();
867 // get and populate new items
868 for(int a
= 0; a
< groups
.size(); a
++) {
869 log
.beginGroup(groups
.at(a
));
870 QStringList keys
= log
.allKeys();
871 w
= new QTreeWidgetItem
;
872 w
->setFlags(Qt::ItemIsEnabled
);
873 w
->setText(0, groups
.at(a
));
875 // get minimum and maximum version information so we can hilight old files
876 min
= max
= log
.value(keys
.at(0)).toString();
877 for(int b
= 0; b
< keys
.size(); b
++) {
878 if(log
.value(keys
.at(b
)).toString() > max
)
879 max
= log
.value(keys
.at(b
)).toString();
880 if(log
.value(keys
.at(b
)).toString() < min
)
881 min
= log
.value(keys
.at(b
)).toString();
884 for(int b
= 0; b
< keys
.size(); b
++) {
886 file
= userSettings
->value("defaults/mountpoint").toString() + "/" + keys
.at(b
);
887 if(QFileInfo(file
).isDir())
889 w2
= new QTreeWidgetItem(w
, QStringList() << "/"
890 + keys
.at(b
) << log
.value(keys
.at(b
)).toString());
891 if(log
.value(keys
.at(b
)).toString() != max
) {
892 w2
->setForeground(0, QBrush(QColor(255, 0, 0)));
893 w2
->setForeground(1, QBrush(QColor(255, 0, 0)));
900 w
->setData(1, Qt::DisplayRole
, QString("%1 / %2").arg(min
, max
));
902 w
->setData(1, Qt::DisplayRole
, max
);
904 ui
.treeInfo
->insertTopLevelItems(0, items
);
905 ui
.treeInfo
->resizeColumnToContents(0);
909 QUrl
RbUtilQt::proxy()
911 if(userSettings
->value("defaults/proxytype") == "manual")
912 return QUrl(userSettings
->value("defaults/proxy").toString());
914 else if(userSettings
->value("defaults/proxytype") == "system")
915 return QUrl(getenv("http_proxy"));