mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-09-29 09:22:18 -07:00
More fixes.
Took 4 minutes Took 4 seconds
This commit is contained in:
parent
48780ccc24
commit
e4dc46ce37
6 changed files with 32 additions and 7 deletions
|
|
@ -541,8 +541,10 @@ MainWindow::MainWindow(QWidget *parent)
|
|||
|
||||
void MainWindow::startupConfigCheck()
|
||||
{
|
||||
// Signals for unknown/failed DB were emitted during the front-loaded parse
|
||||
// before MainWindow existed. Drive the UX now that receivers are connected.
|
||||
// checkUnknownSets() is intentionally deferred from the card database load
|
||||
// (which runs in main() before MainWindow exists) so that
|
||||
// cardDatabaseNewSetsFound / cardDatabaseAllNewSetsEnabled have live
|
||||
// receivers when emitted.
|
||||
CardDatabaseManager::getInstance()->checkUnknownSets();
|
||||
|
||||
if (SettingsCache::instance().debug().getLocalGameOnStartup()) {
|
||||
|
|
|
|||
|
|
@ -264,8 +264,9 @@ int main(int argc, char *argv[])
|
|||
// contention that happens when the load runs alongside window construction.
|
||||
// The CardDatabaseModel populates from the already-loaded data in its
|
||||
// constructor, so the window appears fully populated with no startup lag.
|
||||
// Note: unknown-set / failure signals are deferred; MainWindow triggers
|
||||
// checkUnknownSets() in startupConfigCheck() once receivers are connected.
|
||||
// Note: checkUnknownSets() is deferred until MainWindow::startupConfigCheck()
|
||||
// so that cardDatabaseNewSetsFound / cardDatabaseAllNewSetsEnabled have live
|
||||
// receivers when emitted.
|
||||
CardDatabaseManager::getInstance()->loadCardDatabases();
|
||||
|
||||
MainWindow ui;
|
||||
|
|
|
|||
|
|
@ -57,6 +57,12 @@ protected:
|
|||
public:
|
||||
/**
|
||||
* @brief Check for sets that are unknown and emit signals if needed.
|
||||
*
|
||||
* Called from MainWindow::startupConfigCheck() after signal connections are
|
||||
* live (the front-loaded parse in main() runs before MainWindow exists, so
|
||||
* signals emitted there would have no receivers). May also be called by
|
||||
* the loader via the friend declaration. Has side effects: enables all
|
||||
* sets when none are enabled (first-run), marks all sets as known.
|
||||
*/
|
||||
void checkUnknownSets();
|
||||
|
||||
|
|
|
|||
|
|
@ -129,7 +129,11 @@ LoadStatus CardDatabaseLoader::doLoadCardDatabases()
|
|||
qCInfo(CardDatabaseLoadingSuccessOrFailureLog) << "Card Database Loading Success";
|
||||
emit databaseDataReady(std::move(data));
|
||||
emit loadingFinished();
|
||||
database->checkUnknownSets();
|
||||
// NOTE: checkUnknownSets() is intentionally NOT called here. During
|
||||
// the front-loaded parse in main() this runs before MainWindow exists,
|
||||
// so cardDatabaseNewSetsFound / cardDatabaseAllNewSetsEnabled would be
|
||||
// emitted with no receivers. MainWindow::startupConfigCheck() calls
|
||||
// checkUnknownSets() once its signal connections are live.
|
||||
} else {
|
||||
qCInfo(CardDatabaseLoadingSuccessOrFailureLog) << "Card Database Loading Failed";
|
||||
emit loadingFailed(); // bring up the settings dialog
|
||||
|
|
|
|||
|
|
@ -72,7 +72,19 @@ protected:
|
|||
static SetNameMap sets;
|
||||
ICardSetPriorityController *cardSetPriorityController;
|
||||
|
||||
/** @brief Snapshot the current parse is filling, or nullptr when emitting signals. */
|
||||
/**
|
||||
* @brief Snapshot the current parse is filling, or nullptr when emitting signals.
|
||||
*
|
||||
* This is an implicit-inheritance-via-member-variable pattern: parseFileInto()
|
||||
* sets this before delegating to parseFile(), and loadCardsFromXml() /
|
||||
* loadFormats() check it to decide between direct insertion and signal
|
||||
* emission. Safe under the current model because loadFromFileMutex serialises
|
||||
* all parser access and parseFile() is never re-entered. If a future change
|
||||
* adds parallel parsing or a second parseFileInto() call within parseFile(),
|
||||
* this pointer would race -- at that point refactor to pass CardDatabaseData*
|
||||
* through the call chain instead. However, we are mostly RAM, not CPU bound on
|
||||
* DB startup at this point so there's not much point to parallel parsing.
|
||||
*/
|
||||
CardDatabaseData *targetData = nullptr;
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -31,7 +31,7 @@ public:
|
|||
|
||||
SetOptions getSetOptions(QString /* shortName */) const override
|
||||
{
|
||||
return {};
|
||||
return {0, true, true};
|
||||
}
|
||||
|
||||
void saveSets(const QVector<SetSaveData> & /* data */) override
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue