2019-10-04 10:37:34 -07:00
|
|
|
#include "quam/archive.h"
|
2019-09-27 00:09:09 -07:00
|
|
|
#include "quam/main_window.h"
|
|
|
|
|
|
|
|
#include <QApplication>
|
|
|
|
#include <QCommandLineParser>
|
|
|
|
#include <QCoreApplication>
|
|
|
|
|
|
|
|
static void setupAppl(QCoreApplication &appl) {
|
|
|
|
appl.setApplicationName("QuAM!");
|
|
|
|
appl.setApplicationVersion("1.0");
|
|
|
|
appl.setOrganizationDomain("greyserv.net");
|
|
|
|
appl.setOrganizationName("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("Quake Archive Manager");
|
|
|
|
par.setSingleDashWordOptionMode(
|
|
|
|
QCommandLineParser::ParseAsCompactedShortOptions);
|
|
|
|
|
|
|
|
par.addHelpOption();
|
|
|
|
par.addVersionOption();
|
|
|
|
|
|
|
|
QCommandLineOption fileNameOpt{QStringList{"f", "file"},
|
|
|
|
trMain("Open the archive <file>."),
|
|
|
|
trMain("file")};
|
|
|
|
par.addOption(fileNameOpt);
|
|
|
|
|
|
|
|
par.process(appl);
|
|
|
|
|
|
|
|
auto fileName = par.value(fileNameOpt).toStdString();
|
2019-09-28 01:17:55 -07:00
|
|
|
|
|
|
|
auto st = openReadBin(fileName);
|
2019-10-04 10:37:34 -07:00
|
|
|
auto arc = Arc::readArchive(st);
|
2019-09-27 00:09:09 -07:00
|
|
|
|
2019-10-04 10:37:34 -07:00
|
|
|
qDebug() << arc;
|
2019-09-28 01:17:55 -07:00
|
|
|
|
2019-09-27 00:09:09 -07:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
int main(int argc, char *argv[]) {
|
2019-09-28 01:17:55 -07:00
|
|
|
if(argc <= 1) {
|
2019-09-27 00:09:09 -07:00
|
|
|
return modeGui(argc, argv);
|
|
|
|
} else {
|
|
|
|
return modeText(argc, argv);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// EOF
|