forked from len0rd/rockbox
rbutil: Merge rbutil with utils folder.
rbutil uses several components from the utils folder, and can be considered part of utils too. Having it in a separate folder is an arbitrary split that doesn't help anymore these days, so merge them. This also allows other utils to easily use libtools.make without the need to navigate to a different folder. Change-Id: I3fc2f4de19e3e776553efb5dea5f779dfec0dc21
This commit is contained in:
parent
6c6f0757d7
commit
c876d3bbef
494 changed files with 13 additions and 13 deletions
152
utils/rbutilqt/gui/backupdialog.cpp
Normal file
152
utils/rbutilqt/gui/backupdialog.cpp
Normal file
|
|
@ -0,0 +1,152 @@
|
|||
/***************************************************************************
|
||||
* __________ __ ___.
|
||||
* Open \______ \ ____ ____ | | _\_ |__ _______ ___
|
||||
* Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
|
||||
* Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
|
||||
* Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
|
||||
* \/ \/ \/ \/ \/
|
||||
*
|
||||
* Copyright (C) 2012 by Dominik Riebeling
|
||||
*
|
||||
* 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 <QThread>
|
||||
#include <QDialog>
|
||||
#include <QMessageBox>
|
||||
#include <QFileDialog>
|
||||
#include "backupdialog.h"
|
||||
#include "ui_backupdialogfrm.h"
|
||||
#include "rbsettings.h"
|
||||
#include "progressloggergui.h"
|
||||
#include "ziputil.h"
|
||||
#include "rockboxinfo.h"
|
||||
#include "Logger.h"
|
||||
|
||||
class BackupSizeThread : public QThread
|
||||
{
|
||||
public:
|
||||
void run(void);
|
||||
void setPath(QString p) { m_path = p; }
|
||||
qint64 currentSize(void) { return m_currentSize; }
|
||||
|
||||
private:
|
||||
QString m_path;
|
||||
qint64 m_currentSize;
|
||||
};
|
||||
|
||||
|
||||
void BackupSizeThread::run(void)
|
||||
{
|
||||
LOG_INFO() << "Thread started, calculating" << m_path;
|
||||
m_currentSize = 0;
|
||||
|
||||
QDirIterator it(m_path, QDirIterator::Subdirectories);
|
||||
while(it.hasNext()) {
|
||||
m_currentSize += QFileInfo(it.next()).size();
|
||||
}
|
||||
LOG_INFO() << "Thread done, sum:" << m_currentSize;
|
||||
}
|
||||
|
||||
|
||||
BackupDialog::BackupDialog(QWidget* parent) : QDialog(parent)
|
||||
{
|
||||
ui.setupUi(this);
|
||||
|
||||
m_thread = new BackupSizeThread();
|
||||
connect(m_thread, SIGNAL(finished()), this, SLOT(updateSizeInfo()));
|
||||
connect(m_thread, SIGNAL(terminated()), this, SLOT(updateSizeInfo()));
|
||||
|
||||
connect(ui.buttonCancel, SIGNAL(clicked()), this, SLOT(close()));
|
||||
connect(ui.buttonCancel, SIGNAL(clicked()), m_thread, SLOT(quit()));
|
||||
connect(ui.buttonChange, SIGNAL(clicked()), this, SLOT(changeBackupPath()));
|
||||
connect(ui.buttonBackup, SIGNAL(clicked()), this, SLOT(backup()));
|
||||
|
||||
ui.backupSize->setText(tr("Installation size: calculating ..."));
|
||||
m_mountpoint = RbSettings::value(RbSettings::Mountpoint).toString();
|
||||
|
||||
m_backupName = RbSettings::value(RbSettings::BackupPath).toString();
|
||||
if(m_backupName.isEmpty()) {
|
||||
m_backupName = m_mountpoint;
|
||||
}
|
||||
RockboxInfo info(m_mountpoint);
|
||||
m_backupName += "/.backup/rockbox-backup-" + info.version() + ".zip";
|
||||
ui.backupLocation->setText(QDir::toNativeSeparators(m_backupName));
|
||||
|
||||
m_thread->setPath(m_mountpoint + "/.rockbox");
|
||||
m_thread->start();
|
||||
}
|
||||
|
||||
|
||||
void BackupDialog::changeBackupPath(void)
|
||||
{
|
||||
QString backupString = QFileDialog::getSaveFileName(this,
|
||||
tr("Select Backup Filename"), m_backupName, "*.zip");
|
||||
// only update if a filename was entered, ignore if cancelled
|
||||
if(!backupString.isEmpty()) {
|
||||
m_backupName = backupString;
|
||||
ui.backupLocation->setText(QDir::toNativeSeparators(m_backupName));
|
||||
RbSettings::setValue(RbSettings::BackupPath, QFileInfo(m_backupName).absolutePath());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void BackupDialog::updateSizeInfo(void)
|
||||
{
|
||||
double size = m_thread->currentSize() / (1024 * 1024);
|
||||
QString unit = "MiB";
|
||||
|
||||
if(size > 1024) {
|
||||
size /= 1024;
|
||||
unit = "GiB";
|
||||
}
|
||||
|
||||
ui.backupSize->setText(tr("Installation size: %L1 %2").arg(size, 0, 'g', 4).arg(unit));
|
||||
}
|
||||
|
||||
|
||||
void BackupDialog::backup(void)
|
||||
{
|
||||
if(QFileInfo(m_backupName).isFile()) {
|
||||
if(QMessageBox::warning(this, tr("File exists"),
|
||||
tr("The selected backup file already exists. Overwrite?"),
|
||||
QMessageBox::Yes | QMessageBox::No) == QMessageBox::No) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
m_logger = new ProgressLoggerGui(this);
|
||||
connect(m_logger, SIGNAL(closed()), this, SLOT(close()));
|
||||
m_logger->show();
|
||||
m_logger->addItem(tr("Starting backup ..."),LOGINFO);
|
||||
QCoreApplication::processEvents();
|
||||
|
||||
// create dir, if it doesnt exist
|
||||
QFileInfo backupFile(m_backupName);
|
||||
if(!QDir(backupFile.path()).exists())
|
||||
{
|
||||
QDir a;
|
||||
a.mkpath(backupFile.path());
|
||||
}
|
||||
|
||||
// create backup
|
||||
ZipUtil zip(this);
|
||||
connect(&zip, SIGNAL(logProgress(int, int)), m_logger, SLOT(setProgress(int, int)));
|
||||
connect(&zip, SIGNAL(logItem(QString, int)), m_logger, SLOT(addItem(QString, int)));
|
||||
zip.open(m_backupName, QuaZip::mdCreate);
|
||||
|
||||
QString mp = m_mountpoint + "/.rockbox";
|
||||
if(zip.appendDirToArchive(mp, m_mountpoint)) {
|
||||
m_logger->addItem(tr("Backup successful."), LOGINFO);
|
||||
}
|
||||
else {
|
||||
m_logger->addItem(tr("Backup failed!"), LOGERROR);
|
||||
}
|
||||
zip.close();
|
||||
m_logger->setFinished();
|
||||
}
|
||||
|
||||
48
utils/rbutilqt/gui/backupdialog.h
Normal file
48
utils/rbutilqt/gui/backupdialog.h
Normal file
|
|
@ -0,0 +1,48 @@
|
|||
/***************************************************************************
|
||||
* __________ __ ___.
|
||||
* Open \______ \ ____ ____ | | _\_ |__ _______ ___
|
||||
* Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
|
||||
* Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
|
||||
* Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
|
||||
* \/ \/ \/ \/ \/
|
||||
*
|
||||
* Copyright (C) 2012 by Dominik Riebeling
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
#ifndef BACKUPDIALOG_H
|
||||
#define BACKUPDIALOG_H
|
||||
|
||||
#include <QDialog>
|
||||
#include "ui_backupdialogfrm.h"
|
||||
#include "progressloggergui.h"
|
||||
|
||||
class BackupSizeThread;
|
||||
|
||||
class BackupDialog : public QDialog
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
BackupDialog(QWidget* parent = nullptr);
|
||||
|
||||
private slots:
|
||||
void changeBackupPath(void);
|
||||
void updateSizeInfo(void);
|
||||
void backup(void);
|
||||
|
||||
private:
|
||||
Ui::BackupDialog ui;
|
||||
QString m_backupName;
|
||||
QString m_mountpoint;
|
||||
BackupSizeThread *m_thread;
|
||||
ProgressLoggerGui *m_logger;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
145
utils/rbutilqt/gui/backupdialogfrm.ui
Normal file
145
utils/rbutilqt/gui/backupdialogfrm.ui
Normal file
|
|
@ -0,0 +1,145 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>BackupDialog</class>
|
||||
<widget class="QDialog" name="BackupDialog">
|
||||
<property name="windowModality">
|
||||
<enum>Qt::WindowModal</enum>
|
||||
</property>
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>554</width>
|
||||
<height>448</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Backup</string>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout_2">
|
||||
<item row="0" column="0" rowspan="4">
|
||||
<widget class="QLabel" name="label_4">
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
<property name="pixmap">
|
||||
<pixmap resource="../rbutilqt.qrc">:/icons/wizard.jpg</pixmap>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1" colspan="3">
|
||||
<widget class="QLabel" name="label_2">
|
||||
<property name="text">
|
||||
<string><html><head/><body><p>This dialog will create a backup by archiving the contents of the Rockbox installation on the player into a zip file. This will include installed themes and settings stored below the .rockbox folder on the player.</p><p>The backup filename will be created based on the installed version. </p></body></html></string>
|
||||
</property>
|
||||
<property name="wordWrap">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1" colspan="3">
|
||||
<widget class="QGroupBox" name="groupBox">
|
||||
<property name="title">
|
||||
<string>Backup</string>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout">
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="backupSize">
|
||||
<property name="text">
|
||||
<string>Size: unknown</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="backupLocation">
|
||||
<property name="text">
|
||||
<string>Backup to: unknown</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<spacer name="horizontalSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>78</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item row="1" column="2">
|
||||
<widget class="QPushButton" name="buttonChange">
|
||||
<property name="text">
|
||||
<string>&Change</string>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="../rbutilqt.qrc">
|
||||
<normaloff>:/icons/edit-find.svg</normaloff>:/icons/edit-find.svg</iconset>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="2" colspan="2">
|
||||
<spacer name="verticalSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>20</width>
|
||||
<height>1</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item row="3" column="1">
|
||||
<spacer name="horizontalSpacer_2">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>143</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item row="3" column="2">
|
||||
<widget class="QPushButton" name="buttonBackup">
|
||||
<property name="text">
|
||||
<string>&Backup</string>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="../rbutilqt.qrc">
|
||||
<normaloff>:/icons/go-next.svg</normaloff>:/icons/go-next.svg</iconset>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="3">
|
||||
<widget class="QPushButton" name="buttonCancel">
|
||||
<property name="text">
|
||||
<string>&Cancel</string>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="../rbutilqt.qrc">
|
||||
<normaloff>:/icons/process-stop.svg</normaloff>:/icons/process-stop.svg</iconset>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<tabstops>
|
||||
<tabstop>buttonBackup</tabstop>
|
||||
<tabstop>buttonCancel</tabstop>
|
||||
</tabstops>
|
||||
<resources>
|
||||
<include location="../rbutilqt.qrc"/>
|
||||
</resources>
|
||||
<connections/>
|
||||
</ui>
|
||||
78
utils/rbutilqt/gui/changelog.cpp
Normal file
78
utils/rbutilqt/gui/changelog.cpp
Normal file
|
|
@ -0,0 +1,78 @@
|
|||
/***************************************************************************
|
||||
* __________ __ ___.
|
||||
* Open \______ \ ____ ____ | | _\_ |__ _______ ___
|
||||
* Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
|
||||
* Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
|
||||
* Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
|
||||
* \/ \/ \/ \/ \/
|
||||
*
|
||||
* Copyright (C) 2013 by Dominik Riebeling
|
||||
*
|
||||
* 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 "changelog.h"
|
||||
#include "rbsettings.h"
|
||||
#include "ui_changelogfrm.h"
|
||||
|
||||
Changelog::Changelog(QWidget *parent) : QDialog(parent)
|
||||
{
|
||||
ui.setupUi(this);
|
||||
ui.browserChangelog->setOpenExternalLinks(true);
|
||||
// FIXME: support translated changelog file (changelog.de.txt etc)
|
||||
ui.browserChangelog->setHtml(parseChangelogFile(":/docs/changelog.txt"));
|
||||
ui.browserChangelog->moveCursor(QTextCursor::End, QTextCursor::MoveAnchor);
|
||||
ui.checkBoxShowAlways->setChecked(RbSettings::value(RbSettings::ShowChangelog).toBool());
|
||||
connect(ui.buttonOk, SIGNAL(clicked()), this, SLOT(accept()));
|
||||
}
|
||||
|
||||
|
||||
void Changelog::accept(void)
|
||||
{
|
||||
RbSettings::setValue(RbSettings::ShowChangelog, ui.checkBoxShowAlways->isChecked());
|
||||
this->hide();
|
||||
this->deleteLater();
|
||||
}
|
||||
|
||||
|
||||
QString Changelog::parseChangelogFile(QString filename)
|
||||
{
|
||||
QFile changelog(filename);
|
||||
changelog.open(QIODevice::ReadOnly);
|
||||
QTextStream c(&changelog);
|
||||
#if QT_VERSION < 0x060000
|
||||
c.setCodec(QTextCodec::codecForName("UTF-8"));
|
||||
#else
|
||||
c.setEncoding(QStringConverter::Utf8);
|
||||
#endif
|
||||
QString text;
|
||||
while(!c.atEnd()) {
|
||||
QString line = c.readLine();
|
||||
if(line.startsWith("#"))
|
||||
continue;
|
||||
if(line.startsWith("Version")) {
|
||||
text.append(QString("<h4>Rockbox Utility %1</h4>").arg(line.remove("Version")));
|
||||
line = c.readLine();
|
||||
text.append("<ul>");
|
||||
while(line.startsWith("*")) {
|
||||
QString t = line.remove(QRegExp("^\\*"));
|
||||
t.replace(QRegExp("FS#(\\d+)"),
|
||||
"<a href='http://www.rockbox.org/tracker/task/\\1'>FS#\\1</a>");
|
||||
t.replace(QRegExp("G#(\\d+)"),
|
||||
"<a href='http://gerrit.rockbox.org/r/\\1'>G#\\1</a>");
|
||||
text.append(QString("<li>%1</li>").arg(t));
|
||||
line = c.readLine();
|
||||
if(line.startsWith("#"))
|
||||
line = c.readLine();
|
||||
}
|
||||
text.append("</ul>");
|
||||
}
|
||||
}
|
||||
changelog.close();
|
||||
return text;
|
||||
}
|
||||
40
utils/rbutilqt/gui/changelog.h
Normal file
40
utils/rbutilqt/gui/changelog.h
Normal file
|
|
@ -0,0 +1,40 @@
|
|||
/***************************************************************************
|
||||
* __________ __ ___.
|
||||
* Open \______ \ ____ ____ | | _\_ |__ _______ ___
|
||||
* Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
|
||||
* Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
|
||||
* Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
|
||||
* \/ \/ \/ \/ \/
|
||||
*
|
||||
* Copyright (C) 2013 by Dominik Riebeling
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
#ifndef CHANGELOG_H
|
||||
#define CHANGELOG_H
|
||||
|
||||
#include <QDialog>
|
||||
#include "ui_changelogfrm.h"
|
||||
|
||||
class Changelog : public QDialog
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
Changelog(QWidget *parent = nullptr);
|
||||
|
||||
public slots:
|
||||
void accept(void);
|
||||
|
||||
private:
|
||||
QString parseChangelogFile(QString filename);
|
||||
Ui::Changelog ui;
|
||||
|
||||
};
|
||||
|
||||
#endif
|
||||
60
utils/rbutilqt/gui/changelogfrm.ui
Normal file
60
utils/rbutilqt/gui/changelogfrm.ui
Normal file
|
|
@ -0,0 +1,60 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>Changelog</class>
|
||||
<widget class="QDialog" name="Changelog">
|
||||
<property name="windowModality">
|
||||
<enum>Qt::WindowModal</enum>
|
||||
</property>
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>500</width>
|
||||
<height>400</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Changelog</string>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout">
|
||||
<item row="0" column="0" colspan="3">
|
||||
<widget class="QTextBrowser" name="browserChangelog"/>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<spacer name="horizontalSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QCheckBox" name="checkBoxShowAlways">
|
||||
<property name="text">
|
||||
<string>Show on startup</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="2">
|
||||
<widget class="QPushButton" name="buttonOk">
|
||||
<property name="text">
|
||||
<string>&Ok</string>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="../rbutilqt.qrc">
|
||||
<normaloff>:/icons/go-next.svg</normaloff>:/icons/go-next.svg</iconset>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<resources>
|
||||
<include location="../rbutilqt.qrc"/>
|
||||
</resources>
|
||||
<connections/>
|
||||
</ui>
|
||||
56
utils/rbutilqt/gui/comboboxviewdelegate.cpp
Normal file
56
utils/rbutilqt/gui/comboboxviewdelegate.cpp
Normal file
|
|
@ -0,0 +1,56 @@
|
|||
/***************************************************************************
|
||||
* __________ __ ___.
|
||||
* Open \______ \ ____ ____ | | _\_ |__ _______ ___
|
||||
* Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
|
||||
* Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
|
||||
* Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
|
||||
* \/ \/ \/ \/ \/
|
||||
*
|
||||
* Copyright (C) 2011 by Dominik Riebeling
|
||||
*
|
||||
* 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 <QStyledItemDelegate>
|
||||
#include <QPainter>
|
||||
#include <QApplication>
|
||||
#include <qdebug.h>
|
||||
#include "comboboxviewdelegate.h"
|
||||
|
||||
void ComboBoxViewDelegate::paint(QPainter *painter,
|
||||
const QStyleOptionViewItem &option, const QModelIndex &index) const
|
||||
{
|
||||
QPen pen;
|
||||
QFont font;
|
||||
pen = painter->pen();
|
||||
font = painter->font();
|
||||
|
||||
painter->save();
|
||||
// paint selection
|
||||
if(option.state & QStyle::State_Selected) {
|
||||
painter->setPen(QPen(Qt::NoPen));
|
||||
painter->setBrush(QApplication::palette().highlight());
|
||||
painter->drawRect(option.rect);
|
||||
painter->restore();
|
||||
painter->save();
|
||||
pen.setColor(QApplication::palette().color(QPalette::HighlightedText));
|
||||
}
|
||||
else {
|
||||
pen.setColor(QApplication::palette().color(QPalette::Text));
|
||||
}
|
||||
// draw data (text)
|
||||
painter->setPen(pen);
|
||||
painter->drawText(option.rect, Qt::AlignLeft, index.data().toString());
|
||||
|
||||
// draw user data right aligned, italic
|
||||
font.setItalic(true);
|
||||
painter->setFont(font);
|
||||
painter->drawText(option.rect, Qt::AlignRight, index.data(Qt::UserRole).toString());
|
||||
painter->restore();
|
||||
}
|
||||
|
||||
30
utils/rbutilqt/gui/comboboxviewdelegate.h
Normal file
30
utils/rbutilqt/gui/comboboxviewdelegate.h
Normal file
|
|
@ -0,0 +1,30 @@
|
|||
/***************************************************************************
|
||||
* __________ __ ___.
|
||||
* Open \______ \ ____ ____ | | _\_ |__ _______ ___
|
||||
* Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
|
||||
* Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
|
||||
* Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
|
||||
* \/ \/ \/ \/ \/
|
||||
*
|
||||
* Copyright (C) 2011 by Dominik Riebeling
|
||||
*
|
||||
* 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 <QStyledItemDelegate>
|
||||
|
||||
class ComboBoxViewDelegate : public QStyledItemDelegate
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
ComboBoxViewDelegate(QObject* parent = nullptr) : QStyledItemDelegate(parent) { }
|
||||
|
||||
void paint(QPainter *painter, const QStyleOptionViewItem &option,
|
||||
const QModelIndex &index) const;
|
||||
};
|
||||
|
||||
112
utils/rbutilqt/gui/infowidget.cpp
Normal file
112
utils/rbutilqt/gui/infowidget.cpp
Normal file
|
|
@ -0,0 +1,112 @@
|
|||
/***************************************************************************
|
||||
* __________ __ ___.
|
||||
* Open \______ \ ____ ____ | | _\_ |__ _______ ___
|
||||
* Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
|
||||
* Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
|
||||
* Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
|
||||
* \/ \/ \/ \/ \/
|
||||
*
|
||||
* Copyright (C) 2012 by Dominik Riebeling
|
||||
*
|
||||
* 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 <QWidget>
|
||||
#include <QDebug>
|
||||
#include "infowidget.h"
|
||||
#include "rbsettings.h"
|
||||
#include "Logger.h"
|
||||
|
||||
InfoWidget::InfoWidget(QWidget *parent) : QWidget(parent)
|
||||
{
|
||||
ui.setupUi(this);
|
||||
|
||||
ui.treeInfo->setAlternatingRowColors(true);
|
||||
ui.treeInfo->setHeaderLabels(QStringList() << tr("File") << tr("Version"));
|
||||
ui.treeInfo->expandAll();
|
||||
ui.treeInfo->setColumnCount(2);
|
||||
ui.treeInfo->setLayoutDirection(Qt::LeftToRight);
|
||||
}
|
||||
|
||||
|
||||
void InfoWidget::updateInfo(void)
|
||||
{
|
||||
LOG_INFO() << "updating server info";
|
||||
|
||||
QString mp = RbSettings::value(RbSettings::Mountpoint).toString();
|
||||
QSettings log(mp + "/.rockbox/rbutil.log", QSettings::IniFormat, this);
|
||||
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();
|
||||
}
|
||||
|
||||
for(int b = 0; b < keys.size(); b++) {
|
||||
QString file;
|
||||
file = mp + "/" + keys.at(b);
|
||||
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->expandAll();
|
||||
ui.treeInfo->resizeColumnToContents(0);
|
||||
ui.treeInfo->collapseAll();
|
||||
}
|
||||
|
||||
|
||||
void InfoWidget::changeEvent(QEvent *e)
|
||||
{
|
||||
if(e->type() == QEvent::LanguageChange) {
|
||||
ui.retranslateUi(this);
|
||||
ui.treeInfo->setHeaderLabels(QStringList() << tr("File") << tr("Version"));
|
||||
} else {
|
||||
QWidget::changeEvent(e);
|
||||
}
|
||||
}
|
||||
|
||||
41
utils/rbutilqt/gui/infowidget.h
Normal file
41
utils/rbutilqt/gui/infowidget.h
Normal file
|
|
@ -0,0 +1,41 @@
|
|||
/***************************************************************************
|
||||
* __________ __ ___.
|
||||
* Open \______ \ ____ ____ | | _\_ |__ _______ ___
|
||||
* Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
|
||||
* Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
|
||||
* Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
|
||||
* \/ \/ \/ \/ \/
|
||||
*
|
||||
* Copyright (C) 2012 by Dominik Riebeling
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
#ifndef INFOWIDGET_H
|
||||
#define INFOWIDGET_H
|
||||
|
||||
#include <QWidget>
|
||||
#include "ui_infowidgetfrm.h"
|
||||
|
||||
class InfoWidget : public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
InfoWidget(QWidget *parent = nullptr);
|
||||
|
||||
public slots:
|
||||
void updateInfo(void);
|
||||
|
||||
private:
|
||||
void changeEvent(QEvent *e);
|
||||
|
||||
Ui::InfoWidgetFrm ui;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
43
utils/rbutilqt/gui/infowidgetfrm.ui
Normal file
43
utils/rbutilqt/gui/infowidgetfrm.ui
Normal file
|
|
@ -0,0 +1,43 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>InfoWidgetFrm</class>
|
||||
<widget class="QWidget" name="InfoWidgetFrm">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>400</width>
|
||||
<height>300</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Info</string>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout">
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="labelInfo">
|
||||
<property name="text">
|
||||
<string>Currently installed packages.<br/><b>Note:</b> if you manually installed packages this might not be correct!</string>
|
||||
</property>
|
||||
<property name="textFormat">
|
||||
<enum>Qt::RichText</enum>
|
||||
</property>
|
||||
<property name="wordWrap">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QTreeWidget" name="treeInfo">
|
||||
<column>
|
||||
<property name="text">
|
||||
<string>Package</string>
|
||||
</property>
|
||||
</column>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<resources/>
|
||||
<connections/>
|
||||
</ui>
|
||||
691
utils/rbutilqt/gui/selectiveinstallwidget.cpp
Normal file
691
utils/rbutilqt/gui/selectiveinstallwidget.cpp
Normal file
|
|
@ -0,0 +1,691 @@
|
|||
/***************************************************************************
|
||||
* __________ __ ___.
|
||||
* Open \______ \ ____ ____ | | _\_ |__ _______ ___
|
||||
* Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
|
||||
* Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
|
||||
* Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
|
||||
* \/ \/ \/ \/ \/
|
||||
*
|
||||
* Copyright (C) 2012 by Dominik Riebeling
|
||||
*
|
||||
* 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 <QWidget>
|
||||
#include <QMessageBox>
|
||||
#include <QFileDialog>
|
||||
#include "selectiveinstallwidget.h"
|
||||
#include "ui_selectiveinstallwidgetfrm.h"
|
||||
#include "playerbuildinfo.h"
|
||||
#include "rbsettings.h"
|
||||
#include "rockboxinfo.h"
|
||||
#include "progressloggergui.h"
|
||||
#include "bootloaderinstallbase.h"
|
||||
#include "bootloaderinstallhelper.h"
|
||||
#include "themesinstallwindow.h"
|
||||
#include "utils.h"
|
||||
#include "Logger.h"
|
||||
|
||||
SelectiveInstallWidget::SelectiveInstallWidget(QWidget* parent) : QWidget(parent)
|
||||
{
|
||||
ui.setupUi(this);
|
||||
ui.rockboxCheckbox->setChecked(RbSettings::value(RbSettings::InstallRockbox).toBool());
|
||||
ui.fontsCheckbox->setChecked(RbSettings::value(RbSettings::InstallFonts).toBool());
|
||||
ui.themesCheckbox->setChecked(RbSettings::value(RbSettings::InstallThemes).toBool());
|
||||
ui.pluginDataCheckbox->setChecked(RbSettings::value(RbSettings::InstallPluginData).toBool());
|
||||
ui.voiceCheckbox->setChecked(RbSettings::value(RbSettings::InstallVoice).toBool());
|
||||
ui.manualCheckbox->setChecked(RbSettings::value(RbSettings::InstallManual).toBool());
|
||||
|
||||
ui.manualCombobox->addItem("PDF", "pdf");
|
||||
ui.manualCombobox->addItem("HTML (zip)", "zip");
|
||||
ui.manualCombobox->addItem("HTML", "html");
|
||||
|
||||
// check if Rockbox is installed by looking after rockbox-info.txt.
|
||||
// If installed uncheck bootloader installation.
|
||||
RockboxInfo info(m_mountpoint);
|
||||
ui.bootloaderCheckbox->setChecked(!info.success());
|
||||
|
||||
m_logger = nullptr;
|
||||
m_zipinstaller = nullptr;
|
||||
m_themesinstaller = nullptr;
|
||||
|
||||
connect(ui.installButton, &QAbstractButton::clicked,
|
||||
this, &SelectiveInstallWidget::startInstall);
|
||||
connect(this, &SelectiveInstallWidget::installSkipped,
|
||||
this, &SelectiveInstallWidget::continueInstall);
|
||||
connect(ui.themesCustomize, &QAbstractButton::clicked,
|
||||
this, &SelectiveInstallWidget::customizeThemes);
|
||||
connect(ui.selectedVersion, static_cast<void (QComboBox::*)(int)>(&QComboBox::currentIndexChanged),
|
||||
this, &SelectiveInstallWidget::selectedVersionChanged);
|
||||
// update version information. This also handles setting the previously
|
||||
// selected build type and bootloader disabling.
|
||||
updateVersion();
|
||||
}
|
||||
|
||||
|
||||
void SelectiveInstallWidget::selectedVersionChanged(int index)
|
||||
{
|
||||
m_buildtype = static_cast<PlayerBuildInfo::BuildType>(ui.selectedVersion->itemData(index).toInt());
|
||||
bool voice = true;
|
||||
switch(m_buildtype) {
|
||||
case PlayerBuildInfo::TypeRelease:
|
||||
ui.selectedDescription->setText(tr("This is the latest stable "
|
||||
"release available."));
|
||||
voice = true;
|
||||
break;
|
||||
case PlayerBuildInfo::TypeDevel:
|
||||
ui.selectedDescription->setText(tr("The development version is "
|
||||
"updated on every code change."));
|
||||
voice = false;
|
||||
break;
|
||||
case PlayerBuildInfo::TypeCandidate:
|
||||
ui.selectedDescription->setText(tr("This will eventually become the "
|
||||
"next Rockbox version. Install it to help testing."));
|
||||
voice = false;
|
||||
break;
|
||||
case PlayerBuildInfo::TypeDaily:
|
||||
ui.selectedDescription->setText(tr("Daily updated development version."));
|
||||
voice = true;
|
||||
break;
|
||||
}
|
||||
ui.voiceCheckbox->setEnabled(voice);
|
||||
ui.voiceCombobox->setEnabled(voice);
|
||||
ui.voiceLabel->setEnabled(voice);
|
||||
ui.voiceCheckbox->setToolTip(voice ? "" : tr("Not available for the selected version"));
|
||||
|
||||
updateVoiceLangs();
|
||||
}
|
||||
|
||||
|
||||
void SelectiveInstallWidget::updateVersion(void)
|
||||
{
|
||||
// get some configuration values globally
|
||||
m_mountpoint = RbSettings::value(RbSettings::Mountpoint).toString();
|
||||
m_target = RbSettings::value(RbSettings::CurrentPlatform).toString();
|
||||
m_blmethod = PlayerBuildInfo::instance()->value(
|
||||
PlayerBuildInfo::BootloaderMethod, m_target).toString();
|
||||
|
||||
if(m_logger != nullptr) {
|
||||
delete m_logger;
|
||||
m_logger = nullptr;
|
||||
}
|
||||
|
||||
// re-populate all version items
|
||||
QMap<PlayerBuildInfo::BuildType, QString> types;
|
||||
types[PlayerBuildInfo::TypeRelease] = tr("Stable Release (Version %1)");
|
||||
if (PlayerBuildInfo::instance()->value(PlayerBuildInfo::BuildStatus).toInt() != STATUS_RETIRED) {
|
||||
types[PlayerBuildInfo::TypeCandidate] = tr("Release Candidate (Revison %1)");
|
||||
types[PlayerBuildInfo::TypeDaily] = tr("Daily Build (%1)");
|
||||
types[PlayerBuildInfo::TypeDevel] = tr("Development Version (Revison %1)");
|
||||
}
|
||||
|
||||
ui.selectedVersion->clear();
|
||||
for(auto i = types.begin(); i != types.end(); i++) {
|
||||
QString version = PlayerBuildInfo::instance()->value(
|
||||
PlayerBuildInfo::BuildVersion, i.key()).toString();
|
||||
if(!version.isEmpty())
|
||||
ui.selectedVersion->addItem(i.value().arg(version), i.key());
|
||||
}
|
||||
|
||||
// select previously selected version
|
||||
int index = ui.selectedVersion->findData(
|
||||
static_cast<PlayerBuildInfo::BuildType>(RbSettings::value(RbSettings::Build).toInt()));
|
||||
if(index < 0) {
|
||||
index = ui.selectedVersion->findData(PlayerBuildInfo::TypeRelease);
|
||||
if(index < 0) {
|
||||
index = ui.selectedVersion->findData(PlayerBuildInfo::TypeDevel);
|
||||
}
|
||||
}
|
||||
ui.selectedVersion->setCurrentIndex(index);
|
||||
// check if Rockbox is installed. If it is untick the bootloader option, as
|
||||
// well as if the selected player doesn't need a bootloader.
|
||||
if(m_blmethod == "none") {
|
||||
ui.bootloaderCheckbox->setEnabled(false);
|
||||
ui.bootloaderCheckbox->setChecked(false);
|
||||
ui.bootloaderLabel->setEnabled(false);
|
||||
ui.bootloaderLabel->setText(tr("The selected player doesn't need a bootloader."));
|
||||
}
|
||||
else {
|
||||
ui.bootloaderCheckbox->setEnabled(true);
|
||||
ui.bootloaderLabel->setEnabled(true);
|
||||
ui.bootloaderLabel->setText(tr("The bootloader is required for starting "
|
||||
"Rockbox. Installation of the bootloader is only necessary "
|
||||
"on first time installation."));
|
||||
// check if Rockbox is installed by looking after rockbox-info.txt.
|
||||
// If installed uncheck bootloader installation.
|
||||
RockboxInfo info(m_mountpoint);
|
||||
ui.bootloaderCheckbox->setChecked(!info.success());
|
||||
}
|
||||
|
||||
updateVoiceLangs();
|
||||
}
|
||||
|
||||
void SelectiveInstallWidget::updateVoiceLangs()
|
||||
{
|
||||
// populate languages for voice file.
|
||||
QVariant current = ui.voiceCombobox->currentData();
|
||||
QMap<QString, QVariant> langs = PlayerBuildInfo::instance()->value(
|
||||
PlayerBuildInfo::LanguageList).toMap();
|
||||
QStringList voicelangs = PlayerBuildInfo::instance()->value(
|
||||
PlayerBuildInfo::BuildVoiceLangs, m_buildtype).toStringList();
|
||||
ui.voiceCombobox->clear();
|
||||
for(auto it = langs.begin(); it != langs.end(); it++) {
|
||||
if(voicelangs.contains(it.key())) {
|
||||
ui.voiceCombobox->addItem(it.value().toString(), it.key());
|
||||
LOG_INFO() << "available voices: adding" << it.key();
|
||||
}
|
||||
|
||||
}
|
||||
// try to select the previously selected one again (if still present)
|
||||
// TODO: Fall back to system language if not found, or english.
|
||||
int sel = ui.voiceCombobox->findData(current);
|
||||
if(sel >= 0)
|
||||
ui.voiceCombobox->setCurrentIndex(sel);
|
||||
|
||||
}
|
||||
|
||||
|
||||
void SelectiveInstallWidget::saveSettings(void)
|
||||
{
|
||||
LOG_INFO() << "saving current settings";
|
||||
|
||||
RbSettings::setValue(RbSettings::InstallRockbox, ui.rockboxCheckbox->isChecked());
|
||||
RbSettings::setValue(RbSettings::InstallFonts, ui.fontsCheckbox->isChecked());
|
||||
RbSettings::setValue(RbSettings::InstallThemes, ui.themesCheckbox->isChecked());
|
||||
RbSettings::setValue(RbSettings::InstallPluginData, ui.pluginDataCheckbox->isChecked());
|
||||
RbSettings::setValue(RbSettings::InstallVoice, ui.voiceCheckbox->isChecked());
|
||||
RbSettings::setValue(RbSettings::InstallManual, ui.manualCheckbox->isChecked());
|
||||
RbSettings::setValue(RbSettings::VoiceLanguage, ui.voiceCombobox->currentData().toString());
|
||||
}
|
||||
|
||||
|
||||
void SelectiveInstallWidget::startInstall(void)
|
||||
{
|
||||
LOG_INFO() << "starting installation";
|
||||
saveSettings();
|
||||
|
||||
m_installStage = 0;
|
||||
if(m_logger != nullptr) delete m_logger;
|
||||
m_logger = new ProgressLoggerGui(this);
|
||||
QString warning = Utils::checkEnvironment(false);
|
||||
if(!warning.isEmpty())
|
||||
{
|
||||
warning += "<br/>" + tr("Continue with installation?");
|
||||
if(QMessageBox::warning(this, tr("Really continue?"), warning,
|
||||
QMessageBox::Ok | QMessageBox::Abort, QMessageBox::Abort)
|
||||
== QMessageBox::Abort)
|
||||
{
|
||||
emit installSkipped(true);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
m_logger->show();
|
||||
if(!QFileInfo(m_mountpoint).isDir()) {
|
||||
m_logger->addItem(tr("Mountpoint is wrong"), LOGERROR);
|
||||
m_logger->setFinished();
|
||||
return;
|
||||
}
|
||||
// start installation. No errors until now.
|
||||
continueInstall(false);
|
||||
|
||||
}
|
||||
|
||||
|
||||
void SelectiveInstallWidget::continueInstall(bool error)
|
||||
{
|
||||
LOG_INFO() << "continuing install with stage" << m_installStage;
|
||||
if(error) {
|
||||
LOG_ERROR() << "Last part returned error.";
|
||||
m_logger->setFinished();
|
||||
m_installStage = 9;
|
||||
}
|
||||
m_installStage++;
|
||||
switch(m_installStage) {
|
||||
case 0: LOG_ERROR() << "Something wrong!"; break;
|
||||
case 1: installBootloader(); break;
|
||||
case 2: installRockbox(); break;
|
||||
case 3: installFonts(); break;
|
||||
case 4: installThemes(); break;
|
||||
case 5: installPluginData(); break;
|
||||
case 6: installVoicefile(); break;
|
||||
case 7: installManual(); break;
|
||||
case 8: installBootloaderPost(); break;
|
||||
default: break;
|
||||
}
|
||||
|
||||
if(m_installStage > 8) {
|
||||
LOG_INFO() << "All install stages done.";
|
||||
m_logger->setFinished();
|
||||
if(m_blmethod != "none") {
|
||||
// check if Rockbox is installed by looking after rockbox-info.txt.
|
||||
// If installed uncheck bootloader installation.
|
||||
RockboxInfo info(m_mountpoint);
|
||||
ui.bootloaderCheckbox->setChecked(!info.success());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void SelectiveInstallWidget::installBootloader(void)
|
||||
{
|
||||
if(ui.bootloaderCheckbox->isChecked()) {
|
||||
LOG_INFO() << "installing bootloader";
|
||||
|
||||
QString platform = RbSettings::value(RbSettings::Platform).toString();
|
||||
QString backupDestination = "";
|
||||
|
||||
// create installer
|
||||
BootloaderInstallBase *bl =
|
||||
BootloaderInstallHelper::createBootloaderInstaller(this,
|
||||
PlayerBuildInfo::instance()->value(
|
||||
PlayerBuildInfo::BootloaderMethod).toString());
|
||||
if(bl == nullptr) {
|
||||
m_logger->addItem(tr("No install method known."), LOGERROR);
|
||||
m_logger->setFinished();
|
||||
return;
|
||||
}
|
||||
|
||||
// the bootloader install class does NOT use any GUI stuff.
|
||||
// All messages are passed via signals.
|
||||
connect(bl, SIGNAL(done(bool)), m_logger, SLOT(setFinished()));
|
||||
connect(bl, SIGNAL(done(bool)), this, SLOT(continueInstall(bool)));
|
||||
connect(bl, SIGNAL(logItem(QString, int)), m_logger, SLOT(addItem(QString, int)));
|
||||
connect(bl, SIGNAL(logProgress(int, int)), m_logger, SLOT(setProgress(int, int)));
|
||||
// pass Abort button click signal to current installer
|
||||
connect(m_logger, SIGNAL(aborted()), bl, SLOT(progressAborted()));
|
||||
|
||||
// set bootloader filename. Do this now as installed() needs it.
|
||||
QStringList blfile = PlayerBuildInfo::instance()->value(
|
||||
PlayerBuildInfo::BootloaderFile).toStringList();
|
||||
QStringList blfilepath;
|
||||
for(int a = 0; a < blfile.size(); a++) {
|
||||
blfilepath.append(RbSettings::value(RbSettings::Mountpoint).toString()
|
||||
+ blfile.at(a));
|
||||
}
|
||||
bl->setBlFile(blfilepath);
|
||||
QUrl url(PlayerBuildInfo::instance()->value(PlayerBuildInfo::BootloaderUrl).toString()
|
||||
+ PlayerBuildInfo::instance()->value(PlayerBuildInfo::BootloaderName).toString());
|
||||
bl->setBlUrl(url);
|
||||
bl->setLogfile(RbSettings::value(RbSettings::Mountpoint).toString()
|
||||
+ "/.rockbox/rbutil.log");
|
||||
|
||||
if(bl->installed() == BootloaderInstallBase::BootloaderRockbox) {
|
||||
if(QMessageBox::question(this, tr("Bootloader detected"),
|
||||
tr("Bootloader already installed. Do you want to reinstall the bootloader?"),
|
||||
QMessageBox::Yes | QMessageBox::No) == QMessageBox::No) {
|
||||
// keep m_logger open for auto installs.
|
||||
// don't consider abort as error in auto-mode.
|
||||
m_logger->addItem(tr("Bootloader installation skipped"), LOGINFO);
|
||||
delete bl;
|
||||
emit installSkipped(true);
|
||||
return;
|
||||
}
|
||||
}
|
||||
else if(bl->installed() == BootloaderInstallBase::BootloaderOther
|
||||
&& bl->capabilities() & BootloaderInstallBase::Backup)
|
||||
{
|
||||
QString targetFolder = PlayerBuildInfo::instance()->value(
|
||||
PlayerBuildInfo::DisplayName).toString()
|
||||
+ " Firmware Backup";
|
||||
// remove invalid character(s)
|
||||
targetFolder.remove(QRegExp("[:/]"));
|
||||
if(QMessageBox::question(this, tr("Create Bootloader backup"),
|
||||
tr("You can create a backup of the original bootloader "
|
||||
"file. Press \"Yes\" to select an output folder on your "
|
||||
"computer to save the file to. The file will get placed "
|
||||
"in a new folder \"%1\" created below the selected folder.\n"
|
||||
"Press \"No\" to skip this step.").arg(targetFolder),
|
||||
QMessageBox::Yes | QMessageBox::No) == QMessageBox::Yes) {
|
||||
backupDestination = QFileDialog::getExistingDirectory(this,
|
||||
tr("Browse backup folder"), QDir::homePath());
|
||||
if(!backupDestination.isEmpty())
|
||||
backupDestination += "/" + targetFolder;
|
||||
|
||||
LOG_INFO() << "backing up to" << backupDestination;
|
||||
// backup needs to be done after the m_logger has been set up.
|
||||
}
|
||||
}
|
||||
|
||||
if(bl->capabilities() & BootloaderInstallBase::NeedsOf)
|
||||
{
|
||||
int ret;
|
||||
ret = QMessageBox::information(this, tr("Prerequisites"),
|
||||
bl->ofHint(),QMessageBox::Ok | QMessageBox::Abort);
|
||||
if(ret != QMessageBox::Ok) {
|
||||
// consider aborting an error to close window / abort automatic
|
||||
// installation.
|
||||
m_logger->addItem(tr("Bootloader installation aborted"), LOGINFO);
|
||||
m_logger->setFinished();
|
||||
emit installSkipped(true);
|
||||
return;
|
||||
}
|
||||
// open dialog to browse to of file
|
||||
QString offile;
|
||||
QString filter
|
||||
= PlayerBuildInfo::instance()->value(PlayerBuildInfo::BootloaderFilter).toString();
|
||||
if(!filter.isEmpty()) {
|
||||
filter = tr("Bootloader files (%1)").arg(filter) + ";;";
|
||||
}
|
||||
filter += tr("All files (*)");
|
||||
offile = QFileDialog::getOpenFileName(this,
|
||||
tr("Select firmware file"), QDir::homePath(), filter);
|
||||
if(!QFileInfo(offile).isReadable()) {
|
||||
m_logger->addItem(tr("Error opening firmware file"), LOGERROR);
|
||||
m_logger->setFinished();
|
||||
emit installSkipped(true);
|
||||
return;
|
||||
}
|
||||
if(!bl->setOfFile(offile, blfile)) {
|
||||
m_logger->addItem(tr("Error reading firmware file"), LOGERROR);
|
||||
m_logger->setFinished();
|
||||
emit installSkipped(true);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
// start install.
|
||||
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) {
|
||||
m_logger->setFinished();
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
bl->install();
|
||||
|
||||
}
|
||||
else {
|
||||
LOG_INFO() << "Bootloader install disabled.";
|
||||
emit installSkipped(false);
|
||||
}
|
||||
}
|
||||
|
||||
void SelectiveInstallWidget::installBootloaderPost()
|
||||
{
|
||||
// don't do anything if no bootloader install has been done.
|
||||
if(ui.bootloaderCheckbox->isChecked()) {
|
||||
QString msg = BootloaderInstallHelper::postinstallHints(
|
||||
RbSettings::value(RbSettings::Platform).toString());
|
||||
if(!msg.isEmpty()) {
|
||||
QMessageBox::information(this, tr("Manual steps required"), msg);
|
||||
}
|
||||
}
|
||||
emit installSkipped(false);
|
||||
}
|
||||
|
||||
|
||||
void SelectiveInstallWidget::installRockbox(void)
|
||||
{
|
||||
if(ui.rockboxCheckbox->isChecked()) {
|
||||
LOG_INFO() << "installing Rockbox";
|
||||
QString url;
|
||||
|
||||
RbSettings::setValue(RbSettings::Build, m_buildtype);
|
||||
RbSettings::sync();
|
||||
|
||||
url = PlayerBuildInfo::instance()->value(
|
||||
PlayerBuildInfo::BuildUrl, m_buildtype).toString();
|
||||
//! install build
|
||||
if(m_zipinstaller != nullptr) m_zipinstaller->deleteLater();
|
||||
m_zipinstaller = new ZipInstaller(this);
|
||||
m_zipinstaller->setUrl(url);
|
||||
m_zipinstaller->setLogSection("Rockbox (Base)");
|
||||
if(!RbSettings::value(RbSettings::CacheDisabled).toBool())
|
||||
m_zipinstaller->setCache(true);
|
||||
m_zipinstaller->setLogVersion(PlayerBuildInfo::instance()->value(
|
||||
PlayerBuildInfo::BuildVersion, m_buildtype).toString());
|
||||
m_zipinstaller->setMountPoint(m_mountpoint);
|
||||
|
||||
connect(m_zipinstaller, SIGNAL(done(bool)), this, SLOT(continueInstall(bool)));
|
||||
|
||||
connect(m_zipinstaller, SIGNAL(logItem(QString, int)), m_logger, SLOT(addItem(QString, int)));
|
||||
connect(m_zipinstaller, SIGNAL(logProgress(int, int)), m_logger, SLOT(setProgress(int, int)));
|
||||
connect(m_logger, SIGNAL(aborted()), m_zipinstaller, SLOT(abort()));
|
||||
m_zipinstaller->install();
|
||||
|
||||
}
|
||||
else {
|
||||
LOG_INFO() << "Rockbox install disabled.";
|
||||
emit installSkipped(false);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void SelectiveInstallWidget::installFonts(void)
|
||||
{
|
||||
if(ui.fontsCheckbox->isChecked()) {
|
||||
LOG_INFO() << "installing Fonts";
|
||||
|
||||
RockboxInfo installInfo(m_mountpoint);
|
||||
QString fontsurl;
|
||||
QString logversion;
|
||||
QString relversion = installInfo.release();
|
||||
if(!relversion.isEmpty()) {
|
||||
// release is empty for non-release versions (i.e. daily / current)
|
||||
logversion = installInfo.release();
|
||||
}
|
||||
fontsurl = PlayerBuildInfo::instance()->value(
|
||||
PlayerBuildInfo::BuildFontUrl, m_buildtype).toString();
|
||||
fontsurl.replace("%RELVERSION%", relversion);
|
||||
|
||||
// create new zip installer
|
||||
if(m_zipinstaller != nullptr) m_zipinstaller->deleteLater();
|
||||
m_zipinstaller = new ZipInstaller(this);
|
||||
m_zipinstaller->setUrl(fontsurl);
|
||||
m_zipinstaller->setLogSection("Fonts");
|
||||
m_zipinstaller->setLogVersion(logversion);
|
||||
m_zipinstaller->setMountPoint(m_mountpoint);
|
||||
if(!RbSettings::value(RbSettings::CacheDisabled).toBool())
|
||||
m_zipinstaller->setCache(true);
|
||||
|
||||
connect(m_zipinstaller, SIGNAL(done(bool)), this, SLOT(continueInstall(bool)));
|
||||
connect(m_zipinstaller, SIGNAL(logItem(QString, int)), m_logger, SLOT(addItem(QString, int)));
|
||||
connect(m_zipinstaller, SIGNAL(logProgress(int, int)), m_logger, SLOT(setProgress(int, int)));
|
||||
connect(m_logger, SIGNAL(aborted()), m_zipinstaller, SLOT(abort()));
|
||||
m_zipinstaller->install();
|
||||
}
|
||||
else {
|
||||
LOG_INFO() << "Fonts install disabled.";
|
||||
emit installSkipped(false);
|
||||
}
|
||||
}
|
||||
|
||||
void SelectiveInstallWidget::installVoicefile(void)
|
||||
{
|
||||
if(ui.voiceCheckbox->isChecked() && ui.voiceCheckbox->isEnabled()) {
|
||||
LOG_INFO() << "installing Voice file";
|
||||
QString lang = ui.voiceCombobox->currentData().toString();
|
||||
|
||||
RockboxInfo installInfo(m_mountpoint);
|
||||
QString voiceurl;
|
||||
QString logversion;
|
||||
QString relversion = installInfo.release();
|
||||
if(m_buildtype != PlayerBuildInfo::TypeRelease) {
|
||||
// release is empty for non-release versions (i.e. daily / current)
|
||||
logversion = installInfo.release();
|
||||
}
|
||||
voiceurl = PlayerBuildInfo::instance()->value(
|
||||
PlayerBuildInfo::BuildVoiceUrl, m_buildtype).toString();
|
||||
voiceurl.replace("%LANGUAGE%", lang);
|
||||
|
||||
// create new zip installer
|
||||
if(m_zipinstaller != nullptr) m_zipinstaller->deleteLater();
|
||||
m_zipinstaller = new ZipInstaller(this);
|
||||
m_zipinstaller->setUrl(voiceurl);
|
||||
m_zipinstaller->setLogSection("Prerendered Voice (" + lang + ")");
|
||||
m_zipinstaller->setLogVersion(logversion);
|
||||
m_zipinstaller->setMountPoint(m_mountpoint);
|
||||
if(!RbSettings::value(RbSettings::CacheDisabled).toBool())
|
||||
m_zipinstaller->setCache(true);
|
||||
|
||||
connect(m_zipinstaller, SIGNAL(done(bool)), this, SLOT(continueInstall(bool)));
|
||||
connect(m_zipinstaller, SIGNAL(logItem(QString, int)), m_logger, SLOT(addItem(QString, int)));
|
||||
connect(m_zipinstaller, SIGNAL(logProgress(int, int)), m_logger, SLOT(setProgress(int, int)));
|
||||
connect(m_logger, SIGNAL(aborted()), m_zipinstaller, SLOT(abort()));
|
||||
m_zipinstaller->install();
|
||||
}
|
||||
else {
|
||||
LOG_INFO() << "Voice install disabled.";
|
||||
emit installSkipped(false);
|
||||
}
|
||||
}
|
||||
|
||||
void SelectiveInstallWidget::installManual(void)
|
||||
{
|
||||
if(ui.manualCheckbox->isChecked() && ui.manualCheckbox->isEnabled()) {
|
||||
LOG_INFO() << "installing Manual";
|
||||
QString mantype = ui.manualCombobox->currentData().toString();
|
||||
|
||||
RockboxInfo installInfo(m_mountpoint);
|
||||
QString manualurl;
|
||||
QString logversion;
|
||||
QString relversion = installInfo.release();
|
||||
if(m_buildtype != PlayerBuildInfo::TypeRelease) {
|
||||
// release is empty for non-release versions (i.e. daily / current)
|
||||
logversion = installInfo.release();
|
||||
}
|
||||
|
||||
manualurl = PlayerBuildInfo::instance()->value(
|
||||
PlayerBuildInfo::BuildManualUrl, m_buildtype).toString();
|
||||
if(mantype == "pdf")
|
||||
manualurl.replace("%FORMAT%", ".pdf");
|
||||
else
|
||||
manualurl.replace("%FORMAT%", "-html.zip");
|
||||
|
||||
// create new zip installer
|
||||
if(m_zipinstaller != nullptr) m_zipinstaller->deleteLater();
|
||||
m_zipinstaller = new ZipInstaller(this);
|
||||
m_zipinstaller->setUrl(manualurl);
|
||||
m_zipinstaller->setLogSection("Manual (" + mantype + ")");
|
||||
m_zipinstaller->setLogVersion(logversion);
|
||||
m_zipinstaller->setMountPoint(m_mountpoint);
|
||||
if(!RbSettings::value(RbSettings::CacheDisabled).toBool())
|
||||
m_zipinstaller->setCache(true);
|
||||
// if type is html extract it.
|
||||
m_zipinstaller->setUnzip(mantype == "html");
|
||||
|
||||
connect(m_zipinstaller, SIGNAL(done(bool)), this, SLOT(continueInstall(bool)));
|
||||
connect(m_zipinstaller, SIGNAL(logItem(QString, int)), m_logger, SLOT(addItem(QString, int)));
|
||||
connect(m_zipinstaller, SIGNAL(logProgress(int, int)), m_logger, SLOT(setProgress(int, int)));
|
||||
connect(m_logger, SIGNAL(aborted()), m_zipinstaller, SLOT(abort()));
|
||||
m_zipinstaller->install();
|
||||
}
|
||||
else {
|
||||
LOG_INFO() << "Manual install disabled.";
|
||||
emit installSkipped(false);
|
||||
}
|
||||
}
|
||||
|
||||
void SelectiveInstallWidget::customizeThemes(void)
|
||||
{
|
||||
if(m_themesinstaller == nullptr)
|
||||
m_themesinstaller = new ThemesInstallWindow(this);
|
||||
|
||||
m_themesinstaller->setSelectOnly(true);
|
||||
m_themesinstaller->show();
|
||||
}
|
||||
|
||||
|
||||
void SelectiveInstallWidget::installThemes(void)
|
||||
{
|
||||
if(ui.themesCheckbox->isChecked()) {
|
||||
LOG_INFO() << "installing themes";
|
||||
if(m_themesinstaller == nullptr)
|
||||
m_themesinstaller = new ThemesInstallWindow(this);
|
||||
|
||||
connect(m_themesinstaller, SIGNAL(done(bool)), this, SLOT(continueInstall(bool)));
|
||||
m_themesinstaller->setLogger(m_logger);
|
||||
m_themesinstaller->setModal(true);
|
||||
m_themesinstaller->install();
|
||||
}
|
||||
else {
|
||||
LOG_INFO() << "Themes install disabled.";
|
||||
emit installSkipped(false);
|
||||
}
|
||||
}
|
||||
|
||||
static const struct {
|
||||
const char *name; // display name
|
||||
const char *rockfile; // rock file to look for
|
||||
PlayerBuildInfo::BuildInfo zipurl; // download url
|
||||
} PluginDataFiles[] = {
|
||||
{ "Doom", "games/doom.rock", PlayerBuildInfo::DoomUrl },
|
||||
{ "Duke3D", "games/duke3d.rock", PlayerBuildInfo::Duke3DUrl },
|
||||
{ "Quake", "games/quake.rock", PlayerBuildInfo::QuakeUrl },
|
||||
{ "Puzzles fonts", "games/sgt-blackbox.rock", PlayerBuildInfo::PuzzFontsUrl },
|
||||
{ "Wolf3D", "games/wolf3d.rock", PlayerBuildInfo::Wolf3DUrl },
|
||||
{ "XWorld", "games/xworld.rock", PlayerBuildInfo::XWorldUrl },
|
||||
{ "MIDI Patchset", "viewers/midi.rock", PlayerBuildInfo::MidiPatchsetUrl },
|
||||
};
|
||||
|
||||
void SelectiveInstallWidget::installPluginData(void)
|
||||
{
|
||||
if(ui.pluginDataCheckbox->isChecked()) {
|
||||
// build a list of zip urls that we need, then install
|
||||
QStringList dataUrls;
|
||||
QStringList dataName;
|
||||
|
||||
for(size_t i = 0; i < sizeof(PluginDataFiles) / sizeof(PluginDataFiles[0]); i++)
|
||||
{
|
||||
// check if installed Rockbox has this plugin.
|
||||
if(QFileInfo(m_mountpoint + "/.rockbox/rocks/" + PluginDataFiles[i].rockfile).exists()) {
|
||||
dataName.append(PluginDataFiles[i].name);
|
||||
// game URLs do not depend on the actual build type, but we need
|
||||
// to pass it (simplifies the API, and will allow to make them
|
||||
// type specific later if needed)
|
||||
dataUrls.append(PlayerBuildInfo::instance()->value(
|
||||
PluginDataFiles[i].zipurl, m_buildtype).toString());
|
||||
}
|
||||
}
|
||||
|
||||
if(dataUrls.size() == 0)
|
||||
{
|
||||
m_logger->addItem(
|
||||
tr("Your installation doesn't require any plugin data files, skipping."),
|
||||
LOGINFO);
|
||||
emit installSkipped(false);
|
||||
return;
|
||||
}
|
||||
|
||||
LOG_INFO() << "installing plugin data files";
|
||||
|
||||
// create new zip installer
|
||||
if(m_zipinstaller != nullptr) m_zipinstaller->deleteLater();
|
||||
m_zipinstaller = new ZipInstaller(this);
|
||||
|
||||
m_zipinstaller->setUrl(dataUrls);
|
||||
m_zipinstaller->setLogSection(dataName);
|
||||
m_zipinstaller->setLogVersion();
|
||||
m_zipinstaller->setMountPoint(m_mountpoint);
|
||||
if(!RbSettings::value(RbSettings::CacheDisabled).toBool())
|
||||
m_zipinstaller->setCache(true);
|
||||
connect(m_zipinstaller, SIGNAL(done(bool)), this, SLOT(continueInstall(bool)));
|
||||
connect(m_zipinstaller, SIGNAL(logItem(QString, int)), m_logger, SLOT(addItem(QString, int)));
|
||||
connect(m_zipinstaller, SIGNAL(logProgress(int, int)), m_logger, SLOT(setProgress(int, int)));
|
||||
connect(m_logger, SIGNAL(aborted()), m_zipinstaller, SLOT(abort()));
|
||||
m_zipinstaller->install();
|
||||
}
|
||||
else {
|
||||
LOG_INFO() << "Gamefile install disabled.";
|
||||
emit installSkipped(false);
|
||||
}
|
||||
}
|
||||
|
||||
void SelectiveInstallWidget::changeEvent(QEvent *e)
|
||||
{
|
||||
if(e->type() == QEvent::LanguageChange) {
|
||||
ui.retranslateUi(this);
|
||||
} else {
|
||||
QWidget::changeEvent(e);
|
||||
}
|
||||
}
|
||||
74
utils/rbutilqt/gui/selectiveinstallwidget.h
Normal file
74
utils/rbutilqt/gui/selectiveinstallwidget.h
Normal file
|
|
@ -0,0 +1,74 @@
|
|||
/***************************************************************************
|
||||
* __________ __ ___.
|
||||
* Open \______ \ ____ ____ | | _\_ |__ _______ ___
|
||||
* Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
|
||||
* Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
|
||||
* Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
|
||||
* \/ \/ \/ \/ \/
|
||||
*
|
||||
* Copyright (C) 2012 by Dominik Riebeling
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
#ifndef SELECTIVEINSTALLWIDGET_H
|
||||
#define SELECTIVEINSTALLWIDGET_H
|
||||
|
||||
#include <QWidget>
|
||||
#include "ui_selectiveinstallwidgetfrm.h"
|
||||
#include "progressloggergui.h"
|
||||
#include "zipinstaller.h"
|
||||
#include "themesinstallwindow.h"
|
||||
#include "playerbuildinfo.h"
|
||||
|
||||
class SelectiveInstallWidget : public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
SelectiveInstallWidget(QWidget* parent = nullptr);
|
||||
|
||||
public slots:
|
||||
void updateVersion(void);
|
||||
void saveSettings(void);
|
||||
void startInstall(void);
|
||||
|
||||
private slots:
|
||||
void continueInstall(bool);
|
||||
void customizeThemes(void);
|
||||
void selectedVersionChanged(int);
|
||||
void updateVoiceLangs();
|
||||
|
||||
private:
|
||||
void installBootloader(void);
|
||||
void installRockbox(void);
|
||||
void installFonts(void);
|
||||
void installVoicefile(void);
|
||||
void installManual(void);
|
||||
void installThemes(void);
|
||||
void installPluginData(void);
|
||||
void installBootloaderPost(void);
|
||||
|
||||
signals:
|
||||
void installSkipped(bool);
|
||||
|
||||
private:
|
||||
void changeEvent(QEvent *e);
|
||||
|
||||
Ui::SelectiveInstallWidget ui;
|
||||
QString m_target;
|
||||
QString m_blmethod;
|
||||
QString m_mountpoint;
|
||||
ProgressLoggerGui *m_logger;
|
||||
int m_installStage;
|
||||
ZipInstaller *m_zipinstaller;
|
||||
ThemesInstallWindow *m_themesinstaller;
|
||||
PlayerBuildInfo::BuildType m_buildtype;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
316
utils/rbutilqt/gui/selectiveinstallwidgetfrm.ui
Normal file
316
utils/rbutilqt/gui/selectiveinstallwidgetfrm.ui
Normal file
|
|
@ -0,0 +1,316 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>SelectiveInstallWidget</class>
|
||||
<widget class="QWidget" name="SelectiveInstallWidget">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>663</width>
|
||||
<height>440</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="MinimumExpanding" vsizetype="MinimumExpanding">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Selective Installation</string>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout_3">
|
||||
<item row="0" column="0">
|
||||
<widget class="QGroupBox" name="versionSelectGroupBox">
|
||||
<property name="title">
|
||||
<string>Rockbox version to install</string>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout">
|
||||
<item row="0" column="0">
|
||||
<widget class="QComboBox" name="selectedVersion"/>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<widget class="QLabel" name="selectedDescription">
|
||||
<property name="text">
|
||||
<string>Version information not available yet.</string>
|
||||
</property>
|
||||
<property name="wordWrap">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QGroupBox" name="groupBox">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="MinimumExpanding" vsizetype="MinimumExpanding">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="title">
|
||||
<string>Rockbox components to install</string>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout_2">
|
||||
<item row="0" column="0">
|
||||
<widget class="QCheckBox" name="bootloaderCheckbox">
|
||||
<property name="text">
|
||||
<string>&Bootloader</string>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="../rbutilqt.qrc">
|
||||
<normaloff>:/icons/preferences-system.svg</normaloff>:/icons/preferences-system.svg</iconset>
|
||||
</property>
|
||||
<property name="checked">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QCheckBox" name="rockboxCheckbox">
|
||||
<property name="text">
|
||||
<string>&Rockbox</string>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="../rbutilqt.qrc">
|
||||
<normaloff>:/icons/multimedia-player.svg</normaloff>:/icons/multimedia-player.svg</iconset>
|
||||
</property>
|
||||
<property name="checked">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="2">
|
||||
<widget class="QLabel" name="themesLabel">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Preferred">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Themes allow adjusting the user interface of Rockbox. Use "Customize" to select themes.</string>
|
||||
</property>
|
||||
<property name="wordWrap">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="0">
|
||||
<widget class="QCheckBox" name="themesCheckbox">
|
||||
<property name="text">
|
||||
<string>Themes</string>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="../rbutilqt.qrc">
|
||||
<normaloff>:/icons/preferences-desktop-theme.svg</normaloff>:/icons/preferences-desktop-theme.svg</iconset>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="0">
|
||||
<widget class="QCheckBox" name="fontsCheckbox">
|
||||
<property name="text">
|
||||
<string>Fonts</string>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="../rbutilqt.qrc">
|
||||
<normaloff>:/icons/preferences-desktop-font.svg</normaloff>:/icons/preferences-desktop-font.svg</iconset>
|
||||
</property>
|
||||
<property name="checked">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="2">
|
||||
<widget class="QLabel" name="bootloaderLabel">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Preferred">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>The bootloader is required for starting Rockbox. Only necessary for first time install.</string>
|
||||
</property>
|
||||
<property name="wordWrap">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="6" column="2">
|
||||
<widget class="QLabel" name="pluginDataLabe">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Preferred">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Some plugins require additional data files.</string>
|
||||
</property>
|
||||
<property name="wordWrap">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="4">
|
||||
<widget class="QPushButton" name="themesCustomize">
|
||||
<property name="text">
|
||||
<string>Customize</string>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="../rbutilqt.qrc">
|
||||
<normaloff>:/icons/preferences-system.svg</normaloff>:/icons/preferences-system.svg</iconset>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="2">
|
||||
<widget class="QLabel" name="fontsLabel">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Preferred">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Additional fonts for the User Interface.</string>
|
||||
</property>
|
||||
<property name="wordWrap">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="7" column="2">
|
||||
<widget class="QLabel" name="voiceLabel">
|
||||
<property name="text">
|
||||
<string>Install prerendered voice file.</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="6" column="0">
|
||||
<widget class="QCheckBox" name="pluginDataCheckbox">
|
||||
<property name="text">
|
||||
<string>Plugin Data</string>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="../rbutilqt.qrc">
|
||||
<normaloff>:/icons/input-gaming.svg</normaloff>:/icons/input-gaming.svg</iconset>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="3">
|
||||
<spacer name="horizontalSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeType">
|
||||
<enum>QSizePolicy::Minimum</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>1</width>
|
||||
<height>1</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item row="8" column="0">
|
||||
<widget class="QCheckBox" name="manualCheckbox">
|
||||
<property name="text">
|
||||
<string>&Manual</string>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="../rbutilqt.qrc">
|
||||
<normaloff>:/icons/edit-find.svg</normaloff>:/icons/edit-find.svg</iconset>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="7" column="0">
|
||||
<widget class="QCheckBox" name="voiceCheckbox">
|
||||
<property name="text">
|
||||
<string>&Voice File</string>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="../rbutilqt.qrc">
|
||||
<normaloff>:/icons/audio-volume-high.svg</normaloff>:/icons/audio-volume-high.svg</iconset>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="7" column="4">
|
||||
<widget class="QComboBox" name="voiceCombobox"/>
|
||||
</item>
|
||||
<item row="1" column="2">
|
||||
<widget class="QLabel" name="rockboxLabel">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Preferred">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>The main Rockbox firmware.</string>
|
||||
</property>
|
||||
<property name="wordWrap">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="8" column="2">
|
||||
<widget class="QLabel" name="manualLabel">
|
||||
<property name="text">
|
||||
<string>Save a copy of the manual on the player.</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="8" column="4">
|
||||
<widget class="QComboBox" name="manualCombobox"/>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="0">
|
||||
<spacer name="verticalSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
<property name="sizeType">
|
||||
<enum>QSizePolicy::Expanding</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>20</width>
|
||||
<height>1</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item row="3" column="0">
|
||||
<widget class="QPushButton" name="installButton">
|
||||
<property name="text">
|
||||
<string>&Install</string>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="../rbutilqt.qrc">
|
||||
<normaloff>:/icons/package-x-generic.svg</normaloff>:/icons/package-x-generic.svg</iconset>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<tabstops>
|
||||
<tabstop>selectedVersion</tabstop>
|
||||
<tabstop>bootloaderCheckbox</tabstop>
|
||||
<tabstop>rockboxCheckbox</tabstop>
|
||||
<tabstop>fontsCheckbox</tabstop>
|
||||
<tabstop>themesCheckbox</tabstop>
|
||||
<tabstop>themesCustomize</tabstop>
|
||||
<tabstop>pluginDataCheckbox</tabstop>
|
||||
<tabstop>installButton</tabstop>
|
||||
</tabstops>
|
||||
<resources>
|
||||
<include location="../rbutilqt.qrc"/>
|
||||
</resources>
|
||||
<connections/>
|
||||
</ui>
|
||||
Loading…
Add table
Add a link
Reference in a new issue