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 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52
|
#include "qlogocontroller.h"
#include "logocontroller.h"
#include <QCoreApplication>
#include <QCommandLineParser>
// Some global options.
// Use 'extern' to access them.
bool hasGUI = false;
void processOptions(QCoreApplication *a)
{
QCommandLineParser parser;
QCoreApplication::setApplicationName("logo");
QCoreApplication::setApplicationVersion(LOGOVERSION);
parser.setApplicationDescription("UCBLOGO-compatable Logo language Interpreter.");
parser.addHelpOption();
parser.addVersionOption();
parser.addOptions({
{"QLogoGUI",
QCoreApplication::translate("main",
"DO NOT USE! Set the input and output to the format used by "
"the QLogo GUI Application. Useless elsewhere.")},
});
parser.process(*a);
if (parser.isSet("QLogoGUI")) {
hasGUI = true;
}
}
int main(int argc, char **argv)
{
QCoreApplication application(argc, argv);
processOptions(&application);
Controller *mainController;
if (hasGUI) {
mainController = new QLogoController;
} else {
mainController = new LogoController;
}
int retval = mainController->run();
delete mainController;
return retval;
}
|