mirror of
https://github.com/Fishwaldo/SBCBMC.git
synced 2025-03-15 19:41:36 +00:00
Start QML Window
This commit is contained in:
parent
3badf6e5da
commit
4fab32f227
8 changed files with 90 additions and 26 deletions
|
@ -15,15 +15,20 @@ cmake_policy(SET CMP0071 NEW)
|
||||||
|
|
||||||
find_package(Qt5 COMPONENTS Core REQUIRED)
|
find_package(Qt5 COMPONENTS Core REQUIRED)
|
||||||
find_package(Qt5 COMPONENTS RemoteObjects REQUIRED)
|
find_package(Qt5 COMPONENTS RemoteObjects REQUIRED)
|
||||||
|
find_package(Qt5 COMPONENTS Qml REQUIRED)
|
||||||
|
find_package(Qt5 COMPONENTS Quick REQUIRED)
|
||||||
|
find_package(Qt5 COMPONENTS QuickControls2 REQUIRED)
|
||||||
|
|
||||||
find_package(PkgConfig REQUIRED)
|
find_package(PkgConfig REQUIRED)
|
||||||
|
|
||||||
#configure_file(include/config.h.in include/config.h)
|
#configure_file(include/config.h.in include/config.h)
|
||||||
|
|
||||||
set(HEADERS
|
set(HEADERS
|
||||||
|
include/client.hpp
|
||||||
)
|
)
|
||||||
set(SOURCES
|
set(SOURCES
|
||||||
source/main.cpp
|
source/main.cpp
|
||||||
|
source/client.cpp
|
||||||
)
|
)
|
||||||
qt5_generate_repc(REPSOURCES
|
qt5_generate_repc(REPSOURCES
|
||||||
${CMAKE_SOURCE_DIR}/plugins/dcdc-usb-200/source/dcdc_usb_200.rep
|
${CMAKE_SOURCE_DIR}/plugins/dcdc-usb-200/source/dcdc_usb_200.rep
|
||||||
|
@ -39,6 +44,7 @@ add_executable(sbcbmc-client
|
||||||
${SOURCES}
|
${SOURCES}
|
||||||
${HEADERS}
|
${HEADERS}
|
||||||
${REPSOURCES}
|
${REPSOURCES}
|
||||||
|
sbcbmc-client.qrc
|
||||||
)
|
)
|
||||||
|
|
||||||
target_include_directories(sbcbmc-client PRIVATE
|
target_include_directories(sbcbmc-client PRIVATE
|
||||||
|
@ -49,4 +55,4 @@ target_include_directories(sbcbmc-client PRIVATE
|
||||||
${LibUSB_INCLUDE_DIRS}
|
${LibUSB_INCLUDE_DIRS}
|
||||||
)
|
)
|
||||||
|
|
||||||
target_link_libraries(sbcbmc-client Qt5::Core Qt5::RemoteObjects)
|
target_link_libraries(sbcbmc-client Qt5::Core Qt5::RemoteObjects Qt5::Qml Qt5::Quick)
|
12
client/include/client.hpp
Normal file
12
client/include/client.hpp
Normal file
|
@ -0,0 +1,12 @@
|
||||||
|
#include <QObject>
|
||||||
|
#include <QQmlApplicationEngine>
|
||||||
|
|
||||||
|
class SBCBMCClient : public QObject {
|
||||||
|
Q_OBJECT
|
||||||
|
public:
|
||||||
|
SBCBMCClient(QObject *parent = nullptr);
|
||||||
|
~SBCBMCClient();
|
||||||
|
|
||||||
|
private:
|
||||||
|
QQmlApplicationEngine *engine;
|
||||||
|
};
|
21
client/qml/main.qml
Normal file
21
client/qml/main.qml
Normal file
|
@ -0,0 +1,21 @@
|
||||||
|
import QtQuick.Controls 2.12
|
||||||
|
|
||||||
|
ApplicationWindow {
|
||||||
|
visible: true
|
||||||
|
|
||||||
|
menuBar: MenuBar {
|
||||||
|
// ...
|
||||||
|
}
|
||||||
|
|
||||||
|
header: ToolBar {
|
||||||
|
// ...
|
||||||
|
}
|
||||||
|
|
||||||
|
footer: TabBar {
|
||||||
|
// ...
|
||||||
|
}
|
||||||
|
|
||||||
|
StackView {
|
||||||
|
anchors.fill: parent
|
||||||
|
}
|
||||||
|
}
|
5
client/sbcbmc-client.qrc
Normal file
5
client/sbcbmc-client.qrc
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
<!DOCTYPE RCC><RCC version="1.0">
|
||||||
|
<qresource>
|
||||||
|
<file>qml/main.qml</file>
|
||||||
|
</qresource>
|
||||||
|
</RCC>
|
38
client/source/client.cpp
Normal file
38
client/source/client.cpp
Normal file
|
@ -0,0 +1,38 @@
|
||||||
|
#include "client.hpp"
|
||||||
|
|
||||||
|
SBCBMCClient::SBCBMCClient(QObject *parent) :
|
||||||
|
QObject(parent)
|
||||||
|
{
|
||||||
|
this->engine = new QQmlApplicationEngine("qrc:///qml/main.qml");
|
||||||
|
}
|
||||||
|
|
||||||
|
SBCBMCClient::~SBCBMCClient()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
#if 0
|
||||||
|
QRemoteObjectNode node(QUrl("tcp://127.0.0.1:1999"));
|
||||||
|
|
||||||
|
QObject::connect(&node, &QRemoteObjectNode::remoteObjectAdded,
|
||||||
|
[](const QRemoteObjectSourceLocation& info){
|
||||||
|
qDebug() << "New source added : " << info;
|
||||||
|
});
|
||||||
|
|
||||||
|
qDebug() << "Waiting for registry ";
|
||||||
|
node.waitForRegistry(10000);
|
||||||
|
|
||||||
|
qDebug() << "Already here sources : " << node.registry()->sourceLocations();
|
||||||
|
|
||||||
|
QTimer timer;
|
||||||
|
timer.start(5000);
|
||||||
|
|
||||||
|
QObject::connect(&timer, &QTimer::timeout,
|
||||||
|
[&](){
|
||||||
|
qDebug() << "New sources list : " << node.registry()->sourceLocations();
|
||||||
|
});
|
||||||
|
|
||||||
|
QRemoteObjectDynamicReplica *plugin = node.acquireDynamic("plugins/thermal/thermal_zone1/x86_pkg_temp");
|
||||||
|
QRemoteObjectDynamicReplica *plugin2 = node.acquireDynamic("plugins/thermal/thermal_zone0/x86_pkg_temp");
|
||||||
|
|
||||||
|
#endif
|
|
@ -3,9 +3,10 @@
|
||||||
#include <QLoggingCategory>
|
#include <QLoggingCategory>
|
||||||
#include <QtRemoteObjects/QRemoteObjectNode>
|
#include <QtRemoteObjects/QRemoteObjectNode>
|
||||||
#include <QTimer>
|
#include <QTimer>
|
||||||
|
#include "client.hpp"
|
||||||
|
|
||||||
|
|
||||||
Q_LOGGING_CATEGORY(ozwdaemon, "ozw.daemon");
|
Q_LOGGING_CATEGORY(sbcclient, "sbcbmc.client");
|
||||||
|
|
||||||
#if 0
|
#if 0
|
||||||
#define APP_VERSION #carputer_VERSION_MAJOR.#carputer_VERSION_MINOR.#carputer_VERSION_PATCH
|
#define APP_VERSION #carputer_VERSION_MAJOR.#carputer_VERSION_MINOR.#carputer_VERSION_PATCH
|
||||||
|
@ -17,40 +18,21 @@ Q_LOGGING_CATEGORY(ozwdaemon, "ozw.daemon");
|
||||||
int main(int argc, char *argv[]) {
|
int main(int argc, char *argv[]) {
|
||||||
|
|
||||||
QCoreApplication a(argc, argv);
|
QCoreApplication a(argc, argv);
|
||||||
QCoreApplication::setApplicationName("carclient");
|
QCoreApplication::setApplicationName("sbcbmc-client");
|
||||||
//QCoreApplication::setApplicationVersion(DEF2STR(APP_VERSION));
|
//QCoreApplication::setApplicationVersion(DEF2STR(APP_VERSION));
|
||||||
QCoreApplication::setOrganizationName("DynamX");
|
QCoreApplication::setOrganizationName("DynamX");
|
||||||
QCoreApplication::setOrganizationDomain("dynam.com");
|
QCoreApplication::setOrganizationDomain("dynam.com");
|
||||||
|
|
||||||
QCommandLineParser parser;
|
QCommandLineParser parser;
|
||||||
parser.setApplicationDescription("CarClient");
|
parser.setApplicationDescription("SBCBMC Client");
|
||||||
parser.addHelpOption();
|
parser.addHelpOption();
|
||||||
parser.addVersionOption();
|
parser.addVersionOption();
|
||||||
|
|
||||||
parser.process(a);
|
parser.process(a);
|
||||||
|
|
||||||
QRemoteObjectNode node(QUrl("tcp://127.0.0.1:1999"));
|
SBCBMCClient client;
|
||||||
|
|
||||||
QObject::connect(&node, &QRemoteObjectNode::remoteObjectAdded,
|
|
||||||
[](const QRemoteObjectSourceLocation& info){
|
|
||||||
qDebug() << "New source added : " << info;
|
|
||||||
});
|
|
||||||
|
|
||||||
qDebug() << "Waiting for registry ";
|
|
||||||
node.waitForRegistry(10000);
|
|
||||||
|
|
||||||
qDebug() << "Already here sources : " << node.registry()->sourceLocations();
|
|
||||||
|
|
||||||
QTimer timer;
|
|
||||||
timer.start(5000);
|
|
||||||
|
|
||||||
QObject::connect(&timer, &QTimer::timeout,
|
|
||||||
[&](){
|
|
||||||
qDebug() << "New sources list : " << node.registry()->sourceLocations();
|
|
||||||
});
|
|
||||||
|
|
||||||
QRemoteObjectDynamicReplica *plugin = node.acquireDynamic("plugins/thermal/thermal_zone1/x86_pkg_temp");
|
|
||||||
QRemoteObjectDynamicReplica *plugin2 = node.acquireDynamic("plugins/thermal/thermal_zone0/x86_pkg_temp");
|
|
||||||
|
|
||||||
|
|
||||||
a.exec();
|
a.exec();
|
||||||
|
|
|
@ -48,7 +48,7 @@ add_library(dcdc-usb-200
|
||||||
|
|
||||||
target_include_directories(dcdc-usb-200 PRIVATE
|
target_include_directories(dcdc-usb-200 PRIVATE
|
||||||
"${PROJECT_BINARY_DIR}"
|
"${PROJECT_BINARY_DIR}"
|
||||||
"${CMAKE_SOURCE_DIR}/car/include/"
|
"${CMAKE_SOURCE_DIR}/agent/include/"
|
||||||
${LibUSB_INCLUDE_DIRS}
|
${LibUSB_INCLUDE_DIRS}
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
|
@ -38,7 +38,7 @@ add_library(thermal
|
||||||
|
|
||||||
target_include_directories(thermal PRIVATE
|
target_include_directories(thermal PRIVATE
|
||||||
"${PROJECT_BINARY_DIR}"
|
"${PROJECT_BINARY_DIR}"
|
||||||
"${CMAKE_SOURCE_DIR}/car/include/"
|
"${CMAKE_SOURCE_DIR}/agent/include/"
|
||||||
)
|
)
|
||||||
|
|
||||||
target_include_directories(thermal PUBLIC
|
target_include_directories(thermal PUBLIC
|
||||||
|
|
Loading…
Add table
Reference in a new issue