summaryrefslogtreecommitdiffstats
path: root/app
diff options
context:
space:
mode:
Diffstat (limited to 'app')
-rw-r--r--app/CMakeLists.txt34
-rw-r--r--app/main.cpp64
2 files changed, 29 insertions, 69 deletions
diff --git a/app/CMakeLists.txt b/app/CMakeLists.txt
index e99daa7..e786164 100644
--- a/app/CMakeLists.txt
+++ b/app/CMakeLists.txt
@@ -1,5 +1,5 @@
###########################################################################
-# Copyright 2018,2019 Konsulko Group
+# Copyright 2018,2019,2022 Konsulko Group
#
# Author: Scott Murray <scott.murray@konsulko.com>
#
@@ -16,12 +16,18 @@
# limitations under the License.
###########################################################################
-set(CMAKE_INCLUDE_CURRENT_DIR ON)
-set(CMAKE_AUTOMOC ON)
-set(CMAKE_AUTORCC ON)
+project(cluster-dashboard VERSION 2.0.0 LANGUAGES CXX)
+
+if(CMAKE_VERSION VERSION_LESS "3.7.0")
+ set(CMAKE_INCLUDE_CURRENT_DIR ON)
+endif()
+set(OE_QMAKE_PATH_EXTERNAL_HOST_BINS $ENV{OE_QMAKE_PATH_HOST_BINS})
+
set(CMAKE_CXX_STANDARD 14)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
-set(OE_QMAKE_PATH_EXTERNAL_HOST_BINS $ENV{OE_QMAKE_PATH_HOST_BINS})
+
+set(CMAKE_AUTOMOC ON)
+set(CMAKE_AUTORCC ON)
find_package(Qt5 COMPONENTS Core Gui QuickControls2 QuickWidgets REQUIRED)
find_package(Qt5Gui ${QT_MIN_VERSION} CONFIG REQUIRED Private)
@@ -30,8 +36,6 @@ find_program(WAYLAND_SCANNER_EXECUTABLE NAMES wayland-scanner)
qt5_add_resources(RESOURCES cluster-gauges.qrc images/images.qrc)
-PROJECT_TARGET_ADD(cluster-gauges)
-
add_custom_command(
OUTPUT agl-shell-client-protocol.h
COMMAND ${WAYLAND_SCANNER_EXECUTABLE} client-header
@@ -56,14 +60,13 @@ add_custom_command(
DEPENDS ${CMAKE_SOURCE_DIR}/app/protocol/agl-shell.xml
)
-add_executable(${TARGET_NAME}
+add_executable(${PROJECT_NAME}
main.cpp
agl-shell-protocol.c
agl-shell-client-protocol.h
${RESOURCES}
)
-pkg_check_modules(QTAPPFW REQUIRED qtappfw-signal-composer)
pkg_check_modules(GLIB REQUIRED glib-2.0)
pkg_check_modules(WAYLAND_CLIENT REQUIRED wayland-client)
@@ -73,19 +76,12 @@ include_directories(
${GLIB_INCLUDE_DIRS}
)
-set_target_properties(${TARGET_NAME} PROPERTIES
- LABELS "EXECUTABLE"
- PREFIX ""
- COMPILE_FLAGS "${QTAPPFW_FLAGS} ${GLIB_FLAGS} ${EXTRAS_CFLAGS} -DFOR_AFB_BINDING"
- LINK_FLAGS "${BINDINGS_LINK_FLAG}"
- LINK_LIBRARIES "${EXTRAS_LIBRARIES}"
- OUTPUT_NAME "${TARGET_NAME}"
-)
-
-target_link_libraries(${TARGET_NAME}
+target_link_libraries(${PROJECT_NAME}
Qt5::QuickControls2
Qt5::QuickWidgets
${QTAPPFW_LIBRARIES}
${GLIB_LDFLAGS}
${WAYLAND_CLIENT_LIBRARIES}
)
+
+install(TARGETS ${PROJECT_NAME} DESTINATION bin)
diff --git a/app/main.cpp b/app/main.cpp
index 3c460d5..14c2ead 100644
--- a/app/main.cpp
+++ b/app/main.cpp
@@ -32,7 +32,6 @@
#include <QDebug>
#include <QScreen>
-#include <signalcomposer.h>
#include <wayland-client.h>
#include "agl-shell-client-protocol.h"
@@ -144,7 +143,7 @@ create_component(QPlatformNativeInterface *native, QQmlComponent *comp,
int main(int argc, char *argv[])
{
- QString myname = QString("cluster-gauges");
+ QString myname = QString("cluster-dashboard");
struct agl_shell *agl_shell;
struct wl_output *output;
@@ -165,60 +164,25 @@ int main(int argc, char *argv[])
screen = qApp->primaryScreen();
output = getWlOutput(native, screen);
- QCommandLineParser parser;
- parser.addPositionalArgument("port", app.translate("main", "port for binding"));
- parser.addPositionalArgument("secret", app.translate("main", "secret for binding"));
- parser.addHelpOption();
- parser.addVersionOption();
- parser.process(app);
-
- QStringList positionalArguments = parser.positionalArguments();
+ read_config();
QQmlApplicationEngine engine;
QQmlContext *context = engine.rootContext();
+ context->setContextProperty("runAnimation", runAnimation);
- if (positionalArguments.length() == 2) {
- int port = positionalArguments.takeFirst().toInt();
- QString secret = positionalArguments.takeFirst();
-
- QUrl bindingAddress;
- QUrlQuery query;
-
- struct wl_surface *bg;
-
- bindingAddress.setScheme(QStringLiteral("ws"));
- bindingAddress.setHost(QStringLiteral("localhost"));
- bindingAddress.setPort(port);
- bindingAddress.setPath(QStringLiteral("/api"));
-
- query.addQueryItem(QStringLiteral("token"), secret);
- bindingAddress.setQuery(query);
-
- read_config();
+ QQmlComponent bg_comp(&engine, QUrl("qrc:/cluster-gauges.qml"));
+ qDebug() << bg_comp.errors();
+ struct wl_surface *bg = create_component(native, &bg_comp, screen, &qobj_bg);
- context->setContextProperty(QStringLiteral("bindingAddress"),
- bindingAddress);
+ // set the surface as the background
+ agl_shell_set_background(agl_shell, bg, output);
- context->setContextProperty("SignalComposer",
- new SignalComposer(bindingAddress,
- context));
- context->setContextProperty("runAnimation", runAnimation);
-
- QQmlComponent bg_comp(&engine, QUrl("qrc:/cluster-gauges.qml"));
- qDebug() << bg_comp.errors();
-
- bg = create_component(native, &bg_comp, screen, &qobj_bg);
-
- // set the surface as the background
- agl_shell_set_background(agl_shell, bg, output);
-
- // instruct the compositor it can display after Qt has a chance
- // to load everything
- QTimer::singleShot(500, [agl_shell](){
- qDebug() << "agl_shell ready!";
- agl_shell_ready(agl_shell);
- });
- }
+ // instruct the compositor it can display after Qt has a chance
+ // to load everything
+ QTimer::singleShot(500, [agl_shell](){
+ qDebug() << "agl_shell ready!";
+ agl_shell_ready(agl_shell);
+ });
return app.exec();
}