aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--app/app.pro39
-rw-r--r--app/app.qrc9
-rw-r--r--app/main.cpp99
-rw-r--r--app/meson.build40
-rw-r--r--app/protocol/agl-shell-desktop.xml142
-rw-r--r--app/qml/Main.qml2
-rw-r--r--app/qml/qml.qrc9
-rw-r--r--app/shell-desktop.cpp50
-rw-r--r--app/shell-desktop.h90
-rw-r--r--meson.build33
-rw-r--r--tbtnavi.pro2
11 files changed, 83 insertions, 432 deletions
diff --git a/app/app.pro b/app/app.pro
deleted file mode 100644
index 398e063..0000000
--- a/app/app.pro
+++ /dev/null
@@ -1,39 +0,0 @@
-TEMPLATE = app
-TARGET = tbtnavi
-
-QT = qml network quick positioning location widgets gui-private
-PKGCONFIG += qtappfw-navigation qtappfw-vehicle-signals wayland-client
-
-CONFIG += c++1z link_pkgconfig wayland-scanner
-
-SOURCES += \
- main.cpp \
- navigation_client.cpp \
- qcheapruler.cpp \
- file_operation.cpp \
- shell-desktop.cpp
-
-HEADERS += \
- qcheapruler.hpp \
- navigation_client.h \
- file_operation.h \
- shell-desktop.h
-
-INCLUDEPATH += \
- ../include
-
-OTHER_FILES += \
- qmapboxlgapp.qml
-
-RESOURCES += \
- images/images.qrc \
- app.qrc
-
-WAYLANDCLIENTSOURCES += \
- protocol/agl-shell-desktop.xml
-
-target.path = /usr/bin
-target.files += $${OUT_PWD}/$${TARGET}
-target.CONFIG = no_check_exist executable
-
-INSTALLS += target
diff --git a/app/app.qrc b/app/app.qrc
deleted file mode 100644
index 0f1bb81..0000000
--- a/app/app.qrc
+++ /dev/null
@@ -1,9 +0,0 @@
-<RCC>
- <qresource prefix="/">
- <file>qml/qmldir</file>
- <file>qml/Main.qml</file>
- <file>qml/MapWindow.qml</file>
- <file>qml/InfoWindow.qml</file>
- <file>qml/TbtBoard.qml</file>
- </qresource>
-</RCC>
diff --git a/app/main.cpp b/app/main.cpp
index 4486d61..0b896b4 100644
--- a/app/main.cpp
+++ b/app/main.cpp
@@ -9,83 +9,10 @@
#include <QtQuick/QQuickWindow>
#include <navigation.h>
#include <vehiclesignals.h>
-#include <QScreen>
#include "navigation_client.h"
#include "qcheapruler.hpp"
#include "file_operation.h"
-#include "shell-desktop.h"
-
-#include <qpa/qplatformnativeinterface.h>
-#include <wayland-client.h>
-
-#include "wayland-agl-shell-desktop-client-protocol.h"
-
-#define OUTPUT_ID "remoting-remote-1"
-
-static void
-global_add(void *data, struct wl_registry *reg, uint32_t name,
- const char *interface, uint32_t)
-{
- struct agl_shell_desktop **shell = static_cast<struct agl_shell_desktop **>(data);
-
- if (strcmp(interface, agl_shell_desktop_interface.name) == 0) {
- *shell = static_cast<struct agl_shell_desktop *>(
- wl_registry_bind(reg, name, &agl_shell_desktop_interface, 1)
- );
- }
-}
-
-static void
-global_remove(void *data, struct wl_registry *reg, uint32_t id)
-{
- /* Don't care */
- (void) data;
- (void) reg;
- (void) id;
-}
-
-static const struct wl_registry_listener registry_listener = {
- global_add,
- global_remove,
-};
-
-static struct agl_shell_desktop *
-register_agl_shell_desktop(QPlatformNativeInterface *native)
-{
- struct wl_display *wl;
- struct wl_registry *registry;
- struct agl_shell_desktop *shell = nullptr;
-
- wl = static_cast<struct wl_display *>(native->nativeResourceForIntegration("display"));
- registry = wl_display_get_registry(wl);
-
- wl_registry_add_listener(registry, &registry_listener, &shell);
-
- /* Roundtrip to get all globals advertised by the compositor */
- wl_display_roundtrip(wl);
- wl_registry_destroy(registry);
-
- return shell;
-}
-
-
-static QScreen *
-find_qscreen(const char *screen_name)
-{
- QList<QScreen *> screens = qApp->screens();
- QScreen *found = nullptr;
- QString qstr_name = QString::fromUtf8(screen_name, -1);
-
- for (QScreen *xscreen : screens) {
- if (qstr_name == xscreen->name()) {
- found = xscreen;
- break;
- }
- }
-
- return found;
-}
int main(int argc, char *argv[])
{
@@ -101,30 +28,6 @@ int main(int argc, char *argv[])
QCoreApplication::setApplicationVersion("0.1.0");
app.setDesktopFileName(graphic_role);
- QPlatformNativeInterface *native = qApp->platformNativeInterface();
- agl_shell_desktop = register_agl_shell_desktop(native);
- if (!agl_shell_desktop) {
- qDebug() << "Could not find agl_shell_desktop extension. Is agl-compositor running?";
- exit(EXIT_FAILURE);
- }
-
- std::shared_ptr<struct agl_shell_desktop> shell{agl_shell_desktop, agl_shell_desktop_destroy};
- Shell *aglShell = new Shell(shell, nullptr);
-
- /* inform the compositor that the window be placed on a different
- * output */
- QScreen *screen_to_put = find_qscreen(OUTPUT_ID);
- if (screen_to_put) {
- qDebug() << "Found screen to put " << screen_to_put->name();
- aglShell->set_window_on_screen(screen_to_put, graphic_role);
- } else {
- qDebug() << "Couldn't find screen to put " << OUTPUT_ID;
- qDebug() << "Available screens: ";
- for (auto &ss: qApp->screens()) {
- qDebug() << "screen: " << ss->name();
- }
- }
-
// Load qml
QQmlApplicationEngine engine;
@@ -147,7 +50,7 @@ int main(int argc, char *argv[])
// notification streams separate.
Navigation *navigation = new Navigation(new VehicleSignals(vsConfig), false, context);
- engine.load(QUrl(QStringLiteral("qrc:qml/Main.qml")));
+ engine.load(QUrl(QStringLiteral("qrc:/Main.qml")));
QObject *root = engine.rootObjects().first();
new navigation_client(navigation, root->findChild<QObject*>("mapwindow"));
diff --git a/app/meson.build b/app/meson.build
new file mode 100644
index 0000000..864edb7
--- /dev/null
+++ b/app/meson.build
@@ -0,0 +1,40 @@
+cpp = meson.get_compiler('cpp')
+qt5_dep = dependency('qt5', modules: ['Qml', 'Quick', 'Gui', 'Location'])
+
+dep_qtappfw = [
+ dependency('qtappfw-navigation'),
+ dependency('qtappfw-vehicle-signals'),
+]
+
+tbtnavi_dep = [
+ qt5_dep,
+ dep_qtappfw,
+]
+
+tbtnavi_headers = [
+ 'qcheapruler.hpp',
+ 'navigation_client.h',
+ 'file_operation.h'
+]
+
+moc_files = qt5.compile_moc(headers: tbtnavi_headers,
+ dependencies: qt5_dep)
+
+tbtnavi_resources = [
+ 'images/images.qrc',
+ 'qml/qml.qrc'
+]
+
+resource_files = qt5.compile_resources(sources: tbtnavi_resources)
+
+tbtnavi_src = [
+ 'main.cpp',
+ 'navigation_client.cpp',
+ 'qcheapruler.cpp',
+ 'file_operation.cpp'
+]
+
+executable('tbtnavi', tbtnavi_src, resource_files, moc_files,
+ include_directories: include_directories('../include'),
+ dependencies : tbtnavi_dep,
+ install: true)
diff --git a/app/protocol/agl-shell-desktop.xml b/app/protocol/agl-shell-desktop.xml
deleted file mode 100644
index e7b9493..0000000
--- a/app/protocol/agl-shell-desktop.xml
+++ /dev/null
@@ -1,142 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<protocol name="agl_shell_desktop">
- <copyright>
- Copyright © 2020 Collabora, Ltd.
-
- Permission is hereby granted, free of charge, to any person obtaining a
- copy of this software and associated documentation files (the "Software"),
- to deal in the Software without restriction, including without limitation
- the rights to use, copy, modify, merge, publish, distribute, sublicense,
- and/or sell copies of the Software, and to permit persons to whom the
- Software is furnished to do so, subject to the following conditions:
-
- The above copyright notice and this permission notice (including the next
- paragraph) shall be included in all copies or substantial portions of the
- Software.
-
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
- THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
- FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
- DEALINGS IN THE SOFTWARE.
- </copyright>
- <interface name="agl_shell_desktop" version="1">
- <description summary="Private extension to allow applications activate other apps">
- This extension can be used by regular application to instruct to compositor
- to activate or switch to other running (regular) applications. The client
- is responsbile for filtering their own app_id when receiving application id.
-
- Note that other (regular) applications can bind to this interface and there is
- no mechanism to place to restrict or limit that.
- </description>
-
- <enum name="app_role">
- <entry name="popup" value="0"/>
- <entry name="fullscreen" value="1"/>
- <entry name="split_vertical" value="2"/>
- <entry name="split_horizontal" value="3"/>
- <entry name="remote" value="4"/>
- </enum>
-
- <enum name="app_state">
- <entry name="activated" value="0"/>
- <entry name="deactivated" value="1"/>
- </enum>
-
- <event name="application">
- <description summary="advertise application id">
- The compositor may choose to advertise one or more application ids which
- can be used to activate/switch to.
-
- When this global is bound, the compositor will send all application ids
- available for activation, but may send additional application id at any
- time (when they've been mapped in the compositor).
- </description>
- <arg name="app_id" type="string"/>
- </event>
-
- <request name="activate_app">
- <description summary="make client current window">
- Ask the compositor to make a toplevel to become the current/focused
- window for window management purposes.
-
- See xdg_toplevel.set_app_id from the xdg-shell protocol for a
- description of app_id.
- </description>
- <arg name="app_id" type="string"/>
- <arg name="app_data" type="string" allow-null="true"/>
- <arg name="output" type="object" interface="wl_output"/>
- </request>
-
- <request name="set_app_property">
- <description summary="set properties for a client identified by app_id">
- Ask the compositor to make a top-level window obey the 'app_role' enum
- and, depending on that role, to use some of the arguments as initial
- values to take into account.
-
- Note that x, y, bx, by, width and height would only make sense for the
- pop-up role, with the output argument being applicable to all the roles.
- The width and height values define the maximum area which the
- top-level window should be placed into. Note this doesn't correspond to
- top-level surface size, but to a bounding box which will be used to
- clip the surface to, in case the surface area extends that of this
- bounding box. Both of these values need to be larger than 0 (zero) to be
- taken into account by the compositor. Any negative values for the width
- and height will be discarded.
-
- The x and y values will serve as the (initial) position values.
- The bx and by values are the top-left x and y value of the bounding box.
- Any clipping happening to the bounding box will not affect the surface
- size or the position of the underlying surface backing the top-level
- window. The bx and by values, like the positional values, could be
- both set to zero, or even negative values. The compositor will pass
- those on without any further validation.
-
- The initial position values and the bounding rectangle will still be
- in effect on a subsequent activation request of the 'app_id', assuming
- it was previously de-activated at some point in time.
-
- See xdg_toplevel.set_app_id from the xdg-shell protocol for a
- description of app_id.
- </description>
- <arg name="app_id" type="string"/>
- <arg name="role" type="uint" enum="app_role"/>
- <arg name="x" type="int"/>
- <arg name="y" type="int"/>
- <arg name="bx" type="int"/>
- <arg name="by" type="int"/>
- <arg name="width" type="int"/>
- <arg name="height" type="int"/>
- <arg name="output" type="object" interface="wl_output"/>
- </request>
-
- <request name="deactivate_app">
- <description summary="de-activate/hide window identified by app_id">
- Ask the compositor to hide the toplevel window for window
- management purposes. Depending on the window role, this request
- will either display the previously active window (or the background
- in case there's no previously activate surface) or temporarly (or
- until a 'activate_app' is called upon) hide the surface. All
- the surfaces are identifiable by using the app_id, and no actions are
- taken in case the app_id is not/was not present.
-
- See xdg_toplevel.set_app_id from the xdg-shell protocol for a
- description of app_id.
- </description>
- <arg name="app_id" type="string"/>
- </request>
-
- <event name="state_app">
- <description summary="event sent when application has suffered state modification">
- Notifies application(s) when other application have suffered state modifications.
- </description>
- <arg name="app_id" type="string"/>
- <arg name="app_data" type="string" allow-null="true"/>
- <arg name="state" type="uint" enum="app_state"/>
- <arg name="role" type="uint" enum="app_role"/>
- </event>
-
- </interface>
-</protocol>
diff --git a/app/qml/Main.qml b/app/qml/Main.qml
index 186e345..80191b0 100644
--- a/app/qml/Main.qml
+++ b/app/qml/Main.qml
@@ -3,8 +3,6 @@ import QtQuick.Controls 2.2
import QtQuick.Window 2.11
-import "qrc:/qml"
-
ApplicationWindow {
id: tbtnavi
diff --git a/app/qml/qml.qrc b/app/qml/qml.qrc
new file mode 100644
index 0000000..cfa6ac0
--- /dev/null
+++ b/app/qml/qml.qrc
@@ -0,0 +1,9 @@
+<RCC>
+ <qresource prefix="/">
+ <file>qmldir</file>
+ <file>Main.qml</file>
+ <file>MapWindow.qml</file>
+ <file>InfoWindow.qml</file>
+ <file>TbtBoard.qml</file>
+ </qresource>
+</RCC>
diff --git a/app/shell-desktop.cpp b/app/shell-desktop.cpp
deleted file mode 100644
index 7e6e1d2..0000000
--- a/app/shell-desktop.cpp
+++ /dev/null
@@ -1,50 +0,0 @@
-/*
- * Copyright © 2020 Collabora Ltd.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice (including the
- * next paragraph) shall be included in all copies or substantial
- * portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
- * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
- * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
- * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
- * SOFTWARE.
- */
-
-#include <QGuiApplication>
-#include <QDebug>
-#include "shell-desktop.h"
-#include <qpa/qplatformnativeinterface.h>
-#include <stdio.h>
-
-static struct wl_output *
-getWlOutput(QScreen *screen)
-{
- QPlatformNativeInterface *native = qApp->platformNativeInterface();
- void *output = native->nativeResourceForScreen("output", screen);
- return static_cast<struct ::wl_output*>(output);
-}
-
-void
-Shell::set_window_on_screen(QScreen *screen, const QString &app_id)
-{
- struct wl_output *output;
- output = getWlOutput(screen);
- agl_shell_desktop_set_app_property(this->shell.get(),
- app_id.toStdString().c_str(),
- AGL_SHELL_DESKTOP_APP_ROLE_REMOTE,
- 0, 0, 0, 0, 0, 0, output);
-
-}
diff --git a/app/shell-desktop.h b/app/shell-desktop.h
deleted file mode 100644
index 7c3c36b..0000000
--- a/app/shell-desktop.h
+++ /dev/null
@@ -1,90 +0,0 @@
-/*
- * Copyright © 2020 Collabora Ltd.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice (including the
- * next paragraph) shall be included in all copies or substantial
- * portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
- * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
- * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
- * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
- * SOFTWARE.
- */
-
-#ifndef SHELLDESKTOP_H
-#define SHELLDESKTOP_H
-
-#include <QObject>
-#include <QString>
-#include <QScreen>
-#include <QWindow>
-#include <QDebug>
-#include <memory>
-
-#include "wayland-agl-shell-desktop-client-protocol.h"
-
-static void
-application_id_event(void *data, struct agl_shell_desktop *agl_shell_desktop,
- const char *app_id);
-static void
-application_state_event(void *data, struct agl_shell_desktop *agl_shell_desktop,
- const char *app_id, const char *app_data,
- uint32_t app_state, uint32_t app_role);
-
-static const struct agl_shell_desktop_listener agl_shell_desktop_listener = {
- application_id_event,
- application_state_event,
-};
-
-class Shell : public QObject
-{
-Q_OBJECT
-
-public:
- std::shared_ptr<struct agl_shell_desktop> shell;
- Shell(std::shared_ptr<struct agl_shell_desktop> shell, QObject *parent = nullptr) :
- QObject(parent), shell(shell)
- {
- struct agl_shell_desktop *agl_shell_desktop = shell.get();
- agl_shell_desktop_add_listener(agl_shell_desktop,
- &agl_shell_desktop_listener, this);
- }
-
-public slots: // calls out of qml into CPP
- void set_window_on_screen(QScreen *screen, const QString &app_id);
-};
-
-static void
-application_id_event(void *data, struct agl_shell_desktop *agl_shell_desktop,
- const char *app_id)
-{
- Shell *aglShell = static_cast<Shell *>(data);
- (void) agl_shell_desktop;
-}
-
-static void
-application_state_event(void *data, struct agl_shell_desktop *agl_shell_desktop,
- const char *app_id, const char *app_data,
- uint32_t app_state, uint32_t app_role)
-{
- (void) data;
- (void) agl_shell_desktop;
- (void) app_id;
- (void) app_data;
- (void) app_state;
- (void) app_role;
-}
-
-#endif // SHELLDESKTOP_H
diff --git a/meson.build b/meson.build
new file mode 100644
index 0000000..2a56fd8
--- /dev/null
+++ b/meson.build
@@ -0,0 +1,33 @@
+#
+# Copyright ©, 2023 Collabora, Ltd.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+project (
+ 'tbtnavi',
+ ['c', 'cpp'],
+ version : '1.0.0',
+ license : 'Apache-2.0',
+ meson_version : '>= 0.60.0',
+ default_options :
+ [
+ 'warning_level=1',
+ 'buildtype=debugoptimized',
+ 'c_std=c17',
+ 'cpp_std=c++17'
+ ],
+)
+
+qt5 = import('qt5')
+subdir('app')
diff --git a/tbtnavi.pro b/tbtnavi.pro
deleted file mode 100644
index 5cf7e78..0000000
--- a/tbtnavi.pro
+++ /dev/null
@@ -1,2 +0,0 @@
-TEMPLATE = subdirs
-SUBDIRS = app