File tree Expand file tree Collapse file tree 7 files changed +28
-89
lines changed
Expand file tree Collapse file tree 7 files changed +28
-89
lines changed Original file line number Diff line number Diff line change 11set (SRC
2- src/utils_plugin.cpp
32 src/deviceinfo.cpp
43 src/fileinfo.cpp
54 src/bluetoothstatus.cpp)
65set (HEADERS
7- src/utils_plugin.h
86 src/deviceinfo.h
97 src/fileinfo.h
108 src/bluetoothstatus.h)
119
12- add_library (asteroidutilsplugin ${SRC} ${HEADERS} )
10+ # TODO: ensure FileInfo 1.0 (singleton) & BluetoothStatus 1.0 (normal) QML classes work
11+ qt_add_qml_module(asteroidutilsplugin
12+ URI org.asteroid.utils
13+ VERSION 1.0
14+ PLUGIN_TARGET asteroidutilsplugin
15+ #NO_PLUGIN_OPTIONAL
16+ SOURCES
17+ ${SRC} ${HEADERS}
18+ )
19+
20+ target_include_directories (asteroidutilsplugin PRIVATE src)
1321
1422target_link_libraries (asteroidutilsplugin
15- Qt::DBus
16- Qt::Qml
17- Qt::Quick)
23+ #PUBLIC
24+ # Qt::Qml
25+ # Qt::Quick
26+ PRIVATE
27+ Qt::DBus # bluetoothstatus
28+ )
1829
1930install (TARGETS asteroidutilsplugin
2031 DESTINATION ${INSTALL_QML_IMPORT_DIR} /org/asteroid/utils)
21- install (FILES qmldir
22- DESTINATION ${INSTALL_QML_IMPORT_DIR} /org/asteroid/utils)
32+ install (FILES ${CMAKE_CURRENT_BINARY_DIR} / qmldir
33+ DESTINATION ${INSTALL_QML_IMPORT_DIR} /org/asteroid/utils)
Load Diff This file was deleted.
Original file line number Diff line number Diff line change 2323#include < QDBusObjectPath>
2424#include < QDBusConnection>
2525#include < QDBusServiceWatcher>
26+ #include < QtQml>
2627
2728typedef QMap<QString, QMap<QString, QVariant>> InterfaceList;
2829Q_DECLARE_METATYPE (InterfaceList)
2930
3031class BluetoothStatus : public QObject
3132{
3233 Q_OBJECT
34+ QML_ELEMENT
3335 Q_PROPERTY (bool powered READ getPowered WRITE setPowered NOTIFY poweredChanged)
3436 Q_PROPERTY (bool connected READ getConnected NOTIFY connectedChanged)
3537
Original file line number Diff line number Diff line change 2626class DeviceInfo : public QObject
2727{
2828 Q_OBJECT
29+ QML_SINGLETON
30+ QML_ELEMENT
2931 Q_DISABLE_COPY (DeviceInfo)
3032 Q_PROPERTY (bool hasRoundScreen READ hasRoundScreen CONSTANT)
3133 Q_PROPERTY (double borderGestureWidth READ borderGestureWidth CONSTANT)
@@ -38,11 +40,8 @@ class DeviceInfo : public QObject
3840 Q_PROPERTY (QString buildID READ buildID CONSTANT)
3941 DeviceInfo ();
4042public:
41- static QObject * qmlInstance (QQmlEngine *engine , QJSEngine *scriptEngine )
43+ static DeviceInfo * create (QQmlEngine *, QJSEngine *)
4244 {
43- Q_UNUSED (engine);
44- Q_UNUSED (scriptEngine);
45-
4645 return new DeviceInfo;
4746 }
4847 bool hasRoundScreen ();
Original file line number Diff line number Diff line change 2525class FileInfo : public QObject
2626{
2727 Q_OBJECT
28+ QML_SINGLETON
29+ QML_ELEMENT
2830 Q_DISABLE_COPY (FileInfo)
2931 FileInfo () {}
3032public:
31- static QObject * qmlInstance (QQmlEngine *engine , QJSEngine *scriptEngine )
33+ static FileInfo * create (QQmlEngine *, QJSEngine *)
3234 {
33- Q_UNUSED (engine);
34- Q_UNUSED (scriptEngine);
35-
3635 return new FileInfo;
3736 }
37+ // TODO: FileInfo(QObject *parent = 0); instead?
3838 Q_INVOKABLE bool exists (const QString fileName);
3939};
4040
Load Diff This file was deleted.
Load Diff This file was deleted.
You can’t perform that action at this time.
0 commit comments