No need to QDebug.

This commit is contained in:
Lukas Brübach 2024-12-29 17:58:51 +01:00
parent c3bd973468
commit ae636986ae
2 changed files with 5 additions and 7 deletions

View file

@ -1012,6 +1012,7 @@ void TabDeckEditor::actLoadDeck()
QString fileName = dialog.selectedFiles().at(0); QString fileName = dialog.selectedFiles().at(0);
openDeckFromFile(fileName, deckOpenLocation); openDeckFromFile(fileName, deckOpenLocation);
updateBannerCardComboBox();
} }
void TabDeckEditor::actOpenRecent(const QString &fileName) void TabDeckEditor::actOpenRecent(const QString &fileName)
@ -1037,6 +1038,10 @@ void TabDeckEditor::openDeckFromFile(const QString &fileName, DeckOpenLocation d
auto *l = new DeckLoader; auto *l = new DeckLoader;
if (l->loadFromFile(fileName, fmt)) { if (l->loadFromFile(fileName, fmt)) {
SettingsCache::instance().recents().updateRecentlyOpenedDeckPaths(fileName); SettingsCache::instance().recents().updateRecentlyOpenedDeckPaths(fileName);
updateBannerCardComboBox();
if (!l->getBannerCard().isEmpty()) {
bannerCardComboBox->setCurrentIndex(bannerCardComboBox->findText(l->getBannerCard()));
}
if (deckOpenLocation == NEW_TAB) { if (deckOpenLocation == NEW_TAB) {
emit openDeckEditor(l); emit openDeckEditor(l);
} else { } else {
@ -1045,11 +1050,6 @@ void TabDeckEditor::openDeckFromFile(const QString &fileName, DeckOpenLocation d
} }
} else { } else {
delete l; delete l;
updateBannerCardComboBox();
if (!l->getBannerCard().isEmpty()) {
qDebug() << "Found banner card:" << l->getBannerCard();
bannerCardComboBox->setCurrentIndex(bannerCardComboBox->findText(l->getBannerCard()));
}
QMessageBox::critical(this, tr("Error"), tr("Could not open deck at %1").arg(fileName)); QMessageBox::critical(this, tr("Error"), tr("Could not open deck at %1").arg(fileName));
} }
setSaveStatus(true); setSaveStatus(true);

View file

@ -89,13 +89,11 @@ void VisualDeckStorageWidget::refreshBannerCards()
flowWidget->clearLayout(); // Clear existing widgets in the flow layout flowWidget->clearLayout(); // Clear existing widgets in the flow layout
foreach (const QString &file, filteredFiles) { foreach (const QString &file, filteredFiles) {
qDebug() << file;
auto deckLoader = new DeckLoader(); auto deckLoader = new DeckLoader();
deckLoader->loadFromFile(file, DeckLoader::CockatriceFormat); deckLoader->loadFromFile(file, DeckLoader::CockatriceFormat);
deckListModel->setDeckList(new DeckLoader(*deckLoader)); deckListModel->setDeckList(new DeckLoader(*deckLoader));
auto *display = new DeckPreviewCardPictureWidget(flowWidget, false); auto *display = new DeckPreviewCardPictureWidget(flowWidget, false);
qDebug() << "Banner card is: " << deckLoader->getBannerCard();
auto bannerCard = deckLoader->getBannerCard().isEmpty() auto bannerCard = deckLoader->getBannerCard().isEmpty()
? CardInfoPtr() ? CardInfoPtr()
: CardDatabaseManager::getInstance()->getCard(deckLoader->getBannerCard()); : CardDatabaseManager::getInstance()->getCard(deckLoader->getBannerCard());