summaryrefslogtreecommitdiff
path: root/client/mainwindow.cc
diff options
context:
space:
mode:
authordeva <deva>2006-04-21 13:50:55 +0000
committerdeva <deva>2006-04-21 13:50:55 +0000
commit4d2903789bc9a497cb1210de6d7653f8215143a5 (patch)
treef7efa8925aa6d0b51876ed22b50688c3969e3f2c /client/mainwindow.cc
parent1b68dd554e2e238f499ebfd12c222263fe050bd2 (diff)
*** empty log message ***
Diffstat (limited to 'client/mainwindow.cc')
-rw-r--r--client/mainwindow.cc39
1 files changed, 31 insertions, 8 deletions
diff --git a/client/mainwindow.cc b/client/mainwindow.cc
index fa73a9e..d2c9248 100644
--- a/client/mainwindow.cc
+++ b/client/mainwindow.cc
@@ -39,21 +39,44 @@
#include "control.h"
-QPushButton *MainWindow::createButton(char* icon)
+#include <QSvgRenderer>
+#include <QPainter>
+
+#define SVG false
+
+QPixmap MainWindow::loadIcon(char* fname)
{
- QPixmap pixmap(icon);
+ QSvgRenderer svgrenderer;
+ QPainter painter;
int w = (int)((double)x11Info().appDpiX() / 1.5);
int h = (int)((double)x11Info().appDpiY() / 1.5);
- Qt::AspectRatioMode aspect = pixmap.width()<pixmap.height()?
- Qt::KeepAspectRatio:Qt::KeepAspectRatioByExpanding;
+ if(SVG) {
+ QPixmap pixmap(w, h);
+ painter.begin(&pixmap);
+ QString filename = fname;
+ svgrenderer.load(filename);
+ svgrenderer.render(&painter);
+ painter.end();
+ return pixmap;
+ } else {
+ QPixmap pixmap(fname);
+ Qt::AspectRatioMode aspect = pixmap.width()<pixmap.height()?
+ Qt::KeepAspectRatio:Qt::KeepAspectRatioByExpanding;
+ pixmap = pixmap.scaled(w,h, aspect, Qt::SmoothTransformation);
+ return pixmap;
+ }
+}
- pixmap = pixmap.scaled(w,h, aspect, Qt::SmoothTransformation);
+QPushButton *MainWindow::createButton(char* icon)
+{
+ int w = (int)((double)x11Info().appDpiX() / 1.5);
+ int h = (int)((double)x11Info().appDpiY() / 1.5);
QPushButton *btn = new QPushButton();
- btn->setIconSize(QSize(50,50));
- btn->setIcon(pixmap);
+ btn->setIconSize(QSize(w,h));
+ btn->setIcon(loadIcon(icon));
return btn;
}
@@ -152,7 +175,7 @@ void MainWindow::snapshot_clicked()
{
MIaV::control.shoot();
- QImage screenshot((uchar*)rgb, 720, 576, QImage::Format_RGB32);
+ QImage screenshot(720, 576, QImage::Format_RGB32);
decoder->snapshot((char*)screenshot.bits());
QPixmap *p = new QPixmap();