diff options
| author | deva <deva> | 2006-05-02 20:19:39 +0000 | 
|---|---|---|
| committer | deva <deva> | 2006-05-02 20:19:39 +0000 | 
| commit | d5da69b6ed984df4c60c3a7abfa8119db34eab2b (patch) | |
| tree | 92426df38177cd7c40f26957d2daee9afff4d45e /client | |
| parent | 2bee772bed19a55f666d7106c02735f14c0084e4 (diff) | |
*** empty log message ***
Diffstat (limited to 'client')
| -rw-r--r-- | client/mainwindow.cc | 20 | 
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*/ | 
