summaryrefslogtreecommitdiffstats
path: root/core
diff options
context:
space:
mode:
authorGravatar jan Iversen <jani@libreoffice.org>2018-06-09 12:31:31 +0200
committerGravatar Dirk Hohndel <dirk@hohndel.org>2018-06-09 21:19:46 +0200
commitacc9784fd9d7bc5695cc862132d2bb0ee7f87f48 (patch)
tree30c65f607ccaff15e7ea4326ee458a96f8bdb6de /core
parentf7e8f2124503d3952a9fc6838a4fb8f2e2e09878 (diff)
downloadsubsurface-acc9784fd9d7bc5695cc862132d2bb0ee7f87f48.tar.gz
core: remove qml properties from desktop compile
add #ifdef SUBSURFACE_MOBILE to secure qml macros are not compiled with desktop Signed-off-by: Jan Iversen <jani@apache.org>
Diffstat (limited to 'core')
-rw-r--r--core/downloadfromdcthread.cpp9
-rw-r--r--core/downloadfromdcthread.h30
2 files changed, 35 insertions, 4 deletions
diff --git a/core/downloadfromdcthread.cpp b/core/downloadfromdcthread.cpp
index 39d31d726..e837b0442 100644
--- a/core/downloadfromdcthread.cpp
+++ b/core/downloadfromdcthread.cpp
@@ -277,16 +277,19 @@ QString DCDeviceData::devBluetoothName() const
return m_devBluetoothName;
}
+#ifdef SUBSURFACE_MOBILE
QString DCDeviceData::descriptor() const
{
return "";
}
+#endif // SUBSURFACE_MOBILE
bool DCDeviceData::bluetoothMode() const
{
return data.bluetooth_mode;
}
+#ifdef SUBSURFACE_MOBILE
bool DCDeviceData::forceDownload() const
{
return data.force_download;
@@ -306,6 +309,7 @@ int DCDeviceData::diveId() const
{
return data.diveid;
}
+#endif // SUBSURFACE_MOBILE
void DCDeviceData::setVendor(const QString& vendor)
{
@@ -358,6 +362,7 @@ void DCDeviceData::setCreateNewTrip(bool create)
data.create_new_trip = create;
}
+#ifdef SUBSURFACE_MOBILE
void DCDeviceData::setDeviceId(int deviceId)
{
data.deviceid = deviceId;
@@ -367,6 +372,7 @@ void DCDeviceData::setDiveId(int diveId)
{
data.diveid = diveId;
}
+#endif // SUBSURFACE_MOBILE
void DCDeviceData::setSaveDump(bool save)
{
@@ -383,10 +389,13 @@ void DCDeviceData::setSaveLog(bool saveLog)
data.libdc_log = saveLog;
}
+#ifdef SUBSURFACE_MOBILE
bool DCDeviceData::saveLog() const
{
return data.libdc_log;
}
+#endif // SUBSURFACE_MOBILE
+
device_data_t* DCDeviceData::internalData()
{
diff --git a/core/downloadfromdcthread.h b/core/downloadfromdcthread.h
index f36676943..685c6e5e8 100644
--- a/core/downloadfromdcthread.h
+++ b/core/downloadfromdcthread.h
@@ -14,6 +14,7 @@
/* Helper object for access of Device Data in QML */
class DCDeviceData : public QObject {
Q_OBJECT
+#ifdef SUBSURFACE_MOBILE
Q_PROPERTY(QString vendor READ vendor WRITE setVendor)
Q_PROPERTY(QString product READ product WRITE setProduct)
Q_PROPERTY(bool bluetoothMode READ bluetoothMode WRITE setBluetoothMode)
@@ -26,6 +27,7 @@ class DCDeviceData : public QObject {
Q_PROPERTY(int diveId READ diveId WRITE setDiveId)
Q_PROPERTY(bool saveDump READ saveDump WRITE setSaveDump)
Q_PROPERTY(bool saveLog READ saveLog WRITE setSaveLog)
+#endif // SUBSURFACE_MOBILE
public:
DCDeviceData(QObject *parent = nullptr);
@@ -34,26 +36,42 @@ public:
QString vendor() const;
QString product() const;
QString devName() const;
+ bool bluetoothMode() const;
+ bool saveDump() const;
QString devBluetoothName() const;
+#ifdef SUBSURFACE_MOBILE
QString descriptor() const;
- bool bluetoothMode() const;
bool forceDownload() const;
bool createNewTrip() const;
- bool saveDump() const;
bool saveLog() const;
int deviceId() const;
int diveId() const;
+#endif // SUBSURFACE_MOBILE
/* this needs to be a pointer to make the C-API happy */
device_data_t* internalData();
+#ifdef SUBSURFACE_MOBILE
Q_INVOKABLE QStringList getProductListFromVendor(const QString& vendor);
Q_INVOKABLE int getMatchingAddress(const QString &vendor, const QString &product);
Q_INVOKABLE int getDetectedVendorIndex();
Q_INVOKABLE int getDetectedProductIndex(const QString &currentVendorText);
+#else
+ QStringList getProductListFromVendor(const QString& vendor);
+ int getMatchingAddress(const QString &vendor, const QString &product);
+
+ int getDetectedVendorIndex();
+ int getDetectedProductIndex(const QString &currentVendorText);
+#endif // SUBSURFACE_MOBILE
+#ifdef SUBSURFACE_MOBILE
public slots:
+ void setDeviceId(int deviceId);
+ void setDiveId(int diveId);
+#else
+public:
+#endif // SUBSURFACE_MOBILE
void setVendor(const QString& vendor);
void setProduct(const QString& product);
void setDevName(const QString& devName);
@@ -61,8 +79,6 @@ public slots:
void setBluetoothMode(bool mode);
void setForceDownload(bool force);
void setCreateNewTrip(bool create);
- void setDeviceId(int deviceId);
- void setDiveId(int diveId);
void setSaveDump(bool dumpMode);
void setSaveLog(bool saveLog);
private:
@@ -75,13 +91,19 @@ private:
class DownloadThread : public QThread {
Q_OBJECT
+#ifdef SUBSURFACE_MOBILE
Q_PROPERTY(DCDeviceData* deviceData MEMBER m_data)
+#endif // SUBSURFACE_MOBILE
public:
DownloadThread();
void run() override;
+#ifdef SUBSURFACE_MOBILE
Q_INVOKABLE DCDeviceData *data();
+#else
+ DCDeviceData *data();
+#endif // SUBSURFACE_MOBILE
QString error;
private: