29 #include <QApplication>
33 #include "TRMMonitorGUI.h"
37 int main(
int argc,
char *argv[])
39 QApplication app(argc, argv);
40 QStringList args = app.arguments();
43 QString hostAddressStr;
47 QRegExp optionPort(
"-port");
48 QRegExp optionIP(
"-ip");
49 QRegExp optionClientId(
"-clientId");
50 QRegExp optionBarWidth(
"-barWidth");
53 for (
int i = 1; i < args.size(); ++i) {
55 if (optionPort.indexIn(args.at(i)) != -1 ) {
56 portNumber= args.at(i+1).toInt();
58 qDebug() <<
"port is " << portNumber;
60 else if (optionIP.indexIn(args.at(i)) != -1 ) {
61 hostAddressStr = args.at(i+1);
63 qDebug() <<
"ip is " << hostAddressStr;
65 else if (optionClientId.indexIn(args.at(i)) != -1 ) {
66 clientId = args.at(i+1);
68 qDebug() <<
"clientId is " << clientId;
70 else if (optionBarWidth.indexIn(args.at(i)) != -1 ) {
71 barWidth = args.at(i+1);
73 qDebug() <<
"barWidth is " << barWidth;
79 if (portNumber < 0 || portNumber > 65535 || hostAddressStr.isEmpty()) {
80 printf(
"\r\n%s: <ip address> <port number> <clientName> <barWidth> \r\n", args.at(0).toUtf8().data());
84 if (clientId.isEmpty()) clientId =
"FFFFF001";
85 if (barWidth.isEmpty()) barWidth =
"3600";
87 TRMMonitorGUI monitorGUI(QHostAddress(hostAddressStr), portNumber, clientId, barWidth);