X-Git-Url: https://git.cworth.org/git?a=blobdiff_plain;f=gui%2Fmain.cpp;h=b98bce60dcff045238890051f990c7bc502c8554;hb=ff6dad3ca0f52fb91b5035843df7da79126291e1;hp=d7af53dde789c219e76dae1428254f3b58337dfd;hpb=48412ffde3dd4710c96d5e8d9cfdf1789e4d703a;p=apitrace diff --git a/gui/main.cpp b/gui/main.cpp index d7af53d..b98bce6 100644 --- a/gui/main.cpp +++ b/gui/main.cpp @@ -1,25 +1,36 @@ +#include + #include "mainwindow.h" #include "apitrace.h" #include "apitracecall.h" +#include "os_string.hpp" +#include "os_process.hpp" + #include #include #include +#include Q_DECLARE_METATYPE(QList); Q_DECLARE_METATYPE(QVector); Q_DECLARE_METATYPE(Qt::CaseSensitivity); Q_DECLARE_METATYPE(ApiTrace::SearchResult); Q_DECLARE_METATYPE(ApiTrace::SearchRequest); +Q_DECLARE_METATYPE(QList); static void usage(void) { - qWarning("usage: qapitrace [TRACE] [CALLNO]\n"); + qWarning("usage: qapitrace [options] [TRACE] [CALLNO]\n" + "Valid options include:\n" + " -h, --help Print this help message\n" + " --remote-target HOST Replay trace on remote target HOST\n"); } int main(int argc, char **argv) { + QApplication::setGraphicsSystem("raster"); QApplication app(argc, argv); qRegisterMetaType >(); @@ -28,7 +39,18 @@ int main(int argc, char **argv) qRegisterMetaType(); qRegisterMetaType(); qRegisterMetaType(); + qRegisterMetaType >(); + +#ifndef Q_OS_WIN + os::String currentProcess = os::getProcessName(); + currentProcess.trimFilename(); + QString path = qgetenv("PATH"); + path = QLatin1String(currentProcess.str()) + QLatin1String(":") + path; + qputenv("PATH", path.toLatin1()); +#endif + QStringList args = app.arguments(); + QString remoteTarget; int i = 1; while (i < args.count()) { @@ -39,6 +61,13 @@ int main(int argc, char **argv) ++i; if (arg == QLatin1String("--")) { break; + } else if (arg == QLatin1String("--remote-target")) { + if (i == args.count()) { + qWarning("Option --remote-target requires an argument.\n"); + exit(1); + } + remoteTarget = args[i]; + ++i; } else if (arg == QLatin1String("-h") || arg == QLatin1String("--help")) { usage(); @@ -62,5 +91,9 @@ int main(int argc, char **argv) window.loadTrace(fileName, callNum); } + if (remoteTarget.length()) { + window.setRemoteTarget(remoteTarget); + } + app.exec(); }