summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--CMakeLists.txt1
-rw-r--r--app/CMakeLists.txt18
-rw-r--r--app/main.cpp31
3 files changed, 38 insertions, 12 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 806ae35..37683ee 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -21,6 +21,5 @@ CMAKE_MINIMUM_REQUIRED(VERSION 3.3)
set(AFB_HELPERS_QTWSCLIENT ON CACHE BOOL "enable Qt's WebSocket client" FORCE)
add_definitions(-DUSE_API_DYN)
-#add_definitions(-DAFB_BINDING_WANT_DYNAPI)
include(${CMAKE_CURRENT_SOURCE_DIR}/conf.d/cmake/config.cmake)
diff --git a/app/CMakeLists.txt b/app/CMakeLists.txt
index 8f8bd1e..25da122 100644
--- a/app/CMakeLists.txt
+++ b/app/CMakeLists.txt
@@ -25,6 +25,12 @@ qt5_add_resources(RESOURCES Mixer.qrc)
PROJECT_TARGET_ADD(mixer)
+option(NATIVE_BUILD "Build for native environment, without homescreen and window manager" OFF)
+if(NATIVE_BUILD)
+ message(STATUS "Native build is ON")
+ add_definitions(-DNATIVE_BUILD)
+endif()
+
add_executable(mixer
main.cpp
mixer.cpp
@@ -49,9 +55,9 @@ target_link_libraries(mixer
afb-helpers
)
-#add_custom_command(TARGET ${TARGET_NAME}
-#PRE_BUILD
-#COMMAND mkdir -p ${CMAKE_CURRENT_BINARY_DIR}/../package/htdocs
-#COMMAND cp -rv ${CMAKE_CURRENT_SOURCE_DIR}/../htdocs ${CMAKE_CURRENT_BINARY_DIR}/../package/
-#COMMAND mkdir -p ${CMAKE_CURRENT_BINARY_DIR}/../package/etc
-#COMMAND cp -rv ${CMAKE_CURRENT_SOURCE_DIR}/../etc ${CMAKE_CURRENT_BINARY_DIR}/../package/)
+if(NOT NATIVE_BUILD)
+ target_link_libraries(mixer
+ homescreen
+ qtWindowmanagerWrapper
+ )
+endif()
diff --git a/app/main.cpp b/app/main.cpp
index 9c6339f..60b2951 100644
--- a/app/main.cpp
+++ b/app/main.cpp
@@ -30,8 +30,12 @@
#include <QtQuick/qquickitem.h>
#include <QtQuick/qquickview.h>
#include <QQuickWindow>
+#ifndef NATIVE_BUILD
#include <libhomescreen.hpp>
#include <qlibwindowmanager.h>
+#else
+#include <QScreen>
+#endif
#include "mixer.h"
int main(int argc, char *argv[])
@@ -50,7 +54,7 @@ int main(int argc, char *argv[])
parser.process(app);
QStringList positionalArguments = parser.positionalArguments();
- qmlRegisterType<Mixer>("Mixer", 1, 0, "Mixer");
+ qmlRegisterType<Mixer>("Mixer", 1, 0, "Mixer");
QQmlApplicationEngine engine;
if (positionalArguments.length() == 2) {
@@ -68,6 +72,7 @@ int main(int argc, char *argv[])
context->setContextProperty(QStringLiteral("bindingAddress"), bindingAddress);
std::string token = secret.toStdString();
+#ifndef NATIVE_BUILD
LibHomeScreen* hs = new LibHomeScreen();
QLibWindowmanager* qwm = new QLibWindowmanager();
@@ -100,14 +105,30 @@ int main(int argc, char *argv[])
}
}
});
-
+#endif
engine.load(QUrl(QStringLiteral("qrc:/Mixer.qml")));
// Find the instantiated model QObject and connect the signals/slots
- QList<QObject *> mobjs = engine.rootObjects();
+ QList<QObject*> mobjs = engine.rootObjects();
+ if (mobjs.empty())
+ {
+ qDebug() << "[ERROR] Failed to load QML!";
+ return -1;
+ }
- QQuickWindow *window = qobject_cast<QQuickWindow *>(mobjs.first());
- QObject::connect(window, SIGNAL(frameSwapped()), qwm, SLOT(slotActivateSurface()));
+ QQuickWindow *window = qobject_cast<QQuickWindow *>(mobjs.first());
+#ifdef NATIVE_BUILD
+ window->setFlags(window->flags() & ~Qt::FramelessWindowHint); // Remove the borderless flag
+ window->setHeight(QGuiApplication::primaryScreen()->geometry().height());
+#else
+ QObject::connect(window, SIGNAL(frameSwapped()), qwm, SLOT(slotActivateSurface()));
+#endif
}
+ else
+ {
+ qDebug() << "[ERROR] No port and token specified!";
+ return -1;
+ }
+
return app.exec();
}