Cockatrice 2026-01-14-Development-2.11.0-beta.46
A cross-platform virtual tabletop for multiplayer card games
Loading...
Searching...
No Matches

AbstractTabDeckEditor is the base class for all deck editor tabs. More...

#include <abstract_tab_deck_editor.h>

Inheritance diagram for AbstractTabDeckEditor:
[legend]
Collaboration diagram for AbstractTabDeckEditor:
[legend]

Classes

struct  DockActions
 The actions associated with managing a QDockWidget. More...

Public Slots

virtual void onDeckChanged ()
 Called when the deck changes.
virtual void onDeckModified ()
 Called when the deck is modified.
void updateCard (const ExactCard &card)
 Updates the card info panel.
void actAddCard (const ExactCard &card)
 Adds a card to the main deck or sideboard based on Ctrl key.
void actAddCardToSideboard (const ExactCard &card)
 Adds a card to the sideboard explicitly.
void actDecrementCard (const ExactCard &card)
 Decrements a card from the main deck.
void actDecrementCardFromSideboard (const ExactCard &card)
 Decrements a card from the sideboard.
void actOpenRecent (const QString &fileName)
 Opens a recently opened deck file.
void filterTreeChanged (FilterTree *filterTree)
 Called when the filter tree changes.
bool closeRequest () override
 Requests closing the tab.
virtual void showPrintingSelector ()=0
 Shows the printing selector dock. Pure virtual.
virtual void dockTopLevelChanged (bool topLevel)=0
 Slot for when a dock's top-level state changes. Pure virtual.

Signals

void openDeckEditor (const LoadedDeck &deck)
 Emitted when a deck should be opened in a new editor tab.
void deckEditorClosing (AbstractTabDeckEditor *tab)
 Emitted before the tab is closed.
Signals inherited from Tab
void userEvent (bool globalEvent=true)
void tabTextChanged (Tab *tab, const QString &newTabText)

Public Member Functions

 AbstractTabDeckEditor (TabSupervisor *_tabSupervisor)
 Constructs an AbstractTabDeckEditor.
virtual void createMenus ()=0
 Creates the menus for this tab. Pure virtual.
virtual QString getTabText () const override=0
 Returns the display text for the tab.
bool confirmClose ()
 Confirms whether the tab can be safely closed.
virtual void retranslateUi () override=0
 Retranslates the UI text. Pure virtual.
void openDeck (const LoadedDeck &deck)
 Opens a deck in this tab.
DeckEditorDeckDockWidgetgetDeckDockWidget () const
Public Member Functions inherited from Tab
 Tab (TabSupervisor *_tabSupervisor)
const QList< QMenu * > & getTabMenus () const
TabSupervisorgetTabSupervisor () const
bool getContentsChanged () const
void setContentsChanged (bool _contentsChanged)
virtual bool closeRequest ()
virtual void tabActivated ()

Public Attributes

DeckStateManagerdeckStateManager
DeckEditorMenudeckMenu
 Menu for deck operations.
DeckEditorCardDatabaseDockWidgetcardDatabaseDockWidget
 Database dock.
DeckEditorCardInfoDockWidgetcardInfoDockWidget
 Card info dock.
DeckEditorDeckDockWidgetdeckDockWidget
 Deck dock.
DeckEditorFilterDockWidgetfilterDockWidget
 Filter dock.
DeckEditorPrintingSelectorDockWidgetprintingSelectorDockWidget
 Printing selector dock.

Protected Types

enum  DeckOpenLocation { CANCELLED , SAME_TAB , NEW_TAB }
 Enum describing deck open locations. More...

Protected Slots

virtual void actNewDeck ()
 Starts a new deck in this tab.
void cleanDeckAndResetModified ()
 Cleans the current deck and resets the modified state.
virtual void actLoadDeck ()
 Loads a deck from file.
bool actSaveDeck ()
 Saves the current deck.
virtual bool actSaveDeckAs ()
 Saves the current deck under a new name.
virtual void actLoadDeckFromClipboard ()
 Loads a deck from the clipboard.
void actEditDeckInClipboard ()
 Opens a deck editor for clipboard contents.
void actEditDeckInClipboardRaw ()
 Opens a raw clipboard deck editor.
void actSaveDeckToClipboard ()
 Saves deck to clipboard with full info.
void actSaveDeckToClipboardNoSetInfo ()
 Saves deck to clipboard without set info.
void actSaveDeckToClipboardRaw ()
 Saves deck to clipboard in raw format.
void actSaveDeckToClipboardRawNoSetInfo ()
 Saves deck to clipboard in raw format without set info.
void actPrintDeck ()
 Prints the deck using a preview dialog.
void actLoadDeckFromWebsite ()
 Loads a deck from an online website.
void actExportDeckDecklist ()
 Exports the deck to decklist.org.
void actExportDeckDecklistXyz ()
 Exports the deck to decklist.xyz.
void actAnalyzeDeckDeckstats ()
 Analyzes the deck using deckstats.net.
void actAnalyzeDeckTappedout ()
 Analyzes the deck using tappedout.net.
void saveDeckRemoteFinished (const Response &r)
 Callback when a remote deck save finishes.
virtual void loadLayout ()=0
virtual void restartLayout ()=0
virtual void freeDocksSize ()=0
virtual void refreshShortcuts ()=0
void closeEvent (QCloseEvent *event) override
 Handles dock close events.
virtual void dockVisibleTriggered ()=0
 Slot triggered when a dock visibility changes. Pure virtual.
virtual void dockFloatingTriggered ()=0
 Slot triggered when a dock floating state changes. Pure virtual.
Protected Slots inherited from Tab
void showCardInfoPopup (const QPoint &pos, const CardRef &cardRef)
void deleteCardInfoPopup (const QString &cardName)

Protected Member Functions

void registerDockWidget (QDockWidget *widget)
 registers a QDockWidget as a managed dock widget. Creates the associated actions and menu, adds them to the viewMenu, and connects those actions to the tab's slots.
DeckOpenLocation confirmOpen (bool openInSameTabIfBlank=true)
 Confirms deck open action based on settings and modified state.
QMessageBox * createSaveConfirmationWindow ()
 Creates a save confirmation message box.
void addCardHelper (const ExactCard &card, const QString &zoneName)
 Helper function to add a card to a specific deck zone.
virtual void openDeckFromFile (const QString &fileName, DeckOpenLocation deckOpenLocation)
 Opens a deck from a file.
Protected Member Functions inherited from Tab
void addTabMenu (QMenu *menu)

Protected Attributes

QMenu * viewMenu
QAction * aResetLayout
QMap< QDockWidget *, DockActionsdockToActions
Protected Attributes inherited from Tab
TabSupervisortabSupervisor

Private Member Functions

virtual void setDeck (const LoadedDeck &_deck)
 Sets the deck for this tab.
void editDeckInClipboard (bool annotated)
 Helper for editing decks from the clipboard.
void exportToDecklistWebsite (DeckLoader::DecklistWebsite website)
 Helper for exporting decks to websites.

Friends

class DeckEditorMenu

Detailed Description

AbstractTabDeckEditor is the base class for all deck editor tabs.

Description: AbstractTabDeckEditor is the base class for all deck editor tabs. It provides core functionality such as deck model management, card addition/removal, and integration with dock widgets and tab supervisors.

Purpose:

  • Acts as the foundation for deck editor tabs (TabDeckEditor and TabDeckEditorVisual).
  • Provides basic deck operations like adding, removing, swapping, and decrementing cards.
  • Integrates with DeckListModel and CardDatabaseModel to access deck and card data.
  • Handles saving, loading, and layout persistence at the tab level.

Dock Widgets (typically managed in derived classes):

  • DeckEditorCardInfoDockWidget — Displays detailed card info.
  • DeckEditorDeckDockWidget— Displays mainboard/sideboard cards and zones.
  • DeckEditorFilterDockWidget— Provides filtering options for card searches.
  • DeckEditorPrintingSelectorDockWidget— Selector for different card printings.
  • DeckEditorDatabaseDisplayWidget— Shows card database for adding cards to deck.

Key Methods:

Provides UI docks for the deck, database, card info, printing selector, and filters. Supports loading, saving, editing, exporting decks, and interactions with external services such as DeckStats, TappedOut, and remote deck uploads.

Member Enumeration Documentation

◆ DeckOpenLocation

Enum describing deck open locations.

Enumerator
CANCELLED 

Operation cancelled.

SAME_TAB 

Open deck in the same tab.

NEW_TAB 

Open deck in a new tab.

Constructor & Destructor Documentation

◆ AbstractTabDeckEditor()

AbstractTabDeckEditor::AbstractTabDeckEditor ( TabSupervisor * _tabSupervisor)
explicit

Constructs an AbstractTabDeckEditor.

Constructs the AbstractTabDeckEditor. Initializes all dock widgets and connects signals/slots.

Parameters
_tabSupervisorPointer to the TabSupervisor managing this tab.
_tabSupervisorThe tab supervisor managing this tab.
Here is the call graph for this function:
Here is the caller graph for this function:

Member Function Documentation

◆ actAddCard

void AbstractTabDeckEditor::actAddCard ( const ExactCard & card)
slot

Adds a card to the main deck or sideboard based on Ctrl key.

Adds a card to the main deck or sideboard depending on Ctrl key.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ actAddCardToSideboard

void AbstractTabDeckEditor::actAddCardToSideboard ( const ExactCard & card)
slot

Adds a card to the sideboard explicitly.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ actAnalyzeDeckDeckstats

void AbstractTabDeckEditor::actAnalyzeDeckDeckstats ( )
protectedslot

Analyzes the deck using deckstats.net.

Analyzes the deck using DeckStats.

Here is the caller graph for this function:

◆ actAnalyzeDeckTappedout

void AbstractTabDeckEditor::actAnalyzeDeckTappedout ( )
protectedslot

Analyzes the deck using tappedout.net.

Analyzes the deck using TappedOut.

Here is the caller graph for this function:

◆ actDecrementCard

void AbstractTabDeckEditor::actDecrementCard ( const ExactCard & card)
slot

Decrements a card from the main deck.

Here is the caller graph for this function:

◆ actDecrementCardFromSideboard

void AbstractTabDeckEditor::actDecrementCardFromSideboard ( const ExactCard & card)
slot

Decrements a card from the sideboard.

Here is the caller graph for this function:

◆ actEditDeckInClipboard

void AbstractTabDeckEditor::actEditDeckInClipboard ( )
protectedslot

Opens a deck editor for clipboard contents.

Slot for editing deck in clipboard with annotations.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ actEditDeckInClipboardRaw

void AbstractTabDeckEditor::actEditDeckInClipboardRaw ( )
protectedslot

Opens a raw clipboard deck editor.

Slot for editing deck in clipboard without annotations.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ actExportDeckDecklist

void AbstractTabDeckEditor::actExportDeckDecklist ( )
protectedslot

Exports the deck to decklist.org.

Exports deck to www.decklist.org.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ actExportDeckDecklistXyz

void AbstractTabDeckEditor::actExportDeckDecklistXyz ( )
protectedslot

Exports the deck to decklist.xyz.

Exports deck to www.decklist.xyz.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ actLoadDeck

void AbstractTabDeckEditor::actLoadDeck ( )
protectedvirtualslot

Loads a deck from file.

Loads a deck from file using a dialog. Displays a save confirmation if needed.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ actLoadDeckFromClipboard

void AbstractTabDeckEditor::actLoadDeckFromClipboard ( )
protectedvirtualslot

Loads a deck from the clipboard.

Loads a deck from clipboard. Displays confirmation if the tab is modified.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ actLoadDeckFromWebsite

void AbstractTabDeckEditor::actLoadDeckFromWebsite ( )
protectedslot

Loads a deck from an online website.

Loads a deck from a website.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ actNewDeck

void AbstractTabDeckEditor::actNewDeck ( )
protectedvirtualslot

Starts a new deck in this tab.

Creates a new deck. Handles opening in new tab if needed.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ actOpenRecent

void AbstractTabDeckEditor::actOpenRecent ( const QString & fileName)
slot

Opens a recently opened deck file.

Opens a recently used deck file.

Parameters
fileNamePath to the deck file.
Here is the call graph for this function:

◆ actPrintDeck

void AbstractTabDeckEditor::actPrintDeck ( )
protectedslot

Prints the deck using a preview dialog.

Prints the deck using a QPrintPreviewDialog.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ actSaveDeck

bool AbstractTabDeckEditor::actSaveDeck ( )
protectedslot

Saves the current deck.

Saves the current deck. If remote deck, sends upload command.

Returns
True if save succeeded, false otherwise.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ actSaveDeckAs

bool AbstractTabDeckEditor::actSaveDeckAs ( )
protectedvirtualslot

Saves the current deck under a new name.

Saves the deck to a user-selected file.

Returns
True if save succeeded.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ actSaveDeckToClipboard

void AbstractTabDeckEditor::actSaveDeckToClipboard ( )
protectedslot

Saves deck to clipboard with full info.

Saves deck to clipboard with set info and annotation.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ actSaveDeckToClipboardNoSetInfo

void AbstractTabDeckEditor::actSaveDeckToClipboardNoSetInfo ( )
protectedslot

Saves deck to clipboard without set info.

Saves deck to clipboard with annotation, without set info.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ actSaveDeckToClipboardRaw

void AbstractTabDeckEditor::actSaveDeckToClipboardRaw ( )
protectedslot

Saves deck to clipboard in raw format.

Saves deck to clipboard without annotations, with set info.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ actSaveDeckToClipboardRawNoSetInfo

void AbstractTabDeckEditor::actSaveDeckToClipboardRawNoSetInfo ( )
protectedslot

Saves deck to clipboard in raw format without set info.

Saves deck to clipboard without annotations or set info.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ addCardHelper()

void AbstractTabDeckEditor::addCardHelper ( const ExactCard & card,
const QString & zoneName )
protected

Helper function to add a card to a specific deck zone.

Helper for adding a card to a deck zone.

Parameters
cardCard to add.
zoneNameZone to add the card to.
Here is the caller graph for this function:

◆ cleanDeckAndResetModified

void AbstractTabDeckEditor::cleanDeckAndResetModified ( )
protectedslot

Cleans the current deck and resets the modified state.

Clears the current deck and resets modified flag.

Here is the caller graph for this function:

◆ closeEvent

void AbstractTabDeckEditor::closeEvent ( QCloseEvent * event)
overrideprotectedslot

Handles dock close events.

Handles the close event of the tab.

Parameters
eventClose event.
Here is the call graph for this function:

◆ closeRequest

bool AbstractTabDeckEditor::closeRequest ( )
overrideslot

Requests closing the tab.

Handles close requests from outside (tab manager).

Here is the call graph for this function:
Here is the caller graph for this function:

◆ confirmClose()

bool AbstractTabDeckEditor::confirmClose ( )

Confirms whether the tab can be safely closed.

Shows a confirmation dialog before closing.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ confirmOpen()

AbstractTabDeckEditor::DeckOpenLocation AbstractTabDeckEditor::confirmOpen ( bool openInSameTabIfBlank = true)
protected

Confirms deck open action based on settings and modified state.

Displays the save confirmation dialog before loading a deck.

Parameters
openInSameTabIfBlankWhether to reuse same tab if blank.
Returns
Selected DeckOpenLocation.
Parameters
openInSameTabIfBlankOpen in same tab if current tab is blank.
Returns
DeckOpenLocation enum indicating where to open the deck.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ createMenus()

virtual void AbstractTabDeckEditor::createMenus ( )
pure virtual

Creates the menus for this tab. Pure virtual.

Implemented in TabDeckEditor, and TabDeckEditorVisual.

◆ createSaveConfirmationWindow()

QMessageBox * AbstractTabDeckEditor::createSaveConfirmationWindow ( )
protected

Creates a save confirmation message box.

Creates the base save confirmation dialog.

Returns
Pointer to a QMessageBox.
Here is the caller graph for this function:

◆ deckEditorClosing

void AbstractTabDeckEditor::deckEditorClosing ( AbstractTabDeckEditor * tab)
signal

Emitted before the tab is closed.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ dockFloatingTriggered

virtual void AbstractTabDeckEditor::dockFloatingTriggered ( )
protectedpure virtualslot

Slot triggered when a dock floating state changes. Pure virtual.

Here is the caller graph for this function:

◆ dockTopLevelChanged

virtual void AbstractTabDeckEditor::dockTopLevelChanged ( bool topLevel)
pure virtualslot

Slot for when a dock's top-level state changes. Pure virtual.

Here is the caller graph for this function:

◆ dockVisibleTriggered

virtual void AbstractTabDeckEditor::dockVisibleTriggered ( )
protectedpure virtualslot

Slot triggered when a dock visibility changes. Pure virtual.

Here is the caller graph for this function:

◆ editDeckInClipboard()

void AbstractTabDeckEditor::editDeckInClipboard ( bool annotated)
private

Helper for editing decks from the clipboard.

Opens the deck editor to edit clipboard contents.

Parameters
annotatedIf true, edits with annotations.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ exportToDecklistWebsite()

void AbstractTabDeckEditor::exportToDecklistWebsite ( DeckLoader::DecklistWebsite website)
private

Helper for exporting decks to websites.

Exports the deck to a decklist website.

Parameters
websiteTarget website.
websiteWebsite to export to.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ filterTreeChanged

void AbstractTabDeckEditor::filterTreeChanged ( FilterTree * filterTree)
slot

Called when the filter tree changes.

Applies a new filter tree to the database display.

◆ freeDocksSize

virtual void AbstractTabDeckEditor::freeDocksSize ( )
protectedpure virtualslot

◆ getDeckDockWidget()

DeckEditorDeckDockWidget * AbstractTabDeckEditor::getDeckDockWidget ( ) const
inline

◆ getTabText()

virtual QString AbstractTabDeckEditor::getTabText ( ) const
nodiscardoverridepure virtual

Returns the display text for the tab.

Implements Tab.

Implemented in TabDeckEditor, and TabDeckEditorVisual.

Here is the caller graph for this function:

◆ loadLayout

virtual void AbstractTabDeckEditor::loadLayout ( )
protectedpure virtualslot

◆ onDeckChanged

void AbstractTabDeckEditor::onDeckChanged ( )
virtualslot

Called when the deck changes.

Placeholder: called when the deck changes.

◆ onDeckModified

void AbstractTabDeckEditor::onDeckModified ( )
virtualslot

Called when the deck is modified.

Marks the tab as modified and updates the save menu status.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ openDeck()

void AbstractTabDeckEditor::openDeck ( const LoadedDeck & deck)

Opens a deck in this tab.

Parameters
deckThe deck to open
deckThe deck
Here is the call graph for this function:
Here is the caller graph for this function:

◆ openDeckEditor

void AbstractTabDeckEditor::openDeckEditor ( const LoadedDeck & deck)
signal

Emitted when a deck should be opened in a new editor tab.

Here is the caller graph for this function:

◆ openDeckFromFile()

void AbstractTabDeckEditor::openDeckFromFile ( const QString & fileName,
DeckOpenLocation deckOpenLocation )
protectedvirtual

Opens a deck from a file.

Actually opens a deck from file.

Parameters
fileNamePath to the deck file.
deckOpenLocationWhere to open the deck (same or new tab).
Here is the call graph for this function:
Here is the caller graph for this function:

◆ refreshShortcuts

virtual void AbstractTabDeckEditor::refreshShortcuts ( )
protectedpure virtualslot
Here is the caller graph for this function:

◆ registerDockWidget()

void AbstractTabDeckEditor::registerDockWidget ( QDockWidget * widget)
protected

registers a QDockWidget as a managed dock widget. Creates the associated actions and menu, adds them to the viewMenu, and connects those actions to the tab's slots.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ restartLayout

virtual void AbstractTabDeckEditor::restartLayout ( )
protectedpure virtualslot

◆ retranslateUi()

virtual void AbstractTabDeckEditor::retranslateUi ( )
overridepure virtual

Retranslates the UI text. Pure virtual.

Implements Tab.

Implemented in TabDeckEditor, and TabDeckEditorVisual.

◆ saveDeckRemoteFinished

void AbstractTabDeckEditor::saveDeckRemoteFinished ( const Response & response)
protectedslot

Callback when a remote deck save finishes.

Callback for remote deck save completion.

Parameters
responseServer response.
Here is the caller graph for this function:

◆ setDeck()

void AbstractTabDeckEditor::setDeck ( const LoadedDeck & _deck)
privatevirtual

Sets the deck for this tab.

Sets the currently active deck.

Parameters
_deckThe deck object.
_deckThe deck
Here is the call graph for this function:
Here is the caller graph for this function:

◆ showPrintingSelector

virtual void AbstractTabDeckEditor::showPrintingSelector ( )
pure virtualslot

Shows the printing selector dock. Pure virtual.

Here is the caller graph for this function:

◆ updateCard

void AbstractTabDeckEditor::updateCard ( const ExactCard & card)
slot

Updates the card info panel.

Updates the card info dock and printing selector.

Parameters
cardThe card to display.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ DeckEditorMenu

friend class DeckEditorMenu
friend

Member Data Documentation

◆ aResetLayout

QAction* AbstractTabDeckEditor::aResetLayout
protected

◆ cardDatabaseDockWidget

DeckEditorCardDatabaseDockWidget* AbstractTabDeckEditor::cardDatabaseDockWidget

Database dock.

◆ cardInfoDockWidget

DeckEditorCardInfoDockWidget* AbstractTabDeckEditor::cardInfoDockWidget

Card info dock.

◆ deckDockWidget

DeckEditorDeckDockWidget* AbstractTabDeckEditor::deckDockWidget

Deck dock.

◆ deckMenu

DeckEditorMenu* AbstractTabDeckEditor::deckMenu

Menu for deck operations.

◆ deckStateManager

DeckStateManager* AbstractTabDeckEditor::deckStateManager

◆ dockToActions

QMap<QDockWidget *, DockActions> AbstractTabDeckEditor::dockToActions
protected

◆ filterDockWidget

DeckEditorFilterDockWidget* AbstractTabDeckEditor::filterDockWidget

Filter dock.

◆ printingSelectorDockWidget

DeckEditorPrintingSelectorDockWidget* AbstractTabDeckEditor::printingSelectorDockWidget

Printing selector dock.

◆ viewMenu

QMenu* AbstractTabDeckEditor::viewMenu
protected

The documentation for this class was generated from the following files: