set up command line options
This commit is contained in:
parent
b193d662c7
commit
fbc9feed13
@ -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()
|
||||||
|
27
src/main.cpp
27
src/main.cpp
@ -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();
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user