mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-01-04 17:17:56 -08:00
Automatic Card Database Updates (#6004)
* Add the option to background the oracle wizard, add an option to automatically launch oracle wizard in background every X days since last launch. * Mocks and a typo. * Lint. * Lint? * qOverload the spinBox. * Change to a prompt instead. * An Label. * Update window_main.cpp --------- Co-authored-by: Lukas Brübach <Bruebach.Lukas@bdosecurity.de> Co-authored-by: Zach H <zahalpern+github@gmail.com>
This commit is contained in:
@@ -8,6 +8,7 @@
|
||||
#include <QCommandLineParser>
|
||||
#include <QIcon>
|
||||
#include <QLibraryInfo>
|
||||
#include <QTimer>
|
||||
#include <QTranslator>
|
||||
|
||||
QTranslator *translator, *qtTranslator;
|
||||
@@ -16,6 +17,7 @@ ThemeManager *themeManager;
|
||||
const QString translationPrefix = "oracle";
|
||||
QString translationPath;
|
||||
bool isSpoilersOnly;
|
||||
bool isBackgrounded;
|
||||
|
||||
void installNewTranslator()
|
||||
{
|
||||
@@ -57,10 +59,13 @@ int main(int argc, char *argv[])
|
||||
|
||||
// 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);
|
||||
QCommandLineOption spoilersOnlyOption("s", QCoreApplication::translate("main", "Only run in spoiler mode"));
|
||||
QCommandLineOption backgroundOption("b", QCoreApplication::translate("main", "Run in no-confirm background mode"));
|
||||
parser.addOption(spoilersOnlyOption);
|
||||
parser.addOption(backgroundOption);
|
||||
parser.process(app);
|
||||
isSpoilersOnly = parser.isSet(showProgressOption);
|
||||
isSpoilersOnly = parser.isSet(spoilersOnlyOption);
|
||||
isBackgrounded = parser.isSet(backgroundOption);
|
||||
|
||||
#ifdef Q_OS_MAC
|
||||
translationPath = qApp->applicationDirPath() + "/../Resources/translations";
|
||||
@@ -85,5 +90,9 @@ int main(int argc, char *argv[])
|
||||
|
||||
wizard.show();
|
||||
|
||||
if (isBackgrounded) {
|
||||
QTimer::singleShot(0, &wizard, [&wizard]() { wizard.runInBackground(); });
|
||||
}
|
||||
|
||||
return app.exec();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user