-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.cpp
29 lines (26 loc) · 1021 Bytes
/
main.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
#include "mainwindow.h"
#include <QApplication>
#include <QCommandLineParser>
#include <iostream>
int main(int argc, char *argv[])
{
QApplication a(argc, argv);
MainWindow w;
w.show();
QCoreApplication::setApplicationName("Network Tester");
QCoreApplication::setApplicationVersion("1.0");
QCommandLineParser parser;
parser.setApplicationDescription("Network Tester");
parser.addHelpOption();
parser.addVersionOption();
parser.addPositionalArgument("hosts", QCoreApplication::translate("main", "Hosts to connect."), "[hosts...]");
parser.addOption(QCommandLineOption("t", "Test for <seconds>", "seconds"));
parser.addOption(QCommandLineOption("f", "Write output to logfile at <path>", "path"));
parser.process(a);
QStringList hosts = parser.positionalArguments();
for (auto &host : hosts) {
w.connectToHostViaCMD(host);
}
w.startTimer(parser.value("f"), parser.value("t").toLongLong());
return a.exec();
}