From bfef1d021970c57ce007fb4c29d62b0a1f4e13a2 Mon Sep 17 00:00:00 2001 From: Dirk Hohndel Date: Fri, 10 May 2013 08:56:56 -0700 Subject: Fix some compiler warnings Passing the alignment as int instead of float or double was actually a bug as CENTER is defined as (-0.5) ... Signed-off-by: Dirk Hohndel --- profile.h | 2 +- qt-ui/profilegraphics.cpp | 4 +--- qt-ui/profilegraphics.h | 2 +- 3 files changed, 3 insertions(+), 5 deletions(-) diff --git a/profile.h b/profile.h index 89324530a..2b2c7bff5 100644 --- a/profile.h +++ b/profile.h @@ -14,7 +14,7 @@ struct graphics_context; struct plot_info; struct plot_data { unsigned int in_deco:1; - unsigned int cylinderindex; + int cylinderindex; int sec; /* pressure[0] is sensor pressure * pressure[1] is interpolated pressure */ diff --git a/qt-ui/profilegraphics.cpp b/qt-ui/profilegraphics.cpp index 71aebd19f..5607cb3b8 100644 --- a/qt-ui/profilegraphics.cpp +++ b/qt-ui/profilegraphics.cpp @@ -550,7 +550,7 @@ void ProfileGraphicsView::plot_cylinder_pressure_text() } } -void ProfileGraphicsView::plot_pressure_value(int mbar, int sec, int xalign, int yalign) +void ProfileGraphicsView::plot_pressure_value(int mbar, int sec, double xalign, double yalign) { int pressure; const char *unit; @@ -1234,7 +1234,6 @@ void ToolTipItem::setRect(const QRectF& r) void ToolTipItem::collapse() { - QRectF newRect = childrenBoundingRect(); QPropertyAnimation *animation = new QPropertyAnimation(this, "rect"); animation->setDuration(100); animation->setStartValue(boundingRect()); @@ -1244,7 +1243,6 @@ void ToolTipItem::collapse() void ToolTipItem::expand() { - QRectF currentRect = rectangle; QRectF nextRectangle; double width = 0, height = title->boundingRect().height() + SPACING; diff --git a/qt-ui/profilegraphics.h b/qt-ui/profilegraphics.h index 288c9230a..a2033ca75 100644 --- a/qt-ui/profilegraphics.h +++ b/qt-ui/profilegraphics.h @@ -83,7 +83,7 @@ private: void plot_text_samples(); void plot_depth_sample(struct plot_data *entry, text_render_options_t *tro); void plot_cylinder_pressure_text(); - void plot_pressure_value(int mbar, int sec, int xalign, int yalign); + void plot_pressure_value(int mbar, int sec, double xalign, double yalign); void plot_deco_text(); void plot_pp_gas_profile(); void plot_pp_text(); -- cgit v1.2.3-70-g09d2 From 3e22e388e9c6b3fe2804acc414c96511b738ad57 Mon Sep 17 00:00:00 2001 From: Dirk Hohndel Date: Fri, 10 May 2013 09:24:06 -0700 Subject: Implement the get_screen_dpi function This is sadly known to be incorrect on most systems. But it's as incorrect as it was on Gtk so should work equally well to get roughly the right sizes for printing - once we implement printing, that is :-) Also removed a qDebug that snuck in in commit 6fc4d72079dd ("Enable defautl_filename in settings"). Signed-off-by: Dirk Hohndel --- display.h | 6 ++---- qt-gui.cpp | 7 ++++++- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/display.h b/display.h index 8567bc955..b62ae3ba3 100644 --- a/display.h +++ b/display.h @@ -6,15 +6,13 @@ extern "C" { #endif #define SCALE_SCREEN 1.0 -#warning "PORT THE get_screen_dpi to Qt" -#define SCALE_PRINT 1.0 -//#define SCALE_PRINT (1.0 / get_screen_dpi()) +#define SCALE_PRINT (1.0 / get_screen_dpi()) extern void repaint_dive(void); extern void do_print(void); // Commented out because I don't know how to get the dpi on a paint device yet. -// extern gdouble get_screen_dpi(void); +extern double get_screen_dpi(void); /* Plot info with smoothing, velocity indication * and one-, two- and three-minute minimums and maximums */ diff --git a/qt-gui.cpp b/qt-gui.cpp index 5d858d733..d70e00379 100644 --- a/qt-gui.cpp +++ b/qt-gui.cpp @@ -28,6 +28,7 @@ #include #include #include +#include class Translator: public QTranslator { @@ -83,7 +84,6 @@ void init_ui(int *argcp, char ***argvp) if (v.isValid()) { QString name = v.toString(); prefs.default_filename = strdup(name.toUtf8()); - qDebug("default filename %s", prefs.default_filename); } settings.endGroup(); @@ -200,4 +200,9 @@ QString get_pressure_string(pressure_t pressure, bool showunit) } } +double get_screen_dpi() +{ + QDesktopWidget *mydesk = application->desktop(); + return mydesk->physicalDpiX(); +} #include "qt-gui.moc" -- cgit v1.2.3-70-g09d2