X-Git-Url: https://git.cworth.org/git?a=blobdiff_plain;f=gui%2Fmain.cpp;h=b98bce60dcff045238890051f990c7bc502c8554;hb=HEAD;hp=3ae56db1768ecc6528446006e2f4c77146fb74c8;hpb=ebe01ce9942e570f23b40793e97cf02b6f3616ee;p=apitrace diff --git a/gui/main.cpp b/gui/main.cpp index 3ae56db..b98bce6 100644 --- a/gui/main.cpp +++ b/gui/main.cpp @@ -1,8 +1,13 @@ +#include + #include "mainwindow.h" #include "apitrace.h" #include "apitracecall.h" +#include "os_string.hpp" +#include "os_process.hpp" + #include #include #include @@ -17,7 +22,10 @@ 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) @@ -34,12 +42,15 @@ int main(int argc, char **argv) qRegisterMetaType >(); #ifndef Q_OS_WIN + os::String currentProcess = os::getProcessName(); + currentProcess.trimFilename(); QString path = qgetenv("PATH"); - path = QLatin1String(APITRACE_BINARY_DIR) + QLatin1String(":") + 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()) { @@ -50,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(); @@ -73,5 +91,9 @@ int main(int argc, char **argv) window.loadTrace(fileName, callNum); } + if (remoteTarget.length()) { + window.setRemoteTarget(remoteTarget); + } + app.exec(); }