2020-06-30 15:43:06 +01:00
|
|
|
#include "StdAfx.h"
|
|
|
|
|
2017-07-02 20:55:56 +01:00
|
|
|
#include "qapple.h"
|
|
|
|
#include <QApplication>
|
2019-12-08 20:21:35 +00:00
|
|
|
#include <QTimer>
|
|
|
|
#include <QCommandLineParser>
|
|
|
|
|
|
|
|
#include "linux/version.h"
|
2020-12-23 19:23:13 +00:00
|
|
|
#include "applicationname.h"
|
2019-12-08 20:21:35 +00:00
|
|
|
|
2017-07-02 20:55:56 +01:00
|
|
|
|
|
|
|
int main(int argc, char *argv[])
|
|
|
|
{
|
2019-12-08 20:21:35 +00:00
|
|
|
QApplication app(argc, argv);
|
2017-10-10 14:26:40 +01:00
|
|
|
|
2020-10-11 09:49:50 +01:00
|
|
|
QApplication::setOrganizationName(ORGANIZATION_NAME);
|
|
|
|
QApplication::setApplicationName(APPLICATION_NAME);
|
2019-12-08 20:21:35 +00:00
|
|
|
const QString qversion = QString::fromStdString(getVersion());
|
|
|
|
QApplication::setApplicationVersion(qversion);
|
|
|
|
|
|
|
|
QCommandLineParser parser;
|
|
|
|
parser.setApplicationDescription("Qt Apple Emulator");
|
|
|
|
parser.addHelpOption();
|
|
|
|
parser.addVersionOption();
|
|
|
|
|
2019-12-12 20:19:25 +00:00
|
|
|
const QCommandLineOption runOption("r", "start immeditaely");
|
2019-12-08 20:21:35 +00:00
|
|
|
parser.addOption(runOption);
|
|
|
|
|
2019-12-12 20:19:25 +00:00
|
|
|
const QCommandLineOption logStateOption("load-state", "load state file", "file");
|
2019-12-08 20:21:35 +00:00
|
|
|
parser.addOption(logStateOption);
|
|
|
|
|
|
|
|
parser.process(app);
|
2017-10-10 14:26:40 +01:00
|
|
|
|
2017-07-02 20:55:56 +01:00
|
|
|
QApple w;
|
2019-12-08 20:21:35 +00:00
|
|
|
|
|
|
|
const bool run = parser.isSet(runOption);
|
|
|
|
const QString stateFile = parser.value(logStateOption);
|
|
|
|
if (!stateFile.isEmpty())
|
|
|
|
{
|
|
|
|
w.loadStateFile(stateFile);
|
|
|
|
}
|
|
|
|
|
2017-07-02 20:55:56 +01:00
|
|
|
w.show();
|
|
|
|
|
2019-12-08 20:21:35 +00:00
|
|
|
if (run)
|
|
|
|
{
|
|
|
|
QTimer::singleShot(0, &w, SLOT(startEmulator()));
|
|
|
|
}
|
|
|
|
|
|
|
|
return app.exec();
|
2017-07-02 20:55:56 +01:00
|
|
|
}
|