Add ENABLE_GSTREAMERMM, make gstreamermm support optional.
[pulseview.git] / main.cpp
index c7fe9bb2dedc38029d115b324c3da58d2a3f6d58..857c36a9c224567f78cd055a70df2566ffdbe2ad 100644 (file)
--- a/main.cpp
+++ b/main.cpp
 #include <getopt.h>
 #include <vector>
 
+#ifdef ENABLE_GSTREAMERMM
+#include <gstreamermm.h>
+#endif
+
 #include <libsigrokcxx/libsigrokcxx.hpp>
 
 #include <QCheckBox>
@@ -54,6 +58,7 @@
 #include "pv/logging.hpp"
 #include "pv/mainwindow.hpp"
 #include "pv/session.hpp"
+#include "pv/util.hpp"
 
 #ifdef ANDROID
 #include <libsigrokandroidutils/libsigrokandroidutils.h>
@@ -168,6 +173,11 @@ int main(int argc, char *argv[])
        bool do_scan = true;
        bool show_version = false;
 
+#ifdef ENABLE_GSTREAMERMM
+       // Initialise gstreamermm. Must be called before any other GLib stuff.
+       Gst::init();
+#endif
+
        Application a(argc, argv);
 
 #ifdef ANDROID
@@ -254,9 +264,14 @@ int main(int argc, char *argv[])
        for (int i = 0; i < argc; i++)
                open_files.emplace_back(argv[i]);
 
+       qRegisterMetaType<pv::util::Timestamp>("util::Timestamp");
+       qRegisterMetaType<uint64_t>("uint64_t");
+
        // Prepare the global settings since logging needs them early on
        pv::GlobalSettings settings;
+       settings.save_internal_defaults();
        settings.set_defaults_where_needed();
+       settings.apply_theme();
 
        pv::logging.init();
 
@@ -314,7 +329,7 @@ int main(int argc, char *argv[])
                        if (open_files.empty())
                                w.add_default_session();
                        else
-                               for (string open_file : open_files)
+                               for (string& open_file : open_files)
                                        w.add_session_with_file(open_file, open_file_format);
 
 #ifdef ENABLE_SIGNALS