Ticket #2132: mythtv-0.19-themecachesize.patch
File mythtv-0.19-themecachesize.patch, 2.0 KB (added by , 19 years ago) |
---|
-
libs/libmyth/mythcontext.cpp
1289 1289 1290 1290 QFileInfoListIterator it(*list); 1291 1291 QFileInfo *fi; 1292 QMap<QDateTime, QString> dirtimes; 1292 1293 1293 1294 while ((fi = it.current()) != 0) 1294 1295 { … … 1299 1300 { 1300 1301 if (fi->absFilePath() == themecachedir) 1301 1302 continue; 1302 RemoveCacheDir(fi->absFilePath());1303 dirtimes[fi->lastModified()] = fi->absFilePath(); 1303 1304 } 1304 1305 } 1306 1307 const size_t max_cached = GetNumSetting("ThemeCacheSize", 1); 1308 while (dirtimes.size() >= max_cached) 1309 { 1310 RemoveCacheDir(dirtimes.begin().data()); 1311 dirtimes.erase(dirtimes.begin()); 1312 } 1313 1314 for(QMap<QDateTime, QString>::const_iterator i = dirtimes.begin(); i != dirtimes.end(); ++i) 1315 { 1316 VERBOSE(VB_IMPORTANT, "Keeping cache dir: " << (*i).data()); 1317 } 1305 1318 } 1306 1319 1307 1320 void MythContext::RemoveCacheDir(const QString &dirname) -
programs/mythfrontend/globalsettings.cpp
728 728 return gs; 729 729 } 730 730 731 static HostSpinBox *ThemeCacheSize() 732 { 733 HostSpinBox *gs = new HostSpinBox("ThemeCacheSize", 1, 1000, 1, true); 734 gs->setLabel(QObject::tr("Theme cache size")); 735 gs->setValue(1); 736 gs->setHelpText(QObject::tr("Maximum number of prescaled themes to cache.")); 737 return gs; 738 } 739 731 740 static HostComboBox *MenuTheme() 732 741 { 733 742 HostComboBox *gc = new HostComboBox("MenuTheme"); … … 3250 3259 theme->addChild(ThemeFontSizeType()); 3251 3260 theme->addChild(RandomTheme()); 3252 3261 theme->addChild(MenuTheme()); 3262 theme->addChild(ThemeCacheSize()); 3253 3263 addChild(theme); 3254 3264 3255 3265 VerticalConfigurationGroup* screen = new VerticalConfigurationGroup(false);