Commit 54a52c87 authored by Gus Grubba's avatar Gus Grubba

Figure out if device has touch control

parent a85e2068
...@@ -79,7 +79,7 @@ public: ...@@ -79,7 +79,7 @@ public:
void showMessage(const QString& message); void showMessage(const QString& message);
/// @return true: Fake ui into showing mobile interface /// @return true: Fake ui into showing mobile interface
bool fakeMobile(void) { return _fakeMobile; } bool fakeMobile(void) const { return _fakeMobile; }
// Still working on getting rid of this and using dependency injection instead for everything // Still working on getting rid of this and using dependency injection instead for everything
QGCToolbox* toolbox(void) { return _toolbox; } QGCToolbox* toolbox(void) { return _toolbox; }
......
...@@ -26,6 +26,12 @@ ScreenToolsController::ScreenToolsController() ...@@ -26,6 +26,12 @@ ScreenToolsController::ScreenToolsController()
} }
bool
ScreenToolsController::hasTouch() const
{
return QTouchDevice::devices().count() > 0 || isMobile();
}
QString QString
ScreenToolsController::iOSDevice() const ScreenToolsController::iOSDevice() const
{ {
......
...@@ -37,6 +37,7 @@ public: ...@@ -37,6 +37,7 @@ public:
Q_PROPERTY(bool isLinux READ isLinux CONSTANT) Q_PROPERTY(bool isLinux READ isLinux CONSTANT)
Q_PROPERTY(bool isWindows READ isWindows CONSTANT) Q_PROPERTY(bool isWindows READ isWindows CONSTANT)
Q_PROPERTY(bool isSerialAvailable READ isSerialAvailable CONSTANT) Q_PROPERTY(bool isSerialAvailable READ isSerialAvailable CONSTANT)
Q_PROPERTY(bool hasTouch READ hasTouch CONSTANT)
Q_PROPERTY(QString iOSDevice READ iOSDevice CONSTANT) Q_PROPERTY(QString iOSDevice READ iOSDevice CONSTANT)
Q_PROPERTY(QString fixedFontFamily READ fixedFontFamily CONSTANT) Q_PROPERTY(QString fixedFontFamily READ fixedFontFamily CONSTANT)
Q_PROPERTY(QString normalFontFamily READ normalFontFamily CONSTANT) Q_PROPERTY(QString normalFontFamily READ normalFontFamily CONSTANT)
...@@ -47,9 +48,9 @@ public: ...@@ -47,9 +48,9 @@ public:
Q_INVOKABLE int mouseY(void) { return QCursor::pos().y(); } Q_INVOKABLE int mouseY(void) { return QCursor::pos().y(); }
#if defined(__mobile__) #if defined(__mobile__)
bool isMobile () { return true; } bool isMobile () const { return true; }
#else #else
bool isMobile () { return qgcApp()->fakeMobile(); } bool isMobile () const { return qgcApp()->fakeMobile(); }
#endif #endif
#if defined (Q_OS_ANDROID) #if defined (Q_OS_ANDROID)
...@@ -102,6 +103,8 @@ public: ...@@ -102,6 +103,8 @@ public:
bool isDebug () { return false; } bool isDebug () { return false; }
#endif #endif
bool hasTouch() const;
QString iOSDevice () const; QString iOSDevice () const;
QString fixedFontFamily () const; QString fixedFontFamily () const;
QString normalFontFamily () const; QString normalFontFamily () const;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment