summaryrefslogtreecommitdiff
path: root/client/mainwindow.cc
diff options
context:
space:
mode:
Diffstat (limited to 'client/mainwindow.cc')
-rw-r--r--client/mainwindow.cc20
1 files changed, 12 insertions, 8 deletions
diff --git a/client/mainwindow.cc b/client/mainwindow.cc
index 982388b..645fef4 100644
--- a/client/mainwindow.cc
+++ b/client/mainwindow.cc
@@ -43,23 +43,25 @@
#include <QPainter>
#include "svgloader.h"
-#define CAIRO_SVG
+//#define CAIRO_SVG
QPixmap MainWindow::loadIcon(char* fname)
{
QSvgRenderer svgrenderer;
QPainter painter;
- int w = (int)((double)x11Info().appDpiX() / 1.5);
- int h = (int)((double)x11Info().appDpiY() / 1.5);
+ int dpix = x11Info().appDpiX();
+ int dpiy = x11Info().appDpiY();
+
+ printf("DpiX: %d DpiY: %d\n", dpix, dpiy);
#ifdef CAIRO_SVG
QPixmap pixmap;
- SVGLoader cairo;
+ SVGLoader svg;
QString filename = fname;
filename.append(".svg");
- w = h;
- pixmap = QPixmap::fromImage(cairo.load(filename, 0, 0, 0.1, 0.1));
+ double dpi = (double)(dpix + dpiy) / 2.0;
+ pixmap = QPixmap::fromImage(svg.load(filename, 0, 0, 12.0 / dpi, 12.0 / dpi));
return pixmap;
#else/*CAIRO_SVG*/
#ifdef QT_SVG
@@ -72,10 +74,12 @@ QPixmap MainWindow::loadIcon(char* fname)
return pixmap;
#else/*QT_SVG*/
// Load as png
- QPixmap pixmap(fname".png");
+ QString filename = fname;
+ filename.append(".png");
+ QPixmap pixmap(filename);
Qt::AspectRatioMode aspect = pixmap.width()<pixmap.height()?
Qt::KeepAspectRatio:Qt::KeepAspectRatioByExpanding;
- pixmap = pixmap.scaled(w,h, aspect, Qt::SmoothTransformation);
+ pixmap = pixmap.scaled((int)((double)dpix / 1.5),(int)((double)dpix / 1.5), aspect, Qt::SmoothTransformation);
return pixmap;
#endif/*QT_SVG*/
#endif/*CAIRO_SVG*/