Expose QPixmapCache's cache limit size as an user preference

This commit is contained in:
Fabio Bas 2014-12-24 16:16:34 +01:00
parent 776d809f2f
commit b96104bed4
6 changed files with 42 additions and 5 deletions

View file

@ -361,7 +361,8 @@ void MainWindow::createMenus()
MainWindow::MainWindow(QWidget *parent)
: QMainWindow(parent), localServer(0), bHasActivated(false)
{
QPixmapCache::setCacheLimit(200000);
connect(settingsCache, SIGNAL(pixmapCacheSizeChanged(int)), this, SLOT(pixmapCacheSizeChanged(int)));
pixmapCacheSizeChanged(settingsCache->getPixmapCacheSize());
client = new RemoteClient;
connect(client, SIGNAL(connectionClosedEventReceived(const Event_ConnectionClosed &)), this, SLOT(processConnectionClosedEvent(const Event_ConnectionClosed &)));
@ -430,3 +431,10 @@ void MainWindow::changeEvent(QEvent *event)
QMainWindow::changeEvent(event);
}
void MainWindow::pixmapCacheSizeChanged(int value)
{
//qDebug() << "Setting pixmap cache size to " << value << " MBs";
// translate MBs to KBs
QPixmapCache::setCacheLimit(value * 1024);
}