X-Git-Url: https://sigrok.org/gitweb/?p=pulseview.git;a=blobdiff_plain;f=main.cpp;h=1e4fe577dc11328b4b07167b3ce1c42d16fdd075;hp=12d3bb6e30748ca9278e39477a1c7b2042c18848;hb=611c86259f66dd1766b10b1e1b671b0fadd51fe2;hpb=374c697f74ba8abbfe2a014416eb398bb460d1c3 diff --git a/main.cpp b/main.cpp index 12d3bb6e..1e4fe577 100644 --- a/main.cpp +++ b/main.cpp @@ -26,6 +26,11 @@ #include #include +#ifdef ENABLE_FLOW +#include +#include +#endif + #include #include @@ -54,6 +59,7 @@ #include "pv/logging.hpp" #include "pv/mainwindow.hpp" #include "pv/session.hpp" +#include "pv/util.hpp" #ifdef ANDROID #include @@ -153,6 +159,7 @@ void usage() " -d, --driver Specify the device driver to use\n" " -D, --dont-scan Don't auto-scan for devices, use -d spec only\n" " -i, --input-file Load input from file\n" + " -s, --settings Load PulseView session setup from file\n" " -I, --input-format Input format\n" " -c, --clean Don't restore previous sessions on startup\n" "\n", PV_BIN_NAME); @@ -162,12 +169,20 @@ int main(int argc, char *argv[]) { int ret = 0; shared_ptr context; - string open_file_format, driver; + string open_file_format, open_setup_file, driver; vector open_files; bool restore_sessions = true; bool do_scan = true; bool show_version = false; +#ifdef ENABLE_FLOW + // Initialise gstreamermm. Must be called before any other GLib stuff. + Gst::init(); + + // Initialize libsigrokflow. Must be called after Gst::init(). + Srf::init(); +#endif + Application a(argc, argv); #ifdef ANDROID @@ -185,6 +200,7 @@ int main(int argc, char *argv[]) {"driver", required_argument, nullptr, 'd'}, {"dont-scan", no_argument, nullptr, 'D'}, {"input-file", required_argument, nullptr, 'i'}, + {"settings", required_argument, nullptr, 's'}, {"input-format", required_argument, nullptr, 'I'}, {"clean", no_argument, nullptr, 'c'}, {"log-to-stdout", no_argument, nullptr, 's'}, @@ -192,7 +208,7 @@ int main(int argc, char *argv[]) }; const int c = getopt_long(argc, argv, - "h?VDcl:d:i:I:", long_options, nullptr); + "h?VDcl:d:i:s:I:", long_options, nullptr); if (c == -1) break; @@ -239,6 +255,10 @@ int main(int argc, char *argv[]) open_files.emplace_back(optarg); break; + case 's': + open_setup_file = optarg; + break; + case 'I': open_file_format = optarg; break; @@ -254,6 +274,9 @@ int main(int argc, char *argv[]) for (int i = 0; i < argc; i++) open_files.emplace_back(argv[i]); + qRegisterMetaType("util::Timestamp"); + qRegisterMetaType("uint64_t"); + // Prepare the global settings since logging needs them early on pv::GlobalSettings settings; settings.save_internal_defaults(); @@ -317,7 +340,8 @@ int main(int argc, char *argv[]) w.add_default_session(); else for (string& open_file : open_files) - w.add_session_with_file(open_file, open_file_format); + w.add_session_with_file(open_file, open_file_format, + open_setup_file); #ifdef ENABLE_SIGNALS if (SignalHandler::prepare_signals()) {