From abd87ccf156b803ea1b9941865ca60600b742724 Mon Sep 17 00:00:00 2001 From: Dominik Riebeling Date: Sun, 27 Jan 2013 10:32:02 +0100 Subject: [PATCH] Themes Window: don't set cache folder on each request. The Themes Window reuses the download object for getting preview images. Since the object is reused it isn't necessary to set the cache path on each network request. Change-Id: Ibc531e09ad19ede3cab7326d9230bd5188710d98 --- rbutil/rbutilqt/themesinstallwindow.cpp | 31 ++++++++++++------------- 1 file changed, 15 insertions(+), 16 deletions(-) diff --git a/rbutil/rbutilqt/themesinstallwindow.cpp b/rbutil/rbutilqt/themesinstallwindow.cpp index e254865b25..9f60dfd212 100644 --- a/rbutil/rbutilqt/themesinstallwindow.cpp +++ b/rbutil/rbutilqt/themesinstallwindow.cpp @@ -47,12 +47,25 @@ ThemesInstallWindow::ThemesInstallWindow(QWidget *parent) : QDialog(parent) connect(ui.listThemes, SIGNAL(itemSelectionChanged()), this, SLOT(updateSize())); connect(&igetter, SIGNAL(done(bool)), this, SLOT(updateImage(bool))); + 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); + } + logger = NULL; } ThemesInstallWindow::~ThemesInstallWindow() { - if(infocachedir!="") + if(!infocachedir.isEmpty()) Utils::recursiveRmdir(infocachedir); } @@ -75,7 +88,7 @@ void ThemesInstallWindow::downloadInfo() infoUrl.replace("%RELEASE%", installInfo.release()); infoUrl.replace("%RBUTILVER%", VERSION); QUrl url = QUrl(infoUrl); - qDebug() << "[Themes] Info URL:" << url << "Query:" << url.queryItems(); + qDebug() << "[Themes] Info URL:" << url; getter->setFile(&themesInfo); connect(getter, SIGNAL(done(bool)), this, SLOT(downloadDone(bool))); @@ -219,21 +232,7 @@ void ThemesInstallWindow::updateDetails(QListWidgetItem* cur, QListWidgetItem* p text.replace("\n", "
"); ui.themeDescription->setHtml(text); iniDetails.endGroup(); - igetter.abort(); - if(!RbSettings::value(RbSettings::CacheDisabled).toBool()) - igetter.setCache(true); - else - { - if(infocachedir=="") - { - infocachedir = QDir::tempPath() + "rbutil-themeinfo"; - QDir d = QDir::temp(); - d.mkdir("rbutil-themeinfo"); - } - igetter.setCache(infocachedir); - } - igetter.getFile(img); }