set up command line options

This commit is contained in:
scatterflower 2020-08-22 13:33:51 -05:00
parent b193d662c7
commit fbc9feed13
2 changed files with 27 additions and 5 deletions

View File

@ -1,11 +1,14 @@
#include "akashimain.h" #include "include/akashimain.h"
#include "ui_akashimain.h" #include "ui_akashimain.h"
#include <QDebug>
AkashiMain::AkashiMain(QWidget *parent) AkashiMain::AkashiMain(QWidget *parent)
: QMainWindow(parent) : QMainWindow(parent)
, ui(new Ui::AkashiMain) , ui(new Ui::AkashiMain)
{ {
ui->setupUi(this); ui->setupUi(this);
qDebug("Main application started");
} }
AkashiMain::~AkashiMain() AkashiMain::~AkashiMain()

View File

@ -1,11 +1,30 @@
#include "akashimain.h" #include "include/akashimain.h"
#include <QApplication> #include <QApplication>
#include <QDebug>
#include <QCommandLineParser>
#include <QCommandLineOption>
int main(int argc, char *argv[]) int main(int argc, char *argv[])
{ {
QApplication a(argc, argv); QApplication app(argc, argv);
QApplication::setApplicationName("akashi");
QApplication::setApplicationVersion("0.0.1");
QCommandLineParser parser;
parser.setApplicationDescription("A server for Attorney Online 2");
parser.addHelpOption();
parser.addVersionOption();
QCommandLineOption headlessOption(QStringList() << "l" << "headless", "Run the server without a GUI");
parser.addOption(headlessOption);
parser.process(app);
bool headless = parser.isSet(headlessOption);
AkashiMain w; AkashiMain w;
w.show(); if(!headless)
return a.exec(); w.show();
return app.exec();
} }