diff --git a/MobileClient/QtProject/src/cpp/HelperClasses/ApplicationHelper.cpp b/MobileClient/QtProject/src/cpp/HelperClasses/ApplicationHelper.cpp index 8ae067c..4032217 100644 --- a/MobileClient/QtProject/src/cpp/HelperClasses/ApplicationHelper.cpp +++ b/MobileClient/QtProject/src/cpp/HelperClasses/ApplicationHelper.cpp @@ -19,17 +19,20 @@ #include "../WebApi/WebApi.h" // Qt includes ----------------------------- -#include #include +#include #include +#include //----------------------------------------------------------------------------------------------------------------------------- -ApplicationHelper::ApplicationHelper(Settings *settings, PlateformDetail *plateformDetail, +ApplicationHelper::ApplicationHelper(Settings *settings, + PlateformDetail *plateformDetail, QObject *parent) : QObject(parent), m_Settings(settings), m_PlateformDetail(plateformDetail), + m_DipScaleFactor(), m_CurrentClientVersion(), m_WebApiCommand_GetCurrentClientVersion(this), m_DevelopmentMode(false), @@ -43,6 +46,30 @@ ApplicationHelper::ApplicationHelper(Settings *settings, PlateformDetail *platef .arg(buildTimestamp()) .arg(m_PlateformDetail->name())); + // Dip scale factor + double dipNorm; + switch(m_PlateformDetail->getOS()) + { + case PlateformDetail::OS_DESKTOP: + dipNorm = 96.0; + break; + case PlateformDetail::OS_ANDROID: + dipNorm = 160.0; + break; + case PlateformDetail::OS_IOS: + dipNorm = 160.0; + break; + case PlateformDetail::OS_WINPHONE: + dipNorm = 160.0; + break; + } + QScreen *screen = qApp->primaryScreen(); + //double dip = screen->physicalDotsPerInch() / screen->devicePixelRatio() / dipNorm; + double dip = screen->physicalDotsPerInch() / 108.0; + if(dip <= 1.0) + dip = 1.0; + setDip(dip); + // Check if newer version was installed if(m_Settings->get_Application_LastVersion() != QApplication::applicationVersion()) { @@ -74,6 +101,22 @@ ApplicationHelper::~ApplicationHelper() //----------------------------------------------------------------------------------------------------------------------------- +int ApplicationHelper::dip() +{ + return m_DipScaleFactor; +} + +//----------------------------------------------------------------------------------------------------------------------------- + +void ApplicationHelper::setDip(int dipScaleFactor) +{ + m_DipScaleFactor = dipScaleFactor; + + emit signal_Dip_Changed(); +} + +//----------------------------------------------------------------------------------------------------------------------------- + QString ApplicationHelper::version() const { return QApplication::applicationVersion(); diff --git a/MobileClient/QtProject/src/cpp/HelperClasses/ApplicationHelper.h b/MobileClient/QtProject/src/cpp/HelperClasses/ApplicationHelper.h index 2d81ba0..8b2c419 100644 --- a/MobileClient/QtProject/src/cpp/HelperClasses/ApplicationHelper.h +++ b/MobileClient/QtProject/src/cpp/HelperClasses/ApplicationHelper.h @@ -28,18 +28,26 @@ class ApplicationHelper : public QObject { Q_OBJECT + Q_PROPERTY(double dip READ dip WRITE setDip NOTIFY signal_Dip_Changed) + public: explicit ApplicationHelper(Settings *settings, PlateformDetail *plateformDetail, QObject *parent = 0); ~ApplicationHelper(); + int dip(); + + void setDip(int dip); + signals: void signal_NewClientVersionAvailable(); void signal_DevelopmentMode_Changed(bool developmentMode); + void signal_Dip_Changed(); + public slots: // Version @@ -82,6 +90,9 @@ private slots: // Link to PlateformDetail PlateformDetail *m_PlateformDetail; + // Dip Scale Factor + double m_DipScaleFactor; + // Version QString m_CurrentClientVersion; WebApiCommand m_WebApiCommand_GetCurrentClientVersion; diff --git a/MobileClient/QtProject/src/cpp/HelperClasses/PlateformDetail.cpp b/MobileClient/QtProject/src/cpp/HelperClasses/PlateformDetail.cpp index 4deb1a4..9ec36c1 100644 --- a/MobileClient/QtProject/src/cpp/HelperClasses/PlateformDetail.cpp +++ b/MobileClient/QtProject/src/cpp/HelperClasses/PlateformDetail.cpp @@ -16,7 +16,7 @@ PlateformDetail::PlateformDetail(QObject *parent) : QObject(parent), - m_Os(OS_OTHER) + m_Os(OS_DESKTOP) { #ifdef Q_OS_ANDROID m_Os = OS_ANDROID; @@ -47,7 +47,7 @@ PlateformDetail::OS PlateformDetail::getOS() const bool PlateformDetail::isMobile() { - return m_Os != OS_OTHER; + return m_Os != OS_DESKTOP; } //----------------------------------------------------------------------------------------------------------------------------- @@ -71,7 +71,7 @@ QString PlateformDetail::name() case OS_WINPHONE: return "Windows phone"; break; - case OS_OTHER: + case OS_DESKTOP: return "Desktop"; break; } diff --git a/MobileClient/QtProject/src/cpp/HelperClasses/PlateformDetail.h b/MobileClient/QtProject/src/cpp/HelperClasses/PlateformDetail.h index 48c39b1..424a0f0 100644 --- a/MobileClient/QtProject/src/cpp/HelperClasses/PlateformDetail.h +++ b/MobileClient/QtProject/src/cpp/HelperClasses/PlateformDetail.h @@ -25,7 +25,7 @@ class PlateformDetail : public QObject OS_ANDROID, OS_IOS, OS_WINPHONE, - OS_OTHER + OS_DESKTOP }; explicit PlateformDetail(QObject *parent = 0); diff --git a/MobileClient/QtProject/src/qml/Navigator.qml b/MobileClient/QtProject/src/qml/Navigator.qml index 45b210f..c8ac7f9 100644 --- a/MobileClient/QtProject/src/qml/Navigator.qml +++ b/MobileClient/QtProject/src/qml/Navigator.qml @@ -18,6 +18,7 @@ Rectangle { z: 2 // so flickable doesn't draw on top + color: ( mouseBack.pressed || mouseContinue.pressed || mouseMenu.pressed ) ? Qt.lighter(hc_Application.color_BackgroundNavigator(), 1.2) diff --git a/MobileClient/QtProject/src/qml/Panel_Home.qml b/MobileClient/QtProject/src/qml/Panel_Home.qml index f99ffe4..e8d171c 100644 --- a/MobileClient/QtProject/src/qml/Panel_Home.qml +++ b/MobileClient/QtProject/src/qml/Panel_Home.qml @@ -28,8 +28,8 @@ Item { id: navigator anchors.top: parent.top + height: 30 * hc_Application.dip width: parent.width - height: 40 title : (stackView.currentItem != null) ? stackView.currentItem.navigation_Title : ""; backButtonVisible : stackView.depth > 1 diff --git a/MobileClient/QtProject/src/qml/Panel_NearbySpots.qml b/MobileClient/QtProject/src/qml/Panel_NearbySpots.qml index 323753a..c7d22ce 100644 --- a/MobileClient/QtProject/src/qml/Panel_NearbySpots.qml +++ b/MobileClient/QtProject/src/qml/Panel_NearbySpots.qml @@ -66,8 +66,8 @@ Item { id: navigator anchors.top: parent.top + height: 30 * hc_Application.dip width: parent.width - height: 40 title : (stackView.currentItem != null) ? stackView.currentItem.navigation_Title : ""; backButtonVisible : stackView.depth > 1 diff --git a/MobileClient/QtProject/src/qml/Panel_Upload.qml b/MobileClient/QtProject/src/qml/Panel_Upload.qml index f7794bd..e4a8e85 100644 --- a/MobileClient/QtProject/src/qml/Panel_Upload.qml +++ b/MobileClient/QtProject/src/qml/Panel_Upload.qml @@ -55,8 +55,8 @@ Item { id: navigator anchors.top: parent.top + height: 30 * hc_Application.dip width: parent.width - height: 40 title : (stackView.currentItem != null) ? stackView.currentItem.navigation_Title : ""; backButtonVisible : (stackView.currentItem != null) ? stackView.currentItem.navigation_BackButtonVisible : false; diff --git a/MobileClient/QtProject/src/qml/Panel_User.qml b/MobileClient/QtProject/src/qml/Panel_User.qml index 4e226a0..7e85f3a 100644 --- a/MobileClient/QtProject/src/qml/Panel_User.qml +++ b/MobileClient/QtProject/src/qml/Panel_User.qml @@ -48,8 +48,8 @@ Item { id: navigator anchors.top: parent.top + height: 30 * hc_Application.dip width: parent.width - height: 40 title : (stackView.currentItem != null) ? stackView.currentItem.navigation_Title : ""; backButtonVisible : (stackView.currentItem != null) ? stackView.currentItem.navigation_BackButtonVisible : false; diff --git a/MobileClient/QtProject/src/qml/widgets/TabWidgetBottom.qml b/MobileClient/QtProject/src/qml/widgets/TabWidgetBottom.qml index d98f74a..666d96f 100644 --- a/MobileClient/QtProject/src/qml/widgets/TabWidgetBottom.qml +++ b/MobileClient/QtProject/src/qml/widgets/TabWidgetBottom.qml @@ -1,6 +1,7 @@ // Qt imports ------------------------------ import QtQuick 2.0 +import QtQuick.Window 2.0 // Project qml imports --------------------- import "qrc:/qml/" @@ -61,7 +62,8 @@ Item { Repeater { model: stack.children.length delegate: TabButton { - width: tabWidgetBottom.width / stack.children.length; height: 36 + width: tabWidgetBottom.width / stack.children.length; + height: 30 * hc_Application.dip iconSource: stack.children[index].tabWidget_ButtonIconSource buttonText: stack.children[index].tabWidget_ButtonText diff --git a/MobileClient/QtProject/src/qml/widgets/TabWidgetTop.qml b/MobileClient/QtProject/src/qml/widgets/TabWidgetTop.qml index c264833..1191ff9 100644 --- a/MobileClient/QtProject/src/qml/widgets/TabWidgetTop.qml +++ b/MobileClient/QtProject/src/qml/widgets/TabWidgetTop.qml @@ -51,7 +51,8 @@ Item { Repeater { model: stack.children.length delegate: TabButton { - width: tabWidgetTop.width / stack.children.length; height: 36 + width: tabWidgetTop.width / stack.children.length; + height: 30 * hc_Application.dip iconSource: stack.children[index].tabWidget_ButtonIconSource buttonText: stack.children[index].tabWidget_ButtonText