add menu option to reload card db (#5196)

This commit is contained in:
RickyRister 2024-11-24 23:43:08 -08:00 committed by GitHub
parent c51b54c0c5
commit 3255ed3ffb
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 12 additions and 1 deletions

View file

@ -666,6 +666,7 @@ void MainWindow::retranslateUi()
aOpenCustomFolder->setText(tr("Open custom image folder"));
aOpenCustomsetsFolder->setText(tr("Open custom sets folder"));
aAddCustomSet->setText(tr("Add custom sets/cards"));
aReloadCardDatabase->setText(tr("Reload card database"));
helpMenu->setTitle(tr("&Help"));
aAbout->setText(tr("&About Cockatrice"));
@ -714,6 +715,8 @@ void MainWindow::createActions()
connect(aOpenCustomsetsFolder, SIGNAL(triggered()), this, SLOT(actOpenCustomsetsFolder()));
aAddCustomSet = new QAction(QString(), this);
connect(aAddCustomSet, SIGNAL(triggered()), this, SLOT(actAddCustomSet()));
aReloadCardDatabase = new QAction(QString(), this);
connect(aReloadCardDatabase, SIGNAL(triggered()), this, SLOT(actReloadCardDatabase()));
aAbout = new QAction(this);
connect(aAbout, SIGNAL(triggered()), this, SLOT(actAbout()));
@ -788,6 +791,8 @@ void MainWindow::createMenus()
dbMenu->addAction(aOpenCustomFolder);
dbMenu->addAction(aOpenCustomsetsFolder);
dbMenu->addAction(aAddCustomSet);
dbMenu->addSeparator();
dbMenu->addAction(aReloadCardDatabase);
helpMenu = menuBar()->addMenu(QString());
helpMenu->addAction(aAbout);
@ -1324,6 +1329,11 @@ int MainWindow::getNextCustomSetPrefix(QDir dataDir)
return maxIndex + 1;
}
void MainWindow::actReloadCardDatabase()
{
const auto reloadOk1 = QtConcurrent::run([] { CardDatabaseManager::getInstance()->loadCardDatabases(); });
}
void MainWindow::actManageSets()
{
wndSets = new WndSets(this);