mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-06-15 03:28:49 -07:00
Update recently opened decks regardless of where the deck is opened from (#5691)
This commit is contained in:
parent
5238087ddf
commit
6bb9ae92bf
4 changed files with 17 additions and 6 deletions
|
|
@ -128,6 +128,19 @@ void AbstractTabDeckEditor::actSwapCard(CardInfoPtr info, QString zoneName)
|
||||||
deckDockWidget->deckModel->findCard(info->getName(), zoneName, providerId, collectorNumber));
|
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
|
* Sets the currently active deck for this tab
|
||||||
* @param _deck The deck. Takes ownership of the object
|
* @param _deck The deck. Takes ownership of the object
|
||||||
|
|
@ -290,13 +303,12 @@ void AbstractTabDeckEditor::openDeckFromFile(const QString &fileName, DeckOpenLo
|
||||||
|
|
||||||
auto *l = new DeckLoader;
|
auto *l = new DeckLoader;
|
||||||
if (l->loadFromFile(fileName, fmt, true)) {
|
if (l->loadFromFile(fileName, fmt, true)) {
|
||||||
SettingsCache::instance().recents().updateRecentlyOpenedDeckPaths(fileName);
|
|
||||||
if (deckOpenLocation == NEW_TAB) {
|
if (deckOpenLocation == NEW_TAB) {
|
||||||
emit openDeckEditor(l);
|
emit openDeckEditor(l);
|
||||||
l->deleteLater();
|
l->deleteLater();
|
||||||
} else {
|
} else {
|
||||||
deckMenu->setSaveStatus(false);
|
deckMenu->setSaveStatus(false);
|
||||||
setDeck(l);
|
openDeck(l);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
l->deleteLater();
|
l->deleteLater();
|
||||||
|
|
|
||||||
|
|
@ -54,7 +54,7 @@ public:
|
||||||
virtual void retranslateUi() override = 0;
|
virtual void retranslateUi() override = 0;
|
||||||
|
|
||||||
// Deck Management
|
// Deck Management
|
||||||
virtual void setDeck(DeckLoader *_deckLoader);
|
void openDeck(DeckLoader *deck);
|
||||||
DeckLoader *getDeckList() const;
|
DeckLoader *getDeckList() const;
|
||||||
void setModified(bool _windowModified);
|
void setModified(bool _windowModified);
|
||||||
|
|
||||||
|
|
@ -117,6 +117,7 @@ protected slots:
|
||||||
virtual void dockFloatingTriggered() = 0;
|
virtual void dockFloatingTriggered() = 0;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
virtual void setDeck(DeckLoader *_deck);
|
||||||
void editDeckInClipboard(bool annotated);
|
void editDeckInClipboard(bool annotated);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
|
||||||
|
|
@ -246,8 +246,6 @@ void TabDeckStorage::actOpenLocalDeck()
|
||||||
if (!deckLoader.loadFromFile(filePath, DeckLoader::CockatriceFormat, true))
|
if (!deckLoader.loadFromFile(filePath, DeckLoader::CockatriceFormat, true))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
SettingsCache::instance().recents().updateRecentlyOpenedDeckPaths(filePath);
|
|
||||||
|
|
||||||
emit openDeckEditor(&deckLoader);
|
emit openDeckEditor(&deckLoader);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -772,7 +772,7 @@ TabDeckEditor *TabSupervisor::addDeckEditorTab(const DeckLoader *deckToOpen)
|
||||||
{
|
{
|
||||||
auto *tab = new TabDeckEditor(this);
|
auto *tab = new TabDeckEditor(this);
|
||||||
if (deckToOpen)
|
if (deckToOpen)
|
||||||
tab->setDeck(new DeckLoader(*deckToOpen));
|
tab->openDeck(new DeckLoader(*deckToOpen));
|
||||||
connect(tab, &AbstractTabDeckEditor::deckEditorClosing, this, &TabSupervisor::deckEditorClosed);
|
connect(tab, &AbstractTabDeckEditor::deckEditorClosing, this, &TabSupervisor::deckEditorClosed);
|
||||||
connect(tab, &AbstractTabDeckEditor::openDeckEditor, this, &TabSupervisor::addDeckEditorTab);
|
connect(tab, &AbstractTabDeckEditor::openDeckEditor, this, &TabSupervisor::addDeckEditorTab);
|
||||||
myAddTab(tab);
|
myAddTab(tab);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue