diff --git a/qdlt/qdltoptmanager.cpp b/qdlt/qdltoptmanager.cpp index c422b762..bf363052 100644 --- a/qdlt/qdltoptmanager.cpp +++ b/qdlt/qdltoptmanager.cpp @@ -23,6 +23,7 @@ #include "qdltoptmanager.h" #include "version.h" + #include #include @@ -37,6 +38,31 @@ QDltOptManager::QDltOptManager() convertionmode = e_ASCI; commandline_mode = false; delimiter=','; + + m_parser.setSingleDashWordOptionMode(QCommandLineParser::ParseAsLongOptions); + + m_parser.addPositionalArgument("logfile", "Loading one or more logfiles on startup (must end with .dlt)"); + m_parser.addPositionalArgument("projectfile", "Loading project file on startup (must end with .dlp)"); + m_parser.addPositionalArgument("filterfile", "Loading filterfile on startup (must end with .dlf)"); + m_parser.addPositionalArgument("pcapfile", "Importing DLT/IPC from pcap file on startup (must end with .pcap)"); + m_parser.addPositionalArgument("mf4file", "Importing DLT/IPC from mf4 file on startup (must end with .mf4)"); + m_parser.addOptions({ + {"c", "Convert logfile file to ", "textfile"}, + {"u", "Conversion will be done in UTF8 instead of ASCII"}, + {"csv", "Conversion will be done in CSV format"}, + {"d", "Conversion will NOT be done, save in dlt file format again instead"}, + {"dd", "Conversion will NOT be done, save as decoded messages in dlt format"}, + {"b", "Execute a plugin command with parameters before loading log file.", "plugin|command|param1|..|param"}, + {"e", "Execute a plugin command with parameters after loading log file.", "plugin|command|param1|..|param"}, + {QStringList() << "s" << "silent", "Enable silent mode without any GUI. Ideal for commandline usage."}, + {"stream", "Treat the input logfiles as DLT stream instead of DLT files."}, + {QStringList() << "t" << "terminate", "Terminate DLT Viewer after command line execution."}, + {"w", "Set the working directory", "workingdirectory"}, + {"delimiter", "The used delimiter for CSV export (Default: ,).", "character"}, + {QStringList() << "h" << "help", "Print this help message."}, + {QStringList() << "v" << "version", "Print the version."} + }); + } QDltOptManager* QDltOptManager::getInstance() @@ -79,206 +105,157 @@ void QDltOptManager::printVersion(QString appname) qDebug() << "Version:" << PACKAGE_VERSION << PACKAGE_VERSION_STATE; } -void QDltOptManager::printUsage() +void QDltOptManager::printUsage(const QString& helpText) { -#if (WIN32) - qDebug()<<"Usage: dlt-viewer.exe [OPTIONS] [logfile] [projectfile] [filterfile] [mf4file] [pcapfile]"; -#else - qDebug()<<"Usage: dlt-viewer [OPTIONS] [logfile] [projectfile] [filterfile] [mf4file] [pcapfile]"; -#endif - - qDebug()<<"\nOptions:"; - qDebug()<<" [logfile]\tLoading one or more logfiles on startup (must end with .dlt)"; - qDebug()<<" [projectfile]\tLoading project file on startup (must end with .dlp)"; - qDebug()<<" [filterfile]\tLoading filterfile on startup (must end with .dlf)"; - qDebug()<<" [pcapfile]\tImporting DLT/IPC from pcap file on startup (must end with .pcap)"; - qDebug()<<" [mf4file]\tImporting DLT/IPC from mf4 file on startup (must end with .mf4)"; - qDebug()<<" -h or --help\tPrint usage"; - qDebug()<<" -c textfile\tConvert logfile file to textfile"; - qDebug()<<" -u\tConversion will be done in UTF8 instead of ASCII"; - qDebug()<<" -csv\tConversion will be done in CSV format"; - qDebug()<<" -d\tConversion will NOT be done, save in dlt file format again instead"; - qDebug()<<" -dd\tConversion will NOT be done, save as decoded messages in dlt format"; - qDebug()<<" -b \"plugin|command|param1|..|param\"\tExecute a plugin command with parameters before loading log file."; - qDebug()<<" -e \"plugin|command|param1|..|param\"\tExecute a plugin command with parameters after loading log file."; - qDebug()<<" -s or --silent\tEnable silent mode without any GUI. Ideal for commandline usage."; - qDebug()<<" -stream\tTreat the input logfiles as DLT stream instead of DLT files."; - qDebug()<<" -t or --terminate\tTerminate DLT Viewer after command line execution."; - qDebug()<<" -v or --version\tOnly show version and buildtime information"; - qDebug()<<" -w workingdirectory\tSet the working directory"; - qDebug()<<" -delimiter \tThe used delimiter for CSV export (Default: ,)."; - qDebug()<<"\nExamples:"; - qDebug()<<" dlt-viewer.exe -t -c output.txt input.dlt"; - qDebug()<<" dlt-viewer.exe -t -s -u -c output.txt input.dlt"; - qDebug()<<" dlt-viewer.exe -t -s -d -c output.dlt input.dlt"; - qDebug()<<" dlt-viewer.exe -t -s decoded.dlp -dd -c output.dlt input.dlt "; - qDebug()<<" dlt-viewer.exe -t -s -csv -c output.csv input.dlt"; - qDebug()<<" dlt-viewer.exe -t -s -d filter.dlf -c output.dlt input.dlt"; - qDebug()<<" dlt-viewer.exe -p export.dlp -e \"Filetransfer Plugin|export|ftransferdir\" input.dlt"; - qDebug()<<" dlt-viewer.exe input1.dlt input2.dlt"; - qDebug()<<" dlt-viewer.exe -t -c output.txt input.pcap"; - qDebug()<<" dlt-viewer.exe -t -c output.txt input1.mf4 input2.mf4"; + qDebug() << helpText.toStdString().c_str(); + qDebug() << "\nExamples:"; + qDebug() << " dlt-viewer.exe -t -c output.txt input.dlt"; + qDebug() << " dlt-viewer.exe -t -s -u -c output.txt input.dlt"; + qDebug() << " dlt-viewer.exe -t -s -d -c output.dlt input.dlt"; + qDebug() << " dlt-viewer.exe -t -s decoded.dlp -dd -c output.dlt input.dlt "; + qDebug() << " dlt-viewer.exe -t -s -csv -c output.csv input.dlt"; + qDebug() << " dlt-viewer.exe -t -s -d filter.dlf -c output.dlt input.dlt"; + qDebug() << " dlt-viewer.exe -p export.dlp -e \"Filetransfer Plugin|export|ftransferdir\" input.dlt"; + qDebug() << " dlt-viewer.exe input1.dlt input2.dlt"; + qDebug() << " dlt-viewer.exe -t -c output.txt input.pcap"; + qDebug() << " dlt-viewer.exe -t -c output.txt input1.mf4 input2.mf4"; } -void QDltOptManager::parse(QStringList *opt) +void QDltOptManager::parse(const QStringList& args) { - QString str; + m_parser.parse(args); qDebug() << "### Starting DLT Viewer"; - printVersion(opt->at(0)); - - qDebug() << "### Parsing Options"; + printVersion(args.at(0)); /* the default parameter - exactly one parameter - should either be * a dlt or a dlp file, so this enables the "doubleclick" feature */ - //str = opt->at(0); && ( str.compare("-h)") != 0 || str.compare("-v") !=0 ) - if(opt->size()==2 ) - { - if(opt->at(1).endsWith(".dlp") || opt->at(1).endsWith(".DLP")) - { - projectFile = QString("%1").arg(opt->at(1)); - project = true; - qDebug()<< "Project filename:" << projectFile; - return; - } - if(opt->at(1).endsWith(".dlt") || opt->at(1).endsWith(".DLT")) - { - const QString logFile = QString("%1").arg(opt->at(1)); - logFiles += logFile; - qDebug()<< "DLT filename:" << logFile; - return; - } - } - - // 0==Binary 1==First Argument - for (int i = 0; i < opt->size(); ++i) - { - str = opt->at(i); - - if(str.compare("-h") == 0 || str.compare("--help") == 0) - { - printUsage(); - exit(0); - } - else if(str.compare("-s") == 0 || str.compare("--silent") == 0) - { - if ( silent_mode == false) - { - silent_mode = true; - qDebug() << "Silent mode enabled"; - } - } - else if(str.compare("-v") == 0 || str.compare("--version") == 0) - { - printVersion(opt->at(0)); - exit(0); - } - else if(str.compare("-t") == 0 || str.compare("--terminate") == 0) - { - terminate = true; - commandline_mode = true; - } - else if(str.compare("-c")==0) - { - QString c1 = opt->value(i+1); - - convertDestFile = QString("%1").arg(c1); - // check here already if the selected file exists - - qDebug() << "Convert filename:" << convertDestFile; - commandline_mode = true; - - i += 1; - } - else if(str.compare("-delimiter")==0) - { - QString c1 = opt->value(i+1); - - delimiter = QString("%1").arg(c1).front().toLatin1(); - - qDebug() << "Delimiter:" << delimiter; - - i += 1; - } - else if(str.compare("-u")==0) - { - convertionmode = e_UTF8; - } - else if(str.compare("-csv")==0) - { - convertionmode = e_CSV; - } - else if(str.compare("-d")==0) - { - convertionmode = e_DLT; - } - else if(str.compare("-dd")==0) - { - convertionmode = e_DDLT; - } - else if(str.compare("-stream")==0) - { - inputmode = e_inputmode::STREAM; - } - else if(str.compare("-e")==0) - { - QString c = opt->value(i+1); - postPluginCommands += c; - commandline_mode = true; - ++i; - } - else if(str.compare("-b")==0) - { - QString c = opt->value(i+1); - prePluginCommands += c; - commandline_mode = true; - ++i; - } - else if (str.compare("-w") == 0) + if (m_parser.optionNames().isEmpty() && m_parser.positionalArguments().size() == 1) + { + const QString& arg = m_parser.positionalArguments().at(0); + if(arg.endsWith(".dlp") || arg.endsWith(".DLP")) { - workingDirectory = opt->value(i+1); - ++i; + projectFile = arg; + project = true; + qDebug()<< "Project filename:" << projectFile; + return; + } + if (arg.endsWith(".dlt") || arg.endsWith(".DLT")) + { + const QString logFile = arg; + logFiles += logFile; + qDebug()<< "DLT filename:" << logFile; + return; } - else if(opt->at(i).endsWith(".dlt") || opt->at(i).endsWith(".DLT")) + } + + if (m_parser.isSet("help")) { + printUsage(m_parser.helpText()); + exit(0); + } + + if (m_parser.isSet("silent")) { + silent_mode = true; + qDebug() << "Silent mode enabled"; + } + + if (m_parser.isSet("version")) { + // version is already printed above + exit(0); + } + + if (m_parser.isSet("terminate")) { + terminate = true; + commandline_mode = true; + } + + if (m_parser.isSet("c")) { + convertDestFile = m_parser.value("c"); + qDebug() << "Convert filename:" << convertDestFile; + commandline_mode = true; + } + + if (m_parser.isSet("delimiter")) { + delimiter = m_parser.value("delimiter").front().toLatin1(); + qDebug() << "Delimiter:" << delimiter; + } + + if (m_parser.isSet("u")) { + convertionmode = e_UTF8; + } + + if (m_parser.isSet("csv")) { + convertionmode = e_CSV; + } + + if (m_parser.isSet("d")) { + convertionmode = e_DLT; + } + + if (m_parser.isSet("dd")) { + convertionmode = e_DDLT; + } + + if (m_parser.isSet("stream")) { + inputmode = e_inputmode::STREAM; + } + + if (m_parser.isSet("e")) { + postPluginCommands += m_parser.value("e"); + commandline_mode = true; + } + + if (m_parser.isSet("b")) { + prePluginCommands += m_parser.value("b"); + commandline_mode = true; + } + + if (m_parser.isSet("w")) { + workingDirectory = m_parser.value("w"); + } + + QStringList positionalArguments = m_parser.positionalArguments(); + for (const QString &arg : positionalArguments) + { + if(arg.endsWith(".dlt") || arg.endsWith(".DLT")) { - const QString logFile = QString("%1").arg(opt->at(i)); + const QString logFile = arg; logFiles += logFile; qDebug()<< "DLT filename:" << logFile; } - else if(opt->at(i).endsWith(".dlp") || opt->at(i).endsWith(".DLP")) + else if(arg.endsWith(".dlp") || arg.endsWith(".DLP")) { if (project == true) { qDebug() << "\nError: Can only load one project file\n"; - printUsage(); + printUsage(m_parser.helpText()); exit(-1); } - projectFile = QString("%1").arg(opt->at(i)); + projectFile = arg; project = true; qDebug()<< "Project filename:" << projectFile; } - else if(opt->at(i).endsWith(".dlf") || opt->at(i).endsWith(".DLF")) + else if(arg.endsWith(".dlf") || arg.endsWith(".DLF")) { - filterFiles += QString("%1").arg(opt->at(i)); - qDebug()<< "Filter filename:" << QString("%1").arg(opt->at(i)); + filterFiles += arg; + qDebug()<< "Filter filename:" << arg; } - else if(opt->at(i).endsWith(".pcap") || opt->at(i).endsWith(".PCAP")) + else if(arg.endsWith(".pcap") || arg.endsWith(".PCAP")) { - const QString pcapFile = QString("%1").arg(opt->at(i)); + const QString pcapFile = arg; pcapFiles += pcapFile; qDebug()<< "Pcap filename:" << pcapFile; } - else if(opt->at(i).endsWith(".mf4") || opt->at(i).endsWith(".MF4")) + else if(arg.endsWith(".mf4") || arg.endsWith(".MF4")) { - const QString mf4File = QString("%1").arg(opt->at(i)); + const QString mf4File = arg; mf4Files += mf4File; qDebug()<< "MF4 filename:" << mf4File; } - - } // end of for loop + } /* On Windows we do not want to open a console in case * we start the application e.g. from file explorer. @@ -315,3 +292,32 @@ QString QDltOptManager::getCommandName(){return commandName;} QStringList QDltOptManager::getCommandParams(){return commandParams;} QString QDltOptManager::getWorkingDirectory() const { return workingDirectory; } char QDltOptManager::getDelimiter(){return delimiter;} + +QString QDltOptManager::getHelpText() const +{ + return m_parser.helpText(); +} + +void QDltOptManager::reset() +{ + project = false; + terminate = false; + silent_mode = false; + commandline_mode = false; + convertionmode = e_ASCI; + inputmode = e_inputmode::DLT; + projectFile.clear(); + logFiles.clear(); + filterFiles.clear(); + convertDestFile.clear(); + pluginName.clear(); + commandName.clear(); + commandParams.clear(); + prePluginCommands.clear(); + postPluginCommands.clear(); + workingDirectory.clear(); + delimiter=','; + pcapFiles.clear(); + mf4Files.clear(); +} + diff --git a/qdlt/qdltoptmanager.h b/qdlt/qdltoptmanager.h index 6cdda7e1..a27deec6 100644 --- a/qdlt/qdltoptmanager.h +++ b/qdlt/qdltoptmanager.h @@ -21,6 +21,7 @@ #define QDLTOPTMANAGER_H #include +#include #include "export_rules.h" @@ -44,9 +45,9 @@ class QDLT_EXPORT QDltOptManager { public: static QDltOptManager* getInstance(); - void printUsage(); + void printUsage(const QString& helpText); void printVersion(QString appname); - void parse(QStringList *opt); + void parse(const QStringList& arguments); bool isProjectFile(); bool isTerminate(); @@ -71,6 +72,11 @@ class QDLT_EXPORT QDltOptManager const QStringList &getMf4Files() const; char getDelimiter(); + QString getHelpText() const; + + // only testing relevant + void reset(); + private: QDltOptManager(); QDltOptManager(QDltOptManager const&); @@ -98,6 +104,8 @@ class QDLT_EXPORT QDltOptManager QString workingDirectory; char delimiter; + + QCommandLineParser m_parser; }; #endif //QDLTOPTMANAGER_H diff --git a/qdlt/tests/CMakeLists.txt b/qdlt/tests/CMakeLists.txt index beccd1f3..7b65fda1 100644 --- a/qdlt/tests/CMakeLists.txt +++ b/qdlt/tests/CMakeLists.txt @@ -1,15 +1,31 @@ -add_executable(test_tools +add_executable(test_dltmessagematcher test_dltmessagematcher.cpp ) target_link_libraries( - test_tools + test_dltmessagematcher PRIVATE GTest::gtest_main qdlt ) add_test( - NAME test_tools - COMMAND $ + NAME test_dltmessagematcher + COMMAND $ ) + +add_executable(test_dltoptmanager + test_dltoptmanager.cpp +) + +target_link_libraries( + test_dltoptmanager + PRIVATE + GTest::gtest_main + qdlt +) + +add_test( + NAME test_dltoptmanager + COMMAND $ +) diff --git a/qdlt/tests/test_dltoptmanager.cpp b/qdlt/tests/test_dltoptmanager.cpp new file mode 100644 index 00000000..df2c4047 --- /dev/null +++ b/qdlt/tests/test_dltoptmanager.cpp @@ -0,0 +1,171 @@ +#include + +#include + +#include + + +QString logMessageSink; + +void messageHandler(QtMsgType type, const QMessageLogContext &, + const QString &msg) { + if (type == QtDebugMsg) { + logMessageSink.append(msg); + } +} + +class OptManagerTest : public ::testing::Test { +protected: + static void SetUpTestSuite() { + m_manager = QDltOptManager::getInstance(); + + qInstallMessageHandler(messageHandler); + } + + void SetUp() override { + m_manager->reset(); + } + + void TearDown() override { + logMessageSink.clear(); + } + + static QDltOptManager* m_manager; +}; + +QDltOptManager* OptManagerTest::m_manager = nullptr; + +TEST_F(OptManagerTest, txtConversion) { + auto args = QStringList() << "executable" << "-t" << "-c" << "output.txt" << "input.dlt"; + + m_manager->parse(args); + + EXPECT_TRUE(m_manager->isTerminate()); + EXPECT_EQ(m_manager->getConvertDestFile(), "output.txt"); + EXPECT_TRUE(m_manager->getLogFiles().contains("input.dlt")); + EXPECT_TRUE(m_manager->isCommandlineMode()); +} + +TEST_F(OptManagerTest, txtConversionSilentUtf8Mode) { + auto args = QStringList() << "executable" << "-t" << "-s" << "-u" << "-c" << "output.txt" << "input.dlt"; + + m_manager->parse(args); + + EXPECT_TRUE(m_manager->isTerminate()); + EXPECT_TRUE(m_manager->issilentMode()); + EXPECT_EQ(m_manager->getConvertDestFile(), "output.txt"); + EXPECT_TRUE(m_manager->getLogFiles().contains("input.dlt")); + EXPECT_EQ(m_manager->get_convertionmode(), e_UTF8); + EXPECT_TRUE(m_manager->isCommandlineMode()); +} + +TEST_F(OptManagerTest, txtConversionSilentAsciiMode) { + auto args = QStringList() << "executable" << "-t" << "-s" << "-d" << "-c" << "output.txt" << "input.dlt"; + + m_manager->parse(args); + + EXPECT_TRUE(m_manager->isTerminate()); + EXPECT_TRUE(m_manager->issilentMode()); + EXPECT_EQ(m_manager->getConvertDestFile(), "output.txt"); + EXPECT_TRUE(m_manager->getLogFiles().contains("input.dlt")); + EXPECT_EQ(m_manager->get_convertionmode(), e_DLT); + EXPECT_TRUE(m_manager->isCommandlineMode()); +} + +TEST_F(OptManagerTest, csvConversionSilentMode) { + auto args = QStringList() << "executable" << "-t" << "-s" << "-csv" << "-c" << "output.csv" << "input.dlt"; + + m_manager->parse(args); + + EXPECT_TRUE(m_manager->isTerminate()); + EXPECT_TRUE(m_manager->issilentMode()); + EXPECT_EQ(m_manager->getConvertDestFile(), "output.csv"); + EXPECT_TRUE(m_manager->getLogFiles().contains("input.dlt")); + EXPECT_EQ(m_manager->get_convertionmode(), e_CSV); + EXPECT_TRUE(m_manager->isCommandlineMode()); +} + +TEST_F(OptManagerTest, txtConversionSilentDdlMode) { + auto args = QStringList() << "executable" << "-t" << "-s" << "decoded.dlp" << "-dd" << "-c" << "output.dlt" << "input.dlt"; + + m_manager->parse(args); + + EXPECT_TRUE(m_manager->isTerminate()); + EXPECT_TRUE(m_manager->issilentMode()); + EXPECT_EQ(m_manager->getConvertDestFile(), "output.dlt"); + EXPECT_TRUE(m_manager->getLogFiles().contains("input.dlt")); + EXPECT_EQ(m_manager->get_convertionmode(), e_DDLT); + EXPECT_TRUE(m_manager->isCommandlineMode()); + EXPECT_EQ(m_manager->getProjectFile(), "decoded.dlp"); +} + +TEST_F(OptManagerTest, pluginPostCommands) { + auto args = QStringList() << "executable" + << "-p" + << "export.dlp" + << "-e" + << "\"Filetransfer Plugin|export|ftransferdir\"" + << "input.dlt"; + m_manager->parse(args); + + EXPECT_EQ(m_manager->getProjectFile(), "export.dlp"); + EXPECT_TRUE(m_manager->getLogFiles().contains("input.dlt")); + EXPECT_TRUE(m_manager->getPostPluginCommands().contains("\"Filetransfer Plugin|export|ftransferdir\"")); + EXPECT_TRUE(m_manager->isCommandlineMode()); +} + +TEST_F(OptManagerTest, pluginPreCommands) { + auto args = QStringList() << "executable" + << "-b" + << "\"Filetransfer Plugin|export|ftransferdir\"" + << "input.dlt"; + m_manager->parse(args); + + EXPECT_TRUE(m_manager->getLogFiles().contains("input.dlt")); + EXPECT_TRUE(m_manager->getPrePluginCommands().contains("\"Filetransfer Plugin|export|ftransferdir\"")); + EXPECT_TRUE(m_manager->isCommandlineMode()); +} + +TEST_F(OptManagerTest, multipleLogFiles) { + auto args = QStringList() << "executable" << "input1.dlt" << "input2.dlt"; + + m_manager->parse(args); + + EXPECT_TRUE(m_manager->getLogFiles().contains("input1.dlt")); + EXPECT_TRUE(m_manager->getLogFiles().contains("input2.dlt")); +} + +TEST_F(OptManagerTest, pcapFile) { + auto args = QStringList() << "executable" << "-t" << "-c" << "output.txt" << "input.pcap"; + + m_manager->parse(args); + + EXPECT_TRUE(m_manager->isTerminate()); + EXPECT_EQ(m_manager->getConvertDestFile(), "output.txt"); + EXPECT_TRUE(m_manager->getPcapFiles().contains("input.pcap")); + EXPECT_TRUE(m_manager->isCommandlineMode()); +} + +TEST_F(OptManagerTest, mf4Files) { + auto args = QStringList() << "executable" << "-t" << "-c" << "output.txt" << "input1.mf4" << "input2.mf4"; + + m_manager->parse(args); + + EXPECT_TRUE(m_manager->isTerminate()); + EXPECT_EQ(m_manager->getConvertDestFile(), "output.txt"); + EXPECT_TRUE(m_manager->getMf4Files().contains("input1.mf4")); + EXPECT_TRUE(m_manager->getMf4Files().contains("input2.mf4")); + EXPECT_TRUE(m_manager->isCommandlineMode()); +} + +TEST_F(OptManagerTest, version) { + // impossible to check just version because there is a call to exit(0) in the qdltoptmanager + // but any output will be enough to check the version call because it is always printed + auto args = QStringList() << "executable" << "some.dlt"; + + m_manager->parse(args); + + EXPECT_TRUE(logMessageSink.contains("Executable Name:")); + EXPECT_TRUE(logMessageSink.contains("Build time:")); + EXPECT_TRUE(logMessageSink.contains("Version:")); +} diff --git a/src/main.cpp b/src/main.cpp index dc8b8db5..b347c743 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -46,9 +46,8 @@ int main(int argc, char *argv[]) QApplication a(argc, argv); - QStringList arguments = a.arguments(); QDltOptManager *opt = QDltOptManager::getInstance(); - opt->parse(&arguments); + opt->parse(a.arguments()); MainWindow w; w.show(); diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp index 6f589a8d..6ce4badc 100644 --- a/src/mainwindow.cpp +++ b/src/mainwindow.cpp @@ -281,7 +281,6 @@ MainWindow::~MainWindow() delete sortProxyModel; } - void MainWindow::initState() { /* Settings */ @@ -5720,40 +5719,10 @@ void MainWindow::on_action_menuHelp_Info_triggered() QString("(C) 2016,2024 BMW AG\n")); } - -void MainWindow::on_action_menuHelp_Command_Line_triggered() -{ - // Please copy changes to QDltOptManager::getInstance().cpp - printUsage() - - QMessageBox::information(0, QString("DLT Viewer - Command line usage\t\t\t\t\t"), // tabs used to expand mesage box ! - #ifdef WIN32 - QString("Usage: dlt-viewer.exe [OPTIONS] [logfile] [projectfile] [filterfile] [mf4file] [pcapfile]\n\n")+ - QString("Options:\n")+ - #else - QString("Usage: dlt-viewer [OPTIONS] [logfile] [projectfile] [filterfile] [mf4file] [pcapfile]\n\n")+ - QString("Options:\n")+ - #endif - QString(" [logfile]\t\t\tLoading one or more logfiles on startup (must end with .dlt)\n")+ - QString(" [projectfile]\t\tLoading project file on startup (must end with .dlp)\n")+ - QString(" [filterfile]\t\tLoading filterfile on startup (must end with .dlf)\n")+ - QString(" [pcapfile]\tImporting DLT/IPC from pcap file on startup (must end with .pcap)\n")+ - QString(" [mf4file]\tImporting DLT/IPC from mf4 file on startup (must end with .mf4)\n")+ - QString(" -h\t\t\tPrint usage\n")+ - QString(" -s\t\t\tEnable silent mode without any GUI. Ideal for commandline usage.\n")+ - QString(" -stream\tTreat the input logfiles as DLT stream instead of DLT files.\n")+ - QString(" -v\t\t\tShow version and buildtime information\n")+ - QString(" -c \tConvert logfile to ASCII textfile\n")+ - QString(" -u\t\t\tExport logfile to UTF8 instead\n")+ - QString(" -csv\t\t\tExport logfile to csv ( Excel ) instead\n")+ - QString(" -d\t\t\tExport logfile to DLT format\n")+ - QString(" -dd\t\t\tExport logfile to decoded DLT format\n")+ - QString(" -b |command|param1|..|param\n\t\t\tExecute a command plugin with parameters before loading log file\n")+ - QString(" -e |command|param1|..|param\n\t\t\tExecute a command plugin with parameters after loading log file\n")+ - QString(" -t\t\t\tTerminate DLT Viewer after command line execution\n")+ - QString(" -v\t\t\tShow version and buildtime information\n")+ - QString(" -w workingdirectory\tSet the working directory\n")+ - QString(" -delimiter \tThe used delimiter for CSV export (Default: ,)\n") - ); +void MainWindow::on_action_menuHelp_Command_Line_triggered() { + QMessageBox::information( + 0, "DLT Viewer - Command line usage\t\t\t\t\t", // tabs used to expand message box ! + QDltOptManager::getInstance()->getHelpText()); } void MainWindow::on_pluginWidget_itemSelectionChanged()