From 744df8b7c6ccb4e2254e452eec82f5d0703417cf Mon Sep 17 00:00:00 2001 From: Tadao Tanikawa Date: Tue, 31 Jul 2018 01:33:02 +0000 Subject: Add an interface to scalable rendering with multiple resolution To support rendering which fits screen resolution, new class AGLScreenInfo is introduced to get 'scale_factor' from AGL HMI framework. If AGL HMI framework doesn't support multi-resolution, scale is set 1.0 for backward compatibility. Bug-AGL: SPEC-1611 Change-Id: I1dc4dd13c17ae66a706b6fd8ef937fbaab937c9e Signed-off-by: Tadao Tanikawa --- src/qlibwindowmanager.h | 41 ++++++++++++++++++++++++++++++++++++++++- 1 file changed, 40 insertions(+), 1 deletion(-) (limited to 'src/qlibwindowmanager.h') diff --git a/src/qlibwindowmanager.h b/src/qlibwindowmanager.h index 8fb653d..3a720a1 100644 --- a/src/qlibwindowmanager.h +++ b/src/qlibwindowmanager.h @@ -21,6 +21,42 @@ #include #include +class AGLScreenInfo : public QObject +{ + Q_OBJECT + + public: + AGLScreenInfo(double scale = 1.0) { _scale_factor = scale; }; + + Q_INVOKABLE double scale_factor() const { return _scale_factor; }; + + private: + double _scale_factor; +}; + +class AGLScreenInfoPrivate +{ + public: + unsigned long width_dp(void) const { return _width_dp; }; + unsigned long height_dp(void) const { return _height_dp; }; + unsigned long width_mm(void) const { return _width_mm; }; + unsigned long height_mm(void) const { return _height_mm; }; + double scale_factor(void) const { return _scale; }; + + void set_width_dp(unsigned long w) { _width_dp = w; }; + void set_height_dp(unsigned long h) { _height_dp = h; }; + void set_width_mm(unsigned long w) { _width_mm = w; }; + void set_height_mm(unsigned long h) { _height_mm = h; }; + void set_scale_factor(double scale) { _scale = scale; }; + + private: + unsigned long _width_dp; + unsigned long _height_dp; + unsigned long _width_mm; + unsigned long _height_mm; + double _scale = 1.0; +}; + class QLibWindowmanager : public QObject{ Q_OBJECT public: @@ -58,8 +94,11 @@ public: Q_INVOKABLE int activateWindow(const QString &label, const QString &drawing_area); Q_INVOKABLE int deactivateWindow(const QString &label); Q_INVOKABLE int endDraw(const QString &label); + void set_event_handler(enum QEventType et, handler_fun f); + double get_scale_factor() const { return screen_info->scale_factor(); }; + // These APIs are deprecated, please use new API THIS_FUNCTION_IS_DEPRECATED(Q_INVOKABLE int activateSurface(const QString &label)); THIS_FUNCTION_IS_DEPRECATED(Q_INVOKABLE int activateSurface(const QString &label, const QString &drawing_area)); @@ -75,6 +114,6 @@ private: LibWindowmanager* wm; const char* applabel; bool isActive; - + AGLScreenInfoPrivate* screen_info; }; #endif // LIBWINDOWMANAGER_H -- cgit 1.2.3-korg