summaryrefslogtreecommitdiffstats
path: root/logic/screenshots/Screenshot.cpp
diff options
context:
space:
mode:
authorPetr Mrázek <peterix@gmail.com>2014-02-25 01:21:46 +0100
committerPetr Mrázek <peterix@gmail.com>2014-02-25 01:23:33 +0100
commit9d4e840a6e1a7169a2863fa1ff1812f8fe19e615 (patch)
tree5de17defaea9b4fc237493f0d19c00a096c8205b /logic/screenshots/Screenshot.cpp
parentcb5cfe724208beb7d506868fc4e50d9f13e28a53 (diff)
downloadMultiMC-9d4e840a6e1a7169a2863fa1ff1812f8fe19e615.tar
MultiMC-9d4e840a6e1a7169a2863fa1ff1812f8fe19e615.tar.gz
MultiMC-9d4e840a6e1a7169a2863fa1ff1812f8fe19e615.tar.lz
MultiMC-9d4e840a6e1a7169a2863fa1ff1812f8fe19e615.tar.xz
MultiMC-9d4e840a6e1a7169a2863fa1ff1812f8fe19e615.zip
Screenshots: Optimize image loading and memory use, fix list and button layout.
Diffstat (limited to 'logic/screenshots/Screenshot.cpp')
-rw-r--r--logic/screenshots/Screenshot.cpp14
1 files changed, 14 insertions, 0 deletions
diff --git a/logic/screenshots/Screenshot.cpp b/logic/screenshots/Screenshot.cpp
new file mode 100644
index 00000000..882e491f
--- /dev/null
+++ b/logic/screenshots/Screenshot.cpp
@@ -0,0 +1,14 @@
+#include "Screenshot.h"
+#include <QImage>
+#include <QIcon>
+QIcon ScreenShot::getImage()
+{
+ if(!imageloaded)
+ {
+ QImage image(file);
+ QImage thumbnail = image.scaledToWidth(256, Qt::SmoothTransformation);
+ m_image = QIcon(QPixmap::fromImage(thumbnail));
+ imageloaded = true;
+ }
+ return m_image;
+}