enum class FILTERS
{
AIRPORTS = 1,
FDDI = 2,
RRT = 3,
TARGET = 4,
TRACK = 5
};
int main (int argc, char ** argv)
{
QMap<QString, FILTERS> filterMap;
filterMap["airports"] = FILTERS::AIRPORTS;
filterMap["fddi"] = FILTERS::FDDI;
filterMap["rrt"] = FILTERS::RRT;
filterMap["target"] = FILTERS::TARGET;
filterMap["track"] = FILTERS::TRACK;
QCommandLineParser parser;
parser.
setApplicationDescription(QApplication::translate("main",
"Call the right filter"));
parser.addHelpOption();
QCommandLineOption filterTypeOption
("t",
QApplication::translate("main",
"Specifies the type of filter to call"));
parser.addOption(filterTypeOption);
parser.process(app);
QString filterType
= parser.
value(filterTypeOption
);
FILTERS filter = filterMap[filterType];
switch(filter)
{
case FILTERS::AIRPORTS:
AirportsDialog dialog;
break;
case FILTERS::FDDI:
FDDIDialog dialog;
break;
case FILTERS::RRT:
RRTDialog dialog;
break;
case FILTERS::TARGET:
TargetDialog dialog;
break;
case FILTERS::TRACK;
TrackDialog dialog;
break;
}
dialog.show();
int ret = app.exec();
return ret;
}
enum class FILTERS
{
AIRPORTS = 1,
FDDI = 2,
RRT = 3,
TARGET = 4,
TRACK = 5
};
int main (int argc, char ** argv)
{
QApplication app(argc, argv);
QMap<QString, FILTERS> filterMap;
filterMap["airports"] = FILTERS::AIRPORTS;
filterMap["fddi"] = FILTERS::FDDI;
filterMap["rrt"] = FILTERS::RRT;
filterMap["target"] = FILTERS::TARGET;
filterMap["track"] = FILTERS::TRACK;
QCommandLineParser parser;
parser.setApplicationDescription(QApplication::translate("main", "Call the right filter"));
parser.addHelpOption();
QCommandLineOption filterTypeOption("t", QApplication::translate("main", "Specifies the type of filter to call"));
parser.addOption(filterTypeOption);
parser.process(app);
QString filterType = parser.value(filterTypeOption);
FILTERS filter = filterMap[filterType];
switch(filter)
{
case FILTERS::AIRPORTS:
AirportsDialog dialog;
break;
case FILTERS::FDDI:
FDDIDialog dialog;
break;
case FILTERS::RRT:
RRTDialog dialog;
break;
case FILTERS::TARGET:
TargetDialog dialog;
break;
case FILTERS::TRACK;
TrackDialog dialog;
break;
}
dialog.show();
int ret = app.exec();
return ret;
}
To copy to clipboard, switch view to plain text mode
Bookmarks