#include "quam/archive.h" #include "quam/main_window.h" #include #include #include 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 ."), 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