2007-08-15 21:54:15 +00:00
|
|
|
/***************************************************************************
|
|
|
|
* __________ __ ___.
|
|
|
|
* Open \______ \ ____ ____ | | _\_ |__ _______ ___
|
|
|
|
* Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
|
|
|
|
* Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
|
|
|
|
* Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
|
|
|
|
* \/ \/ \/ \/ \/
|
|
|
|
*
|
|
|
|
* Copyright (C) 2007 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.
|
|
|
|
*
|
|
|
|
****************************************************************************/
|
|
|
|
|
2013-01-27 11:01:56 +00:00
|
|
|
#include <QDialog>
|
|
|
|
#include <QMessageBox>
|
2020-10-29 20:07:42 +00:00
|
|
|
#include <QTextCodec>
|
2007-08-15 21:54:15 +00:00
|
|
|
|
2009-03-31 19:50:43 +00:00
|
|
|
#include "ui_themesinstallfrm.h"
|
|
|
|
#include "themesinstallwindow.h"
|
2009-04-27 19:58:24 +00:00
|
|
|
#include "zipinstaller.h"
|
2007-08-15 21:54:15 +00:00
|
|
|
#include "progressloggergui.h"
|
2007-09-14 22:16:22 +00:00
|
|
|
#include "utils.h"
|
2009-05-09 16:59:14 +00:00
|
|
|
#include "rbsettings.h"
|
2010-01-24 21:12:11 +00:00
|
|
|
#include "systeminfo.h"
|
2010-06-06 12:56:27 +00:00
|
|
|
#include "rockboxinfo.h"
|
|
|
|
#include "version.h"
|
2013-11-03 10:08:18 +00:00
|
|
|
#include "Logger.h"
|
2007-08-15 21:54:15 +00:00
|
|
|
|
|
|
|
ThemesInstallWindow::ThemesInstallWindow(QWidget *parent) : QDialog(parent)
|
|
|
|
{
|
|
|
|
ui.setupUi(this);
|
|
|
|
ui.listThemes->setAlternatingRowColors(true);
|
|
|
|
ui.listThemes->setSelectionMode(QAbstractItemView::ExtendedSelection);
|
2009-03-30 21:15:38 +00:00
|
|
|
ui.listThemes->setSortingEnabled(true);
|
2007-08-15 21:54:15 +00:00
|
|
|
ui.themePreview->clear();
|
|
|
|
ui.themePreview->setText(tr("no theme selected"));
|
2009-03-30 21:15:43 +00:00
|
|
|
ui.labelSize->setText(tr("no selection"));
|
2010-01-03 20:04:45 +00:00
|
|
|
ui.listThemes->setLayoutDirection(Qt::LeftToRight);
|
2009-10-31 17:16:34 +00:00
|
|
|
ui.themeDescription->setLayoutDirection(Qt::LeftToRight);
|
2007-09-14 22:16:22 +00:00
|
|
|
|
2007-08-15 21:54:15 +00:00
|
|
|
connect(ui.buttonCancel, SIGNAL(clicked()), this, SLOT(close()));
|
|
|
|
connect(ui.buttonOk, SIGNAL(clicked()), this, SLOT(accept()));
|
2009-03-30 21:15:43 +00:00
|
|
|
connect(ui.listThemes, SIGNAL(currentItemChanged(QListWidgetItem*, QListWidgetItem*)),
|
|
|
|
this, SLOT(updateDetails(QListWidgetItem*, QListWidgetItem*)));
|
|
|
|
connect(ui.listThemes, SIGNAL(itemSelectionChanged()), this, SLOT(updateSize()));
|
2009-03-22 08:33:39 +00:00
|
|
|
connect(&igetter, SIGNAL(done(bool)), this, SLOT(updateImage(bool)));
|
2012-06-23 09:15:46 +00:00
|
|
|
|
2013-01-27 09:32:02 +00:00
|
|
|
if(!RbSettings::value(RbSettings::CacheDisabled).toBool())
|
|
|
|
igetter.setCache(true);
|
|
|
|
else
|
|
|
|
{
|
|
|
|
if(infocachedir.isEmpty())
|
|
|
|
{
|
|
|
|
infocachedir = QDir::tempPath() + "rbutil-themeinfo";
|
|
|
|
QDir d = QDir::temp();
|
|
|
|
d.mkdir("rbutil-themeinfo");
|
|
|
|
}
|
|
|
|
igetter.setCache(infocachedir);
|
|
|
|
}
|
|
|
|
|
2012-06-23 09:15:46 +00:00
|
|
|
logger = NULL;
|
2007-08-15 21:54:15 +00:00
|
|
|
}
|
|
|
|
|
2007-09-14 22:16:22 +00:00
|
|
|
ThemesInstallWindow::~ThemesInstallWindow()
|
|
|
|
{
|
2013-01-27 09:32:02 +00:00
|
|
|
if(!infocachedir.isEmpty())
|
2010-04-02 21:24:19 +00:00
|
|
|
Utils::recursiveRmdir(infocachedir);
|
2007-09-14 22:16:22 +00:00
|
|
|
}
|
2007-08-15 21:54:15 +00:00
|
|
|
|
|
|
|
|
|
|
|
void ThemesInstallWindow::downloadInfo()
|
|
|
|
{
|
|
|
|
// try to get the current build information
|
|
|
|
getter = new HttpGet(this);
|
2010-06-06 12:56:27 +00:00
|
|
|
RockboxInfo installInfo
|
|
|
|
= RockboxInfo(RbSettings::value(RbSettings::Mountpoint).toString());
|
2009-03-22 19:56:13 +00:00
|
|
|
|
2007-08-15 21:54:15 +00:00
|
|
|
themesInfo.open();
|
2013-11-03 10:08:18 +00:00
|
|
|
LOG_INFO() << "downloading info to" << themesInfo.fileName();
|
2007-08-15 21:54:15 +00:00
|
|
|
themesInfo.close();
|
|
|
|
|
2010-06-02 21:55:22 +00:00
|
|
|
QString infoUrl = SystemInfo::value(SystemInfo::ThemesInfoUrl).toString();
|
|
|
|
infoUrl.replace("%TARGET%",
|
2020-11-14 15:33:48 +00:00
|
|
|
SystemInfo::platformValue(SystemInfo::ConfigureModel).toString());
|
2010-06-06 18:02:01 +00:00
|
|
|
infoUrl.replace("%REVISION%", installInfo.revision());
|
|
|
|
infoUrl.replace("%RELEASE%", installInfo.release());
|
2010-06-06 12:56:27 +00:00
|
|
|
infoUrl.replace("%RBUTILVER%", VERSION);
|
2010-06-02 21:55:22 +00:00
|
|
|
QUrl url = QUrl(infoUrl);
|
2013-11-03 10:08:18 +00:00
|
|
|
LOG_INFO() << "Info URL:" << url;
|
2007-08-15 21:54:15 +00:00
|
|
|
getter->setFile(&themesInfo);
|
2009-03-22 08:33:39 +00:00
|
|
|
|
2008-04-06 20:29:26 +00:00
|
|
|
connect(getter, SIGNAL(done(bool)), this, SLOT(downloadDone(bool)));
|
|
|
|
connect(logger, SIGNAL(aborted()), getter, SLOT(abort()));
|
2007-08-15 21:54:15 +00:00
|
|
|
getter->getFile(url);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void ThemesInstallWindow::downloadDone(int id, bool error)
|
|
|
|
{
|
|
|
|
downloadDone(error);
|
2013-11-03 10:08:18 +00:00
|
|
|
LOG_INFO() << "Download" << id << "done, error:" << error;
|
2007-08-15 21:54:15 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void ThemesInstallWindow::downloadDone(bool error)
|
|
|
|
{
|
2013-11-03 10:08:18 +00:00
|
|
|
LOG_INFO() << "Download done, error:" << error;
|
2007-08-15 21:54:15 +00:00
|
|
|
|
|
|
|
disconnect(logger, SIGNAL(aborted()), getter, SLOT(abort()));
|
|
|
|
disconnect(logger, SIGNAL(aborted()), this, SLOT(close()));
|
|
|
|
themesInfo.open();
|
|
|
|
|
|
|
|
QSettings iniDetails(themesInfo.fileName(), QSettings::IniFormat, this);
|
|
|
|
QStringList tl = iniDetails.childGroups();
|
2013-11-03 10:08:18 +00:00
|
|
|
LOG_INFO() << "Theme site result:"
|
|
|
|
<< iniDetails.value("error/code").toString()
|
|
|
|
<< iniDetails.value("error/description").toString()
|
|
|
|
<< iniDetails.value("error/query").toString();
|
2007-08-15 21:54:15 +00:00
|
|
|
|
|
|
|
if(error) {
|
2009-03-22 08:33:49 +00:00
|
|
|
logger->addItem(tr("Network error: %1.\n"
|
|
|
|
"Please check your network and proxy settings.")
|
2007-08-15 21:54:15 +00:00
|
|
|
.arg(getter->errorString()), LOGERROR);
|
|
|
|
getter->abort();
|
2009-05-02 18:40:04 +00:00
|
|
|
logger->setFinished();
|
2007-08-15 21:54:15 +00:00
|
|
|
disconnect(getter, SIGNAL(done(bool)), this, SLOT(downloadDone(bool)));
|
|
|
|
connect(logger, SIGNAL(closed()), this, SLOT(close()));
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
// handle possible error codes
|
|
|
|
if(iniDetails.value("error/code").toInt() != 0 || !iniDetails.contains("error/code")) {
|
2013-11-03 10:08:18 +00:00
|
|
|
LOG_ERROR() << "Theme site returned an error:"
|
|
|
|
<< iniDetails.value("error/code");
|
2007-08-15 21:54:15 +00:00
|
|
|
logger->addItem(tr("the following error occured:\n%1")
|
|
|
|
.arg(iniDetails.value("error/description", "unknown error").toString()), LOGERROR);
|
2009-05-02 18:40:04 +00:00
|
|
|
logger->setFinished();
|
2007-08-15 21:54:15 +00:00
|
|
|
connect(logger, SIGNAL(closed()), this, SLOT(close()));
|
|
|
|
return;
|
|
|
|
}
|
2010-01-10 17:13:32 +00:00
|
|
|
logger->addItem(tr("done."), LOGOK);
|
2009-05-02 18:40:04 +00:00
|
|
|
logger->setFinished();
|
2007-08-15 21:54:15 +00:00
|
|
|
logger->close();
|
|
|
|
|
|
|
|
// setup list
|
|
|
|
for(int i = 0; i < tl.size(); i++) {
|
|
|
|
iniDetails.beginGroup(tl.at(i));
|
|
|
|
// skip all themes without name field set (i.e. error section)
|
2009-03-22 08:33:49 +00:00
|
|
|
if(iniDetails.value("name").toString().isEmpty()) {
|
|
|
|
iniDetails.endGroup();
|
|
|
|
continue;
|
|
|
|
}
|
2013-11-03 10:08:18 +00:00
|
|
|
LOG_INFO() << "adding to list:" << tl.at(i);
|
2009-04-27 17:48:49 +00:00
|
|
|
// convert to unicode and replace HTML-specific entities
|
|
|
|
QByteArray raw = iniDetails.value("name").toByteArray();
|
|
|
|
QTextCodec* codec = QTextCodec::codecForHtml(raw);
|
|
|
|
QString name = codec->toUnicode(raw);
|
|
|
|
name.replace(""", "\"").replace("&", "&");
|
|
|
|
name.replace("<", "<").replace(">", ">");
|
2007-08-15 21:54:15 +00:00
|
|
|
QListWidgetItem *w = new QListWidgetItem;
|
2009-04-27 17:48:49 +00:00
|
|
|
w->setData(Qt::DisplayRole, name.trimmed());
|
2007-08-15 21:54:15 +00:00
|
|
|
w->setData(Qt::UserRole, tl.at(i));
|
|
|
|
ui.listThemes->addItem(w);
|
|
|
|
|
|
|
|
iniDetails.endGroup();
|
|
|
|
}
|
2009-03-22 21:39:40 +00:00
|
|
|
// check if there's a themes "MOTD" available
|
|
|
|
if(iniDetails.contains("status/msg")) {
|
|
|
|
// check if there's a localized msg available
|
2009-05-09 16:59:14 +00:00
|
|
|
QString lang = RbSettings::value(RbSettings::Language).toString().split("_").at(0);
|
2009-03-22 21:39:40 +00:00
|
|
|
QString msg;
|
|
|
|
if(iniDetails.contains("status/msg." + lang))
|
|
|
|
msg = iniDetails.value("status/msg." + lang).toString();
|
|
|
|
else
|
|
|
|
msg = iniDetails.value("status/msg").toString();
|
2013-11-03 10:08:18 +00:00
|
|
|
LOG_INFO() << "MOTD" << msg;
|
2009-03-29 21:11:27 +00:00
|
|
|
if(!msg.isEmpty())
|
|
|
|
QMessageBox::information(this, tr("Information"), msg);
|
2009-03-22 21:39:40 +00:00
|
|
|
}
|
2007-08-15 21:54:15 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2009-03-30 21:15:43 +00:00
|
|
|
void ThemesInstallWindow::updateSize(void)
|
2007-08-15 21:54:15 +00:00
|
|
|
{
|
2009-03-30 21:15:43 +00:00
|
|
|
long size = 0;
|
|
|
|
// sum up size for all selected themes
|
|
|
|
QSettings iniDetails(themesInfo.fileName(), QSettings::IniFormat, this);
|
|
|
|
int items = ui.listThemes->selectedItems().size();
|
|
|
|
for(int i = 0; i < items; i++) {
|
|
|
|
iniDetails.beginGroup(ui.listThemes->selectedItems()
|
|
|
|
.at(i)->data(Qt::UserRole).toString());
|
|
|
|
size += iniDetails.value("size").toInt();
|
|
|
|
iniDetails.endGroup();
|
|
|
|
}
|
|
|
|
ui.labelSize->setText(tr("Download size %L1 kiB (%n item(s))", "", items)
|
|
|
|
.arg((size + 512) / 1024));
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void ThemesInstallWindow::updateDetails(QListWidgetItem* cur, QListWidgetItem* prev)
|
|
|
|
{
|
|
|
|
if(cur == prev)
|
|
|
|
return;
|
2007-09-15 22:57:07 +00:00
|
|
|
|
2007-08-15 21:54:15 +00:00
|
|
|
QSettings iniDetails(themesInfo.fileName(), QSettings::IniFormat, this);
|
2009-03-30 21:15:43 +00:00
|
|
|
|
|
|
|
QCoreApplication::processEvents();
|
2007-08-15 21:54:15 +00:00
|
|
|
ui.themeDescription->setText(tr("fetching details for %1")
|
2009-03-30 21:15:43 +00:00
|
|
|
.arg(cur->data(Qt::DisplayRole).toString()));
|
2007-08-15 21:54:15 +00:00
|
|
|
ui.themePreview->clear();
|
2010-01-10 17:13:32 +00:00
|
|
|
ui.themePreview->setText(tr("fetching preview ..."));
|
2009-04-21 19:50:27 +00:00
|
|
|
imgData.clear();
|
2007-09-15 22:57:07 +00:00
|
|
|
|
2009-03-30 21:15:43 +00:00
|
|
|
iniDetails.beginGroup(cur->data(Qt::UserRole).toString());
|
2007-08-15 21:54:15 +00:00
|
|
|
|
|
|
|
QUrl img, txt;
|
2010-01-24 21:12:11 +00:00
|
|
|
txt = QUrl(QString(SystemInfo::value(SystemInfo::ThemesUrl).toString() + "/"
|
2007-08-15 21:54:15 +00:00
|
|
|
+ iniDetails.value("descriptionfile").toString()));
|
2010-01-24 21:12:11 +00:00
|
|
|
img = QUrl(QString(SystemInfo::value(SystemInfo::ThemesUrl).toString() + "/"
|
2007-08-15 21:54:15 +00:00
|
|
|
+ iniDetails.value("image").toString()));
|
|
|
|
|
|
|
|
QString text;
|
2009-04-27 17:48:49 +00:00
|
|
|
QTextCodec* codec = QTextCodec::codecForName("UTF-8");
|
|
|
|
text = tr("<b>Author:</b> %1<hr/>").arg(codec->toUnicode(iniDetails
|
|
|
|
.value("author", tr("unknown")).toByteArray()));
|
|
|
|
text += tr("<b>Version:</b> %1<hr/>").arg(codec->toUnicode(iniDetails
|
|
|
|
.value("version", tr("unknown")).toByteArray()));
|
|
|
|
text += tr("<b>Description:</b> %1<hr/>").arg(codec->toUnicode(iniDetails
|
|
|
|
.value("about", tr("no description")).toByteArray()));
|
2007-09-15 22:57:07 +00:00
|
|
|
|
2009-04-27 16:07:27 +00:00
|
|
|
text.replace("\n", "<br/>");
|
2007-08-15 21:54:15 +00:00
|
|
|
ui.themeDescription->setHtml(text);
|
|
|
|
iniDetails.endGroup();
|
|
|
|
igetter.abort();
|
2008-04-01 18:02:56 +00:00
|
|
|
igetter.getFile(img);
|
2007-08-15 21:54:15 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void ThemesInstallWindow::updateImage(bool error)
|
|
|
|
{
|
2013-11-03 10:08:18 +00:00
|
|
|
LOG_INFO() << "Updating image:"<< !error;
|
2008-09-14 19:56:58 +00:00
|
|
|
|
2009-03-22 19:56:13 +00:00
|
|
|
if(error) {
|
|
|
|
ui.themePreview->clear();
|
|
|
|
ui.themePreview->setText(tr("Retrieving theme preview failed.\n"
|
|
|
|
"HTTP response code: %1").arg(igetter.httpResponse()));
|
|
|
|
return;
|
|
|
|
}
|
2007-09-15 22:57:07 +00:00
|
|
|
|
2007-08-21 18:24:55 +00:00
|
|
|
QPixmap p;
|
2007-08-15 21:54:15 +00:00
|
|
|
if(!error) {
|
|
|
|
imgData = igetter.readAll();
|
|
|
|
if(imgData.isNull()) return;
|
|
|
|
p.loadFromData(imgData);
|
2007-08-21 18:24:55 +00:00
|
|
|
if(p.isNull()) {
|
2007-08-15 21:54:15 +00:00
|
|
|
ui.themePreview->clear();
|
|
|
|
ui.themePreview->setText(tr("no theme preview"));
|
|
|
|
}
|
2007-09-15 22:57:07 +00:00
|
|
|
else
|
2007-08-21 18:24:55 +00:00
|
|
|
ui.themePreview->setPixmap(p);
|
2007-08-15 21:54:15 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void ThemesInstallWindow::resizeEvent(QResizeEvent* e)
|
|
|
|
{
|
2013-11-03 10:08:18 +00:00
|
|
|
(void)e;
|
2007-08-15 21:54:15 +00:00
|
|
|
QPixmap p, q;
|
|
|
|
QSize img;
|
|
|
|
img.setHeight(ui.themePreview->height());
|
|
|
|
img.setWidth(ui.themePreview->width());
|
|
|
|
|
|
|
|
p.loadFromData(imgData);
|
|
|
|
if(p.isNull()) return;
|
|
|
|
q = p.scaled(img, Qt::KeepAspectRatio, Qt::SmoothTransformation);
|
|
|
|
ui.themePreview->setScaledContents(false);
|
2007-08-23 17:38:39 +00:00
|
|
|
ui.themePreview->setPixmap(p);
|
2007-08-15 21:54:15 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void ThemesInstallWindow::show()
|
|
|
|
{
|
|
|
|
QDialog::show();
|
2012-06-23 09:15:46 +00:00
|
|
|
if(windowSelectOnly)
|
|
|
|
ui.buttonOk->setText(tr("Select"));
|
|
|
|
|
2012-08-19 09:01:58 +00:00
|
|
|
if(!logger)
|
|
|
|
logger = new ProgressLoggerGui(this);
|
2009-03-22 08:33:39 +00:00
|
|
|
|
2012-08-19 09:01:58 +00:00
|
|
|
if(ui.listThemes->count() == 0) {
|
|
|
|
logger->show();
|
|
|
|
logger->addItem(tr("getting themes information ..."), LOGINFO);
|
2008-04-06 19:50:38 +00:00
|
|
|
|
2012-08-19 09:01:58 +00:00
|
|
|
connect(logger, SIGNAL(aborted()), this, SLOT(close()));
|
|
|
|
|
|
|
|
downloadInfo();
|
|
|
|
}
|
2008-04-06 19:50:38 +00:00
|
|
|
|
2007-08-15 21:54:15 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void ThemesInstallWindow::abort()
|
|
|
|
{
|
|
|
|
igetter.abort();
|
2009-05-02 18:40:04 +00:00
|
|
|
logger->setFinished();
|
2007-08-15 21:54:15 +00:00
|
|
|
this->close();
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2012-06-23 09:15:46 +00:00
|
|
|
void ThemesInstallWindow::accept(void)
|
|
|
|
{
|
|
|
|
if(!windowSelectOnly)
|
|
|
|
install();
|
|
|
|
else
|
|
|
|
close();
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void ThemesInstallWindow::install()
|
2007-08-15 21:54:15 +00:00
|
|
|
{
|
|
|
|
if(ui.listThemes->selectedItems().size() == 0) {
|
2012-07-01 12:58:39 +00:00
|
|
|
logger->addItem(tr("No themes selected, skipping"), LOGINFO);
|
|
|
|
emit done(false);
|
2007-08-15 21:54:15 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
QStringList themes;
|
|
|
|
QStringList names;
|
2007-08-26 16:03:56 +00:00
|
|
|
QStringList version;
|
2007-08-15 21:54:15 +00:00
|
|
|
QString zip;
|
|
|
|
QSettings iniDetails(themesInfo.fileName(), QSettings::IniFormat, this);
|
|
|
|
for(int i = 0; i < ui.listThemes->selectedItems().size(); i++) {
|
|
|
|
iniDetails.beginGroup(ui.listThemes->selectedItems().at(i)->data(Qt::UserRole).toString());
|
2010-01-24 21:12:11 +00:00
|
|
|
zip = SystemInfo::value(SystemInfo::ThemesUrl).toString()
|
2007-08-26 16:03:56 +00:00
|
|
|
+ "/" + iniDetails.value("archive").toString();
|
2007-08-15 21:54:15 +00:00
|
|
|
themes.append(zip);
|
2007-08-26 16:03:56 +00:00
|
|
|
names.append("Theme: " +
|
|
|
|
ui.listThemes->selectedItems().at(i)->data(Qt::DisplayRole).toString());
|
|
|
|
// if no version info is available use installation (current) date
|
|
|
|
version.append(iniDetails.value("version",
|
|
|
|
QDate().currentDate().toString("yyyyMMdd")).toString());
|
2007-08-15 21:54:15 +00:00
|
|
|
iniDetails.endGroup();
|
|
|
|
}
|
2013-11-03 10:08:18 +00:00
|
|
|
LOG_INFO() << "installing:" << themes;
|
2007-09-15 22:57:07 +00:00
|
|
|
|
2012-06-23 09:15:46 +00:00
|
|
|
if(logger == NULL)
|
|
|
|
logger = new ProgressLoggerGui(this);
|
2007-08-15 21:54:15 +00:00
|
|
|
logger->show();
|
2009-05-09 16:59:14 +00:00
|
|
|
QString mountPoint = RbSettings::value(RbSettings::Mountpoint).toString();
|
2013-11-03 10:08:18 +00:00
|
|
|
LOG_INFO() << "mountpoint:" << mountPoint;
|
2007-08-15 21:54:15 +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-08-15 21:54:15 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
installer = new ZipInstaller(this);
|
|
|
|
installer->setUrl(themes);
|
|
|
|
installer->setLogSection(names);
|
2007-08-26 16:03:56 +00:00
|
|
|
installer->setLogVersion(version);
|
2007-08-15 21:54:15 +00:00
|
|
|
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-03-22 08:33:39 +00:00
|
|
|
|
2012-06-23 09:15:46 +00:00
|
|
|
if(!windowSelectOnly) {
|
|
|
|
connect(logger, SIGNAL(closed()), this, SLOT(close()));
|
|
|
|
connect(installer, SIGNAL(done(bool)), logger, SLOT(setFinished()));
|
|
|
|
}
|
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)));
|
2012-06-23 09:15:46 +00:00
|
|
|
connect(installer, SIGNAL(done(bool)), this, SIGNAL(done(bool)));
|
2009-05-02 18:50:31 +00:00
|
|
|
connect(logger, SIGNAL(aborted()), installer, SLOT(abort()));
|
|
|
|
installer->install();
|
2007-08-15 21:54:15 +00:00
|
|
|
}
|
|
|
|
|
2011-10-02 14:30:05 +00:00
|
|
|
|
|
|
|
void ThemesInstallWindow::changeEvent(QEvent *e)
|
|
|
|
{
|
|
|
|
if(e->type() == QEvent::LanguageChange) {
|
|
|
|
ui.retranslateUi(this);
|
|
|
|
} else {
|
|
|
|
QWidget::changeEvent(e);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|