mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
core: remove qml properties from downloadfromcthread
Remove Q_OBJECT and qml properties from DCDeviceData class Remove DCDeviceData register from mobile-helper.cpp Change DCDeviceData constructor to be without parameters Signed-off-by: Jan Iversen <jani@apache.org>
This commit is contained in:
parent
807571a588
commit
470c218b79
4 changed files with 5 additions and 48 deletions
|
@ -205,7 +205,7 @@ void show_computer_list()
|
||||||
}
|
}
|
||||||
DCDeviceData *DCDeviceData::m_instance = NULL;
|
DCDeviceData *DCDeviceData::m_instance = NULL;
|
||||||
|
|
||||||
DCDeviceData::DCDeviceData(QObject *parent) : QObject(parent)
|
DCDeviceData::DCDeviceData()
|
||||||
{
|
{
|
||||||
memset(&data, 0, sizeof(data));
|
memset(&data, 0, sizeof(data));
|
||||||
data.trip = nullptr;
|
data.trip = nullptr;
|
||||||
|
@ -227,7 +227,7 @@ DCDeviceData::DCDeviceData(QObject *parent) : QObject(parent)
|
||||||
DCDeviceData *DCDeviceData::instance()
|
DCDeviceData *DCDeviceData::instance()
|
||||||
{
|
{
|
||||||
if (!m_instance)
|
if (!m_instance)
|
||||||
m_instance = new DCDeviceData();
|
m_instance = new DCDeviceData;
|
||||||
return m_instance;
|
return m_instance;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -282,19 +282,16 @@ QString DCDeviceData::devBluetoothName() const
|
||||||
return m_devBluetoothName;
|
return m_devBluetoothName;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef SUBSURFACE_MOBILE
|
|
||||||
QString DCDeviceData::descriptor() const
|
QString DCDeviceData::descriptor() const
|
||||||
{
|
{
|
||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
#endif // SUBSURFACE_MOBILE
|
|
||||||
|
|
||||||
bool DCDeviceData::bluetoothMode() const
|
bool DCDeviceData::bluetoothMode() const
|
||||||
{
|
{
|
||||||
return data.bluetooth_mode;
|
return data.bluetooth_mode;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef SUBSURFACE_MOBILE
|
|
||||||
bool DCDeviceData::forceDownload() const
|
bool DCDeviceData::forceDownload() const
|
||||||
{
|
{
|
||||||
return data.force_download;
|
return data.force_download;
|
||||||
|
@ -314,7 +311,6 @@ int DCDeviceData::diveId() const
|
||||||
{
|
{
|
||||||
return data.diveid;
|
return data.diveid;
|
||||||
}
|
}
|
||||||
#endif // SUBSURFACE_MOBILE
|
|
||||||
|
|
||||||
void DCDeviceData::setVendor(const QString& vendor)
|
void DCDeviceData::setVendor(const QString& vendor)
|
||||||
{
|
{
|
||||||
|
@ -367,7 +363,6 @@ void DCDeviceData::setCreateNewTrip(bool create)
|
||||||
data.create_new_trip = create;
|
data.create_new_trip = create;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef SUBSURFACE_MOBILE
|
|
||||||
void DCDeviceData::setDeviceId(int deviceId)
|
void DCDeviceData::setDeviceId(int deviceId)
|
||||||
{
|
{
|
||||||
data.deviceid = deviceId;
|
data.deviceid = deviceId;
|
||||||
|
@ -377,7 +372,6 @@ void DCDeviceData::setDiveId(int diveId)
|
||||||
{
|
{
|
||||||
data.diveid = diveId;
|
data.diveid = diveId;
|
||||||
}
|
}
|
||||||
#endif // SUBSURFACE_MOBILE
|
|
||||||
|
|
||||||
void DCDeviceData::setSaveDump(bool save)
|
void DCDeviceData::setSaveDump(bool save)
|
||||||
{
|
{
|
||||||
|
@ -394,12 +388,10 @@ void DCDeviceData::setSaveLog(bool saveLog)
|
||||||
data.libdc_log = saveLog;
|
data.libdc_log = saveLog;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef SUBSURFACE_MOBILE
|
|
||||||
bool DCDeviceData::saveLog() const
|
bool DCDeviceData::saveLog() const
|
||||||
{
|
{
|
||||||
return data.libdc_log;
|
return data.libdc_log;
|
||||||
}
|
}
|
||||||
#endif // SUBSURFACE_MOBILE
|
|
||||||
|
|
||||||
|
|
||||||
device_data_t* DCDeviceData::internalData()
|
device_data_t* DCDeviceData::internalData()
|
||||||
|
|
|
@ -12,25 +12,9 @@
|
||||||
#include "core/btdiscovery.h"
|
#include "core/btdiscovery.h"
|
||||||
#endif
|
#endif
|
||||||
/* Helper object for access of Device Data in QML */
|
/* Helper object for access of Device Data in QML */
|
||||||
class DCDeviceData : public QObject {
|
class DCDeviceData {
|
||||||
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)
|
|
||||||
Q_PROPERTY(QString devName READ devName WRITE setDevName)
|
|
||||||
Q_PROPERTY(QString devBluetoothName READ devBluetoothName WRITE setDevBluetoothName)
|
|
||||||
Q_PROPERTY(QString descriptor READ descriptor)
|
|
||||||
Q_PROPERTY(bool forceDownload READ forceDownload WRITE setForceDownload)
|
|
||||||
Q_PROPERTY(bool createNewTrip READ createNewTrip WRITE setCreateNewTrip)
|
|
||||||
Q_PROPERTY(int deviceId READ deviceId WRITE setDeviceId)
|
|
||||||
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:
|
public:
|
||||||
DCDeviceData(QObject *parent = nullptr);
|
DCDeviceData();
|
||||||
static DCDeviceData *instance();
|
static DCDeviceData *instance();
|
||||||
|
|
||||||
QString vendor() const;
|
QString vendor() const;
|
||||||
|
@ -39,39 +23,24 @@ public:
|
||||||
bool bluetoothMode() const;
|
bool bluetoothMode() const;
|
||||||
bool saveDump() const;
|
bool saveDump() const;
|
||||||
QString devBluetoothName() const;
|
QString devBluetoothName() const;
|
||||||
#ifdef SUBSURFACE_MOBILE
|
|
||||||
QString descriptor() const;
|
QString descriptor() const;
|
||||||
bool forceDownload() const;
|
bool forceDownload() const;
|
||||||
bool createNewTrip() const;
|
bool createNewTrip() const;
|
||||||
bool saveLog() const;
|
bool saveLog() const;
|
||||||
int deviceId() const;
|
int deviceId() const;
|
||||||
int diveId() const;
|
int diveId() const;
|
||||||
#endif // SUBSURFACE_MOBILE
|
|
||||||
|
|
||||||
/* this needs to be a pointer to make the C-API happy */
|
/* this needs to be a pointer to make the C-API happy */
|
||||||
device_data_t* internalData();
|
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 ¤tVendorText);
|
|
||||||
#else
|
|
||||||
QStringList getProductListFromVendor(const QString& vendor);
|
QStringList getProductListFromVendor(const QString& vendor);
|
||||||
int getMatchingAddress(const QString &vendor, const QString &product);
|
int getMatchingAddress(const QString &vendor, const QString &product);
|
||||||
|
|
||||||
int getDetectedVendorIndex();
|
int getDetectedVendorIndex();
|
||||||
int getDetectedProductIndex(const QString ¤tVendorText);
|
int getDetectedProductIndex(const QString ¤tVendorText);
|
||||||
#endif // SUBSURFACE_MOBILE
|
|
||||||
|
|
||||||
#ifdef SUBSURFACE_MOBILE
|
|
||||||
public slots:
|
|
||||||
void setDeviceId(int deviceId);
|
void setDeviceId(int deviceId);
|
||||||
void setDiveId(int diveId);
|
void setDiveId(int diveId);
|
||||||
#else
|
|
||||||
public:
|
|
||||||
#endif // SUBSURFACE_MOBILE
|
|
||||||
void setVendor(const QString& vendor);
|
void setVendor(const QString& vendor);
|
||||||
void setProduct(const QString& product);
|
void setProduct(const QString& product);
|
||||||
void setDevName(const QString& devName);
|
void setDevName(const QString& devName);
|
||||||
|
@ -91,9 +60,6 @@ private:
|
||||||
|
|
||||||
class DownloadThread : public QThread {
|
class DownloadThread : public QThread {
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
#ifdef SUBSURFACE_MOBILE
|
|
||||||
Q_PROPERTY(DCDeviceData* deviceData MEMBER m_data)
|
|
||||||
#endif // SUBSURFACE_MOBILE
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
DownloadThread();
|
DownloadThread();
|
||||||
|
|
|
@ -138,7 +138,7 @@ QMLManager::QMLManager() : m_locationServiceEnabled(false),
|
||||||
m_selectedDiveTimestamp(0),
|
m_selectedDiveTimestamp(0),
|
||||||
m_credentialStatus(CS_UNKNOWN),
|
m_credentialStatus(CS_UNKNOWN),
|
||||||
alreadySaving(false),
|
alreadySaving(false),
|
||||||
m_device_data(new DCDeviceData(this))
|
m_device_data(new DCDeviceData)
|
||||||
{
|
{
|
||||||
LOG_STP("qmlmgr starting");
|
LOG_STP("qmlmgr starting");
|
||||||
m_instance = this;
|
m_instance = this;
|
||||||
|
|
|
@ -57,7 +57,6 @@ void run_ui()
|
||||||
qmlRegisterType<QMLManager>("org.subsurfacedivelog.mobile", 1, 0, "QMLManager");
|
qmlRegisterType<QMLManager>("org.subsurfacedivelog.mobile", 1, 0, "QMLManager");
|
||||||
qmlRegisterType<QMLProfile>("org.subsurfacedivelog.mobile", 1, 0, "QMLProfile");
|
qmlRegisterType<QMLProfile>("org.subsurfacedivelog.mobile", 1, 0, "QMLProfile");
|
||||||
|
|
||||||
qmlRegisterType<DCDeviceData>("org.subsurfacedivelog.mobile", 1, 0, "DCDeviceData");
|
|
||||||
qmlRegisterType<DownloadThread>("org.subsurfacedivelog.mobile", 1, 0, "DCDownloadThread");
|
qmlRegisterType<DownloadThread>("org.subsurfacedivelog.mobile", 1, 0, "DCDownloadThread");
|
||||||
qmlRegisterType<DiveImportedModel>("org.subsurfacedivelog.mobile", 1, 0, "DCImportModel");
|
qmlRegisterType<DiveImportedModel>("org.subsurfacedivelog.mobile", 1, 0, "DCImportModel");
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue