mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-01-15 14:34:04 -08:00
Update recently opened decks regardless of where the deck is opened from (#5691)
This commit is contained in:
@@ -128,6 +128,19 @@ void AbstractTabDeckEditor::actSwapCard(CardInfoPtr info, QString zoneName)
|
||||
deckDockWidget->deckModel->findCard(info->getName(), zoneName, providerId, collectorNumber));
|
||||
}
|
||||
|
||||
/**
|
||||
* Opens the deck in this tab.
|
||||
* @param deck The deck. Takes ownership of the object
|
||||
*/
|
||||
void AbstractTabDeckEditor::openDeck(DeckLoader *deck)
|
||||
{
|
||||
setDeck(deck);
|
||||
|
||||
if (!deck->getLastFileName().isEmpty()) {
|
||||
SettingsCache::instance().recents().updateRecentlyOpenedDeckPaths(deck->getLastFileName());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the currently active deck for this tab
|
||||
* @param _deck The deck. Takes ownership of the object
|
||||
@@ -290,13 +303,12 @@ void AbstractTabDeckEditor::openDeckFromFile(const QString &fileName, DeckOpenLo
|
||||
|
||||
auto *l = new DeckLoader;
|
||||
if (l->loadFromFile(fileName, fmt, true)) {
|
||||
SettingsCache::instance().recents().updateRecentlyOpenedDeckPaths(fileName);
|
||||
if (deckOpenLocation == NEW_TAB) {
|
||||
emit openDeckEditor(l);
|
||||
l->deleteLater();
|
||||
} else {
|
||||
deckMenu->setSaveStatus(false);
|
||||
setDeck(l);
|
||||
openDeck(l);
|
||||
}
|
||||
} else {
|
||||
l->deleteLater();
|
||||
|
||||
@@ -54,7 +54,7 @@ public:
|
||||
virtual void retranslateUi() override = 0;
|
||||
|
||||
// Deck Management
|
||||
virtual void setDeck(DeckLoader *_deckLoader);
|
||||
void openDeck(DeckLoader *deck);
|
||||
DeckLoader *getDeckList() const;
|
||||
void setModified(bool _windowModified);
|
||||
|
||||
@@ -117,6 +117,7 @@ protected slots:
|
||||
virtual void dockFloatingTriggered() = 0;
|
||||
|
||||
private:
|
||||
virtual void setDeck(DeckLoader *_deck);
|
||||
void editDeckInClipboard(bool annotated);
|
||||
|
||||
protected:
|
||||
|
||||
@@ -246,8 +246,6 @@ void TabDeckStorage::actOpenLocalDeck()
|
||||
if (!deckLoader.loadFromFile(filePath, DeckLoader::CockatriceFormat, true))
|
||||
continue;
|
||||
|
||||
SettingsCache::instance().recents().updateRecentlyOpenedDeckPaths(filePath);
|
||||
|
||||
emit openDeckEditor(&deckLoader);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -772,7 +772,7 @@ TabDeckEditor *TabSupervisor::addDeckEditorTab(const DeckLoader *deckToOpen)
|
||||
{
|
||||
auto *tab = new TabDeckEditor(this);
|
||||
if (deckToOpen)
|
||||
tab->setDeck(new DeckLoader(*deckToOpen));
|
||||
tab->openDeck(new DeckLoader(*deckToOpen));
|
||||
connect(tab, &AbstractTabDeckEditor::deckEditorClosing, this, &TabSupervisor::deckEditorClosed);
|
||||
connect(tab, &AbstractTabDeckEditor::openDeckEditor, this, &TabSupervisor::addDeckEditorTab);
|
||||
myAddTab(tab);
|
||||
|
||||
Reference in New Issue
Block a user