Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Donald Haase
Cockatrice
Commits
7ef5f2d3
Commit
7ef5f2d3
authored
Jan 16, 2015
by
Gavin Bisesi
Browse files
Merge pull request #558 from ctrlaltca/memory_limit
Limit pixmap cache size to 2047MB; fix #555
parents
8e396cad
24c6e4a8
Changes
3
Hide whitespace changes
Inline
Side-by-side
cockatrice/src/dlg_settings.cpp
View file @
7ef5f2d3
...
@@ -52,8 +52,9 @@ GeneralSettingsPage::GeneralSettingsPage()
...
@@ -52,8 +52,9 @@ GeneralSettingsPage::GeneralSettingsPage()
pixmapCacheLabel
=
new
QLabel
;
pixmapCacheLabel
=
new
QLabel
;
pixmapCacheEdit
=
new
QSpinBox
;
pixmapCacheEdit
=
new
QSpinBox
;
pixmapCacheEdit
->
setMinimum
(
64
);
pixmapCacheEdit
->
setMinimum
(
PIXMAPCACHE_SIZE_MIN
);
pixmapCacheEdit
->
setMaximum
(
8192
);
// 2047 is the max value to avoid overflowing of QPixmapCache::setCacheLimit(int size)
pixmapCacheEdit
->
setMaximum
(
PIXMAPCACHE_SIZE_MAX
);
pixmapCacheEdit
->
setSingleStep
(
64
);
pixmapCacheEdit
->
setSingleStep
(
64
);
pixmapCacheEdit
->
setValue
(
settingsCache
->
getPixmapCacheSize
());
pixmapCacheEdit
->
setValue
(
settingsCache
->
getPixmapCacheSize
());
pixmapCacheEdit
->
setSuffix
(
" MB"
);
pixmapCacheEdit
->
setSuffix
(
" MB"
);
...
...
cockatrice/src/settingscache.cpp
View file @
7ef5f2d3
...
@@ -24,6 +24,10 @@ SettingsCache::SettingsCache()
...
@@ -24,6 +24,10 @@ SettingsCache::SettingsCache()
picDownload
=
settings
->
value
(
"personal/picturedownload"
,
true
).
toBool
();
picDownload
=
settings
->
value
(
"personal/picturedownload"
,
true
).
toBool
();
picDownloadHq
=
settings
->
value
(
"personal/picturedownloadhq"
,
false
).
toBool
();
picDownloadHq
=
settings
->
value
(
"personal/picturedownloadhq"
,
false
).
toBool
();
pixmapCacheSize
=
settings
->
value
(
"personal/pixmapCacheSize"
,
PIXMAPCACHE_SIZE_DEFAULT
).
toInt
();
pixmapCacheSize
=
settings
->
value
(
"personal/pixmapCacheSize"
,
PIXMAPCACHE_SIZE_DEFAULT
).
toInt
();
//sanity check
if
(
pixmapCacheSize
<
PIXMAPCACHE_SIZE_MIN
||
pixmapCacheSize
>
PIXMAPCACHE_SIZE_MAX
)
pixmapCacheSize
=
PIXMAPCACHE_SIZE_DEFAULT
;
picUrl
=
settings
->
value
(
"personal/picUrl"
,
PIC_URL_DEFAULT
).
toString
();
picUrl
=
settings
->
value
(
"personal/picUrl"
,
PIC_URL_DEFAULT
).
toString
();
picUrlHq
=
settings
->
value
(
"personal/picUrlHq"
,
PIC_URL_HQ_DEFAULT
).
toString
();
picUrlHq
=
settings
->
value
(
"personal/picUrlHq"
,
PIC_URL_HQ_DEFAULT
).
toString
();
picUrlFallback
=
settings
->
value
(
"personal/picUrlFallback"
,
PIC_URL_FALLBACK
).
toString
();
picUrlFallback
=
settings
->
value
(
"personal/picUrlFallback"
,
PIC_URL_FALLBACK
).
toString
();
...
...
cockatrice/src/settingscache.h
View file @
7ef5f2d3
...
@@ -9,6 +9,8 @@
...
@@ -9,6 +9,8 @@
#define PIC_URL_HQ_FALLBACK "http://mtgimage.com/set/!setcode!/!name!.jpg"
#define PIC_URL_HQ_FALLBACK "http://mtgimage.com/set/!setcode!/!name!.jpg"
// size should be a multiple of 64
// size should be a multiple of 64
#define PIXMAPCACHE_SIZE_DEFAULT 256
#define PIXMAPCACHE_SIZE_DEFAULT 256
#define PIXMAPCACHE_SIZE_MIN 64
#define PIXMAPCACHE_SIZE_MAX 2047
class
QSettings
;
class
QSettings
;
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment