1
Fork 0
mirror of https://github.com/redstrate/Astra.git synced 2025-04-20 11:47:46 +00:00
astra/src/main.cpp

67 lines
1.6 KiB
C++
Raw Normal View History

#include "launchercore.h"
#include "launcherwindow.h"
2021-11-01 09:54:58 -04:00
#include <QApplication>
#include <QCommandLineParser>
#include <keychain.h>
#include <QDir>
#include "sapphirelauncher.h"
#include "squareboot.h"
#include "gameinstaller.h"
#include "config.h"
#include "desktopinterface.h"
#include "cmdinterface.h"
2021-11-01 09:54:58 -04:00
int main(int argc, char* argv[]) {
QCoreApplication::setAttribute(Qt::AA_EnableHighDpiScaling);
QCoreApplication::setAttribute(Qt::AA_UseHighDpiPixmaps);
2021-11-01 09:54:58 -04:00
QApplication app(argc, argv);
#ifdef NDEBUG
2022-02-23 19:00:17 -05:00
QCoreApplication::setApplicationName("astra");
#else
2022-02-23 19:00:17 -05:00
QCoreApplication::setApplicationName("astra-debug");
#endif
QCoreApplication::setApplicationVersion(version);
// we want to decide which interface to use. this is decided by the
// -cli, -desktop, or -tablet
// the default is -desktop
// cli is a special case where it's always "enabled"
QCommandLineParser parser;
parser.setApplicationDescription("Cross-platform FFXIV Launcher");
auto helpOption = parser.addHelpOption();
auto versionOption = parser.addVersionOption();
2021-11-23 15:37:02 -05:00
QCommandLineOption noguiOption("nogui", "Don't open a main window.");
parser.addOption(noguiOption);
auto cmd = new CMDInterface(parser);
parser.process(app);
if(parser.isSet(versionOption)) {
parser.showVersion();
}
if(parser.isSet(helpOption)) {
parser.showHelp();
}
LauncherCore c;
LauncherWindow w(c);
if(!parser.isSet(noguiOption)) {
new DesktopInterface(c);
} else {
if(!cmd->parse(parser, c))
return -1;
2021-11-23 15:37:02 -05:00
}
2021-11-01 09:54:58 -04:00
return app.exec();
}