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"
|
2010-01-20 22:18:36 +00:00
|
|
|
#include "installwindow.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"
|
2010-04-02 21:24:19 +00:00
|
|
|
#include "rockboxinfo.h"
|
2008-06-21 10:28:10 +00:00
|
|
|
#include "sysinfo.h"
|
2009-08-10 19:46:51 +00:00
|
|
|
#include "system.h"
|
2009-08-15 17:02:25 +00:00
|
|
|
#include "systrace.h"
|
2009-05-09 16:59:14 +00:00
|
|
|
#include "rbsettings.h"
|
2010-01-24 21:12:11 +00:00
|
|
|
#include "serverinfo.h"
|
|
|
|
#include "systeminfo.h"
|
2011-03-25 22:16:12 +00:00
|
|
|
#include "ziputil.h"
|
2007-07-29 17:35:31 +00:00
|
|
|
|
2008-09-28 17:02:36 +00:00
|
|
|
#include "progressloggerinterface.h"
|
|
|
|
|
|
|
|
#include "bootloaderinstallbase.h"
|
2010-06-04 21:43:15 +00:00
|
|
|
#include "bootloaderinstallmpio.h"
|
2008-09-28 17:02:36 +00:00
|
|
|
|
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);
|
2010-06-03 06:29:10 +00:00
|
|
|
HttpGet::setGlobalProxy(proxy());
|
2008-09-28 17:02:36 +00:00
|
|
|
// init startup & autodetection
|
|
|
|
ui.setupUi(this);
|
2010-03-29 19:55:51 +00:00
|
|
|
#if defined(Q_OS_LINUX)
|
|
|
|
QIcon windowIcon(":/icons/rockbox-clef.svg");
|
|
|
|
this->setWindowIcon(windowIcon);
|
|
|
|
#endif
|
2011-10-01 21:00:09 +00:00
|
|
|
#if defined(Q_OS_WIN32)
|
|
|
|
QIcon windowIcon = QIcon();
|
2011-10-02 08:57:10 +00:00
|
|
|
windowIcon.addFile(":/icons/rockbox-16.png");
|
|
|
|
windowIcon.addFile(":/icons/rockbox-32.png");
|
|
|
|
windowIcon.addFile(":/icons/rockbox-48.png");
|
|
|
|
windowIcon.addFile(":/icons/rockbox-64.png");
|
|
|
|
windowIcon.addFile(":/icons/rockbox-128.png");
|
|
|
|
windowIcon.addFile(":/icons/rockbox-256.png");
|
2011-10-01 21:00:09 +00:00
|
|
|
this->setWindowIcon(windowIcon);
|
|
|
|
#endif
|
2011-07-17 08:58:55 +00:00
|
|
|
#if defined(Q_OS_MACX)
|
|
|
|
// don't translate menu entries that are handled specially on OS X
|
|
|
|
// (Configure, Quit). Qt handles them for us if they use english string.
|
|
|
|
ui.action_Configure->setText("Configure");
|
|
|
|
ui.actionE_xit->setText("Quit");
|
|
|
|
#endif
|
2010-04-04 21:08:17 +00:00
|
|
|
#if defined(Q_OS_WIN32)
|
|
|
|
long ret;
|
|
|
|
HKEY hk;
|
|
|
|
ret = RegOpenKeyEx(HKEY_CURRENT_USER, _TEXT("Software\\Wine"),
|
|
|
|
0, KEY_QUERY_VALUE, &hk);
|
|
|
|
if(ret == ERROR_SUCCESS) {
|
|
|
|
QMessageBox::warning(this, tr("Wine detected!"),
|
|
|
|
tr("It seems you are trying to run this program under Wine. "
|
|
|
|
"Please don't do this, running under Wine will fail. "
|
|
|
|
"Use the native Linux binary instead."),
|
|
|
|
QMessageBox::Ok, QMessageBox::Ok);
|
|
|
|
qDebug() << "[RbUtil] WINE DETECTED!";
|
|
|
|
RegCloseKey(hk);
|
|
|
|
}
|
|
|
|
#endif
|
2008-09-28 17:02:36 +00:00
|
|
|
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-10-31 17:16:34 +00:00
|
|
|
ui.treeInfo->setLayoutDirection(Qt::LeftToRight);
|
2009-01-25 17:22:06 +00:00
|
|
|
// disable quick install until version info is available
|
|
|
|
ui.buttonSmall->setEnabled(false);
|
|
|
|
ui.buttonComplete->setEnabled(false);
|
2009-11-01 17:16:02 +00:00
|
|
|
ui.actionSmall_Installation->setEnabled(false);
|
|
|
|
ui.actionComplete_Installation->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()));
|
2010-02-11 19:51:50 +00:00
|
|
|
connect(ui.actionE_xit, SIGNAL(triggered()), this, SLOT(shutdown()));
|
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()));
|
2009-08-15 17:02:25 +00:00
|
|
|
connect(ui.action_Trace, SIGNAL(triggered()), this, SLOT(trace()));
|
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
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2010-02-11 19:51:50 +00:00
|
|
|
void RbUtilQt::shutdown(void)
|
|
|
|
{
|
|
|
|
// restore default message handler to prevent trace accesses during
|
|
|
|
// object destruction -- the trace object could already be destroyed.
|
|
|
|
// Fixes segfaults on exit.
|
|
|
|
qInstallMsgHandler(0);
|
2010-03-23 22:07:17 +00:00
|
|
|
SysTrace::save();
|
2010-02-11 19:51:50 +00:00
|
|
|
this->close();
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2009-08-15 17:02:25 +00:00
|
|
|
void RbUtilQt::trace(void)
|
|
|
|
{
|
|
|
|
SysTrace wnd(this);
|
|
|
|
wnd.exec();
|
|
|
|
}
|
|
|
|
|
2008-06-21 10:28:10 +00:00
|
|
|
void RbUtilQt::sysinfo(void)
|
|
|
|
{
|
2009-08-15 17:02:25 +00:00
|
|
|
Sysinfo info(this);
|
|
|
|
info.exec();
|
2008-06-21 10:28:10 +00:00
|
|
|
}
|
|
|
|
|
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)));
|
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-10-27 19:28:51 +00:00
|
|
|
ui.statusbar->showMessage(tr("Downloading build information, please wait ..."));
|
2009-06-16 18:45:20 +00:00
|
|
|
qDebug() << "[RbUtil] downloading build info";
|
2007-07-29 17:35:31 +00:00
|
|
|
daily->setFile(&buildInfo);
|
2010-01-24 21:12:11 +00:00
|
|
|
daily->getFile(QUrl(SystemInfo::value(SystemInfo::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();
|
2009-10-27 19:28:51 +00:00
|
|
|
ui.statusbar->showMessage(tr("Can't get version information!"));
|
2008-09-28 17:02:36 +00:00
|
|
|
QMessageBox::critical(this, tr("Network error"),
|
2010-04-01 22:06:49 +00:00
|
|
|
tr("Can't get version information.\n"
|
|
|
|
"Network error: %1. Please check your network and proxy settings.")
|
|
|
|
.arg(daily->errorString()));
|
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
|
|
|
|
2010-01-24 21:12:11 +00:00
|
|
|
// read info into ServerInfo object
|
2007-08-26 16:03:56 +00:00
|
|
|
buildInfo.open();
|
2010-01-24 21:12:11 +00:00
|
|
|
ServerInfo::readBuildInfo(buildInfo.fileName());
|
2007-08-26 16:03:56 +00:00
|
|
|
buildInfo.close();
|
2010-01-20 22:18:36 +00:00
|
|
|
|
2010-04-01 22:06:49 +00:00
|
|
|
// start bleeding info download
|
2007-08-26 16:03:56 +00:00
|
|
|
bleeding = new HttpGet(this);
|
|
|
|
connect(bleeding, SIGNAL(done(bool)), this, SLOT(downloadBleedingDone(bool)));
|
2009-09-18 22:28:09 +00:00
|
|
|
connect(qApp, SIGNAL(lastWindowClosed()), bleeding, 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);
|
2010-01-24 21:12:11 +00:00
|
|
|
bleeding->getFile(QUrl(SystemInfo::value(SystemInfo::BleedingInfo).toString()));
|
2009-10-27 19:28:51 +00:00
|
|
|
ui.statusbar->showMessage(tr("Downloading build information, please wait ..."));
|
2007-09-16 18:32:49 +00:00
|
|
|
|
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();
|
2010-04-01 22:06:49 +00:00
|
|
|
ui.statusbar->showMessage(tr("Can't get version information!"));
|
|
|
|
QMessageBox::critical(this, tr("Network error"),
|
|
|
|
tr("Can't get version information.\n"
|
|
|
|
"Network error: %1. Please check your network and proxy settings.")
|
|
|
|
.arg(bleeding->errorString()));
|
|
|
|
return;
|
2009-04-27 21:33:51 +00:00
|
|
|
}
|
|
|
|
else {
|
|
|
|
bleedingInfo.open();
|
2010-01-24 21:12:11 +00:00
|
|
|
ServerInfo::readBleedingInfo(bleedingInfo.fileName());
|
2009-04-27 21:33:51 +00:00
|
|
|
bleedingInfo.close();
|
2010-01-24 21:12:11 +00:00
|
|
|
|
2010-01-20 22:18:36 +00:00
|
|
|
ui.statusbar->showMessage(tr("Download build information finished."), 5000);
|
|
|
|
updateSettings();
|
2009-04-27 21:33:51 +00:00
|
|
|
m_gotInfo = true;
|
2009-09-18 22:28:09 +00:00
|
|
|
|
|
|
|
//start check for updates
|
|
|
|
checkUpdate();
|
2009-04-27 21:33:51 +00:00
|
|
|
}
|
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);
|
2009-10-31 17:16:34 +00:00
|
|
|
window->setLayoutDirection(Qt::LeftToRight);
|
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"));
|
2010-01-24 20:48:38 +00:00
|
|
|
while(!r.atEnd()) {
|
|
|
|
QString line = r.readLine();
|
|
|
|
// filter out header.
|
2011-04-30 21:09:15 +00:00
|
|
|
line.remove(QRegExp("^ +.*"));
|
2010-01-24 20:48:38 +00:00
|
|
|
line.remove(QRegExp("^People.*"));
|
|
|
|
about.browserCredits->append(line);
|
|
|
|
}
|
2007-07-29 17:35:31 +00:00
|
|
|
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);
|
|
|
|
|
|
|
|
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-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();
|
2010-06-03 06:29:10 +00:00
|
|
|
HttpGet::setGlobalProxy(proxy());
|
2009-05-09 16:59:14 +00:00
|
|
|
HttpGet::setGlobalCache(RbSettings::value(RbSettings::CachePath).toString());
|
|
|
|
HttpGet::setGlobalDumbCache(RbSettings::value(RbSettings::CacheOffline).toBool());
|
2010-01-20 22:18:36 +00:00
|
|
|
|
|
|
|
if(RbSettings::value(RbSettings::RbutilVersion) != 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)) {
|
|
|
|
QApplication::processEvents();
|
|
|
|
QMessageBox::critical(this, tr("Configuration error"),
|
|
|
|
tr("Your configuration is invalid. This is most likely due "
|
|
|
|
"to a changed device path. The configuration dialog will "
|
|
|
|
"now open to allow you to correct the problem."));
|
|
|
|
configDialog();
|
|
|
|
}
|
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-11-01 17:16:02 +00:00
|
|
|
/* TODO: We should check the flags of the bootloaderinstall classes, and not
|
|
|
|
* just check if its != none or != "fwpatcher" */
|
|
|
|
|
|
|
|
/* Enable bootloader installation, if possible */
|
|
|
|
bool bootloaderInstallable =
|
2010-01-24 21:12:11 +00:00
|
|
|
SystemInfo::value(SystemInfo::CurBootloaderMethod) != "none";
|
2009-11-01 17:16:02 +00:00
|
|
|
ui.buttonBootloader->setEnabled(bootloaderInstallable);
|
|
|
|
ui.labelBootloader->setEnabled(bootloaderInstallable);
|
|
|
|
ui.actionInstall_Bootloader->setEnabled(bootloaderInstallable);
|
|
|
|
|
|
|
|
/* Enable bootloader uninstallation, if possible */
|
|
|
|
bool bootloaderUninstallable = bootloaderInstallable &&
|
2010-01-24 21:12:11 +00:00
|
|
|
SystemInfo::value(SystemInfo::CurBootloaderMethod) != "fwpatcher";
|
2009-11-01 17:16:02 +00:00
|
|
|
ui.labelRemoveBootloader->setEnabled(bootloaderUninstallable);
|
|
|
|
ui.buttonRemoveBootloader->setEnabled(bootloaderUninstallable);
|
|
|
|
ui.actionRemove_bootloader->setEnabled(bootloaderUninstallable);
|
|
|
|
|
|
|
|
/* Disable the whole tab widget if configuration is invalid */
|
|
|
|
bool configurationValid = !chkConfig(false);
|
|
|
|
ui.tabWidget->setEnabled(configurationValid);
|
|
|
|
ui.menuA_ctions->setEnabled(configurationValid);
|
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();
|
2010-01-24 21:12:11 +00:00
|
|
|
QString brand = SystemInfo::value(SystemInfo::CurBrand).toString();
|
2011-07-16 22:07:52 +00:00
|
|
|
QString name = SystemInfo::value(SystemInfo::CurName).toString() +
|
2010-01-24 21:12:11 +00:00
|
|
|
" (" + ServerInfo::value(ServerInfo::CurStatus).toString() + ")";
|
2011-07-16 22:07:52 +00:00
|
|
|
QString mountdisplay = QDir::toNativeSeparators(mountpoint);
|
|
|
|
QString label = Utils::filesystemName(mountpoint);
|
|
|
|
if(!label.isEmpty())
|
|
|
|
mountdisplay += " (" + label + ")";
|
|
|
|
|
2007-08-03 16:55:27 +00:00
|
|
|
if(name.isEmpty()) name = "<none>";
|
2011-07-16 22:07:52 +00:00
|
|
|
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>")
|
2011-07-16 22:07:52 +00:00
|
|
|
.arg(brand, name, mountdisplay));
|
|
|
|
|
2010-01-20 22:18:36 +00:00
|
|
|
// hide quickstart buttons if no release available
|
2010-01-24 21:12:11 +00:00
|
|
|
bool installable = !ServerInfo::value(ServerInfo::CurReleaseVersion).toString().isEmpty();
|
2010-01-20 22:18:36 +00:00
|
|
|
ui.buttonSmall->setEnabled(installable);
|
|
|
|
ui.buttonComplete->setEnabled(installable);
|
|
|
|
ui.actionSmall_Installation->setEnabled(installable);
|
2011-07-16 22:07:52 +00:00
|
|
|
ui.actionComplete_Installation->setEnabled(installable);
|
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
|
|
|
{
|
2010-01-24 21:12:11 +00:00
|
|
|
QString manual= SystemInfo::value(SystemInfo::CurManual).toString();
|
2007-09-15 22:57:07 +00:00
|
|
|
|
2007-07-30 18:11:21 +00:00
|
|
|
if(manual == "")
|
2010-03-15 18:14:59 +00:00
|
|
|
manual = "rockbox-"
|
|
|
|
+ SystemInfo::value(SystemInfo::CurBuildserverModel).toString();
|
2007-07-30 18:11:21 +00:00
|
|
|
QString pdfmanual;
|
2010-01-24 21:12:11 +00:00
|
|
|
pdfmanual = SystemInfo::value(SystemInfo::ManualUrl).toString()
|
2009-04-29 20:58:47 +00:00
|
|
|
+ "/" + manual + ".pdf";
|
2007-07-30 18:11:21 +00:00
|
|
|
QString htmlmanual;
|
2010-01-24 21:12:11 +00:00
|
|
|
htmlmanual = SystemInfo::value(SystemInfo::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.")
|
2010-01-24 21:12:11 +00:00
|
|
|
.arg(ServerInfo::value(ServerInfo::CurReleaseVersion).toString()),
|
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.")
|
2010-01-24 21:12:11 +00:00
|
|
|
.arg(ServerInfo::value(ServerInfo::CurReleaseVersion).toString()),
|
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
|
2010-01-24 21:12:11 +00:00
|
|
|
if(SystemInfo::value(SystemInfo::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()
|
|
|
|
{
|
2010-01-24 21:12:11 +00:00
|
|
|
QString file = SystemInfo::value(SystemInfo::ReleaseUrl).toString();
|
|
|
|
file.replace("%MODEL%", SystemInfo::value(SystemInfo::CurBuildserverModel).toString());
|
|
|
|
file.replace("%RELVERSION%", ServerInfo::value(ServerInfo::CurReleaseVersion).toString());
|
2007-08-26 19:06:40 +00:00
|
|
|
|
2008-06-23 20:31:44 +00:00
|
|
|
// check installed Version and Target
|
2010-04-02 21:24:19 +00:00
|
|
|
QString warning = Utils::checkEnvironment(false);
|
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,
|
2009-08-10 19:20:53 +00:00
|
|
|
QMessageBox::Ok | QMessageBox::Abort, QMessageBox::Abort)
|
|
|
|
== QMessageBox::Abort)
|
2008-10-24 22:31:07 +00:00
|
|
|
{
|
|
|
|
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
|
2009-08-10 19:20:53 +00:00
|
|
|
RockboxInfo rbinfo(RbSettings::value(RbSettings::Mountpoint).toString());
|
|
|
|
if(rbinfo.version() != "")
|
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)
|
|
|
|
{
|
2011-03-25 22:16:12 +00:00
|
|
|
bool result;
|
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()
|
2009-08-10 19:20:53 +00:00
|
|
|
+ "/.backup/rockbox-backup-" + rbinfo.version() + ".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
|
|
|
|
2011-03-25 22:16:12 +00:00
|
|
|
logger->addItem(tr("Beginning Backup..."),LOGINFO);
|
|
|
|
QCoreApplication::processEvents();
|
|
|
|
|
2008-05-11 18:22:42 +00:00
|
|
|
//! create backup
|
2011-03-25 22:16:12 +00:00
|
|
|
ZipUtil zip(this);
|
|
|
|
connect(&zip, SIGNAL(logProgress(int, int)), logger, SLOT(setProgress(int, int)));
|
|
|
|
connect(&zip, SIGNAL(logItem(QString, int)), logger, SLOT(addItem(QString, int)));
|
|
|
|
zip.open(backupName, QuaZip::mdCreate);
|
|
|
|
QString mp = RbSettings::value(RbSettings::Mountpoint).toString();
|
|
|
|
QString folder = mp + "/.rockbox";
|
|
|
|
result = zip.appendDirToArchive(folder, mp);
|
|
|
|
zip.close();
|
|
|
|
if(result)
|
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)");
|
2010-01-24 21:12:11 +00:00
|
|
|
installer->setLogVersion(ServerInfo::value(ServerInfo::CurReleaseVersion).toString());
|
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()
|
|
|
|
{
|
2010-01-20 22:18:36 +00:00
|
|
|
InstallWindow *installWindow = new InstallWindow(this);
|
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
|
2010-05-07 18:18:43 +00:00
|
|
|
BootloaderInstallBase *bl = BootloaderInstallBase::createBootloaderInstaller(this,
|
|
|
|
SystemInfo::value(SystemInfo::CurBootloaderMethod).toString());
|
|
|
|
if(bl == NULL) {
|
2008-09-28 17:02:36 +00:00
|
|
|
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;
|
|
|
|
}
|
2010-05-07 18:18:43 +00:00
|
|
|
|
2008-09-28 17:02:36 +00:00
|
|
|
// set bootloader filename. Do this now as installed() needs it.
|
2010-01-24 21:12:11 +00:00
|
|
|
QStringList blfile = SystemInfo::value(SystemInfo::CurBootloaderFile).toStringList();
|
2009-08-09 10:57:39 +00:00
|
|
|
QStringList blfilepath;
|
|
|
|
for(int a = 0; a < blfile.size(); a++) {
|
|
|
|
blfilepath.append(RbSettings::value(RbSettings::Mountpoint).toString()
|
|
|
|
+ blfile.at(a));
|
|
|
|
}
|
|
|
|
bl->setBlFile(blfilepath);
|
2010-01-24 21:12:11 +00:00
|
|
|
QUrl url(SystemInfo::value(SystemInfo::BootloaderUrl).toString()
|
|
|
|
+ SystemInfo::value(SystemInfo::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);
|
|
|
|
}
|
2009-10-17 09:19:09 +00:00
|
|
|
delete bl;
|
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
|
|
|
{
|
2010-01-24 21:12:11 +00:00
|
|
|
QString targetFolder = SystemInfo::value(SystemInfo::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) {
|
2010-02-16 21:34:39 +00:00
|
|
|
backupDestination = QFileDialog::getExistingDirectory(this,
|
|
|
|
tr("Browse backup folder"), QDir::homePath());
|
|
|
|
if(!backupDestination.isEmpty())
|
|
|
|
backupDestination += "/" + targetFolder;
|
2008-09-28 17:02:36 +00:00
|
|
|
|
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;
|
2010-06-07 17:04:02 +00:00
|
|
|
QString mountpoint = RbSettings::value(RbSettings::Mountpoint).toString();
|
|
|
|
RockboxInfo installInfo(mountpoint);
|
|
|
|
if(installInfo.revision().isEmpty() && installInfo.release().isEmpty()) {
|
|
|
|
QMessageBox::critical(this, tr("No Rockbox installation found"),
|
|
|
|
tr("Could not determine the installed Rockbox version. "
|
|
|
|
"Please install a Rockbox build before installing "
|
|
|
|
"fonts."));
|
|
|
|
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()
|
|
|
|
{
|
2010-06-07 17:04:02 +00:00
|
|
|
QString mountpoint = RbSettings::value(RbSettings::Mountpoint).toString();
|
|
|
|
RockboxInfo installInfo(mountpoint);
|
|
|
|
QString fontsurl;
|
|
|
|
QString logversion;
|
|
|
|
QString relversion = installInfo.release();
|
|
|
|
if(relversion.isEmpty()) {
|
|
|
|
// release is empty for non-release versions (i.e. daily / current)
|
|
|
|
fontsurl = SystemInfo::value(SystemInfo::DailyFontUrl).toString();
|
|
|
|
logversion = installInfo.revision();
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
fontsurl = SystemInfo::value(SystemInfo::ReleaseFontUrl).toString();
|
|
|
|
logversion = installInfo.release();
|
|
|
|
}
|
|
|
|
fontsurl.replace("%RELEASEVER%", relversion);
|
|
|
|
|
2007-08-03 16:20:48 +00:00
|
|
|
// create zip installer
|
|
|
|
installer = new ZipInstaller(this);
|
2010-06-07 17:04:02 +00:00
|
|
|
installer->setUrl(fontsurl);
|
2007-08-03 16:20:48 +00:00
|
|
|
installer->setLogSection("Fonts");
|
2010-06-07 17:04:02 +00:00
|
|
|
installer->setLogVersion(logversion);
|
|
|
|
installer->setMountPoint(mountpoint);
|
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);
|
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
|
|
|
|
2010-06-06 18:02:08 +00:00
|
|
|
QString mountpoint = RbSettings::value(RbSettings::Mountpoint).toString();
|
|
|
|
RockboxInfo installInfo(mountpoint);
|
|
|
|
|
|
|
|
QString voiceurl;
|
|
|
|
QString logversion;
|
|
|
|
QString relversion = installInfo.release();
|
|
|
|
// if no version is found abort.
|
|
|
|
if(installInfo.revision().isEmpty() && relversion.isEmpty()) {
|
|
|
|
QMessageBox::critical(this, tr("No Rockbox installation found"),
|
|
|
|
tr("Could not determine the installed Rockbox version. "
|
|
|
|
"Please install a Rockbox build before installing "
|
|
|
|
"voice files."));
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
if(relversion.isEmpty()) {
|
|
|
|
// release is empty for non-release versions (i.e. daily / current)
|
2010-06-06 18:41:02 +00:00
|
|
|
voiceurl = SystemInfo::value(SystemInfo::DailyVoiceUrl).toString();
|
2010-06-06 18:02:08 +00:00
|
|
|
logversion = installInfo.revision();
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
voiceurl = SystemInfo::value(SystemInfo::ReleaseVoiceUrl).toString();
|
|
|
|
logversion = installInfo.release();
|
|
|
|
}
|
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?"),
|
2010-06-06 18:02:08 +00:00
|
|
|
QMessageBox::Yes | QMessageBox::No) != QMessageBox::Yes)
|
|
|
|
return;
|
|
|
|
|
2010-06-11 17:14:00 +00:00
|
|
|
QDate date = QDate::fromString(
|
|
|
|
ServerInfo::value(ServerInfo::DailyDate).toString(), Qt::ISODate);
|
2010-06-06 18:02:08 +00:00
|
|
|
QString model = SystemInfo::value(SystemInfo::CurBuildserverModel).toString();
|
|
|
|
// replace placeholder in voice url
|
|
|
|
voiceurl.replace("%DATE%", date.toString("yyyyMMdd"));
|
|
|
|
voiceurl.replace("%MODEL%", model);
|
|
|
|
voiceurl.replace("%RELVERSION%", relversion);
|
|
|
|
|
|
|
|
qDebug() << "[RbUtil] voicefile URL:" << voiceurl;
|
|
|
|
|
2007-08-09 16:06:27 +00:00
|
|
|
// create logger
|
|
|
|
logger = new ProgressLoggerGui(this);
|
|
|
|
logger->show();
|
|
|
|
// create zip installer
|
|
|
|
installer = new ZipInstaller(this);
|
2008-12-18 22:42:24 +00:00
|
|
|
|
2007-08-09 16:06:27 +00:00
|
|
|
installer->setUrl(voiceurl);
|
|
|
|
installer->setLogSection("Voice");
|
2010-06-06 18:02:08 +00:00
|
|
|
installer->setLogVersion(logversion);
|
|
|
|
installer->setMountPoint(mountpoint);
|
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-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
|
|
|
|
2010-01-24 21:12:11 +00:00
|
|
|
installer->setUrl(SystemInfo::value(SystemInfo::DoomUrl).toString());
|
2007-08-26 16:03:56 +00:00
|
|
|
installer->setLogSection("Game Addons");
|
2010-01-24 21:12:11 +00:00
|
|
|
installer->setLogVersion(ServerInfo::value(ServerInfo::DailyDate).toString());
|
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);
|
2007-12-14 19:49:11 +00:00
|
|
|
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(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
|
2010-05-07 18:18:43 +00:00
|
|
|
BootloaderInstallBase *bl = BootloaderInstallBase::createBootloaderInstaller(this,
|
|
|
|
SystemInfo::value(SystemInfo::CurBootloaderMethod).toString());
|
2011-06-25 17:20:56 +00:00
|
|
|
|
2010-05-07 18:18:43 +00:00
|
|
|
if(bl == NULL ) {
|
|
|
|
logger->addItem(tr("No uninstall method for this target known."), LOGERROR);
|
|
|
|
logger->setFinished();
|
|
|
|
return;
|
2008-09-28 17:02:36 +00:00
|
|
|
}
|
2010-01-24 21:12:11 +00:00
|
|
|
QStringList blfile = SystemInfo::value(SystemInfo::CurBootloaderFile).toStringList();
|
2009-08-09 10:57:39 +00:00
|
|
|
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
|
|
|
|
2011-06-25 17:21:01 +00:00
|
|
|
BootloaderInstallBase::BootloaderType currentbl = bl->installed();
|
|
|
|
if((bl->capabilities() & BootloaderInstallBase::Uninstall) == 0
|
|
|
|
|| currentbl == BootloaderInstallBase::BootloaderUnknown
|
|
|
|
|| currentbl == BootloaderInstallBase::BootloaderOther)
|
|
|
|
{
|
|
|
|
logger->addItem(tr("Rockbox Utility can not uninstall the bootloader on this target. "
|
|
|
|
"Try a normal firmware update to remove the booloader."), LOGERROR);
|
|
|
|
logger->setFinished();
|
|
|
|
delete bl;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
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)));
|
|
|
|
|
2011-05-29 19:46:20 +00:00
|
|
|
bl->uninstall();
|
2008-09-28 17:02:36 +00:00
|
|
|
|
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
|
|
|
|
2010-01-24 21:12:11 +00:00
|
|
|
QString manual = SystemInfo::value(SystemInfo::CurManual).toString();
|
2009-06-15 20:10:32 +00:00
|
|
|
if(manual.isEmpty())
|
2010-03-15 18:14:59 +00:00
|
|
|
manual = "rockbox-"
|
|
|
|
+ SystemInfo::value(SystemInfo::CurBuildserverModel).toString();
|
2008-12-18 22:42:24 +00:00
|
|
|
|
2010-04-10 06:55:21 +00:00
|
|
|
QDate date = QDate::fromString(ServerInfo::value(ServerInfo::DailyDate).toString(),Qt::ISODate);
|
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 {
|
2010-04-10 06:55:21 +00:00
|
|
|
target = "/" + manual + "-" + date.toString("yyyyMMdd") + "-html.zip";
|
2007-08-22 10:55:05 +00:00
|
|
|
section = "Manual (HTML)";
|
|
|
|
}
|
2010-01-24 21:12:11 +00:00
|
|
|
manualurl = SystemInfo::value(SystemInfo::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);
|
2010-04-10 06:55:21 +00:00
|
|
|
installer->setLogVersion(ServerInfo::value(ServerInfo::DailyDate).toString());
|
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
|
|
|
|
2010-04-23 19:38:04 +00:00
|
|
|
QString mp = RbSettings::value(RbSettings::Mountpoint).toString();
|
|
|
|
QSettings log(mp + "/.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;
|
2010-04-23 19:38:04 +00:00
|
|
|
file = mp + "/" + 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()
|
|
|
|
{
|
2011-06-25 17:21:06 +00:00
|
|
|
QUrl proxy;
|
2009-05-09 16:59:14 +00:00
|
|
|
if(RbSettings::value(RbSettings::ProxyType) == "manual")
|
2011-06-25 17:21:06 +00:00
|
|
|
proxy.setEncodedUrl(RbSettings::value(RbSettings::Proxy).toByteArray());
|
2009-05-09 16:59:14 +00:00
|
|
|
else if(RbSettings::value(RbSettings::ProxyType) == "system")
|
2011-06-25 17:21:06 +00:00
|
|
|
proxy = System::systemProxy();
|
|
|
|
qDebug() << proxy.userName() << proxy.password() << proxy.host() << proxy.port();
|
|
|
|
return proxy;
|
2007-08-26 11:31:55 +00:00
|
|
|
}
|
|
|
|
|
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;
|
|
|
|
}
|
|
|
|
|
2009-09-18 22:28:09 +00:00
|
|
|
void RbUtilQt::checkUpdate(void)
|
|
|
|
{
|
2010-01-24 21:12:11 +00:00
|
|
|
QString url = SystemInfo::value(SystemInfo::RbutilUrl).toString();
|
2009-09-18 22:28:09 +00:00
|
|
|
#if defined(Q_OS_WIN32)
|
|
|
|
url += "win32/";
|
|
|
|
#elif defined(Q_OS_LINUX)
|
|
|
|
url += "linux/";
|
|
|
|
#elif defined(Q_OS_MACX)
|
|
|
|
url += "macosx/";
|
|
|
|
#endif
|
2011-03-25 22:16:12 +00:00
|
|
|
|
2009-09-18 22:28:09 +00:00
|
|
|
update = new HttpGet(this);
|
|
|
|
connect(update, SIGNAL(done(bool)), this, SLOT(downloadUpdateDone(bool)));
|
|
|
|
connect(qApp, SIGNAL(lastWindowClosed()), update, SLOT(abort()));
|
|
|
|
if(RbSettings::value(RbSettings::CacheOffline).toBool())
|
|
|
|
update->setCache(true);
|
2011-03-25 22:16:12 +00:00
|
|
|
|
2010-06-11 19:18:13 +00:00
|
|
|
ui.statusbar->showMessage(tr("Checking for update ..."));
|
2009-09-18 22:28:09 +00:00
|
|
|
update->getFile(QUrl(url));
|
|
|
|
}
|
2009-08-16 20:39:00 +00:00
|
|
|
|
2009-09-18 22:28:09 +00:00
|
|
|
void RbUtilQt::downloadUpdateDone(bool error)
|
|
|
|
{
|
|
|
|
if(error) {
|
|
|
|
qDebug() << "[RbUtil] network error:" << update->error();
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
QString toParse(update->readAll());
|
2011-03-19 11:47:10 +00:00
|
|
|
|
2010-02-28 20:28:45 +00:00
|
|
|
QRegExp searchString("<a[^>]*>([a-zA-Z]+[^<]*)</a>");
|
2009-09-18 22:28:09 +00:00
|
|
|
QStringList rbutilList;
|
|
|
|
int pos = 0;
|
2011-03-19 11:47:10 +00:00
|
|
|
while ((pos = searchString.indexIn(toParse, pos)) != -1)
|
2009-09-18 22:28:09 +00:00
|
|
|
{
|
|
|
|
rbutilList << searchString.cap(1);
|
|
|
|
pos += searchString.matchedLength();
|
|
|
|
}
|
2011-03-25 22:16:12 +00:00
|
|
|
qDebug() << "[RbUtilQt] Checking for update";
|
2011-03-19 11:47:10 +00:00
|
|
|
|
2010-06-11 19:18:13 +00:00
|
|
|
QString newVersion = "";
|
2011-03-19 11:47:10 +00:00
|
|
|
QString foundVersion = "";
|
|
|
|
// check if there is a binary with higher version in this list
|
2009-09-18 22:28:09 +00:00
|
|
|
for(int i=0; i < rbutilList.size(); i++)
|
|
|
|
{
|
2011-03-19 11:47:10 +00:00
|
|
|
QString item = rbutilList.at(i);
|
2009-09-18 22:28:09 +00:00
|
|
|
#if defined(Q_OS_LINUX)
|
|
|
|
#if defined(__amd64__)
|
2011-03-19 11:47:10 +00:00
|
|
|
// skip if it isn't a 64 bit build
|
|
|
|
if( !item.contains("64bit"))
|
2009-09-18 22:28:09 +00:00
|
|
|
continue;
|
2011-03-19 11:47:10 +00:00
|
|
|
// strip the "64bit" suffix for comparison
|
|
|
|
item = item.remove("64bit");
|
2009-09-18 22:28:09 +00:00
|
|
|
#else
|
|
|
|
//skip if it is a 64bit build
|
2011-03-19 11:47:10 +00:00
|
|
|
if(item.contains("64bit"))
|
2009-09-18 22:28:09 +00:00
|
|
|
continue;
|
2011-03-19 11:47:10 +00:00
|
|
|
#endif
|
|
|
|
#endif
|
|
|
|
// check if it is newer, and remember newest
|
|
|
|
if(Utils::compareVersionStrings(VERSION, item) == 1)
|
2009-09-18 22:28:09 +00:00
|
|
|
{
|
2011-03-19 11:47:10 +00:00
|
|
|
if(Utils::compareVersionStrings(newVersion, item) == 1)
|
2009-09-18 22:28:09 +00:00
|
|
|
{
|
2011-03-19 11:47:10 +00:00
|
|
|
newVersion = item;
|
|
|
|
foundVersion = rbutilList.at(i);
|
2009-09-18 22:28:09 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// if we found something newer, display info
|
2011-03-19 11:47:10 +00:00
|
|
|
if(foundVersion != "")
|
2009-09-18 22:28:09 +00:00
|
|
|
{
|
2010-01-24 21:12:11 +00:00
|
|
|
QString url = SystemInfo::value(SystemInfo::RbutilUrl).toString();
|
2009-09-18 22:28:09 +00:00
|
|
|
#if defined(Q_OS_WIN32)
|
|
|
|
url += "win32/";
|
|
|
|
#elif defined(Q_OS_LINUX)
|
|
|
|
url += "linux/";
|
|
|
|
#elif defined(Q_OS_MACX)
|
|
|
|
url += "macosx/";
|
|
|
|
#endif
|
2011-03-19 11:47:10 +00:00
|
|
|
url += foundVersion;
|
|
|
|
|
2009-09-18 22:28:09 +00:00
|
|
|
QMessageBox::information(this,tr("RockboxUtility Update available"),
|
|
|
|
tr("<b>New RockboxUtility Version available.</b> <br><br>"
|
2011-03-19 11:47:10 +00:00
|
|
|
"Download it from here: <a href='%1'>%2</a>")
|
|
|
|
.arg(url).arg(foundVersion));
|
2010-06-11 19:18:13 +00:00
|
|
|
ui.statusbar->showMessage(tr("New version of Rockbox Utility available."));
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
ui.statusbar->showMessage(tr("Rockbox Utility is up to date."), 5000);
|
2009-09-18 22:28:09 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|