servatrice/oracle/src/main.cpp
Zach H b0e643ecc0
Several download URLs have arrived! (#3494)
* Cockatrice Picture loader uses better defined URLs now
URLs are defined on the Card Management tab
Instead of Primary/Backup, you can now define a list of URLs
List of URLs can be drag/dropped for priority ordering
Oracle now uses scryfallId > mtgjsonUUID for !uuid!

Signed-off-by: Zach Halpern <ZaHalpern+github@gmail.com>

* Simplify to QStringList and remove metacall

Signed-off-by: Zach Halpern <ZaHalpern+github@gmail.com>

* fix issues brought up by Dae. Also fix how the defaults load to account for first time users.

Signed-off-by: Zach Halpern <ZaHalpern+github@gmail.com>

* clangify

* Fix save settings on row moved (#3495)

* merge model fix, and reclangify

Signed-off-by: Zach Halpern <ZaHalpern+github@gmail.com>

* Sources > Resources

Signed-off-by: Zach Halpern <ZaHalpern+github@gmail.com>
2019-01-08 15:18:06 -05:00

70 lines
2 KiB
C++

#include <QApplication>
#include <QCommandLineParser>
#include <QIcon>
#include <QLibraryInfo>
#include <QTextCodec>
#include <QTranslator>
#include "main.h"
#include "oraclewizard.h"
#include "settingscache.h"
#include "thememanager.h"
QTranslator *translator, *qtTranslator;
SettingsCache *settingsCache;
ThemeManager *themeManager;
const QString translationPrefix = "oracle";
QString translationPath;
bool isSpoilersOnly;
void installNewTranslator()
{
QString lang = settingsCache->getLang();
qtTranslator->load("qt_" + lang, QLibraryInfo::location(QLibraryInfo::TranslationsPath));
qApp->installTranslator(qtTranslator);
translator->load(translationPrefix + "_" + lang, translationPath);
qApp->installTranslator(translator);
}
int main(int argc, char *argv[])
{
QApplication app(argc, argv);
QCoreApplication::setOrganizationName("Cockatrice");
QCoreApplication::setOrganizationDomain("cockatrice");
// this can't be changed, as it influences the default save path for cards.xml
QCoreApplication::setApplicationName("Cockatrice");
// If the program is opened with the -s flag, it will only do spoilers. Otherwise it will do MTGJSON/Tokens
QCommandLineParser parser;
QCommandLineOption showProgressOption("s", QCoreApplication::translate("main", "Only run in spoiler mode"));
parser.addOption(showProgressOption);
parser.process(app);
isSpoilersOnly = parser.isSet(showProgressOption);
#ifdef Q_OS_MAC
translationPath = qApp->applicationDirPath() + "/../Resources/translations";
#elif defined(Q_OS_WIN)
translationPath = qApp->applicationDirPath() + "/translations";
#else // linux
translationPath = qApp->applicationDirPath() + "/../share/cockatrice/translations";
#endif
settingsCache = new SettingsCache;
themeManager = new ThemeManager;
qtTranslator = new QTranslator;
translator = new QTranslator;
installNewTranslator();
OracleWizard wizard;
QIcon icon("theme:appicon.svg");
wizard.setWindowIcon(icon);
wizard.show();
return app.exec();
}