00001 #include <stdio.h> 00002 #include <iostream> 00003 #include <QtWidgets/QApplication> 00004 #include <QtWidgets/qdesktopwidget.h> 00005 00006 #include "mfextensions/Binaries/mvdlg.hh" 00007 00008 void print_usage() 00009 { 00010 std::cout << "usage: msgviewer [options]\n" 00011 << "allowed options:\n" 00012 << " -h [ --help ] display this help message\n" 00013 << " -c [ --configuration ] arg specify the configuration file to msgviewer\n"; 00014 } 00015 00016 00017 int main(int argc, char** argv) 00018 { 00019 QApplication app(argc, argv); 00020 00021 std::string conf = std::string(); 00022 00023 if (argc > 1) 00024 { 00025 for (int i = 1; i < argc; ++i) 00026 { 00027 if (!strcmp(argv[i], "-h") || !strcmp(argv[i], "--help")) 00028 { 00029 print_usage(); 00030 return 0; 00031 } 00032 00033 else if ((!strcmp(argv[i], "-c") || !strcmp(argv[i], "--configuration")) 00034 && i < argc - 1) 00035 { 00036 conf = std::string(argv[i + 1]); 00037 ++i; 00038 } 00039 00040 else 00041 { 00042 std::cout << "unknown option: " << argv[i] << "\n"; 00043 print_usage(); 00044 return -1; 00045 } 00046 } 00047 } 00048 00049 msgViewerDlg dialog(conf); 00050 dialog.setWindowFlags(Qt::Window); 00051 dialog.show(); 00052 00053 return app.exec(); 00054 00055 return 0; 00056 }