diff --git a/CMakeLists.txt b/CMakeLists.txt index 0359dd6..90b9f0a 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -18,6 +18,10 @@ if (CMAKE_SYSTEM_NAME STREQUAL "Android") set(atcore-gui_EXTRA_LIBS Qt5::AndroidExtras Qt5::QuickControls2) endif() +find_package(AtCore REQUIRED COMPONENTS + AtCore +) + find_package(Qt5 ${REQUIRED_QT_VERSION} REQUIRED NO_MODULE COMPONENTS Core Quick Test Gui Svg QuickControls2) set(atcore-gui_SRCS @@ -27,6 +31,6 @@ set(atcore-gui_SRCS qt5_add_resources(RESOURCES resources.qrc) add_executable(atcore-gui ${atcore-gui_SRCS} ${RESOURCES}) -target_link_libraries(atcore-gui Qt5::Core Qt5::Qml Qt5::Quick Qt5::Svg ${atcore-gui_EXTRA_LIBS}) +target_link_libraries(atcore-gui AtCore::AtCore Qt5::Core Qt5::Qml Qt5::Quick Qt5::Svg ${atcore-gui_EXTRA_LIBS}) install(TARGETS atcore-gui ${KF5_INSTALL_TARGETS_DEFAULT_ARGS}) diff --git a/main.cpp b/main.cpp index 3135014..aae1afa 100644 --- a/main.cpp +++ b/main.cpp @@ -2,14 +2,14 @@ #include #include #include - +#include Q_DECL_EXPORT int main(int argc, char *argv[]) { QGuiApplication::setAttribute(Qt::AA_EnableHighDpiScaling); QApplication app(argc, argv); - + qmlRegisterType("org.kde.atcore",1,0,"AtCore"); QQuickView view; view.setResizeMode(QQuickView::SizeRootObjectToView); view.setSource(QUrl(QStringLiteral("qrc:///main.qml"))); diff --git a/main.qml b/main.qml index 7501127..f2d253c 100644 --- a/main.qml +++ b/main.qml @@ -3,10 +3,15 @@ import QtQuick.Controls 2.2 import QtQuick.Layouts 1.3 import org.kde.kirigami 2.1 as Kirigami import QtQuick.Extras 1.4 +import org.kde.atcore 1.0 Kirigami.ApplicationItem { id: root + AtCore { + id: atcore + } + globalDrawer: Kirigami.GlobalDrawer { id: left title: "AtCore Gui" @@ -29,12 +34,14 @@ Kirigami.ApplicationItem { visible: false TextField { + id: devText placeholderText: "/dev/ttyUSB0" Layout.fillWidth: true } Button { text: "Connect" onClicked: { + atcore.initSerial(devText.text,115200`) rowPie.visible = !rowPie.visible } }