diff options
author | Dominik Riebeling <Dominik.Riebeling@gmail.com> | 2013-01-27 10:32:02 +0100 |
---|---|---|
committer | Dominik Riebeling <Dominik.Riebeling@gmail.com> | 2013-01-27 20:11:17 +0100 |
commit | abd87ccf156b803ea1b9941865ca60600b742724 (patch) | |
tree | 2a1582c01dc33aaa8f4645d2c795fbe344ee3a40 | |
parent | 6a6e7ea26a236b2dd113c9937064c90fd2cf601a (diff) | |
download | rockbox-abd87ccf156b803ea1b9941865ca60600b742724.tar.gz rockbox-abd87ccf156b803ea1b9941865ca60600b742724.zip |
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
-rw-r--r-- | rbutil/rbutilqt/themesinstallwindow.cpp | 31 |
1 files 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) | |||
47 | connect(ui.listThemes, SIGNAL(itemSelectionChanged()), this, SLOT(updateSize())); | 47 | connect(ui.listThemes, SIGNAL(itemSelectionChanged()), this, SLOT(updateSize())); |
48 | connect(&igetter, SIGNAL(done(bool)), this, SLOT(updateImage(bool))); | 48 | connect(&igetter, SIGNAL(done(bool)), this, SLOT(updateImage(bool))); |
49 | 49 | ||
50 | if(!RbSettings::value(RbSettings::CacheDisabled).toBool()) | ||
51 | igetter.setCache(true); | ||
52 | else | ||
53 | { | ||
54 | if(infocachedir.isEmpty()) | ||
55 | { | ||
56 | infocachedir = QDir::tempPath() + "rbutil-themeinfo"; | ||
57 | QDir d = QDir::temp(); | ||
58 | d.mkdir("rbutil-themeinfo"); | ||
59 | } | ||
60 | igetter.setCache(infocachedir); | ||
61 | } | ||
62 | |||
50 | logger = NULL; | 63 | logger = NULL; |
51 | } | 64 | } |
52 | 65 | ||
53 | ThemesInstallWindow::~ThemesInstallWindow() | 66 | ThemesInstallWindow::~ThemesInstallWindow() |
54 | { | 67 | { |
55 | if(infocachedir!="") | 68 | if(!infocachedir.isEmpty()) |
56 | Utils::recursiveRmdir(infocachedir); | 69 | Utils::recursiveRmdir(infocachedir); |
57 | } | 70 | } |
58 | 71 | ||
@@ -75,7 +88,7 @@ void ThemesInstallWindow::downloadInfo() | |||
75 | infoUrl.replace("%RELEASE%", installInfo.release()); | 88 | infoUrl.replace("%RELEASE%", installInfo.release()); |
76 | infoUrl.replace("%RBUTILVER%", VERSION); | 89 | infoUrl.replace("%RBUTILVER%", VERSION); |
77 | QUrl url = QUrl(infoUrl); | 90 | QUrl url = QUrl(infoUrl); |
78 | qDebug() << "[Themes] Info URL:" << url << "Query:" << url.queryItems(); | 91 | qDebug() << "[Themes] Info URL:" << url; |
79 | getter->setFile(&themesInfo); | 92 | getter->setFile(&themesInfo); |
80 | 93 | ||
81 | connect(getter, SIGNAL(done(bool)), this, SLOT(downloadDone(bool))); | 94 | connect(getter, SIGNAL(done(bool)), this, SLOT(downloadDone(bool))); |
@@ -219,21 +232,7 @@ void ThemesInstallWindow::updateDetails(QListWidgetItem* cur, QListWidgetItem* p | |||
219 | text.replace("\n", "<br/>"); | 232 | text.replace("\n", "<br/>"); |
220 | ui.themeDescription->setHtml(text); | 233 | ui.themeDescription->setHtml(text); |
221 | iniDetails.endGroup(); | 234 | iniDetails.endGroup(); |
222 | |||
223 | igetter.abort(); | 235 | igetter.abort(); |
224 | if(!RbSettings::value(RbSettings::CacheDisabled).toBool()) | ||
225 | igetter.setCache(true); | ||
226 | else | ||
227 | { | ||
228 | if(infocachedir=="") | ||
229 | { | ||
230 | infocachedir = QDir::tempPath() + "rbutil-themeinfo"; | ||
231 | QDir d = QDir::temp(); | ||
232 | d.mkdir("rbutil-themeinfo"); | ||
233 | } | ||
234 | igetter.setCache(infocachedir); | ||
235 | } | ||
236 | |||
237 | igetter.getFile(img); | 236 | igetter.getFile(img); |
238 | } | 237 | } |
239 | 238 | ||