Files
simple64/simple64-gui/main.cpp
T
Logan McNaughton 5b53c4eaf2 update gui
2023-08-11 09:41:59 -06:00

43 lines
1.3 KiB
C++

#include "mainwindow.h"
#include <QApplication>
#include <QCommandLineParser>
MainWindow *w = nullptr;
int main(int argc, char *argv[])
{
srand (time(NULL));
QApplication a(argc, argv);
a.setWindowIcon(QIcon(":/icons/simple64.svg"));
QCoreApplication::setApplicationName("simple64-gui");
QCommandLineParser parser;
parser.addHelpOption();
QCommandLineOption verboseOption({"v", "verbose"}, "Verbose mode. Prints out more information to log.");
QCommandLineOption noGUIOption("nogui", "Disable GUI elements.");
QCommandLineOption testOption("test", "Run debug tests.", "number_of_frames");
parser.addOption(verboseOption);
parser.addOption(noGUIOption);
parser.addOption(testOption);
parser.addPositionalArgument("ROM", QCoreApplication::translate("main", "ROM to open."));
parser.process(a);
const QStringList args = parser.positionalArguments();
MainWindow mainWin;
w = &mainWin;
w->show();
if (parser.isSet(verboseOption))
w->setVerbose();
if (parser.isSet(noGUIOption))
w->setNoGUI();
if (parser.isSet(testOption))
w->setTest(parser.value(testOption).toInt());
if (args.size() > 0)
w->openROM(args.at(0), "", 0, 0);
else
w->updateApp();
return a.exec();
}