61 lines
1.5 KiB
C++
61 lines
1.5 KiB
C++
#include "quam/archive.h"
|
|
#include "quam/main_window.h"
|
|
|
|
#include <QApplication>
|
|
#include <QCommandLineParser>
|
|
#include <QCoreApplication>
|
|
|
|
static void setupAppl(QCoreApplication &appl) {
|
|
appl.setApplicationName(QString::fromUtf8("QuAM!"));
|
|
appl.setApplicationVersion(QString::fromUtf8("1.0"));
|
|
appl.setOrganizationDomain(QString::fromUtf8("greyserv.net"));
|
|
appl.setOrganizationName(QString::fromUtf8("Project Golan"));
|
|
}
|
|
|
|
static int modeGui(int argc, char *argv[]) {
|
|
QApplication appl{argc, argv};
|
|
setupAppl(appl);
|
|
MainWindow win;
|
|
win.show();
|
|
return appl.exec();
|
|
}
|
|
|
|
static int modeText(int argc, char *argv[]) {
|
|
QCoreApplication appl{argc, argv};
|
|
setupAppl(appl);
|
|
|
|
QCommandLineParser par;
|
|
|
|
par.setApplicationDescription(QString::fromUtf8("Quake Archive Manager"));
|
|
par.setSingleDashWordOptionMode(
|
|
QCommandLineParser::ParseAsCompactedShortOptions);
|
|
|
|
par.addHelpOption();
|
|
par.addVersionOption();
|
|
|
|
QCommandLineOption fileNameOpt{QStringList{QString::fromUtf8("f"),
|
|
QString::fromUtf8("file")},
|
|
trMain("Open the archive <file>."),
|
|
trMain("file")};
|
|
par.addOption(fileNameOpt);
|
|
|
|
par.process(appl);
|
|
|
|
auto fileName = par.value(fileNameOpt).toStdString();
|
|
|
|
auto st = openReadBin(fileName);
|
|
qDebug() << Arc::Arc(st).root;
|
|
|
|
return 0;
|
|
}
|
|
|
|
int main(int argc, char *argv[]) {
|
|
if(argc <= 1) {
|
|
return modeGui(argc, argv);
|
|
} else {
|
|
return modeText(argc, argv);
|
|
}
|
|
}
|
|
|
|
// EOF
|