ESGRAF48/source/ESGRAF48.cpp

38 lines
900 B
C++
Raw Normal View History

2018-05-10 16:41:14 +00:00
#include "mainwindow.h"
#include "version.h"
2018-05-10 16:41:14 +00:00
#include <QApplication>
#include <QCommandLineParser>
2018-05-10 16:41:14 +00:00
2019-10-05 14:14:45 +00:00
int main(int argc, char** argv)
2018-05-10 16:41:14 +00:00
{
2019-10-05 14:14:45 +00:00
QApplication app(argc, argv);
QCoreApplication::setApplicationName(ESGRAF48_DESCRIPTION);
QCoreApplication::setApplicationVersion(ESGRAF48_VERSION);
2019-10-05 14:14:45 +00:00
QCommandLineParser cmdParser;
cmdParser.setApplicationDescription(ESGRAF48_DESCRIPTION);
cmdParser.addHelpOption();
cmdParser.addVersionOption();
cmdParser.addPositionalArgument("filename", "file to open");
2019-10-05 14:14:45 +00:00
cmdParser.process(app);
2019-10-05 14:14:45 +00:00
const QStringList args = cmdParser.positionalArguments();
2019-10-05 14:14:45 +00:00
std::unique_ptr<MainWindow> mainWindow;
if (args.empty())
{
mainWindow = std::make_unique<MainWindow>(nullptr);
}
else
{
mainWindow = std::make_unique<MainWindow>(nullptr, args.at(0));
}
2019-10-05 14:14:45 +00:00
mainWindow->show();
2018-05-10 16:41:14 +00:00
2019-10-05 14:14:45 +00:00
return app.exec();
2018-05-10 16:41:14 +00:00
}