2007-07-29 17:35:31 +00:00
|
|
|
/***************************************************************************
|
|
|
|
* __________ __ ___.
|
|
|
|
* Open \______ \ ____ ____ | | _\_ |__ _______ ___
|
|
|
|
* Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
|
|
|
|
* Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
|
|
|
|
* Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
|
|
|
|
* \/ \/ \/ \/ \/
|
|
|
|
*
|
|
|
|
* Copyright (C) 2007 by Dominik Riebeling
|
|
|
|
* $Id$
|
|
|
|
*
|
|
|
|
* All files in this archive are subject to the GNU General Public License.
|
|
|
|
* See the file COPYING in the source tree root for full license agreement.
|
|
|
|
*
|
|
|
|
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
|
|
|
|
* KIND, either express or implied.
|
|
|
|
*
|
|
|
|
****************************************************************************/
|
|
|
|
|
|
|
|
#include <QtGui>
|
|
|
|
|
|
|
|
#include "version.h"
|
|
|
|
#include "rbutilqt.h"
|
|
|
|
#include "ui_rbutilqtfrm.h"
|
|
|
|
#include "ui_aboutbox.h"
|
|
|
|
#include "configure.h"
|
|
|
|
#include "install.h"
|
2007-08-05 16:17:35 +00:00
|
|
|
#include "installtalkwindow.h"
|
2008-01-11 23:59:12 +00:00
|
|
|
#include "createvoicewindow.h"
|
2007-07-29 17:35:31 +00:00
|
|
|
#include "httpget.h"
|
2007-08-15 21:54:15 +00:00
|
|
|
#include "installthemes.h"
|
2007-08-10 22:17:43 +00:00
|
|
|
#include "uninstallwindow.h"
|
2008-01-24 20:02:40 +00:00
|
|
|
#include "utils.h"
|
2008-05-10 17:53:15 +00:00
|
|
|
#include "rbzip.h"
|
2008-06-21 10:28:10 +00:00
|
|
|
#include "sysinfo.h"
|
2008-06-27 21:53:22 +00:00
|
|
|
#include "detect.h"
|
2007-07-29 17:35:31 +00:00
|
|
|
|
2008-09-28 17:02:36 +00:00
|
|
|
#include "progressloggerinterface.h"
|
|
|
|
|
|
|
|
#include "bootloaderinstallbase.h"
|
|
|
|
#include "bootloaderinstallmi4.h"
|
|
|
|
#include "bootloaderinstallhex.h"
|
|
|
|
#include "bootloaderinstallipod.h"
|
|
|
|
#include "bootloaderinstallsansa.h"
|
|
|
|
#include "bootloaderinstallfile.h"
|
|
|
|
|
2007-09-23 13:12:34 +00:00
|
|
|
#if defined(Q_OS_LINUX)
|
2007-07-29 18:41:15 +00:00
|
|
|
#include <stdio.h>
|
|
|
|
#endif
|
2007-09-23 13:12:34 +00:00
|
|
|
#if defined(Q_OS_WIN32)
|
|
|
|
#if defined(UNICODE)
|
|
|
|
#define _UNICODE
|
|
|
|
#endif
|
|
|
|
#include <stdio.h>
|
|
|
|
#include <tchar.h>
|
|
|
|
#include <windows.h>
|
|
|
|
#endif
|
2007-07-29 18:41:15 +00:00
|
|
|
|
2007-07-29 17:35:31 +00:00
|
|
|
RbUtilQt::RbUtilQt(QWidget *parent) : QMainWindow(parent)
|
|
|
|
{
|
2007-08-09 18:40:32 +00:00
|
|
|
absolutePath = qApp->applicationDirPath();
|
2008-09-28 17:02:36 +00:00
|
|
|
|
2008-01-25 00:12:25 +00:00
|
|
|
settings = new RbSettings();
|
|
|
|
settings->open();
|
2008-08-30 20:51:50 +00:00
|
|
|
HttpGet::setGlobalUserAgent("rbutil/"VERSION);
|
2008-09-28 17:02:36 +00:00
|
|
|
// init startup & autodetection
|
|
|
|
ui.setupUi(this);
|
|
|
|
updateSettings();
|
|
|
|
downloadInfo();
|
2008-08-30 20:51:50 +00:00
|
|
|
|
2008-04-01 18:02:56 +00:00
|
|
|
m_gotInfo = false;
|
2008-09-28 17:02:36 +00:00
|
|
|
m_auto = false;
|
|
|
|
|
2007-07-30 18:11:21 +00:00
|
|
|
// manual tab
|
2007-08-22 10:55:05 +00:00
|
|
|
ui.radioPdf->setChecked(true);
|
2007-07-29 17:35:31 +00:00
|
|
|
|
2007-08-26 16:03:56 +00:00
|
|
|
// info tab
|
|
|
|
ui.treeInfo->setAlternatingRowColors(true);
|
|
|
|
ui.treeInfo->setHeaderLabels(QStringList() << tr("File") << tr("Version"));
|
|
|
|
ui.treeInfo->expandAll();
|
|
|
|
ui.treeInfo->setColumnCount(2);
|
|
|
|
|
|
|
|
connect(ui.tabWidget, SIGNAL(currentChanged(int)), this, SLOT(updateTabs(int)));
|
2007-07-29 17:35:31 +00:00
|
|
|
connect(ui.actionAbout_Qt, SIGNAL(triggered()), qApp, SLOT(aboutQt()));
|
|
|
|
connect(ui.action_About, SIGNAL(triggered()), this, SLOT(about()));
|
2007-08-29 17:43:11 +00:00
|
|
|
connect(ui.action_Help, SIGNAL(triggered()), this, SLOT(help()));
|
2007-07-29 17:35:31 +00:00
|
|
|
connect(ui.action_Configure, SIGNAL(triggered()), this, SLOT(configDialog()));
|
2007-08-02 21:29:31 +00:00
|
|
|
connect(ui.buttonChangeDevice, SIGNAL(clicked()), this, SLOT(configDialog()));
|
2007-08-26 20:32:20 +00:00
|
|
|
connect(ui.buttonRockbox, SIGNAL(clicked()), this, SLOT(installBtn()));
|
|
|
|
connect(ui.buttonBootloader, SIGNAL(clicked()), this, SLOT(installBootloaderBtn()));
|
|
|
|
connect(ui.buttonFonts, SIGNAL(clicked()), this, SLOT(installFontsBtn()));
|
|
|
|
connect(ui.buttonGames, SIGNAL(clicked()), this, SLOT(installDoomBtn()));
|
2007-08-05 16:17:35 +00:00
|
|
|
connect(ui.buttonTalk, SIGNAL(clicked()), this, SLOT(createTalkFiles()));
|
2008-01-11 23:59:12 +00:00
|
|
|
connect(ui.buttonCreateVoice, SIGNAL(clicked()), this, SLOT(createVoiceFile()));
|
2007-08-09 16:06:27 +00:00
|
|
|
connect(ui.buttonVoice, SIGNAL(clicked()), this, SLOT(installVoice()));
|
2007-08-15 21:54:15 +00:00
|
|
|
connect(ui.buttonThemes, SIGNAL(clicked()), this, SLOT(installThemes()));
|
2007-08-10 22:17:43 +00:00
|
|
|
connect(ui.buttonRemoveRockbox, SIGNAL(clicked()), this, SLOT(uninstall()));
|
|
|
|
connect(ui.buttonRemoveBootloader, SIGNAL(clicked()), this, SLOT(uninstallBootloader()));
|
2007-08-22 10:55:05 +00:00
|
|
|
connect(ui.buttonDownloadManual, SIGNAL(clicked()), this, SLOT(downloadManual()));
|
2007-08-26 19:06:40 +00:00
|
|
|
connect(ui.buttonSmall, SIGNAL(clicked()), this, SLOT(smallInstall()));
|
|
|
|
connect(ui.buttonComplete, SIGNAL(clicked()), this, SLOT(completeInstall()));
|
2007-09-15 22:57:07 +00:00
|
|
|
|
2007-10-12 16:19:35 +00:00
|
|
|
// actions accessible from the menu
|
|
|
|
connect(ui.actionComplete_Installation, SIGNAL(triggered()), this, SLOT(completeInstall()));
|
|
|
|
connect(ui.actionSmall_Installation, SIGNAL(triggered()), this, SLOT(smallInstall()));
|
|
|
|
connect(ui.actionInstall_Bootloader, SIGNAL(triggered()), this, SLOT(installBootloaderBtn()));
|
|
|
|
connect(ui.actionInstall_Rockbox, SIGNAL(triggered()), this, SLOT(installBtn()));
|
|
|
|
connect(ui.actionFonts_Package, SIGNAL(triggered()), this, SLOT(installFontsBtn()));
|
|
|
|
connect(ui.actionInstall_Themes, SIGNAL(triggered()), this, SLOT(installThemes()));
|
|
|
|
connect(ui.actionInstall_Game_Files, SIGNAL(triggered()), this, SLOT(installDoomBtn()));
|
|
|
|
connect(ui.actionInstall_Voice_File, SIGNAL(triggered()), this, SLOT(installVoice()));
|
2008-01-11 23:59:12 +00:00
|
|
|
connect(ui.actionCreate_Voice_File, SIGNAL(triggered()), this, SLOT(createVoiceFile()));
|
2007-10-12 16:19:35 +00:00
|
|
|
connect(ui.actionCreate_Talk_Files, SIGNAL(triggered()), this, SLOT(createTalkFiles()));
|
|
|
|
connect(ui.actionRemove_bootloader, SIGNAL(triggered()), this, SLOT(uninstallBootloader()));
|
|
|
|
connect(ui.actionUninstall_Rockbox, SIGNAL(triggered()), this, SLOT(uninstall()));
|
2008-06-21 10:28:10 +00:00
|
|
|
connect(ui.action_System_Info, SIGNAL(triggered()), this, SLOT(sysinfo()));
|
2007-10-12 16:19:35 +00:00
|
|
|
|
2007-08-22 22:25:04 +00:00
|
|
|
#if !defined(STATIC)
|
|
|
|
ui.actionInstall_Rockbox_Utility_on_player->setEnabled(false);
|
|
|
|
#else
|
|
|
|
connect(ui.actionInstall_Rockbox_Utility_on_player, SIGNAL(triggered()), this, SLOT(installPortable()));
|
|
|
|
#endif
|
2007-07-29 17:35:31 +00:00
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2008-06-21 10:28:10 +00:00
|
|
|
void RbUtilQt::sysinfo(void)
|
|
|
|
{
|
|
|
|
Sysinfo *info = new Sysinfo(this);
|
|
|
|
info->show();
|
|
|
|
}
|
|
|
|
|
2007-08-26 16:03:56 +00:00
|
|
|
void RbUtilQt::updateTabs(int count)
|
|
|
|
{
|
|
|
|
switch(count) {
|
|
|
|
case 6:
|
|
|
|
updateInfo();
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
2007-08-10 22:17:43 +00:00
|
|
|
|
|
|
|
|
2007-07-29 17:35:31 +00:00
|
|
|
void RbUtilQt::downloadInfo()
|
|
|
|
{
|
|
|
|
// try to get the current build information
|
|
|
|
daily = new HttpGet(this);
|
|
|
|
connect(daily, SIGNAL(done(bool)), this, SLOT(downloadDone(bool)));
|
|
|
|
connect(daily, SIGNAL(requestFinished(int, bool)), this, SLOT(downloadDone(int, bool)));
|
2007-09-03 09:46:15 +00:00
|
|
|
connect(qApp, SIGNAL(lastWindowClosed()), daily, SLOT(abort()));
|
2008-01-25 00:12:25 +00:00
|
|
|
if(settings->cacheOffline())
|
2008-03-05 21:12:24 +00:00
|
|
|
daily->setCache(true);
|
|
|
|
else
|
|
|
|
daily->setCache(false);
|
2007-07-29 17:35:31 +00:00
|
|
|
qDebug() << "downloading build info";
|
|
|
|
daily->setFile(&buildInfo);
|
2008-01-25 00:12:25 +00:00
|
|
|
daily->getFile(QUrl(settings->serverConfUrl()));
|
2007-07-29 17:35:31 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void RbUtilQt::downloadDone(bool error)
|
|
|
|
{
|
2007-08-26 16:03:56 +00:00
|
|
|
if(error) {
|
|
|
|
qDebug() << "network error:" << daily->error();
|
2008-09-28 17:02:36 +00:00
|
|
|
QMessageBox::critical(this, tr("Network error"),
|
|
|
|
tr("Can't get version information."));
|
2007-08-26 16:03:56 +00:00
|
|
|
return;
|
|
|
|
}
|
2007-07-29 17:35:31 +00:00
|
|
|
qDebug() << "network status:" << daily->error();
|
2007-09-15 22:57:07 +00:00
|
|
|
|
2007-08-26 16:03:56 +00:00
|
|
|
buildInfo.open();
|
|
|
|
QSettings info(buildInfo.fileName(), QSettings::IniFormat, this);
|
|
|
|
buildInfo.close();
|
|
|
|
versmap.insert("arch_rev", info.value("dailies/rev").toString());
|
|
|
|
versmap.insert("arch_date", info.value("dailies/date").toString());
|
|
|
|
|
|
|
|
bleeding = new HttpGet(this);
|
|
|
|
connect(bleeding, SIGNAL(done(bool)), this, SLOT(downloadBleedingDone(bool)));
|
|
|
|
connect(bleeding, SIGNAL(requestFinished(int, bool)), this, SLOT(downloadDone(int, bool)));
|
2007-09-03 09:46:15 +00:00
|
|
|
connect(qApp, SIGNAL(lastWindowClosed()), daily, SLOT(abort()));
|
2008-01-25 00:12:25 +00:00
|
|
|
if(settings->cacheOffline())
|
2008-03-05 21:12:24 +00:00
|
|
|
bleeding->setCache(true);
|
2007-08-26 16:03:56 +00:00
|
|
|
bleeding->setFile(&bleedingInfo);
|
2008-01-25 00:12:25 +00:00
|
|
|
bleeding->getFile(QUrl(settings->bleedingInfo()));
|
2007-09-16 18:32:49 +00:00
|
|
|
|
2008-07-07 21:40:44 +00:00
|
|
|
if(settings->curVersion() != PUREVERSION) {
|
|
|
|
QApplication::processEvents();
|
|
|
|
QMessageBox::information(this, tr("New installation"),
|
|
|
|
tr("This is a new installation of Rockbox Utility, or a new version. "
|
|
|
|
"The configuration dialog will now open to allow you to setup the program, "
|
|
|
|
" or review your settings."));
|
|
|
|
configDialog();
|
|
|
|
}
|
|
|
|
else if(chkConfig(false)) {
|
2007-09-16 18:32:49 +00:00
|
|
|
QApplication::processEvents();
|
|
|
|
QMessageBox::critical(this, tr("Configuration error"),
|
|
|
|
tr("Your configuration is invalid. This is most likely due "
|
2008-07-07 21:40:44 +00:00
|
|
|
"to a changed device path. The configuration dialog will "
|
|
|
|
"now open to allow you to correct the problem."));
|
2007-09-16 18:32:49 +00:00
|
|
|
configDialog();
|
|
|
|
}
|
2007-08-26 16:03:56 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void RbUtilQt::downloadBleedingDone(bool error)
|
|
|
|
{
|
|
|
|
if(error) qDebug() << "network error:" << bleeding->error();
|
|
|
|
|
|
|
|
bleedingInfo.open();
|
|
|
|
QSettings info(bleedingInfo.fileName(), QSettings::IniFormat, this);
|
|
|
|
bleedingInfo.close();
|
|
|
|
versmap.insert("bleed_rev", info.value("bleeding/rev").toString());
|
|
|
|
versmap.insert("bleed_date", info.value("bleeding/timestamp").toString());
|
|
|
|
qDebug() << "versmap =" << versmap;
|
2008-04-01 18:02:56 +00:00
|
|
|
|
|
|
|
m_gotInfo = true;
|
2007-07-29 17:35:31 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void RbUtilQt::downloadDone(int id, bool error)
|
|
|
|
{
|
|
|
|
QString errorString;
|
2007-08-02 21:29:31 +00:00
|
|
|
errorString = tr("Network error: %1. Please check your network and proxy settings.")
|
|
|
|
.arg(daily->errorString());
|
2007-08-26 16:03:56 +00:00
|
|
|
if(error) {
|
|
|
|
QMessageBox::about(this, "Network Error", errorString);
|
2008-09-28 17:02:36 +00:00
|
|
|
m_networkerror = daily->errorString();
|
2007-08-26 16:03:56 +00:00
|
|
|
}
|
2008-09-28 17:02:36 +00:00
|
|
|
qDebug() << "downloadDone:" << id << "error:" << error;
|
2007-07-29 17:35:31 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void RbUtilQt::about()
|
|
|
|
{
|
2007-07-30 19:35:48 +00:00
|
|
|
QDialog *window = new QDialog(this);
|
2007-07-29 17:35:31 +00:00
|
|
|
Ui::aboutBox about;
|
|
|
|
about.setupUi(window);
|
2007-07-30 19:35:48 +00:00
|
|
|
window->setModal(true);
|
2007-09-15 22:57:07 +00:00
|
|
|
|
2007-07-29 17:35:31 +00:00
|
|
|
QFile licence(":/docs/gpl-2.0.html");
|
|
|
|
licence.open(QIODevice::ReadOnly);
|
|
|
|
QTextStream c(&licence);
|
|
|
|
QString cline = c.readAll();
|
|
|
|
about.browserLicense->insertHtml(cline);
|
|
|
|
about.browserLicense->moveCursor(QTextCursor::Start, QTextCursor::MoveAnchor);
|
|
|
|
QFile credits(":/docs/CREDITS");
|
|
|
|
credits.open(QIODevice::ReadOnly);
|
|
|
|
QTextStream r(&credits);
|
|
|
|
QString rline = r.readAll();
|
|
|
|
about.browserCredits->insertPlainText(rline);
|
|
|
|
about.browserCredits->moveCursor(QTextCursor::Start, QTextCursor::MoveAnchor);
|
2008-08-30 20:51:50 +00:00
|
|
|
QString title = QString("<b>The Rockbox Utility</b><br/>Version %1").arg(FULLVERSION);
|
2007-07-29 17:35:31 +00:00
|
|
|
about.labelTitle->setText(title);
|
2007-07-30 17:33:46 +00:00
|
|
|
about.labelHomepage->setText("<a href='http://www.rockbox.org'>http://www.rockbox.org</a>");
|
2007-07-29 17:35:31 +00:00
|
|
|
|
|
|
|
window->show();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2007-08-29 17:43:11 +00:00
|
|
|
void RbUtilQt::help()
|
|
|
|
{
|
2007-12-16 18:56:45 +00:00
|
|
|
QUrl helpurl("http://www.rockbox.org/wiki/RockboxUtility");
|
2007-08-29 17:43:11 +00:00
|
|
|
QDesktopServices::openUrl(helpurl);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2007-07-29 17:35:31 +00:00
|
|
|
void RbUtilQt::configDialog()
|
|
|
|
{
|
|
|
|
Config *cw = new Config(this);
|
2008-01-25 00:12:25 +00:00
|
|
|
cw->setSettings(settings);
|
2007-08-02 21:29:31 +00:00
|
|
|
connect(cw, SIGNAL(settingsUpdated()), this, SLOT(updateSettings()));
|
2008-03-09 23:33:53 +00:00
|
|
|
connect(cw, SIGNAL(settingsUpdated()), this, SLOT(downloadInfo()));
|
2008-04-06 19:50:38 +00:00
|
|
|
cw->show();
|
2007-07-29 17:35:31 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2007-08-02 21:29:31 +00:00
|
|
|
void RbUtilQt::updateSettings()
|
2007-07-29 17:35:31 +00:00
|
|
|
{
|
2007-08-02 21:29:31 +00:00
|
|
|
qDebug() << "updateSettings()";
|
|
|
|
updateDevice();
|
|
|
|
updateManual();
|
2008-03-05 21:12:24 +00:00
|
|
|
if(settings->proxyType() == "system") {
|
2008-06-27 21:53:22 +00:00
|
|
|
HttpGet::setGlobalProxy(Detect::systemProxy());
|
2008-03-05 21:12:24 +00:00
|
|
|
}
|
|
|
|
else if(settings->proxyType() == "manual") {
|
|
|
|
HttpGet::setGlobalProxy(settings->proxy());
|
|
|
|
}
|
2008-03-09 23:33:53 +00:00
|
|
|
else {
|
|
|
|
HttpGet::setGlobalProxy(QUrl(""));
|
|
|
|
}
|
2008-03-05 21:12:24 +00:00
|
|
|
HttpGet::setGlobalCache(settings->cachePath());
|
2008-05-17 20:21:55 +00:00
|
|
|
HttpGet::setGlobalDumbCache(settings->cacheOffline());
|
2007-07-29 17:35:31 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2007-08-02 21:29:31 +00:00
|
|
|
void RbUtilQt::updateDevice()
|
2007-07-29 17:35:31 +00:00
|
|
|
{
|
2008-01-25 00:12:25 +00:00
|
|
|
if(!settings->curNeedsBootloader() ) {
|
2007-07-29 17:35:31 +00:00
|
|
|
ui.buttonBootloader->setEnabled(false);
|
|
|
|
ui.buttonRemoveBootloader->setEnabled(false);
|
|
|
|
ui.labelBootloader->setEnabled(false);
|
|
|
|
ui.labelRemoveBootloader->setEnabled(false);
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
ui.buttonBootloader->setEnabled(true);
|
|
|
|
ui.labelBootloader->setEnabled(true);
|
2008-01-25 00:12:25 +00:00
|
|
|
if(settings->curBootloaderMethod() == "fwpatcher") {
|
2007-07-29 17:35:31 +00:00
|
|
|
ui.labelRemoveBootloader->setEnabled(false);
|
|
|
|
ui.buttonRemoveBootloader->setEnabled(false);
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
ui.labelRemoveBootloader->setEnabled(true);
|
|
|
|
ui.buttonRemoveBootloader->setEnabled(true);
|
|
|
|
}
|
|
|
|
}
|
2008-01-25 00:12:25 +00:00
|
|
|
|
2007-08-02 21:29:31 +00:00
|
|
|
// displayed device info
|
2008-01-25 00:12:25 +00:00
|
|
|
QString mountpoint = settings->mountpoint();
|
|
|
|
QString brand = settings->curBrand();
|
|
|
|
QString name = settings->curName();
|
2007-08-03 16:55:27 +00:00
|
|
|
if(name.isEmpty()) name = "<none>";
|
|
|
|
if(mountpoint.isEmpty()) mountpoint = "<invalid>";
|
2007-08-02 21:29:31 +00:00
|
|
|
ui.labelDevice->setText(tr("<b>%1 %2</b> at <b>%3</b>")
|
2008-02-06 21:06:24 +00:00
|
|
|
.arg(brand, name, QDir::toNativeSeparators(mountpoint)));
|
2007-07-30 18:11:21 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void RbUtilQt::updateManual()
|
|
|
|
{
|
2008-01-25 00:12:25 +00:00
|
|
|
if(settings->curPlatform() != "")
|
2007-07-30 18:11:21 +00:00
|
|
|
{
|
2008-01-25 00:12:25 +00:00
|
|
|
QString manual= settings->curManual();
|
2007-09-15 22:57:07 +00:00
|
|
|
|
2007-07-30 18:11:21 +00:00
|
|
|
if(manual == "")
|
2008-01-25 00:12:25 +00:00
|
|
|
manual = "rockbox-" + settings->curPlatform();
|
2007-07-30 18:11:21 +00:00
|
|
|
QString pdfmanual;
|
2008-01-25 00:12:25 +00:00
|
|
|
pdfmanual = settings->manualUrl() + "/" + manual + ".pdf";
|
2007-07-30 18:11:21 +00:00
|
|
|
QString htmlmanual;
|
2008-01-25 00:12:25 +00:00
|
|
|
htmlmanual = settings->manualUrl() + "/" + manual + "/rockbox-build.html";
|
2007-07-30 18:11:21 +00:00
|
|
|
ui.labelPdfManual->setText(tr("<a href='%1'>PDF Manual</a>")
|
|
|
|
.arg(pdfmanual));
|
|
|
|
ui.labelHtmlManual->setText(tr("<a href='%1'>HTML Manual (opens in browser)</a>")
|
|
|
|
.arg(htmlmanual));
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
ui.labelPdfManual->setText(tr("Select a device for a link to the correct manual"));
|
|
|
|
ui.labelHtmlManual->setText(tr("<a href='%1'>Manual Overview</a>")
|
|
|
|
.arg("http://www.rockbox.org/manual.shtml"));
|
|
|
|
|
|
|
|
}
|
2007-07-29 17:35:31 +00:00
|
|
|
}
|
|
|
|
|
2007-08-26 19:06:40 +00:00
|
|
|
void RbUtilQt::completeInstall()
|
|
|
|
{
|
2007-09-16 18:32:49 +00:00
|
|
|
if(chkConfig(true)) return;
|
2007-08-26 19:06:40 +00:00
|
|
|
if(QMessageBox::question(this, tr("Confirm Installation"),
|
2008-09-25 20:42:46 +00:00
|
|
|
tr("Do you really want to make a complete Installation? "
|
|
|
|
"This will install the latest build available, not the latest "
|
|
|
|
"released version."),
|
2007-08-26 19:06:40 +00:00
|
|
|
QMessageBox::Yes | QMessageBox::No) != QMessageBox::Yes) return;
|
2007-09-15 22:57:07 +00:00
|
|
|
|
2007-08-26 20:32:20 +00:00
|
|
|
// create logger
|
|
|
|
logger = new ProgressLoggerGui(this);
|
|
|
|
logger->show();
|
2007-09-15 22:57:07 +00:00
|
|
|
|
2007-09-15 23:00:02 +00:00
|
|
|
if(smallInstallInner())
|
2007-08-26 20:32:20 +00:00
|
|
|
return;
|
2008-02-28 20:28:15 +00:00
|
|
|
logger->undoAbort();
|
2007-08-26 20:32:20 +00:00
|
|
|
// Fonts
|
|
|
|
m_error = false;
|
|
|
|
m_installed = false;
|
|
|
|
if(!installFontsAuto())
|
|
|
|
return;
|
|
|
|
else
|
|
|
|
{
|
2007-09-15 22:42:12 +00:00
|
|
|
// wait for installation finished
|
2007-08-26 20:32:20 +00:00
|
|
|
while(!m_installed)
|
|
|
|
QApplication::processEvents();
|
|
|
|
}
|
|
|
|
if(m_error) return;
|
|
|
|
logger->undoAbort();
|
2007-09-15 22:57:07 +00:00
|
|
|
|
2007-08-26 20:32:20 +00:00
|
|
|
// Doom
|
2007-09-15 22:32:14 +00:00
|
|
|
if(hasDoom())
|
2007-08-26 20:32:20 +00:00
|
|
|
{
|
2007-09-15 22:32:14 +00:00
|
|
|
m_error = false;
|
|
|
|
m_installed = false;
|
|
|
|
if(!installDoomAuto())
|
|
|
|
return;
|
|
|
|
else
|
|
|
|
{
|
2007-09-15 22:42:12 +00:00
|
|
|
// wait for installation finished
|
2007-09-15 22:32:14 +00:00
|
|
|
while(!m_installed)
|
|
|
|
QApplication::processEvents();
|
|
|
|
}
|
|
|
|
if(m_error) return;
|
2007-08-26 20:32:20 +00:00
|
|
|
}
|
2007-09-15 22:42:12 +00:00
|
|
|
|
2007-08-26 20:32:20 +00:00
|
|
|
// theme
|
|
|
|
// this is a window
|
|
|
|
// it has its own logger window,so close our.
|
|
|
|
logger->close();
|
|
|
|
installThemes();
|
2007-09-15 22:57:07 +00:00
|
|
|
|
2007-08-26 19:06:40 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void RbUtilQt::smallInstall()
|
|
|
|
{
|
2007-09-16 18:32:49 +00:00
|
|
|
if(chkConfig(true)) return;
|
2007-08-26 19:06:40 +00:00
|
|
|
if(QMessageBox::question(this, tr("Confirm Installation"),
|
2008-09-25 20:42:46 +00:00
|
|
|
tr("Do you really want to make a small Installation? "
|
|
|
|
"This will install the latest build available, not the latest "
|
|
|
|
"released version."),
|
2007-08-26 19:06:40 +00:00
|
|
|
QMessageBox::Yes | QMessageBox::No) != QMessageBox::Yes) return;
|
2007-09-15 22:57:07 +00:00
|
|
|
|
2007-08-26 20:32:20 +00:00
|
|
|
// create logger
|
|
|
|
logger = new ProgressLoggerGui(this);
|
|
|
|
logger->show();
|
2007-09-15 22:42:12 +00:00
|
|
|
|
2007-09-15 23:00:02 +00:00
|
|
|
smallInstallInner();
|
|
|
|
}
|
|
|
|
|
|
|
|
bool RbUtilQt::smallInstallInner()
|
|
|
|
{
|
2008-01-25 00:12:25 +00:00
|
|
|
QString mountpoint = settings->mountpoint();
|
2007-08-26 20:32:20 +00:00
|
|
|
// show dialog with error if mount point is wrong
|
|
|
|
if(!QFileInfo(mountpoint).isDir()) {
|
|
|
|
logger->addItem(tr("Mount point is wrong!"),LOGERROR);
|
|
|
|
logger->abort();
|
2007-09-15 23:00:02 +00:00
|
|
|
return true;
|
2007-09-15 22:57:07 +00:00
|
|
|
}
|
2007-08-26 20:32:20 +00:00
|
|
|
// Bootloader
|
2008-01-25 00:12:25 +00:00
|
|
|
if(settings->curNeedsBootloader())
|
2007-10-19 22:17:52 +00:00
|
|
|
{
|
2007-09-15 22:32:14 +00:00
|
|
|
m_error = false;
|
|
|
|
m_installed = false;
|
2008-09-28 17:02:36 +00:00
|
|
|
m_auto = true;
|
2007-09-15 22:32:14 +00:00
|
|
|
if(!installBootloaderAuto())
|
2007-09-15 23:00:02 +00:00
|
|
|
return true;
|
2007-09-15 22:32:14 +00:00
|
|
|
else
|
|
|
|
{
|
|
|
|
// wait for boot loader installation finished
|
|
|
|
while(!m_installed)
|
|
|
|
QApplication::processEvents();
|
|
|
|
}
|
2008-09-28 17:02:36 +00:00
|
|
|
m_auto = false;
|
2007-09-15 23:00:02 +00:00
|
|
|
if(m_error) return true;
|
2007-09-15 22:32:14 +00:00
|
|
|
logger->undoAbort();
|
2007-10-19 22:17:52 +00:00
|
|
|
}
|
2007-09-15 22:42:12 +00:00
|
|
|
|
2007-08-26 20:32:20 +00:00
|
|
|
// Rockbox
|
|
|
|
m_error = false;
|
|
|
|
m_installed = false;
|
|
|
|
if(!installAuto())
|
2007-09-15 23:00:02 +00:00
|
|
|
return true;
|
2007-08-26 20:32:20 +00:00
|
|
|
else
|
|
|
|
{
|
2007-09-15 22:42:12 +00:00
|
|
|
// wait for installation finished
|
2007-08-26 20:32:20 +00:00
|
|
|
while(!m_installed)
|
|
|
|
QApplication::processEvents();
|
|
|
|
}
|
2007-09-15 23:00:02 +00:00
|
|
|
|
2008-09-28 17:02:36 +00:00
|
|
|
installBootloaderPost(false);
|
2007-09-15 23:00:02 +00:00
|
|
|
return false;
|
2007-08-26 20:32:20 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void RbUtilQt::installdone(bool error)
|
|
|
|
{
|
|
|
|
qDebug() << "install done";
|
|
|
|
m_installed = true;
|
|
|
|
m_error = error;
|
|
|
|
}
|
|
|
|
|
|
|
|
void RbUtilQt::installBtn()
|
|
|
|
{
|
2007-09-16 18:32:49 +00:00
|
|
|
if(chkConfig(true)) return;
|
2007-08-26 20:32:20 +00:00
|
|
|
install();
|
|
|
|
}
|
|
|
|
|
|
|
|
bool RbUtilQt::installAuto()
|
|
|
|
{
|
|
|
|
QString file = QString("%1%2/rockbox.zip")
|
2008-09-24 21:18:37 +00:00
|
|
|
.arg(settings->bleedingUrl(), settings->curPlatformName());
|
2007-09-15 22:57:07 +00:00
|
|
|
|
2007-08-26 19:06:40 +00:00
|
|
|
buildInfo.open();
|
|
|
|
QSettings info(buildInfo.fileName(), QSettings::IniFormat, this);
|
|
|
|
buildInfo.close();
|
|
|
|
|
2008-01-25 00:12:25 +00:00
|
|
|
if(settings->curReleased()) {
|
2007-08-26 19:06:40 +00:00
|
|
|
// only set the keys if needed -- querying will yield an empty string
|
|
|
|
// if not set.
|
2008-10-18 16:19:07 +00:00
|
|
|
versmap.insert("rel_rev", settings->lastRelease(settings->curPlatform()));
|
2007-08-26 19:06:40 +00:00
|
|
|
versmap.insert("rel_date", ""); // FIXME: provide the release timestamp
|
|
|
|
}
|
2007-09-15 22:57:07 +00:00
|
|
|
|
2007-08-26 20:32:20 +00:00
|
|
|
QString myversion = "r" + versmap.value("bleed_rev");
|
2008-10-24 22:31:07 +00:00
|
|
|
|
2008-06-23 20:31:44 +00:00
|
|
|
// check installed Version and Target
|
2008-10-24 22:31:07 +00:00
|
|
|
QString rbVersion = Detect::installedVersion(settings->mountpoint());
|
|
|
|
QString warning = Detect::check(settings, false, settings->curTargetId());
|
2008-06-27 21:53:22 +00:00
|
|
|
|
2008-10-24 22:31:07 +00:00
|
|
|
if(!warning.isEmpty())
|
2008-06-23 20:31:44 +00:00
|
|
|
{
|
2008-10-24 22:31:07 +00:00
|
|
|
if(QMessageBox::warning(this, tr("Really continue?"), warning,
|
|
|
|
QMessageBox::Ok | QMessageBox::Abort, QMessageBox::Abort) == QMessageBox::Abort)
|
|
|
|
{
|
|
|
|
logger->addItem(tr("Aborted!"), LOGERROR);
|
|
|
|
logger->abort();
|
|
|
|
return false;
|
|
|
|
}
|
2008-06-23 20:31:44 +00:00
|
|
|
}
|
2008-10-24 22:31:07 +00:00
|
|
|
|
2008-06-23 20:31:44 +00:00
|
|
|
// check version
|
2008-05-11 18:22:42 +00:00
|
|
|
if(rbVersion != "")
|
2008-05-10 17:53:15 +00:00
|
|
|
{
|
|
|
|
if(QMessageBox::question(this, tr("Installed Rockbox detected"),
|
|
|
|
tr("Rockbox installation detected. Do you want to backup first?"),
|
|
|
|
QMessageBox::Yes | QMessageBox::No) == QMessageBox::Yes)
|
|
|
|
{
|
2008-06-27 20:36:41 +00:00
|
|
|
logger->addItem(tr("Starting backup..."),LOGINFO);
|
2008-05-11 18:53:24 +00:00
|
|
|
QString backupName = settings->mountpoint() + "/.backup/rockbox-backup-"+rbVersion+".zip";
|
2008-10-24 22:31:07 +00:00
|
|
|
|
2008-05-11 18:22:42 +00:00
|
|
|
//! create dir, if it doesnt exist
|
|
|
|
QFileInfo backupFile(backupName);
|
|
|
|
if(!QDir(backupFile.path()).exists())
|
|
|
|
{
|
|
|
|
QDir a;
|
|
|
|
a.mkpath(backupFile.path());
|
|
|
|
}
|
|
|
|
|
|
|
|
//! create backup
|
2008-05-10 17:53:15 +00:00
|
|
|
RbZip backup;
|
2008-06-27 20:36:41 +00:00
|
|
|
connect(&backup,SIGNAL(zipProgress(int,int)),logger, SLOT(setProgress(int,int)));
|
2008-05-11 18:22:42 +00:00
|
|
|
if(backup.createZip(backupName,settings->mountpoint() + "/.rockbox") == Zip::Ok)
|
|
|
|
{
|
2008-07-25 22:29:59 +00:00
|
|
|
logger->addItem(tr("Backup successful"),LOGOK);
|
2008-05-11 18:22:42 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
logger->addItem(tr("Backup failed!"),LOGERROR);
|
|
|
|
logger->abort();
|
|
|
|
return false;
|
|
|
|
}
|
2008-05-10 17:53:15 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
//! install current build
|
2007-08-26 20:32:20 +00:00
|
|
|
ZipInstaller* installer = new ZipInstaller(this);
|
|
|
|
installer->setUrl(file);
|
2007-08-28 13:07:25 +00:00
|
|
|
installer->setLogSection("Rockbox (Base)");
|
2007-08-26 20:32:20 +00:00
|
|
|
installer->setLogVersion(myversion);
|
2008-01-25 00:12:25 +00:00
|
|
|
if(!settings->cacheDisabled())
|
2008-03-05 21:12:24 +00:00
|
|
|
installer->setCache(true);
|
2008-01-25 00:12:25 +00:00
|
|
|
installer->setMountPoint(settings->mountpoint());
|
2007-09-15 22:57:07 +00:00
|
|
|
|
2007-08-26 20:32:20 +00:00
|
|
|
connect(installer, SIGNAL(done(bool)), this, SLOT(installdone(bool)));
|
2007-09-15 22:57:07 +00:00
|
|
|
|
2008-04-06 19:39:41 +00:00
|
|
|
installer->install(logger);
|
2007-08-26 20:32:20 +00:00
|
|
|
return true;
|
2007-08-26 19:06:40 +00:00
|
|
|
}
|
2007-07-29 17:35:31 +00:00
|
|
|
|
2008-05-11 18:22:42 +00:00
|
|
|
|
2007-07-29 17:35:31 +00:00
|
|
|
void RbUtilQt::install()
|
|
|
|
{
|
2008-05-11 18:22:42 +00:00
|
|
|
Install *installWindow = new Install(settings,this);
|
2007-07-29 17:35:31 +00:00
|
|
|
|
|
|
|
buildInfo.open();
|
|
|
|
QSettings info(buildInfo.fileName(), QSettings::IniFormat, this);
|
|
|
|
buildInfo.close();
|
|
|
|
|
2008-01-25 00:12:25 +00:00
|
|
|
if(settings->curReleased()) {
|
2007-08-26 16:03:56 +00:00
|
|
|
// only set the keys if needed -- querying will yield an empty string
|
|
|
|
// if not set.
|
2008-10-18 16:19:07 +00:00
|
|
|
versmap.insert("rel_rev", settings->lastRelease(settings->curPlatform()));
|
2007-08-26 16:03:56 +00:00
|
|
|
versmap.insert("rel_date", ""); // FIXME: provide the release timestamp
|
|
|
|
}
|
|
|
|
installWindow->setVersionStrings(versmap);
|
2007-07-29 17:35:31 +00:00
|
|
|
|
|
|
|
installWindow->show();
|
|
|
|
}
|
|
|
|
|
2007-08-26 20:32:20 +00:00
|
|
|
bool RbUtilQt::installBootloaderAuto()
|
|
|
|
{
|
|
|
|
installBootloader();
|
2008-04-06 19:59:53 +00:00
|
|
|
return !m_error;
|
2007-08-26 20:32:20 +00:00
|
|
|
}
|
2007-08-02 21:29:31 +00:00
|
|
|
|
2007-08-26 20:32:20 +00:00
|
|
|
void RbUtilQt::installBootloaderBtn()
|
2007-07-29 17:35:31 +00:00
|
|
|
{
|
2007-09-16 18:32:49 +00:00
|
|
|
if(chkConfig(true)) return;
|
2007-08-15 14:16:20 +00:00
|
|
|
if(QMessageBox::question(this, tr("Confirm Installation"),
|
2007-08-26 20:32:20 +00:00
|
|
|
tr("Do you really want to install the Bootloader?"),
|
|
|
|
QMessageBox::Yes | QMessageBox::No) != QMessageBox::Yes) return;
|
2007-09-15 22:57:07 +00:00
|
|
|
|
2007-08-15 14:16:20 +00:00
|
|
|
// create logger
|
|
|
|
logger = new ProgressLoggerGui(this);
|
2008-09-28 17:02:36 +00:00
|
|
|
|
2007-08-26 20:32:20 +00:00
|
|
|
installBootloader();
|
|
|
|
}
|
|
|
|
|
|
|
|
void RbUtilQt::installBootloader()
|
2007-09-15 22:57:07 +00:00
|
|
|
{
|
2008-01-25 00:12:25 +00:00
|
|
|
QString platform = settings->curPlatform();
|
2008-09-28 17:02:36 +00:00
|
|
|
QString backupDestination = "";
|
|
|
|
m_error = false;
|
2007-08-26 16:44:23 +00:00
|
|
|
|
|
|
|
// create installer
|
2008-09-28 17:02:36 +00:00
|
|
|
BootloaderInstallBase *bl;
|
|
|
|
QString type = settings->curBootloaderMethod();
|
|
|
|
if(type == "mi4") {
|
|
|
|
bl = new BootloaderInstallMi4(this);
|
|
|
|
}
|
|
|
|
else if(type == "hex") {
|
|
|
|
bl = new BootloaderInstallHex(this);
|
|
|
|
}
|
|
|
|
else if(type == "sansa") {
|
|
|
|
bl = new BootloaderInstallSansa(this);
|
|
|
|
}
|
|
|
|
else if(type == "ipod") {
|
|
|
|
bl = new BootloaderInstallIpod(this);
|
|
|
|
}
|
|
|
|
else if(type == "file") {
|
|
|
|
bl = new BootloaderInstallFile(this);
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
logger->addItem(tr("No install method known."), LOGERROR);
|
2007-08-26 16:44:23 +00:00
|
|
|
logger->abort();
|
|
|
|
return;
|
|
|
|
}
|
2007-09-15 22:57:07 +00:00
|
|
|
|
2008-09-28 17:02:36 +00:00
|
|
|
// set bootloader filename. Do this now as installed() needs it.
|
|
|
|
QString blfile;
|
|
|
|
blfile = settings->mountpoint() + settings->curBootloaderFile();
|
|
|
|
// special case for H10 pure: this player can have a different
|
|
|
|
// bootloader file filename. This is handled here to keep the install
|
|
|
|
// class clean, though having it here is also not the nicest solution.
|
|
|
|
if(settings->curPlatformName() == "h10_ums"
|
|
|
|
|| settings->curPlatformName() == "h10_mtp") {
|
|
|
|
if(resolvePathCase(blfile).isEmpty())
|
|
|
|
blfile = settings->mountpoint()
|
|
|
|
+ settings->curBootloaderName().replace("H10",
|
|
|
|
"H10EMP", Qt::CaseInsensitive);
|
|
|
|
}
|
|
|
|
bl->setBlFile(blfile);
|
|
|
|
QUrl url(settings->bootloaderUrl() + settings->curBootloaderName());
|
|
|
|
bl->setBlUrl(url);
|
|
|
|
bl->setLogfile(settings->mountpoint() + "/.rockbox/rbutil.log");
|
|
|
|
|
|
|
|
if(bl->installed() == BootloaderInstallBase::BootloaderRockbox) {
|
|
|
|
if(QMessageBox::question(this, tr("Bootloader detected"),
|
|
|
|
tr("Bootloader already installed. Do you want to reinstall the bootloader?"),
|
|
|
|
QMessageBox::Yes | QMessageBox::No) == QMessageBox::No) {
|
|
|
|
logger->close();
|
|
|
|
m_error = true;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else if(bl->installed() == BootloaderInstallBase::BootloaderOther
|
|
|
|
&& bl->capabilities() & BootloaderInstallBase::Backup)
|
2007-08-26 16:44:23 +00:00
|
|
|
{
|
2008-09-28 17:02:36 +00:00
|
|
|
QString targetFolder = settings->name(settings->curPlatform())
|
|
|
|
+ " Firmware Backup";
|
|
|
|
// remove invalid character(s)
|
|
|
|
targetFolder.remove(QRegExp("[:/]"));
|
|
|
|
if(QMessageBox::question(this, tr("Create Bootloader backup"),
|
|
|
|
tr("You can create a backup of the original bootloader "
|
|
|
|
"file. Press \"Yes\" to select an output folder on your "
|
|
|
|
"computer to save the file to. The file will get placed "
|
|
|
|
"in a new folder \"%1\" created below the selected folder.\n"
|
|
|
|
"Press \"No\" to skip this step.").arg(targetFolder),
|
|
|
|
QMessageBox::Yes | QMessageBox::No) == QMessageBox::Yes) {
|
|
|
|
BrowseDirtree tree(this, tr("Browse backup folder"));
|
|
|
|
tree.setDir(QDir::home());
|
|
|
|
tree.exec();
|
|
|
|
|
|
|
|
backupDestination = tree.getSelected() + "/" + targetFolder;
|
|
|
|
qDebug() << backupDestination;
|
|
|
|
// backup needs to be done after the logger has been set up.
|
2007-08-26 16:44:23 +00:00
|
|
|
}
|
|
|
|
}
|
2007-09-15 22:57:07 +00:00
|
|
|
|
2008-09-28 17:02:36 +00:00
|
|
|
if(bl->capabilities() & BootloaderInstallBase::NeedsFlashing)
|
2007-08-15 14:16:20 +00:00
|
|
|
{
|
2008-09-28 17:02:36 +00:00
|
|
|
int ret;
|
|
|
|
ret = QMessageBox::information(this, tr("Prerequisites"),
|
|
|
|
tr("Bootloader installation requires you to provide "
|
|
|
|
"a firmware file of the original firmware (hex file). "
|
|
|
|
"You need to download this file yourself due to legal "
|
|
|
|
"reasons. Please refer to the "
|
|
|
|
"<a href='http://www.rockbox.org/manual.shtml'>manual</a> and the "
|
|
|
|
"<a href='http://www.rockbox.org/wiki/IriverBoot"
|
|
|
|
"#Download_and_extract_a_recent_ve'>IriverBoot</a> wiki page on "
|
|
|
|
"how to obtain this file.<br/>"
|
|
|
|
"Press Ok to continue and browse your computer for the firmware "
|
|
|
|
"file."),
|
|
|
|
QMessageBox::Ok | QMessageBox::Abort);
|
|
|
|
if(ret != QMessageBox::Ok) {
|
|
|
|
m_error = true;
|
|
|
|
return;
|
2007-08-15 14:16:20 +00:00
|
|
|
}
|
2008-09-28 17:02:36 +00:00
|
|
|
// open dialog to browse to hex file
|
|
|
|
QString hexfile;
|
|
|
|
hexfile = QFileDialog::getOpenFileName(this,
|
|
|
|
tr("Select firmware file"), QDir::homePath(), "*.hex");
|
|
|
|
if(!QFileInfo(hexfile).isReadable()) {
|
|
|
|
logger->addItem(tr("Error opening firmware file"), LOGERROR);
|
2007-08-26 20:32:20 +00:00
|
|
|
m_error = true;
|
2007-08-15 14:16:20 +00:00
|
|
|
return;
|
|
|
|
}
|
2008-09-28 17:02:36 +00:00
|
|
|
((BootloaderInstallHex*)bl)->setHexfile(hexfile);
|
|
|
|
}
|
|
|
|
|
|
|
|
// the bootloader install class does NOT use any GUI stuff.
|
|
|
|
// All messages are passed via signals.
|
|
|
|
connect(bl, SIGNAL(done(bool)), logger, SLOT(abort()));
|
|
|
|
connect(bl, SIGNAL(done(bool)), this, SLOT(installBootloaderPost(bool)));
|
|
|
|
connect(bl, SIGNAL(logItem(QString, int)), logger, SLOT(addItem(QString, int)));
|
|
|
|
connect(bl, SIGNAL(logProgress(int, int)), logger, SLOT(setProgress(int, int)));
|
|
|
|
|
|
|
|
// show logger and start install.
|
|
|
|
logger->show();
|
|
|
|
if(!backupDestination.isEmpty()) {
|
|
|
|
if(!bl->backup(backupDestination)) {
|
|
|
|
if(QMessageBox::warning(this, tr("Backup error"),
|
|
|
|
tr("Could not create backup file. Continue?"),
|
|
|
|
QMessageBox::No | QMessageBox::Yes)
|
|
|
|
== QMessageBox::No) {
|
|
|
|
logger->abort();
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
bl->install();
|
|
|
|
}
|
|
|
|
|
|
|
|
void RbUtilQt::installBootloaderPost(bool error)
|
|
|
|
{
|
|
|
|
qDebug() << __func__ << error;
|
|
|
|
// if an error occured don't perform post install steps.
|
|
|
|
if(error) {
|
|
|
|
m_error = true;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
m_error = false;
|
|
|
|
|
|
|
|
m_installed = true;
|
|
|
|
// end here if automated install
|
|
|
|
if(m_auto)
|
|
|
|
return;
|
|
|
|
|
|
|
|
QString msg = BootloaderInstallBase::postinstallHints(settings->curPlatform());
|
|
|
|
if(!msg.isEmpty()) {
|
|
|
|
QMessageBox::information(this, tr("Manual steps required"), msg);
|
|
|
|
logger->close();
|
2007-08-15 14:16:20 +00:00
|
|
|
}
|
2008-09-28 17:02:36 +00:00
|
|
|
|
2007-07-29 17:35:31 +00:00
|
|
|
}
|
|
|
|
|
2007-08-26 20:32:20 +00:00
|
|
|
void RbUtilQt::installFontsBtn()
|
2007-07-29 17:35:31 +00:00
|
|
|
{
|
2007-09-16 18:32:49 +00:00
|
|
|
if(chkConfig(true)) return;
|
2007-08-03 16:20:48 +00:00
|
|
|
if(QMessageBox::question(this, tr("Confirm Installation"),
|
2007-08-26 20:32:20 +00:00
|
|
|
tr("Do you really want to install the fonts package?"),
|
|
|
|
QMessageBox::Yes | QMessageBox::No) != QMessageBox::Yes) return;
|
2007-08-03 16:20:48 +00:00
|
|
|
// create logger
|
|
|
|
logger = new ProgressLoggerGui(this);
|
|
|
|
logger->show();
|
2007-08-26 20:53:34 +00:00
|
|
|
installFonts();
|
2007-08-26 20:32:20 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
bool RbUtilQt::installFontsAuto()
|
|
|
|
{
|
|
|
|
installFonts();
|
2008-04-06 19:39:41 +00:00
|
|
|
|
2007-08-26 20:32:20 +00:00
|
|
|
return !m_error;
|
|
|
|
}
|
|
|
|
|
|
|
|
void RbUtilQt::installFonts()
|
|
|
|
{
|
2007-08-03 16:20:48 +00:00
|
|
|
// create zip installer
|
|
|
|
installer = new ZipInstaller(this);
|
2007-09-15 22:57:07 +00:00
|
|
|
|
2008-01-25 00:12:25 +00:00
|
|
|
installer->setUrl(settings->fontUrl());
|
2007-08-03 16:20:48 +00:00
|
|
|
installer->setLogSection("Fonts");
|
2007-08-26 16:03:56 +00:00
|
|
|
installer->setLogVersion(versmap.value("arch_date"));
|
2008-01-25 00:12:25 +00:00
|
|
|
installer->setMountPoint(settings->mountpoint());
|
|
|
|
if(!settings->cacheDisabled())
|
2008-03-05 21:12:24 +00:00
|
|
|
installer->setCache(true);
|
2008-04-06 19:39:41 +00:00
|
|
|
|
|
|
|
connect(installer, SIGNAL(done(bool)), this, SLOT(installdone(bool)));
|
2007-09-15 22:57:07 +00:00
|
|
|
installer->install(logger);
|
2007-07-29 17:35:31 +00:00
|
|
|
}
|
|
|
|
|
2007-08-02 21:29:31 +00:00
|
|
|
|
2007-08-09 16:06:27 +00:00
|
|
|
void RbUtilQt::installVoice()
|
|
|
|
{
|
2007-09-16 18:32:49 +00:00
|
|
|
if(chkConfig(true)) return;
|
2008-04-01 18:02:56 +00:00
|
|
|
|
|
|
|
if(m_gotInfo == false)
|
|
|
|
{
|
|
|
|
QMessageBox::warning(this, tr("Warning"),
|
|
|
|
tr("The Application is still downloading Information about new Builds. Please try again shortly."));
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2007-08-09 16:06:27 +00:00
|
|
|
if(QMessageBox::question(this, tr("Confirm Installation"),
|
|
|
|
tr("Do you really want to install the voice file?"),
|
|
|
|
QMessageBox::Yes | QMessageBox::No) != QMessageBox::Yes) return;
|
|
|
|
// create logger
|
|
|
|
logger = new ProgressLoggerGui(this);
|
|
|
|
logger->show();
|
|
|
|
|
|
|
|
// create zip installer
|
|
|
|
installer = new ZipInstaller(this);
|
2008-04-01 18:02:56 +00:00
|
|
|
|
|
|
|
QString voiceurl = settings->voiceUrl();
|
2007-12-14 22:29:18 +00:00
|
|
|
|
2008-01-25 00:12:25 +00:00
|
|
|
voiceurl += settings->curVoiceName() + "-" +
|
2008-04-01 18:02:56 +00:00
|
|
|
versmap.value("arch_date") + "-english.zip";
|
2007-08-09 16:06:27 +00:00
|
|
|
qDebug() << voiceurl;
|
|
|
|
|
|
|
|
installer->setUrl(voiceurl);
|
|
|
|
installer->setLogSection("Voice");
|
2007-08-26 16:03:56 +00:00
|
|
|
installer->setLogVersion(versmap.value("arch_date"));
|
2008-01-25 00:12:25 +00:00
|
|
|
installer->setMountPoint(settings->mountpoint());
|
|
|
|
if(!settings->cacheDisabled())
|
2008-03-05 21:12:24 +00:00
|
|
|
installer->setCache(true);
|
2007-08-09 16:06:27 +00:00
|
|
|
installer->install(logger);
|
2007-09-15 22:57:07 +00:00
|
|
|
|
2007-08-09 16:06:27 +00:00
|
|
|
}
|
|
|
|
|
2007-08-26 20:32:20 +00:00
|
|
|
void RbUtilQt::installDoomBtn()
|
2007-07-29 17:35:31 +00:00
|
|
|
{
|
2007-09-16 18:32:49 +00:00
|
|
|
if(chkConfig(true)) return;
|
2007-09-15 22:32:14 +00:00
|
|
|
if(!hasDoom()){
|
2007-09-14 20:48:40 +00:00
|
|
|
QMessageBox::critical(this, tr("Error"), tr("Your device doesn't have a doom plugin. Aborting."));
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2007-08-03 16:20:48 +00:00
|
|
|
if(QMessageBox::question(this, tr("Confirm Installation"),
|
2007-08-26 20:32:20 +00:00
|
|
|
tr("Do you really want to install the game addon files?"),
|
|
|
|
QMessageBox::Yes | QMessageBox::No) != QMessageBox::Yes) return;
|
2007-08-03 16:20:48 +00:00
|
|
|
// create logger
|
|
|
|
logger = new ProgressLoggerGui(this);
|
|
|
|
logger->show();
|
2007-09-14 20:48:40 +00:00
|
|
|
|
2007-08-26 20:32:20 +00:00
|
|
|
installDoom();
|
|
|
|
}
|
|
|
|
bool RbUtilQt::installDoomAuto()
|
|
|
|
{
|
|
|
|
installDoom();
|
|
|
|
return !m_error;
|
|
|
|
}
|
|
|
|
|
2007-09-15 22:32:14 +00:00
|
|
|
bool RbUtilQt::hasDoom()
|
|
|
|
{
|
2008-01-25 00:12:25 +00:00
|
|
|
QFile doomrock(settings->mountpoint() +"/.rockbox/rocks/games/doom.rock");
|
2007-09-15 22:32:14 +00:00
|
|
|
return doomrock.exists();
|
|
|
|
}
|
|
|
|
|
2007-08-26 20:32:20 +00:00
|
|
|
void RbUtilQt::installDoom()
|
|
|
|
{
|
2007-08-03 16:20:48 +00:00
|
|
|
// create zip installer
|
|
|
|
installer = new ZipInstaller(this);
|
2007-09-15 22:57:07 +00:00
|
|
|
|
2008-01-25 00:12:25 +00:00
|
|
|
installer->setUrl(settings->doomUrl());
|
2007-08-26 16:03:56 +00:00
|
|
|
installer->setLogSection("Game Addons");
|
|
|
|
installer->setLogVersion(versmap.value("arch_date"));
|
2008-01-25 00:12:25 +00:00
|
|
|
installer->setMountPoint(settings->mountpoint());
|
|
|
|
if(!settings->cacheDisabled())
|
2008-03-05 21:12:24 +00:00
|
|
|
installer->setCache(true);
|
2008-04-06 19:39:41 +00:00
|
|
|
connect(installer, SIGNAL(done(bool)), this, SLOT(installdone(bool)));
|
2007-08-03 16:20:48 +00:00
|
|
|
installer->install(logger);
|
2007-07-29 18:41:15 +00:00
|
|
|
|
2007-07-29 17:35:31 +00:00
|
|
|
}
|
2007-08-02 21:29:31 +00:00
|
|
|
|
2007-08-15 21:54:15 +00:00
|
|
|
void RbUtilQt::installThemes()
|
|
|
|
{
|
2007-09-16 18:32:49 +00:00
|
|
|
if(chkConfig(true)) return;
|
2007-08-15 21:54:15 +00:00
|
|
|
ThemesInstallWindow* tw = new ThemesInstallWindow(this);
|
2008-01-25 00:12:25 +00:00
|
|
|
tw->setSettings(settings);
|
2007-08-15 21:54:15 +00:00
|
|
|
tw->setModal(true);
|
|
|
|
tw->show();
|
|
|
|
}
|
|
|
|
|
2007-08-05 16:17:35 +00:00
|
|
|
void RbUtilQt::createTalkFiles(void)
|
|
|
|
{
|
2007-09-16 18:32:49 +00:00
|
|
|
if(chkConfig(true)) return;
|
2007-08-08 20:16:33 +00:00
|
|
|
InstallTalkWindow *installWindow = new InstallTalkWindow(this);
|
2008-01-25 00:12:25 +00:00
|
|
|
installWindow->setSettings(settings);
|
2008-04-06 19:50:38 +00:00
|
|
|
|
2007-12-14 19:49:11 +00:00
|
|
|
connect(installWindow, SIGNAL(settingsUpdated()), this, SLOT(downloadInfo()));
|
|
|
|
connect(installWindow, SIGNAL(settingsUpdated()), this, SLOT(updateSettings()));
|
2008-04-06 19:50:38 +00:00
|
|
|
installWindow->show();
|
2007-08-05 16:17:35 +00:00
|
|
|
|
|
|
|
}
|
2007-08-10 22:17:43 +00:00
|
|
|
|
2008-01-11 23:59:12 +00:00
|
|
|
void RbUtilQt::createVoiceFile(void)
|
|
|
|
{
|
|
|
|
if(chkConfig(true)) return;
|
|
|
|
CreateVoiceWindow *installWindow = new CreateVoiceWindow(this);
|
2008-01-25 00:12:25 +00:00
|
|
|
installWindow->setSettings(settings);
|
2008-04-06 19:50:38 +00:00
|
|
|
|
2008-01-11 23:59:12 +00:00
|
|
|
connect(installWindow, SIGNAL(settingsUpdated()), this, SLOT(downloadInfo()));
|
|
|
|
connect(installWindow, SIGNAL(settingsUpdated()), this, SLOT(updateSettings()));
|
2008-04-06 19:50:38 +00:00
|
|
|
installWindow->show();
|
2008-01-11 23:59:12 +00:00
|
|
|
}
|
|
|
|
|
2007-08-10 22:17:43 +00:00
|
|
|
void RbUtilQt::uninstall(void)
|
|
|
|
{
|
2007-09-16 18:32:49 +00:00
|
|
|
if(chkConfig(true)) return;
|
2007-08-10 22:17:43 +00:00
|
|
|
UninstallWindow *uninstallWindow = new UninstallWindow(this);
|
2008-01-25 00:12:25 +00:00
|
|
|
uninstallWindow->setSettings(settings);
|
2007-08-10 22:17:43 +00:00
|
|
|
uninstallWindow->show();
|
2007-12-14 19:49:11 +00:00
|
|
|
|
2007-08-10 22:17:43 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void RbUtilQt::uninstallBootloader(void)
|
|
|
|
{
|
2007-09-16 18:32:49 +00:00
|
|
|
if(chkConfig(true)) return;
|
2007-08-10 22:17:43 +00:00
|
|
|
if(QMessageBox::question(this, tr("Confirm Uninstallation"),
|
|
|
|
tr("Do you really want to uninstall the Bootloader?"),
|
|
|
|
QMessageBox::Yes | QMessageBox::No) != QMessageBox::Yes) return;
|
|
|
|
// create logger
|
|
|
|
ProgressLoggerGui* logger = new ProgressLoggerGui(this);
|
2008-09-28 17:02:36 +00:00
|
|
|
logger->setProgressVisible(false);
|
2007-08-10 22:17:43 +00:00
|
|
|
logger->show();
|
2007-09-15 22:57:07 +00:00
|
|
|
|
2008-09-28 17:02:36 +00:00
|
|
|
QString platform = settings->curPlatform();
|
|
|
|
|
|
|
|
// create installer
|
|
|
|
BootloaderInstallBase *bl;
|
|
|
|
QString type = settings->curBootloaderMethod();
|
|
|
|
if(type == "mi4") {
|
|
|
|
bl = new BootloaderInstallMi4();
|
|
|
|
}
|
|
|
|
else if(type == "hex") {
|
|
|
|
bl = new BootloaderInstallHex();
|
|
|
|
}
|
|
|
|
else if(type == "sansa") {
|
|
|
|
bl = new BootloaderInstallSansa();
|
|
|
|
}
|
|
|
|
else if(type == "ipod") {
|
|
|
|
bl = new BootloaderInstallIpod();
|
|
|
|
}
|
|
|
|
else if(type == "file") {
|
|
|
|
bl = new BootloaderInstallFile();
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
logger->addItem(tr("No uninstall method known."), LOGERROR);
|
2007-08-26 16:44:23 +00:00
|
|
|
logger->abort();
|
|
|
|
return;
|
|
|
|
}
|
2007-09-15 22:57:07 +00:00
|
|
|
|
2008-09-28 17:02:36 +00:00
|
|
|
QString blfile = settings->mountpoint() + settings->curBootloaderFile();
|
|
|
|
if(settings->curPlatformName() == "h10_ums"
|
|
|
|
|| settings->curPlatformName() == "h10_mtp") {
|
|
|
|
if(resolvePathCase(blfile).isEmpty())
|
|
|
|
blfile = settings->mountpoint()
|
|
|
|
+ settings->curBootloaderName().replace("H10",
|
|
|
|
"H10EMP", Qt::CaseInsensitive);
|
|
|
|
}
|
|
|
|
bl->setBlFile(blfile);
|
|
|
|
|
|
|
|
connect(bl, SIGNAL(logItem(QString, int)), logger, SLOT(addItem(QString, int)));
|
|
|
|
connect(bl, SIGNAL(logProgress(int, int)), logger, SLOT(setProgress(int, int)));
|
|
|
|
|
|
|
|
int result;
|
|
|
|
result = bl->uninstall();
|
|
|
|
|
|
|
|
logger->abort();
|
2007-09-15 22:57:07 +00:00
|
|
|
|
2007-08-10 22:17:43 +00:00
|
|
|
}
|
2007-08-22 10:55:05 +00:00
|
|
|
|
|
|
|
|
|
|
|
void RbUtilQt::downloadManual(void)
|
|
|
|
{
|
2007-09-16 18:32:49 +00:00
|
|
|
if(chkConfig(true)) return;
|
2007-08-22 10:55:05 +00:00
|
|
|
if(QMessageBox::question(this, tr("Confirm download"),
|
|
|
|
tr("Do you really want to download the manual? The manual will be saved "
|
|
|
|
"to the root folder of your player."),
|
|
|
|
QMessageBox::Yes | QMessageBox::No) != QMessageBox::Yes)
|
|
|
|
return;
|
2007-09-15 22:57:07 +00:00
|
|
|
|
2007-08-22 10:55:05 +00:00
|
|
|
buildInfo.open();
|
|
|
|
QSettings info(buildInfo.fileName(), QSettings::IniFormat, this);
|
|
|
|
buildInfo.close();
|
2007-09-15 22:57:07 +00:00
|
|
|
|
2008-01-25 00:12:25 +00:00
|
|
|
QString manual = settings->curManual();
|
|
|
|
|
2007-08-22 10:55:05 +00:00
|
|
|
QString date = (info.value("dailies/date").toString());
|
2007-09-15 22:57:07 +00:00
|
|
|
|
2007-08-22 10:55:05 +00:00
|
|
|
QString manualurl;
|
|
|
|
QString target;
|
|
|
|
QString section;
|
|
|
|
if(ui.radioPdf->isChecked()) {
|
|
|
|
target = "/" + manual + ".pdf";
|
|
|
|
section = "Manual (PDF)";
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
target = "/" + manual + "-" + date + "-html.zip";
|
|
|
|
section = "Manual (HTML)";
|
|
|
|
}
|
2008-01-25 00:12:25 +00:00
|
|
|
manualurl = settings->manualUrl() + "/" + target;
|
2007-08-22 10:55:05 +00:00
|
|
|
qDebug() << "manualurl =" << manualurl;
|
|
|
|
|
|
|
|
ProgressLoggerGui* logger = new ProgressLoggerGui(this);
|
|
|
|
logger->show();
|
|
|
|
installer = new ZipInstaller(this);
|
2008-01-25 00:12:25 +00:00
|
|
|
installer->setMountPoint(settings->mountpoint());
|
|
|
|
if(!settings->cacheDisabled())
|
2008-03-05 21:12:24 +00:00
|
|
|
installer->setCache(true);
|
2007-08-22 10:55:05 +00:00
|
|
|
installer->setLogSection(section);
|
2007-10-12 06:42:00 +00:00
|
|
|
installer->setLogVersion(date);
|
2007-08-22 10:55:05 +00:00
|
|
|
installer->setUrl(manualurl);
|
|
|
|
installer->setUnzip(false);
|
|
|
|
installer->setTarget(target);
|
|
|
|
installer->install(logger);
|
|
|
|
}
|
2007-08-22 22:25:04 +00:00
|
|
|
|
|
|
|
|
|
|
|
void RbUtilQt::installPortable(void)
|
|
|
|
{
|
|
|
|
if(QMessageBox::question(this, tr("Confirm installation"),
|
|
|
|
tr("Do you really want to install Rockbox Utility to your player? "
|
|
|
|
"After installation you can run it from the players hard drive."),
|
|
|
|
QMessageBox::Yes | QMessageBox::No) != QMessageBox::Yes)
|
|
|
|
return;
|
|
|
|
|
|
|
|
ProgressLoggerGui* logger = new ProgressLoggerGui(this);
|
2007-10-16 21:30:13 +00:00
|
|
|
logger->setProgressMax(0);
|
|
|
|
logger->setProgressValue(0);
|
2007-08-22 22:25:04 +00:00
|
|
|
logger->show();
|
|
|
|
logger->addItem(tr("Installing Rockbox Utility"), LOGINFO);
|
|
|
|
|
|
|
|
// check mountpoint
|
2008-01-25 00:12:25 +00:00
|
|
|
if(!QFileInfo(settings->mountpoint()).isDir()) {
|
2007-08-22 22:25:04 +00:00
|
|
|
logger->addItem(tr("Mount point is wrong!"),LOGERROR);
|
|
|
|
logger->abort();
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
// remove old files first.
|
2008-01-25 00:12:25 +00:00
|
|
|
QFile::remove(settings->mountpoint() + "/RockboxUtility.exe");
|
|
|
|
QFile::remove(settings->mountpoint() + "/RockboxUtility.ini");
|
2007-08-22 22:25:04 +00:00
|
|
|
// copy currently running binary and currently used settings file
|
2008-01-25 00:12:25 +00:00
|
|
|
if(!QFile::copy(qApp->applicationFilePath(), settings->mountpoint() + "/RockboxUtility.exe")) {
|
2007-08-22 22:25:04 +00:00
|
|
|
logger->addItem(tr("Error installing Rockbox Utility"), LOGERROR);
|
|
|
|
logger->abort();
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
logger->addItem(tr("Installing user configuration"), LOGINFO);
|
2008-01-25 00:12:25 +00:00
|
|
|
if(!QFile::copy(settings->userSettingFilename(), settings->mountpoint() + "/RockboxUtility.ini")) {
|
2007-08-22 22:25:04 +00:00
|
|
|
logger->addItem(tr("Error installing user configuration"), LOGERROR);
|
|
|
|
logger->abort();
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
logger->addItem(tr("Successfully installed Rockbox Utility."), LOGOK);
|
|
|
|
logger->abort();
|
2007-10-16 21:30:13 +00:00
|
|
|
logger->setProgressMax(1);
|
|
|
|
logger->setProgressValue(1);
|
2007-09-15 22:57:07 +00:00
|
|
|
|
2007-08-22 22:25:04 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2007-08-26 16:03:56 +00:00
|
|
|
void RbUtilQt::updateInfo()
|
|
|
|
{
|
|
|
|
qDebug() << "RbUtilQt::updateInfo()";
|
|
|
|
|
2008-01-25 00:12:25 +00:00
|
|
|
QSettings log(settings->mountpoint() + "/.rockbox/rbutil.log", QSettings::IniFormat, this);
|
2007-08-26 16:03:56 +00:00
|
|
|
QStringList groups = log.childGroups();
|
|
|
|
QList<QTreeWidgetItem *> items;
|
|
|
|
QTreeWidgetItem *w, *w2;
|
|
|
|
QString min, max;
|
|
|
|
int olditems = 0;
|
|
|
|
|
|
|
|
// remove old list entries (if any)
|
|
|
|
int l = ui.treeInfo->topLevelItemCount();
|
|
|
|
while(l--) {
|
|
|
|
QTreeWidgetItem *m;
|
|
|
|
m = ui.treeInfo->takeTopLevelItem(l);
|
|
|
|
// delete childs (single level deep, no recursion here)
|
|
|
|
int n = m->childCount();
|
|
|
|
while(n--)
|
|
|
|
delete m->child(n);
|
|
|
|
}
|
|
|
|
// get and populate new items
|
|
|
|
for(int a = 0; a < groups.size(); a++) {
|
|
|
|
log.beginGroup(groups.at(a));
|
|
|
|
QStringList keys = log.allKeys();
|
|
|
|
w = new QTreeWidgetItem;
|
|
|
|
w->setFlags(Qt::ItemIsEnabled);
|
|
|
|
w->setText(0, groups.at(a));
|
|
|
|
items.append(w);
|
|
|
|
// get minimum and maximum version information so we can hilight old files
|
|
|
|
min = max = log.value(keys.at(0)).toString();
|
|
|
|
for(int b = 0; b < keys.size(); b++) {
|
|
|
|
if(log.value(keys.at(b)).toString() > max)
|
|
|
|
max = log.value(keys.at(b)).toString();
|
|
|
|
if(log.value(keys.at(b)).toString() < min)
|
|
|
|
min = log.value(keys.at(b)).toString();
|
|
|
|
}
|
2007-09-15 22:57:07 +00:00
|
|
|
|
2007-08-26 16:03:56 +00:00
|
|
|
for(int b = 0; b < keys.size(); b++) {
|
|
|
|
QString file;
|
2008-01-25 00:12:25 +00:00
|
|
|
file = settings->mountpoint() + "/" + keys.at(b);
|
2007-08-26 16:03:56 +00:00
|
|
|
if(QFileInfo(file).isDir())
|
|
|
|
continue;
|
|
|
|
w2 = new QTreeWidgetItem(w, QStringList() << "/"
|
|
|
|
+ keys.at(b) << log.value(keys.at(b)).toString());
|
|
|
|
if(log.value(keys.at(b)).toString() != max) {
|
|
|
|
w2->setForeground(0, QBrush(QColor(255, 0, 0)));
|
|
|
|
w2->setForeground(1, QBrush(QColor(255, 0, 0)));
|
|
|
|
olditems++;
|
|
|
|
}
|
|
|
|
items.append(w2);
|
|
|
|
}
|
|
|
|
log.endGroup();
|
|
|
|
if(min != max)
|
|
|
|
w->setData(1, Qt::DisplayRole, QString("%1 / %2").arg(min, max));
|
|
|
|
else
|
|
|
|
w->setData(1, Qt::DisplayRole, max);
|
|
|
|
}
|
|
|
|
ui.treeInfo->insertTopLevelItems(0, items);
|
|
|
|
ui.treeInfo->resizeColumnToContents(0);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2007-08-26 11:31:55 +00:00
|
|
|
QUrl RbUtilQt::proxy()
|
|
|
|
{
|
2008-01-25 00:12:25 +00:00
|
|
|
if(settings->proxyType() == "manual")
|
|
|
|
return QUrl(settings->proxy());
|
|
|
|
else if(settings->proxy() == "system")
|
2008-01-23 21:54:40 +00:00
|
|
|
{
|
2008-06-27 21:53:22 +00:00
|
|
|
return Detect::systemProxy();
|
2008-01-23 21:54:40 +00:00
|
|
|
}
|
2007-08-26 11:31:55 +00:00
|
|
|
return QUrl("");
|
|
|
|
}
|
|
|
|
|
2007-09-16 18:32:49 +00:00
|
|
|
|
|
|
|
bool RbUtilQt::chkConfig(bool warn)
|
|
|
|
{
|
|
|
|
bool error = false;
|
2008-01-25 00:12:25 +00:00
|
|
|
if(settings->curPlatform().isEmpty()
|
|
|
|
|| settings->mountpoint().isEmpty()
|
|
|
|
|| !QFileInfo(settings->mountpoint()).isWritable()) {
|
2007-09-16 18:32:49 +00:00
|
|
|
error = true;
|
|
|
|
|
|
|
|
if(warn) QMessageBox::critical(this, tr("Configuration error"),
|
2007-09-17 08:50:46 +00:00
|
|
|
tr("Your configuration is invalid. Please go to the configuration "
|
2007-09-16 18:32:49 +00:00
|
|
|
"dialog and make sure the selected values are correct."));
|
|
|
|
}
|
|
|
|
return error;
|
|
|
|
}
|
|
|
|
|