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"
|
2009-03-31 19:50:43 +00:00
|
|
|
#include "themesinstallwindow.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"
|
2009-05-09 16:59:14 +00:00
|
|
|
#include "rbsettings.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)
|
|
|
|
{
|
2009-06-05 21:49:53 +00:00
|
|
|
// startup log
|
|
|
|
qDebug() << "======================================";
|
|
|
|
qDebug() << "[System] Rockbox Utility " VERSION;
|
|
|
|
qDebug() << "[System] Qt version:" << qVersion();
|
|
|
|
qDebug() << "======================================";
|
|
|
|
|
2007-08-09 18:40:32 +00:00
|
|
|
absolutePath = qApp->applicationDirPath();
|
2008-09-28 17:02:36 +00:00
|
|
|
|
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);
|
2009-01-25 17:22:06 +00:00
|
|
|
// disable quick install until version info is available
|
|
|
|
ui.buttonSmall->setEnabled(false);
|
|
|
|
ui.buttonComplete->setEnabled(false);
|
2007-08-26 16:03:56 +00:00
|
|
|
|
|
|
|
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()
|
|
|
|
{
|
2009-01-24 10:02:23 +00:00
|
|
|
// make sure the version map is repopulated correctly later.
|
|
|
|
versmap.clear();
|
2007-07-29 17:35:31 +00:00
|
|
|
// 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()));
|
2009-05-09 16:59:14 +00:00
|
|
|
if(RbSettings::value(RbSettings::CacheOffline).toBool())
|
2008-03-05 21:12:24 +00:00
|
|
|
daily->setCache(true);
|
|
|
|
else
|
|
|
|
daily->setCache(false);
|
2009-06-16 18:45:20 +00:00
|
|
|
qDebug() << "[RbUtil] downloading build info";
|
2007-07-29 17:35:31 +00:00
|
|
|
daily->setFile(&buildInfo);
|
2009-05-09 16:59:14 +00:00
|
|
|
daily->getFile(QUrl(RbSettings::value(RbSettings::ServerConfUrl).toString()));
|
2007-07-29 17:35:31 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void RbUtilQt::downloadDone(bool error)
|
|
|
|
{
|
2007-08-26 16:03:56 +00:00
|
|
|
if(error) {
|
2009-06-16 18:45:20 +00:00
|
|
|
qDebug() << "[RbUtil] 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;
|
|
|
|
}
|
2009-06-16 18:45:20 +00:00
|
|
|
qDebug() << "[RbUtil] 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());
|
|
|
|
|
2009-01-25 17:22:06 +00:00
|
|
|
info.beginGroup("release");
|
2009-05-09 16:59:14 +00:00
|
|
|
versmap.insert("rel_rev", info.value(RbSettings::value(RbSettings::CurBuildserverModel).toString()).toString());
|
2009-01-25 17:22:06 +00:00
|
|
|
info.endGroup();
|
|
|
|
|
|
|
|
if(versmap.value("rel_rev").isEmpty()) {
|
|
|
|
ui.buttonSmall->setEnabled(false);
|
|
|
|
ui.buttonComplete->setEnabled(false);
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
ui.buttonSmall->setEnabled(true);
|
|
|
|
ui.buttonComplete->setEnabled(true);
|
|
|
|
}
|
|
|
|
|
2007-08-26 16:03:56 +00:00
|
|
|
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()));
|
2009-05-09 16:59:14 +00:00
|
|
|
if(RbSettings::value(RbSettings::CacheOffline).toBool())
|
2008-03-05 21:12:24 +00:00
|
|
|
bleeding->setCache(true);
|
2007-08-26 16:03:56 +00:00
|
|
|
bleeding->setFile(&bleedingInfo);
|
2009-05-09 16:59:14 +00:00
|
|
|
bleeding->getFile(QUrl(RbSettings::value(RbSettings::BleedingInfo).toString()));
|
2007-09-16 18:32:49 +00:00
|
|
|
|
2009-05-09 16:59:14 +00:00
|
|
|
if(RbSettings::value(RbSettings::RbutilVersion) != PUREVERSION) {
|
2008-07-07 21:40:44 +00:00
|
|
|
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)
|
|
|
|
{
|
2009-04-27 21:33:51 +00:00
|
|
|
if(error) {
|
2009-06-16 18:45:20 +00:00
|
|
|
qDebug() << "[RbUtil] network error:" << bleeding->error();
|
2009-04-27 21:33:51 +00:00
|
|
|
}
|
|
|
|
else {
|
|
|
|
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());
|
2009-06-16 18:45:20 +00:00
|
|
|
qDebug() << "[RbUtil] version map:" << versmap;
|
2009-04-27 21:33:51 +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
|
|
|
}
|
2009-06-16 18:45:20 +00:00
|
|
|
qDebug() << "[RbUtil] 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);
|
2009-03-08 18:53:32 +00:00
|
|
|
r.setCodec(QTextCodec::codecForName("UTF-8"));
|
2007-07-29 17:35:31 +00:00
|
|
|
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);
|
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
|
|
|
{
|
2009-06-16 18:45:20 +00:00
|
|
|
qDebug() << "[RbUtil] updating current settings";
|
2007-08-02 21:29:31 +00:00
|
|
|
updateDevice();
|
|
|
|
updateManual();
|
2009-05-09 16:59:14 +00:00
|
|
|
if(RbSettings::value(RbSettings::ProxyType) == "system") {
|
2008-06-27 21:53:22 +00:00
|
|
|
HttpGet::setGlobalProxy(Detect::systemProxy());
|
2008-03-05 21:12:24 +00:00
|
|
|
}
|
2009-05-09 16:59:14 +00:00
|
|
|
else if(RbSettings::value(RbSettings::ProxyType) == "manual") {
|
|
|
|
HttpGet::setGlobalProxy(RbSettings::value(RbSettings::Proxy).toString());
|
2008-03-05 21:12:24 +00:00
|
|
|
}
|
2008-03-09 23:33:53 +00:00
|
|
|
else {
|
|
|
|
HttpGet::setGlobalProxy(QUrl(""));
|
|
|
|
}
|
2009-05-09 16:59:14 +00:00
|
|
|
HttpGet::setGlobalCache(RbSettings::value(RbSettings::CachePath).toString());
|
|
|
|
HttpGet::setGlobalDumbCache(RbSettings::value(RbSettings::CacheOffline).toBool());
|
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
|
|
|
{
|
2009-05-09 16:59:14 +00:00
|
|
|
if(RbSettings::value(RbSettings::CurBootloaderMethod) == "none" ) {
|
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);
|
2009-05-09 16:59:14 +00:00
|
|
|
if(RbSettings::value(RbSettings::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);
|
|
|
|
}
|
|
|
|
}
|
2009-01-25 17:48:38 +00:00
|
|
|
|
2007-08-02 21:29:31 +00:00
|
|
|
// displayed device info
|
2009-05-09 16:59:14 +00:00
|
|
|
QString mountpoint = RbSettings::value(RbSettings::Mountpoint).toString();
|
|
|
|
QString brand = RbSettings::value(RbSettings::CurBrand).toString();
|
|
|
|
QString name = RbSettings::value(RbSettings::CurName).toString();
|
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()
|
|
|
|
{
|
2009-05-09 16:59:14 +00:00
|
|
|
if(RbSettings::value(RbSettings::Platform) != "")
|
2007-07-30 18:11:21 +00:00
|
|
|
{
|
2009-05-09 16:59:14 +00:00
|
|
|
QString manual= RbSettings::value(RbSettings::CurManual).toString();
|
2007-09-15 22:57:07 +00:00
|
|
|
|
2007-07-30 18:11:21 +00:00
|
|
|
if(manual == "")
|
2009-05-09 16:59:14 +00:00
|
|
|
manual = "rockbox-" + RbSettings::value(RbSettings::Platform).toString();
|
2007-07-30 18:11:21 +00:00
|
|
|
QString pdfmanual;
|
2009-05-09 16:59:14 +00:00
|
|
|
pdfmanual = RbSettings::value(RbSettings::ManualUrl).toString()
|
2009-04-29 20:58:47 +00:00
|
|
|
+ "/" + manual + ".pdf";
|
2007-07-30 18:11:21 +00:00
|
|
|
QString htmlmanual;
|
2009-05-09 16:59:14 +00:00
|
|
|
htmlmanual = RbSettings::value(RbSettings::ManualUrl).toString()
|
2009-04-29 20:58:47 +00:00
|
|
|
+ "/" + 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-12-19 21:43:22 +00:00
|
|
|
tr("Do you really want to perform a complete installation?\n\n"
|
|
|
|
"This will install Rockbox %1. To install the most recent "
|
|
|
|
"development build available press \"Cancel\" and "
|
|
|
|
"use the \"Installation\" tab.")
|
2009-01-25 17:22:06 +00:00
|
|
|
.arg(versmap.value("rel_rev")),
|
2008-12-19 21:43:22 +00:00
|
|
|
QMessageBox::Ok | QMessageBox::Cancel) != QMessageBox::Ok)
|
|
|
|
return;
|
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;
|
2009-05-02 18:40:04 +00:00
|
|
|
logger->setRunning();
|
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;
|
2009-05-02 18:40:04 +00:00
|
|
|
logger->setRunning();
|
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-12-19 21:43:22 +00:00
|
|
|
tr("Do you really want to perform a minimal installation? "
|
|
|
|
"A minimal installation will contain only the absolutely "
|
|
|
|
"necessary parts to run Rockbox.\n\n"
|
|
|
|
"This will install Rockbox %1. To install the most recent "
|
|
|
|
"development build available press \"Cancel\" and "
|
|
|
|
"use the \"Installation\" tab.")
|
2009-01-25 17:22:06 +00:00
|
|
|
.arg(versmap.value("rel_rev")),
|
2008-12-19 21:43:22 +00:00
|
|
|
QMessageBox::Ok | QMessageBox::Cancel) != QMessageBox::Ok)
|
|
|
|
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()
|
|
|
|
{
|
2009-05-09 16:59:14 +00:00
|
|
|
QString mountpoint = RbSettings::value(RbSettings::Mountpoint).toString();
|
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);
|
2009-05-02 18:40:04 +00:00
|
|
|
logger->setFinished();
|
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
|
2009-05-09 16:59:14 +00:00
|
|
|
if(RbSettings::value(RbSettings::CurBootloaderMethod) != "none")
|
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;
|
2009-02-28 23:11:26 +00:00
|
|
|
if(!installBootloaderAuto()) {
|
2009-05-02 18:40:04 +00:00
|
|
|
logger->setFinished();
|
2007-09-15 23:00:02 +00:00
|
|
|
return true;
|
2009-02-28 23:11:26 +00:00
|
|
|
}
|
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;
|
2009-05-02 18:40:04 +00:00
|
|
|
logger->setRunning();
|
2008-12-18 22:42:24 +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)
|
|
|
|
{
|
2009-06-16 18:45:20 +00:00
|
|
|
qDebug() << "[RbUtil] install done";
|
2007-08-26 20:32:20 +00:00
|
|
|
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()
|
|
|
|
{
|
2009-08-08 00:02:33 +00:00
|
|
|
QString file = RbSettings::value(RbSettings::ReleaseUrl).toString();
|
|
|
|
file.replace("%MODEL%", RbSettings::value(RbSettings::CurBuildserverModel).toString());
|
|
|
|
file.replace("%RELVERSION%", versmap.value("rel_rev"));
|
2007-08-26 19:06:40 +00:00
|
|
|
buildInfo.open();
|
|
|
|
QSettings info(buildInfo.fileName(), QSettings::IniFormat, this);
|
|
|
|
buildInfo.close();
|
|
|
|
|
2008-06-23 20:31:44 +00:00
|
|
|
// check installed Version and Target
|
2009-05-09 16:59:14 +00:00
|
|
|
QString rbVersion = Detect::installedVersion(RbSettings::value(RbSettings::Mountpoint).toString());
|
|
|
|
QString warning = Detect::check(false);
|
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);
|
2009-05-02 18:40:04 +00:00
|
|
|
logger->setFinished();
|
2008-10-24 22:31:07 +00:00
|
|
|
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);
|
2009-05-09 16:59:14 +00:00
|
|
|
QString backupName = RbSettings::value(RbSettings::Mountpoint).toString()
|
2008-12-18 22:42:24 +00:00
|
|
|
+ "/.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());
|
|
|
|
}
|
2008-12-18 22:42:24 +00:00
|
|
|
|
2008-05-11 18:22:42 +00:00
|
|
|
//! 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)));
|
2009-04-29 20:58:47 +00:00
|
|
|
if(backup.createZip(backupName,
|
2009-05-09 16:59:14 +00:00
|
|
|
RbSettings::value(RbSettings::Mountpoint).toString() + "/.rockbox") == Zip::Ok)
|
2008-05-11 18:22:42 +00:00
|
|
|
{
|
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);
|
2009-05-02 18:40:04 +00:00
|
|
|
logger->setFinished();
|
2008-05-11 18:22:42 +00:00
|
|
|
return false;
|
2008-12-18 22:42:24 +00:00
|
|
|
}
|
2008-05-10 17:53:15 +00:00
|
|
|
}
|
|
|
|
}
|
2008-12-18 22:42:24 +00:00
|
|
|
|
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)");
|
2009-01-25 17:22:06 +00:00
|
|
|
installer->setLogVersion(versmap.value("rel_rev"));
|
2009-05-09 16:59:14 +00:00
|
|
|
if(!RbSettings::value(RbSettings::CacheDisabled).toBool())
|
2008-03-05 21:12:24 +00:00
|
|
|
installer->setCache(true);
|
2009-05-09 16:59:14 +00:00
|
|
|
installer->setMountPoint(RbSettings::value(RbSettings::Mountpoint).toString());
|
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)));
|
2009-05-02 18:50:31 +00:00
|
|
|
connect(installer, SIGNAL(logItem(QString, int)), logger, SLOT(addItem(QString, int)));
|
|
|
|
connect(installer, SIGNAL(logProgress(int, int)), logger, SLOT(setProgress(int, int)));
|
|
|
|
connect(installer, SIGNAL(done(bool)), logger, SLOT(setFinished()));
|
|
|
|
connect(logger, SIGNAL(aborted()), installer, SLOT(abort()));
|
|
|
|
installer->install();
|
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()
|
|
|
|
{
|
2009-05-09 16:59:14 +00:00
|
|
|
Install *installWindow = new Install(this);
|
2007-07-29 17:35:31 +00:00
|
|
|
|
|
|
|
buildInfo.open();
|
|
|
|
QSettings info(buildInfo.fileName(), QSettings::IniFormat, this);
|
|
|
|
buildInfo.close();
|
2007-08-26 16:03:56 +00:00
|
|
|
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);
|
2009-05-09 18:49:49 +00:00
|
|
|
logger->show();
|
2007-08-26 20:32:20 +00:00
|
|
|
installBootloader();
|
|
|
|
}
|
|
|
|
|
|
|
|
void RbUtilQt::installBootloader()
|
2007-09-15 22:57:07 +00:00
|
|
|
{
|
2009-05-09 16:59:14 +00:00
|
|
|
QString platform = RbSettings::value(RbSettings::Platform).toString();
|
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;
|
2009-05-09 16:59:14 +00:00
|
|
|
QString type = RbSettings::value(RbSettings::CurBootloaderMethod).toString();
|
2008-09-28 17:02:36 +00:00
|
|
|
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);
|
2009-05-02 18:40:04 +00:00
|
|
|
logger->setFinished();
|
2007-08-26 16:44:23 +00:00
|
|
|
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.
|
2009-08-09 10:57:39 +00:00
|
|
|
QStringList blfile = RbSettings::value(RbSettings::CurBootloaderFile).toStringList();
|
|
|
|
QStringList blfilepath;
|
|
|
|
for(int a = 0; a < blfile.size(); a++) {
|
|
|
|
blfilepath.append(RbSettings::value(RbSettings::Mountpoint).toString()
|
|
|
|
+ blfile.at(a));
|
|
|
|
}
|
|
|
|
bl->setBlFile(blfilepath);
|
2009-05-09 16:59:14 +00:00
|
|
|
QUrl url(RbSettings::value(RbSettings::BootloaderUrl).toString()
|
|
|
|
+ RbSettings::value(RbSettings::CurBootloaderName).toString());
|
2008-09-28 17:02:36 +00:00
|
|
|
bl->setBlUrl(url);
|
2009-05-09 16:59:14 +00:00
|
|
|
bl->setLogfile(RbSettings::value(RbSettings::Mountpoint).toString()
|
2009-04-29 20:58:47 +00:00
|
|
|
+ "/.rockbox/rbutil.log");
|
2008-09-28 17:02:36 +00:00
|
|
|
|
|
|
|
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) {
|
2008-12-18 22:42:24 +00:00
|
|
|
if(m_auto) {
|
|
|
|
// keep logger open for auto installs.
|
|
|
|
// don't consider abort as error in auto-mode.
|
2009-02-28 23:11:26 +00:00
|
|
|
logger->addItem(tr("Bootloader installation skipped"), LOGINFO);
|
2008-12-18 22:42:24 +00:00
|
|
|
installBootloaderPost(false);
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
logger->close();
|
|
|
|
installBootloaderPost(true);
|
|
|
|
}
|
2008-09-28 17:02:36 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else if(bl->installed() == BootloaderInstallBase::BootloaderOther
|
|
|
|
&& bl->capabilities() & BootloaderInstallBase::Backup)
|
2007-08-26 16:44:23 +00:00
|
|
|
{
|
2009-05-09 16:59:14 +00:00
|
|
|
QString targetFolder = RbSettings::value(RbSettings::CurPlatformName).toString()
|
2009-04-29 20:58:47 +00:00
|
|
|
+ " Firmware Backup";
|
2008-09-28 17:02:36 +00:00
|
|
|
// 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;
|
2009-06-16 18:45:20 +00:00
|
|
|
qDebug() << "[RbUtil] backing up to" << backupDestination;
|
2008-09-28 17:02:36 +00:00
|
|
|
// 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
|
|
|
|
2009-05-09 18:17:05 +00:00
|
|
|
if(bl->capabilities() & BootloaderInstallBase::NeedsOf)
|
2007-08-15 14:16:20 +00:00
|
|
|
{
|
2008-09-28 17:02:36 +00:00
|
|
|
int ret;
|
|
|
|
ret = QMessageBox::information(this, tr("Prerequisites"),
|
2009-05-09 18:17:05 +00:00
|
|
|
bl->ofHint(),QMessageBox::Ok | QMessageBox::Abort);
|
2008-09-28 17:02:36 +00:00
|
|
|
if(ret != QMessageBox::Ok) {
|
2009-02-28 23:11:26 +00:00
|
|
|
// consider aborting an error to close window / abort automatic
|
|
|
|
// installation.
|
2008-09-28 17:02:36 +00:00
|
|
|
m_error = true;
|
2009-02-28 23:11:26 +00:00
|
|
|
logger->addItem(tr("Bootloader installation aborted"), LOGINFO);
|
2009-05-09 18:49:49 +00:00
|
|
|
logger->setFinished();
|
2008-09-28 17:02:36 +00:00
|
|
|
return;
|
2007-08-15 14:16:20 +00:00
|
|
|
}
|
2009-05-09 18:17:05 +00:00
|
|
|
// open dialog to browse to of file
|
|
|
|
QString offile;
|
|
|
|
offile = QFileDialog::getOpenFileName(this,
|
|
|
|
tr("Select firmware file"), QDir::homePath());
|
|
|
|
if(!QFileInfo(offile).isReadable()) {
|
2008-09-28 17:02:36 +00:00
|
|
|
logger->addItem(tr("Error opening firmware file"), LOGERROR);
|
2009-05-09 18:49:49 +00:00
|
|
|
logger->setFinished();
|
2007-08-26 20:32:20 +00:00
|
|
|
m_error = true;
|
2007-08-15 14:16:20 +00:00
|
|
|
return;
|
|
|
|
}
|
2009-05-09 18:17:05 +00:00
|
|
|
bl->setOfFile(offile);
|
2008-09-28 17:02:36 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// the bootloader install class does NOT use any GUI stuff.
|
|
|
|
// All messages are passed via signals.
|
2009-05-02 18:40:04 +00:00
|
|
|
connect(bl, SIGNAL(done(bool)), logger, SLOT(setFinished()));
|
2008-09-28 17:02:36 +00:00
|
|
|
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)));
|
|
|
|
|
2009-05-09 18:49:49 +00:00
|
|
|
// start install.
|
2008-09-28 17:02:36 +00:00
|
|
|
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) {
|
2009-05-02 18:40:04 +00:00
|
|
|
logger->setFinished();
|
2008-09-28 17:02:36 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
bl->install();
|
|
|
|
}
|
|
|
|
|
|
|
|
void RbUtilQt::installBootloaderPost(bool error)
|
|
|
|
{
|
2009-06-16 18:45:20 +00:00
|
|
|
qDebug() << "[RbUtil] Bootloader Post-Installation, error state:" << error;
|
2008-09-28 17:02:36 +00:00
|
|
|
// 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;
|
|
|
|
|
2009-04-29 20:58:47 +00:00
|
|
|
QString msg = BootloaderInstallBase::postinstallHints(
|
2009-05-09 16:59:14 +00:00
|
|
|
RbSettings::value(RbSettings::Platform).toString());
|
2008-09-28 17:02:36 +00:00
|
|
|
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
|
|
|
|
2009-05-09 16:59:14 +00:00
|
|
|
installer->setUrl(RbSettings::value(RbSettings::FontUrl).toString());
|
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"));
|
2009-05-09 16:59:14 +00:00
|
|
|
installer->setMountPoint(RbSettings::value(RbSettings::Mountpoint).toString());
|
|
|
|
if(!RbSettings::value(RbSettings::CacheDisabled).toBool())
|
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)));
|
2009-05-02 18:50:31 +00:00
|
|
|
connect(installer, SIGNAL(logItem(QString, int)), logger, SLOT(addItem(QString, int)));
|
|
|
|
connect(installer, SIGNAL(logProgress(int, int)), logger, SLOT(setProgress(int, int)));
|
|
|
|
connect(installer, SIGNAL(done(bool)), logger, SLOT(setFinished()));
|
|
|
|
connect(logger, SIGNAL(aborted()), installer, SLOT(abort()));
|
|
|
|
installer->install();
|
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-12-18 22:42:24 +00:00
|
|
|
|
2008-04-01 18:02:56 +00:00
|
|
|
if(m_gotInfo == false)
|
|
|
|
{
|
|
|
|
QMessageBox::warning(this, tr("Warning"),
|
2008-12-18 22:42:24 +00:00
|
|
|
tr("The Application is still downloading Information about new Builds."
|
|
|
|
" Please try again shortly."));
|
|
|
|
return;
|
2008-04-01 18:02:56 +00:00
|
|
|
}
|
2008-12-18 22:42:24 +00:00
|
|
|
|
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-12-18 22:42:24 +00:00
|
|
|
|
2009-05-09 16:59:14 +00:00
|
|
|
QString voiceurl = RbSettings::value(RbSettings::VoiceUrl).toString();
|
2008-12-18 22:42:24 +00:00
|
|
|
|
2009-06-15 19:18:13 +00:00
|
|
|
voiceurl += RbSettings::value(RbSettings::CurBuildserverModel).toString() + "-" +
|
2008-12-18 22:42:24 +00:00
|
|
|
versmap.value("arch_date") + "-english.zip";
|
2009-06-16 18:45:20 +00:00
|
|
|
qDebug() << "[RbUtil] voicefile URL:" << voiceurl;
|
2007-08-09 16:06:27 +00:00
|
|
|
|
|
|
|
installer->setUrl(voiceurl);
|
|
|
|
installer->setLogSection("Voice");
|
2007-08-26 16:03:56 +00:00
|
|
|
installer->setLogVersion(versmap.value("arch_date"));
|
2009-05-09 16:59:14 +00:00
|
|
|
installer->setMountPoint(RbSettings::value(RbSettings::Mountpoint).toString());
|
|
|
|
if(!RbSettings::value(RbSettings::CacheDisabled).toBool())
|
2008-03-05 21:12:24 +00:00
|
|
|
installer->setCache(true);
|
2009-05-02 18:50:31 +00:00
|
|
|
connect(installer, SIGNAL(logItem(QString, int)), logger, SLOT(addItem(QString, int)));
|
|
|
|
connect(installer, SIGNAL(logProgress(int, int)), logger, SLOT(setProgress(int, int)));
|
|
|
|
connect(installer, SIGNAL(done(bool)), logger, SLOT(setFinished()));
|
|
|
|
connect(logger, SIGNAL(aborted()), installer, SLOT(abort()));
|
|
|
|
installer->install();
|
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()){
|
2008-12-18 22:42:24 +00:00
|
|
|
QMessageBox::critical(this, tr("Error"),
|
|
|
|
tr("Your device doesn't have a doom plugin. Aborting."));
|
2007-09-14 20:48:40 +00:00
|
|
|
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()
|
|
|
|
{
|
2009-05-09 16:59:14 +00:00
|
|
|
QFile doomrock(RbSettings::value(RbSettings::Mountpoint).toString()
|
2009-04-29 20:58:47 +00:00
|
|
|
+"/.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
|
|
|
|
2009-05-09 16:59:14 +00:00
|
|
|
installer->setUrl(RbSettings::value(RbSettings::DoomUrl).toString());
|
2007-08-26 16:03:56 +00:00
|
|
|
installer->setLogSection("Game Addons");
|
|
|
|
installer->setLogVersion(versmap.value("arch_date"));
|
2009-05-09 16:59:14 +00:00
|
|
|
installer->setMountPoint(RbSettings::value(RbSettings::Mountpoint).toString());
|
|
|
|
if(!RbSettings::value(RbSettings::CacheDisabled).toBool())
|
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)));
|
2009-05-02 18:50:31 +00:00
|
|
|
connect(installer, SIGNAL(logItem(QString, int)), logger, SLOT(addItem(QString, int)));
|
|
|
|
connect(installer, SIGNAL(logProgress(int, int)), logger, SLOT(setProgress(int, int)));
|
|
|
|
connect(installer, SIGNAL(done(bool)), logger, SLOT(setFinished()));
|
|
|
|
connect(logger, SIGNAL(aborted()), installer, SLOT(abort()));
|
|
|
|
installer->install();
|
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);
|
|
|
|
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-12-18 22:42:24 +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);
|
2009-05-09 16:59:14 +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);
|
|
|
|
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
|
|
|
|
2009-05-09 16:59:14 +00:00
|
|
|
QString platform = RbSettings::value(RbSettings::Platform).toString();
|
2008-09-28 17:02:36 +00:00
|
|
|
|
|
|
|
// create installer
|
|
|
|
BootloaderInstallBase *bl;
|
2009-05-09 16:59:14 +00:00
|
|
|
QString type = RbSettings::value(RbSettings::CurBootloaderMethod).toString();
|
2008-09-28 17:02:36 +00:00
|
|
|
if(type == "mi4") {
|
2009-05-09 18:17:05 +00:00
|
|
|
bl = new BootloaderInstallMi4(this);
|
2008-09-28 17:02:36 +00:00
|
|
|
}
|
|
|
|
else if(type == "hex") {
|
2009-05-09 18:17:05 +00:00
|
|
|
bl = new BootloaderInstallHex(this);
|
2008-09-28 17:02:36 +00:00
|
|
|
}
|
|
|
|
else if(type == "sansa") {
|
2009-05-09 18:17:05 +00:00
|
|
|
bl = new BootloaderInstallSansa(this);
|
2008-09-28 17:02:36 +00:00
|
|
|
}
|
|
|
|
else if(type == "ipod") {
|
2009-05-09 18:17:05 +00:00
|
|
|
bl = new BootloaderInstallIpod(this);
|
2008-09-28 17:02:36 +00:00
|
|
|
}
|
|
|
|
else if(type == "file") {
|
2009-05-09 18:17:05 +00:00
|
|
|
bl = new BootloaderInstallFile(this);
|
2008-09-28 17:02:36 +00:00
|
|
|
}
|
|
|
|
else {
|
|
|
|
logger->addItem(tr("No uninstall method known."), LOGERROR);
|
2009-05-02 18:40:04 +00:00
|
|
|
logger->setFinished();
|
2007-08-26 16:44:23 +00:00
|
|
|
return;
|
|
|
|
}
|
2007-09-15 22:57:07 +00:00
|
|
|
|
2009-08-09 10:57:39 +00:00
|
|
|
QStringList blfile = RbSettings::value(RbSettings::CurBootloaderFile).toStringList();
|
|
|
|
QStringList blfilepath;
|
|
|
|
for(int a = 0; a < blfile.size(); a++) {
|
|
|
|
blfilepath.append(RbSettings::value(RbSettings::Mountpoint).toString()
|
|
|
|
+ blfile.at(a));
|
2008-09-28 17:02:36 +00:00
|
|
|
}
|
2009-08-09 10:57:39 +00:00
|
|
|
bl->setBlFile(blfilepath);
|
2008-09-28 17:02:36 +00:00
|
|
|
|
|
|
|
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();
|
|
|
|
|
2009-05-02 18:40:04 +00:00
|
|
|
logger->setFinished();
|
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
|
|
|
|
2009-05-09 16:59:14 +00:00
|
|
|
QString manual = RbSettings::value(RbSettings::CurManual).toString();
|
2009-06-15 20:10:32 +00:00
|
|
|
if(manual.isEmpty())
|
|
|
|
manual = "rockbox-" + RbSettings::value(RbSettings::Platform).toString();
|
2008-12-18 22:42:24 +00:00
|
|
|
|
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)";
|
|
|
|
}
|
2009-05-09 16:59:14 +00:00
|
|
|
manualurl = RbSettings::value(RbSettings::ManualUrl).toString() + "/" + target;
|
2009-06-16 18:45:20 +00:00
|
|
|
qDebug() << "[RbUtil] Manual URL:" << manualurl;
|
2007-08-22 10:55:05 +00:00
|
|
|
|
|
|
|
ProgressLoggerGui* logger = new ProgressLoggerGui(this);
|
|
|
|
logger->show();
|
|
|
|
installer = new ZipInstaller(this);
|
2009-05-09 16:59:14 +00:00
|
|
|
installer->setMountPoint(RbSettings::value(RbSettings::Mountpoint).toString());
|
|
|
|
if(!RbSettings::value(RbSettings::CacheDisabled).toBool())
|
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);
|
2009-05-02 18:50:31 +00:00
|
|
|
connect(installer, SIGNAL(logItem(QString, int)), logger, SLOT(addItem(QString, int)));
|
|
|
|
connect(installer, SIGNAL(logProgress(int, int)), logger, SLOT(setProgress(int, int)));
|
|
|
|
connect(installer, SIGNAL(done(bool)), logger, SLOT(setFinished()));
|
|
|
|
connect(logger, SIGNAL(aborted()), installer, SLOT(abort()));
|
|
|
|
installer->install();
|
2007-08-22 10:55:05 +00:00
|
|
|
}
|
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
|
2009-05-09 16:59:14 +00:00
|
|
|
if(!QFileInfo(RbSettings::value(RbSettings::Mountpoint).toString()).isDir()) {
|
2007-08-22 22:25:04 +00:00
|
|
|
logger->addItem(tr("Mount point is wrong!"),LOGERROR);
|
2009-05-02 18:40:04 +00:00
|
|
|
logger->setFinished();
|
2007-08-22 22:25:04 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
// remove old files first.
|
2009-05-09 16:59:14 +00:00
|
|
|
QFile::remove(RbSettings::value(RbSettings::Mountpoint).toString()
|
2009-04-29 20:58:47 +00:00
|
|
|
+ "/RockboxUtility.exe");
|
2009-05-09 16:59:14 +00:00
|
|
|
QFile::remove(RbSettings::value(RbSettings::Mountpoint).toString()
|
2009-04-29 20:58:47 +00:00
|
|
|
+ "/RockboxUtility.ini");
|
2007-08-22 22:25:04 +00:00
|
|
|
// copy currently running binary and currently used settings file
|
2009-04-29 20:58:47 +00:00
|
|
|
if(!QFile::copy(qApp->applicationFilePath(),
|
2009-05-09 16:59:14 +00:00
|
|
|
RbSettings::value(RbSettings::Mountpoint).toString()
|
2008-12-18 22:42:24 +00:00
|
|
|
+ "/RockboxUtility.exe")) {
|
2007-08-22 22:25:04 +00:00
|
|
|
logger->addItem(tr("Error installing Rockbox Utility"), LOGERROR);
|
2009-05-02 18:40:04 +00:00
|
|
|
logger->setFinished();
|
2007-08-22 22:25:04 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
logger->addItem(tr("Installing user configuration"), LOGINFO);
|
2009-05-09 16:59:14 +00:00
|
|
|
if(!QFile::copy(RbSettings::userSettingFilename(),
|
|
|
|
RbSettings::value(RbSettings::Mountpoint).toString()
|
2008-12-18 22:42:24 +00:00
|
|
|
+ "/RockboxUtility.ini")) {
|
2007-08-22 22:25:04 +00:00
|
|
|
logger->addItem(tr("Error installing user configuration"), LOGERROR);
|
2009-05-02 18:40:04 +00:00
|
|
|
logger->setFinished();
|
2007-08-22 22:25:04 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
logger->addItem(tr("Successfully installed Rockbox Utility."), LOGOK);
|
2009-05-02 18:40:04 +00:00
|
|
|
logger->setFinished();
|
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()
|
|
|
|
{
|
2009-06-16 18:45:20 +00:00
|
|
|
qDebug() << "[RbUtil] updating server info";
|
2007-08-26 16:03:56 +00:00
|
|
|
|
2009-05-09 16:59:14 +00:00
|
|
|
QSettings log(RbSettings::value(RbSettings::Mountpoint).toString()
|
2009-04-29 20:58:47 +00:00
|
|
|
+ "/.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;
|
2009-05-09 16:59:14 +00:00
|
|
|
file = RbSettings::value(RbSettings::Mountpoint).toString() + "/" + 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()
|
|
|
|
{
|
2009-05-09 16:59:14 +00:00
|
|
|
if(RbSettings::value(RbSettings::ProxyType) == "manual")
|
|
|
|
return QUrl(RbSettings::value(RbSettings::Proxy).toString());
|
|
|
|
else if(RbSettings::value(RbSettings::ProxyType) == "system")
|
2008-06-27 21:53:22 +00:00
|
|
|
return Detect::systemProxy();
|
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;
|
2009-05-09 16:59:14 +00:00
|
|
|
if(RbSettings::value(RbSettings::Platform).toString().isEmpty()
|
|
|
|
|| RbSettings::value(RbSettings::Mountpoint).toString().isEmpty()
|
|
|
|
|| !QFileInfo(RbSettings::value(RbSettings::Mountpoint).toString()).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;
|
|
|
|
}
|
|
|
|
|