mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-04-27 07:48:01 -07:00
free qprocess on oracle update fail (#4134)
* free qprocess on oracle update fail reload the database whenever oracle exits search for oracle in ../oracle so you can use it from the build dir * only ask for the db updater once
This commit is contained in:
parent
b8cd3af21f
commit
8cbc4c91f6
2 changed files with 27 additions and 11 deletions
|
|
@ -769,8 +769,8 @@ void MainWindow::createMenus()
|
|||
}
|
||||
|
||||
MainWindow::MainWindow(QWidget *parent)
|
||||
: QMainWindow(parent), localServer(nullptr), bHasActivated(false), cardUpdateProcess(nullptr),
|
||||
logviewDialog(nullptr)
|
||||
: QMainWindow(parent), localServer(nullptr), bHasActivated(false), askedForDbUpdater(false),
|
||||
cardUpdateProcess(nullptr), logviewDialog(nullptr)
|
||||
{
|
||||
connect(&SettingsCache::instance(), SIGNAL(pixmapCacheSizeChanged(int)), this, SLOT(pixmapCacheSizeChanged(int)));
|
||||
pixmapCacheSizeChanged(SettingsCache::instance().getPixmapCacheSize());
|
||||
|
|
@ -1003,6 +1003,10 @@ void MainWindow::showWindowIfHidden()
|
|||
|
||||
void MainWindow::cardDatabaseLoadingFailed()
|
||||
{
|
||||
if (askedForDbUpdater) {
|
||||
return;
|
||||
}
|
||||
askedForDbUpdater = true;
|
||||
QMessageBox msgBox;
|
||||
msgBox.setWindowTitle(tr("Card database"));
|
||||
msgBox.setIcon(QMessageBox::Question);
|
||||
|
|
@ -1109,17 +1113,34 @@ void MainWindow::actCheckCardUpdates()
|
|||
|
||||
if (dir.exists(binaryName)) {
|
||||
updaterCmd = dir.absoluteFilePath(binaryName);
|
||||
} else { // try and find the directory oracle is stored in the build directory
|
||||
QDir findLocalDir(dir);
|
||||
findLocalDir.cdUp();
|
||||
findLocalDir.cd(getCardUpdaterBinaryName());
|
||||
if (findLocalDir.exists(binaryName)) {
|
||||
dir = findLocalDir;
|
||||
updaterCmd = dir.absoluteFilePath(binaryName);
|
||||
}
|
||||
}
|
||||
|
||||
if (updaterCmd.isEmpty()) {
|
||||
QMessageBox::warning(this, tr("Error"),
|
||||
tr("Unable to run the card database updater: ") + dir.absoluteFilePath(binaryName));
|
||||
exitCardDatabaseUpdate();
|
||||
return;
|
||||
}
|
||||
|
||||
cardUpdateProcess->start(updaterCmd, QStringList());
|
||||
}
|
||||
|
||||
void MainWindow::exitCardDatabaseUpdate()
|
||||
{
|
||||
cardUpdateProcess->deleteLater();
|
||||
cardUpdateProcess = nullptr;
|
||||
|
||||
QtConcurrent::run(db, &CardDatabase::loadCardDatabases);
|
||||
}
|
||||
|
||||
void MainWindow::cardUpdateError(QProcess::ProcessError err)
|
||||
{
|
||||
QString error;
|
||||
|
|
@ -1145,18 +1166,13 @@ void MainWindow::cardUpdateError(QProcess::ProcessError err)
|
|||
break;
|
||||
}
|
||||
|
||||
cardUpdateProcess->deleteLater();
|
||||
cardUpdateProcess = nullptr;
|
||||
|
||||
exitCardDatabaseUpdate();
|
||||
QMessageBox::warning(this, tr("Error"), tr("The card database updater exited with an error: %1").arg(error));
|
||||
}
|
||||
|
||||
void MainWindow::cardUpdateFinished(int, QProcess::ExitStatus)
|
||||
{
|
||||
cardUpdateProcess->deleteLater();
|
||||
cardUpdateProcess = nullptr;
|
||||
|
||||
QtConcurrent::run(db, &CardDatabase::loadCardDatabases);
|
||||
exitCardDatabaseUpdate();
|
||||
}
|
||||
|
||||
void MainWindow::actCheckServerUpdates()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue