aboutsummaryrefslogtreecommitdiffstats
path: root/app/main.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'app/main.cpp')
-rw-r--r--app/main.cpp37
1 files changed, 36 insertions, 1 deletions
diff --git a/app/main.cpp b/app/main.cpp
index b3fd47a..41773f0 100644
--- a/app/main.cpp
+++ b/app/main.cpp
@@ -9,6 +9,7 @@
#include <QtQuick/QQuickWindow>
#include <navigation.h>
#include <vehiclesignals.h>
+#include <glib.h>
#include "navigation_client.h"
#include "qcheapruler.hpp"
@@ -16,6 +17,34 @@
#include "AglShellGrpcClient.h"
+std::string
+read_config_and_get_output(void)
+{
+ GKeyFile *conf_file;
+ gchar *value;
+ GError *err = NULL;
+
+ bool ret;
+ int n;
+ unsigned width, height, x, y;
+
+ // Load settings from configuration file if it exists
+ conf_file = g_key_file_new();
+
+ ret = g_key_file_load_from_dirs(conf_file, "AGL.conf",
+ (const gchar**) g_get_system_config_dirs(),
+ NULL, G_KEY_FILE_KEEP_COMMENTS, NULL);
+ if (!ret)
+ return std::string("");
+
+ value = g_key_file_get_string(conf_file, "tbtnavi", "output", &err);
+ if (!value) {
+ return std::string("");
+ }
+
+ return std::string(value);
+}
+
int main(int argc, char *argv[])
{
std::string our_name = "tbtnavi";
@@ -30,8 +59,14 @@ int main(int argc, char *argv[])
QCoreApplication::setApplicationVersion("0.1.0");
app.setDesktopFileName(graphic_role);
+ // grab the output to put the application on
+ std::string output = read_config_and_get_output();
+
GrpcClient *client = new GrpcClient();
- client->SetAppOnOutput(our_name, "remoting-remote-1");
+ if (!output.empty())
+ client->SetAppOnOutput(our_name, output);
+ else
+ client->SetAppOnOutput(our_name, "pipewire");
// Load qml
QQmlApplicationEngine engine;