mirror of
https://github.com/Rockbox/rockbox.git
synced 2025-12-09 13:15:18 -05:00
When changing cache path update the size information.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@15022 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
parent
7edf4fd5eb
commit
25441b396d
2 changed files with 11 additions and 2 deletions
|
|
@ -217,7 +217,14 @@ void Config::setUserSettings(QSettings *user)
|
||||||
ui.cachePath->setText(userSettings->value("cachepath").toString());
|
ui.cachePath->setText(userSettings->value("cachepath").toString());
|
||||||
ui.cacheDisable->setChecked(userSettings->value("cachedisable", true).toBool());
|
ui.cacheDisable->setChecked(userSettings->value("cachedisable", true).toBool());
|
||||||
ui.cacheOfflineMode->setChecked(userSettings->value("offline").toBool());
|
ui.cacheOfflineMode->setChecked(userSettings->value("offline").toBool());
|
||||||
QList<QFileInfo> fs = QDir(userSettings->value("cachepath").toString() + "/rbutil-cache/").entryInfoList(QDir::Files | QDir::NoDotAndDotDot);
|
updateCacheInfo(userSettings->value("cachepath").toString());
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void Config::updateCacheInfo(QString path)
|
||||||
|
{
|
||||||
|
QList<QFileInfo> fs;
|
||||||
|
fs = QDir(path + "/rbutil-cache/").entryInfoList(QDir::Files | QDir::NoDotAndDotDot);
|
||||||
qint64 sz = 0;
|
qint64 sz = 0;
|
||||||
for(int i = 0; i < fs.size(); i++) {
|
for(int i = 0; i < fs.size(); i++) {
|
||||||
sz += fs.at(i).size();
|
sz += fs.at(i).size();
|
||||||
|
|
@ -225,7 +232,6 @@ void Config::setUserSettings(QSettings *user)
|
||||||
}
|
}
|
||||||
ui.cacheSize->setText(tr("Current cache size is %1 kiB.")
|
ui.cacheSize->setText(tr("Current cache size is %1 kiB.")
|
||||||
.arg(sz/1024));
|
.arg(sz/1024));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -611,6 +617,7 @@ void Config::setMountpoint(QString m)
|
||||||
void Config::setCache(QString c)
|
void Config::setCache(QString c)
|
||||||
{
|
{
|
||||||
ui.cachePath->setText(c);
|
ui.cachePath->setText(c);
|
||||||
|
updateCacheInfo(c);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -709,6 +716,7 @@ void Config::cacheClear()
|
||||||
QFile::remove(f);
|
QFile::remove(f);
|
||||||
qDebug() << "removed:" << f;
|
qDebug() << "removed:" << f;
|
||||||
}
|
}
|
||||||
|
updateCacheInfo(userSettings->value("cachepath").toString());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -49,6 +49,7 @@ class Config : public QDialog
|
||||||
QString language;
|
QString language;
|
||||||
QString programPath;
|
QString programPath;
|
||||||
QUrl proxy;
|
QUrl proxy;
|
||||||
|
void updateCacheInfo(QString);
|
||||||
|
|
||||||
BrowseDirtree *browser;
|
BrowseDirtree *browser;
|
||||||
BrowseDirtree *cbrowser;
|
BrowseDirtree *cbrowser;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue