artdaq_mfextensions  v1_05_00
msgviewer.cc
1 #include <QtWidgets/qdesktopwidget.h>
2 #include <QtWidgets/QApplication>
3 #include <cstdio>
4 #include <iostream>
5 
6 #include "mfextensions/Binaries/mvdlg.hh"
7 
8 void print_usage()
9 {
10  std::cout << "usage: msgviewer [options]\n"
11  << "allowed options:\n"
12  << " -h [ --help ] display this help message\n"
13  << " -c [ --configuration ] arg specify the configuration file to msgviewer\n";
14 }
15 
16 int main(int argc, char** argv)
17 {
18  QApplication app(argc, argv);
19 
20  std::string conf = std::string();
21 
22  if (argc > 1)
23  {
24  for (int i = 1; i < argc; ++i)
25  {
26  if ((strcmp(argv[i], "-h") == 0) || (strcmp(argv[i], "--help") == 0)) // NOLINT(cppcoreguidelines-pro-bounds-pointer-arithmetic)
27  {
28  print_usage();
29  return 0;
30  }
31 
32  if (((strcmp(argv[i], "-c") == 0) || (strcmp(argv[i], "--configuration") == 0)) && i < argc - 1) // NOLINT(cppcoreguidelines-pro-bounds-pointer-arithmetic)
33  {
34  conf = std::string(argv[i + 1]); // NOLINT(cppcoreguidelines-pro-bounds-pointer-arithmetic)
35  ++i;
36  }
37 
38  else
39  {
40  std::cout << "unknown option: " << argv[i] << "\n"; // NOLINT(cppcoreguidelines-pro-bounds-pointer-arithmetic)
41  print_usage();
42  return -1;
43  }
44  }
45  }
46 
47  msgViewerDlg dialog(conf);
48  dialog.setWindowFlags(Qt::Window);
49  dialog.show();
50 
51  return QApplication::exec();
52 
53  return 0;
54 }
Message Viewer Dialog Window
Definition: mvdlg.hh:27