mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-06-15 03:28:49 -07:00
don't open deck in new tab if current tab is blank (#5169)
This commit is contained in:
parent
f4e2f117c3
commit
86a4b130ff
2 changed files with 12 additions and 2 deletions
|
|
@ -783,7 +783,7 @@ void TabDeckEditor::actNewDeck()
|
||||||
|
|
||||||
void TabDeckEditor::actLoadDeck()
|
void TabDeckEditor::actLoadDeck()
|
||||||
{
|
{
|
||||||
bool openInNewTab = SettingsCache::instance().getOpenDeckInNewTab();
|
bool openInNewTab = SettingsCache::instance().getOpenDeckInNewTab() && !isBlankNewDeck();
|
||||||
|
|
||||||
if (!openInNewTab && !confirmClose())
|
if (!openInNewTab && !confirmClose())
|
||||||
return;
|
return;
|
||||||
|
|
@ -876,7 +876,7 @@ bool TabDeckEditor::actSaveDeckAs()
|
||||||
|
|
||||||
void TabDeckEditor::actLoadDeckFromClipboard()
|
void TabDeckEditor::actLoadDeckFromClipboard()
|
||||||
{
|
{
|
||||||
bool openInNewTab = SettingsCache::instance().getOpenDeckInNewTab();
|
bool openInNewTab = SettingsCache::instance().getOpenDeckInNewTab() && !isBlankNewDeck();
|
||||||
|
|
||||||
if (!openInNewTab && !confirmClose())
|
if (!openInNewTab && !confirmClose())
|
||||||
return;
|
return;
|
||||||
|
|
@ -985,6 +985,15 @@ void TabDeckEditor::recursiveExpand(const QModelIndex &index)
|
||||||
deckView->expand(index);
|
deckView->expand(index);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Returns true if this tab is a blank newly opened tab, as if it was just created with the `New Deck` action.
|
||||||
|
*/
|
||||||
|
bool TabDeckEditor::isBlankNewDeck() const
|
||||||
|
{
|
||||||
|
DeckLoader *const deck = deckModel->getDeckList();
|
||||||
|
return !modified && deck->getLastFileName().isEmpty() && deck->getLastRemoteDeckId() == -1;
|
||||||
|
}
|
||||||
|
|
||||||
CardInfoPtr TabDeckEditor::currentCardInfo() const
|
CardInfoPtr TabDeckEditor::currentCardInfo() const
|
||||||
{
|
{
|
||||||
const QModelIndex currentIndex = databaseView->selectionModel()->currentIndex();
|
const QModelIndex currentIndex = databaseView->selectionModel()->currentIndex();
|
||||||
|
|
|
||||||
|
|
@ -100,6 +100,7 @@ private slots:
|
||||||
void showSearchSyntaxHelp();
|
void showSearchSyntaxHelp();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
bool isBlankNewDeck() const;
|
||||||
CardInfoPtr currentCardInfo() const;
|
CardInfoPtr currentCardInfo() const;
|
||||||
void addCardHelper(QString zoneName);
|
void addCardHelper(QString zoneName);
|
||||||
void offsetCountAtIndex(const QModelIndex &idx, int offset);
|
void offsetCountAtIndex(const QModelIndex &idx, int offset);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue