Cockatrice 2025-11-30-Development-2.11.0-beta.38
A cross-platform virtual tabletop for multiplayer card games
Loading...
Searching...
No Matches

TabDeckEditorVisual provides a fully-featured deck editor tab with an enhanced visual interface. It extends AbstractTabDeckEditor. More...

#include <tab_deck_editor_visual.h>

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

Public Slots

void onDeckChanged () override
 Refresh UI when the deck changes.
void showPrintingSelector () override
 Show the printing selector dock for the currently active card.
void processMainboardCardClick (QMouseEvent *event, CardInfoPictureWithTextOverlayWidget *instance, const QString &zoneName)
 Handle card clicks in the mainboard visual deck.
void processCardClickDatabaseDisplay (QMouseEvent *event, CardInfoPictureWithTextOverlayWidget *instance)
 Handle card clicks in the database visual display.
bool actSaveDeckAs () override
 Save the deck under a new name.
Public Slots inherited from AbstractTabDeckEditor
virtual void onDeckChanged ()
 Called when the deck changes.
virtual void onDeckModified ()
 Called when the deck is modified.
virtual void onDeckHistorySaveRequested (const QString &modificationReason)
 Called when a widget is about to modify the state of the DeckList.
virtual void onDeckHistoryClearRequested ()
 Called when a widget would like to clear the history.
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.

Public Member Functions

 TabDeckEditorVisual (TabSupervisor *_tabSupervisor)
 Constructs a visual deck editor tab.
void retranslateUi () override
 Retranslate UI strings (for i18n support).
QString getTabText () const override
 Get the display text for the tab.
void changeModelIndexAndCardInfo (const ExactCard &activeCard)
 Update the currently selected card in the deck and UI.
void changeModelIndexToCard (const ExactCard &activeCard)
 Change the deck view selection to a specific card.
void createDeckAnalyticsDock ()
 Create the deck analytics dock widget.
void createMenus () override
 Setup menus for this visual deck editor.
void createSearchAndDatabaseFrame ()
 Create search and database display frame.
void createCentralFrame ()
 Create central frame for visual widgets.
Public Member Functions inherited from AbstractTabDeckEditor
 AbstractTabDeckEditor (TabSupervisor *_tabSupervisor)
 Constructs an AbstractTabDeckEditor.
bool confirmClose ()
 Confirms whether the tab can be safely closed.
void openDeck (DeckLoader *deck)
 Opens a deck in this tab.
DeckLoader * getDeckLoader () const
 Returns the currently active deck loader.
DeckListgetDeckList () const
 Returns the currently active deck list.
void setModified (bool _windowModified)
 Sets the modified state of the tab.
DeckEditorDeckDockWidgetgetDeckDockWidget () const
DeckListHistoryManagergetHistoryManager () 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 ()

Protected Slots

void loadLayout () override
 Load the editor layout from settings.
void restartLayout () override
 Reset and restart the layout to default.
void freeDocksSize () override
 Set size restrictions for free floating dock widgets.
void refreshShortcuts () override
 Refresh keyboard shortcuts for this tab.
bool eventFilter (QObject *o, QEvent *e) override
 Synchronize dock state with menu items.
void dockVisibleTriggered () override
 Triggered when a dock visibility menu item is clicked.
void dockFloatingTriggered () override
 Triggered when a dock floating menu item is clicked.
void dockTopLevelChanged (bool topLevel) override
 Triggered when a dock top-level state changes.
Protected Slots inherited from AbstractTabDeckEditor
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.
bool eventFilter (QObject *o, QEvent *e) override
 Event filter for dock state changes.
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 Attributes

TabDeckEditorVisualTabWidgettabContainer
 Tab container holding different visual widgets.
QVBoxLayout * centralFrame
 Layout for central widgets.
QVBoxLayout * searchAndDatabaseFrame
 Layout for search and database display.
QHBoxLayout * searchLayout
 Layout for search bar.
QDockWidget * searchAndDatabaseDock
 Dock widget for search/database display.
QWidget * centralWidget
 Central widget of the editor.
Protected Attributes inherited from AbstractTabDeckEditor
QMenu * viewMenu
QMenu * cardInfoDockMenu
QMenu * deckDockMenu
QMenu * filterDockMenu
QMenu * printingSelectorDockMenu
QAction * aResetLayout
QAction * aCardInfoDockVisible
QAction * aCardInfoDockFloating
QAction * aDeckDockVisible
QAction * aDeckDockFloating
QAction * aFilterDockVisible
QAction * aFilterDockFloating
QAction * aPrintingSelectorDockVisible
QAction * aPrintingSelectorDockFloating
bool modified = false
 Whether the deck/tab has unsaved changes.
Protected Attributes inherited from Tab
TabSupervisortabSupervisor

Additional Inherited Members

Signals inherited from AbstractTabDeckEditor
void openDeckEditor (DeckLoader *deckLoader)
 Emitted when a deck should be opened in a new editor tab.
void deckEditorClosing (AbstractTabDeckEditor *tab)
 Emitted before the tab is closed.
void decrementCard (const ExactCard &card, QString zoneName)
 Emitted when a card should be decremented.
Signals inherited from Tab
void userEvent (bool globalEvent=true)
void tabTextChanged (Tab *tab, const QString &newTabText)
Public Attributes inherited from AbstractTabDeckEditor
DeckListHistoryManagerhistoryManager
DeckEditorMenudeckMenu
 Menu for deck operations.
DeckEditorDatabaseDisplayWidgetdatabaseDisplayDockWidget
 Database dock.
DeckEditorCardInfoDockWidgetcardInfoDockWidget
 Card info dock.
DeckEditorDeckDockWidgetdeckDockWidget
 Deck dock.
DeckEditorFilterDockWidgetfilterDockWidget
 Filter dock.
DeckEditorPrintingSelectorDockWidgetprintingSelectorDockWidget
 Printing selector dock.
Protected Types inherited from AbstractTabDeckEditor
enum  DeckOpenLocation { CANCELLED , SAME_TAB , NEW_TAB }
 Enum describing deck open locations. More...
Protected Member Functions inherited from AbstractTabDeckEditor
DeckOpenLocation confirmOpen (bool openInSameTabIfBlank=true)
 Confirms deck open action based on settings and modified state.
QMessageBox * createSaveConfirmationWindow ()
 Creates a save confirmation message box.
bool isBlankNewDeck () const
 Returns true if the tab is a blank newly created deck.
void addCardHelper (const ExactCard &card, QString zoneName)
 Helper function to add a card to a specific deck zone.
void actSwapCard (const ExactCard &card, const QString &zoneName)
 Swaps a card in the deck view.
virtual void openDeckFromFile (const QString &fileName, DeckOpenLocation deckOpenLocation)
 Opens a deck from a file.
Protected Member Functions inherited from Tab
void addTabMenu (QMenu *menu)

Detailed Description

TabDeckEditorVisual provides a fully-featured deck editor tab with an enhanced visual interface. It extends AbstractTabDeckEditor.

Description: TabDeckEditorVisual is a fully-featured deck editor tab with an enhanced visual interface. It extends AbstractTabDeckEditor and integrates multiple visual components such as a visual deck view, database display, deck analytics, and sample hand preview.

Purpose:

  • Provides an intuitive, visual interface for deck editing.
  • Combines visual deck representation, card database browsing, and analytics into one tab.
  • Supports card interactions via clicks, hover events, and drag-and-drop-like behavior (not yet).

Dock Widgets and Components:

Key Methods:

Constructor & Destructor Documentation

◆ TabDeckEditorVisual()

TabDeckEditorVisual::TabDeckEditorVisual ( TabSupervisor * _tabSupervisor)
explicit

Constructs a visual deck editor tab.

Constructs the TabDeckEditorVisual instance.

Parameters
_tabSupervisorPointer to the tab supervisor managing this tab.

Sets up the central widget, tab container, menus, shortcuts, and restores the saved layout.

Parameters
_tabSupervisorParent tab supervisor managing this tab.
Here is the call graph for this function:

Member Function Documentation

◆ actSaveDeckAs

bool TabDeckEditorVisual::actSaveDeckAs ( )
overrideslot

Save the deck under a new name.

Performs "Save Deck As..." while temporarily disabling the search bar.

Returns
true if successful, false otherwise.
Here is the call graph for this function:

◆ changeModelIndexAndCardInfo()

void TabDeckEditorVisual::changeModelIndexAndCardInfo ( const ExactCard & activeCard)

Update the currently selected card in the deck and UI.

Updates card info and highlights the corresponding card in the deck view.

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

◆ changeModelIndexToCard()

void TabDeckEditorVisual::changeModelIndexToCard ( const ExactCard & activeCard)

Change the deck view selection to a specific card.

Selects the given card in the deck view, checking main and side zones.

Parameters
activeCardCard to select in the deck view.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ createCentralFrame()

void TabDeckEditorVisual::createCentralFrame ( )

Create central frame for visual widgets.

Creates the central frame containing the tab container.

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

◆ createDeckAnalyticsDock()

void TabDeckEditorVisual::createDeckAnalyticsDock ( )

Create the deck analytics dock widget.

◆ createMenus()

void TabDeckEditorVisual::createMenus ( )
overridevirtual

Setup menus for this visual deck editor.

Creates menus for deck editing and view options, including dock actions.

Implements AbstractTabDeckEditor.

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

◆ createSearchAndDatabaseFrame()

void TabDeckEditorVisual::createSearchAndDatabaseFrame ( )

Create search and database display frame.

◆ dockFloatingTriggered

void TabDeckEditorVisual::dockFloatingTriggered ( )
overrideprotectedslot

Triggered when a dock floating menu item is clicked.

Toggles dock floating state based on the corresponding menu action.

Here is the caller graph for this function:

◆ dockTopLevelChanged

void TabDeckEditorVisual::dockTopLevelChanged ( bool topLevel)
overrideprotectedslot

Triggered when a dock top-level state changes.

Updates menu checkboxes when a dock's top-level/floating state changes.

Parameters
topLevelTrue if the dock became floating.

◆ dockVisibleTriggered

void TabDeckEditorVisual::dockVisibleTriggered ( )
overrideprotectedslot

Triggered when a dock visibility menu item is clicked.

Toggles dock visibility based on the corresponding menu action.

Here is the caller graph for this function:

◆ eventFilter

bool TabDeckEditorVisual::eventFilter ( QObject * o,
QEvent * e )
overrideprotectedslot

Synchronize dock state with menu items.

Handles dock visibility, floating, and layout saving events.

Parameters
oThe object sending the event.
eThe event being filtered.
Returns
true if the event is handled, false otherwise.

Keeps dock state in sync with menu items and saves layout when hidden.

Here is the call graph for this function:

◆ freeDocksSize

void TabDeckEditorVisual::freeDocksSize ( )
overrideprotectedslot

Set size restrictions for free floating dock widgets.

Here is the caller graph for this function:

◆ getTabText()

QString TabDeckEditorVisual::getTabText ( ) const
nodiscardoverridevirtual

Get the display text for the tab.

Returns the tab text, prepending a mark if the deck has unsaved changes.

Returns
Tab text with optional modification indicator.

Implements AbstractTabDeckEditor.

◆ loadLayout

void TabDeckEditorVisual::loadLayout ( )
overrideprotectedslot

Load the editor layout from settings.

Loads the saved layout or resets to default if no layout exists.

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

◆ onDeckChanged

void TabDeckEditorVisual::onDeckChanged ( )
overrideslot

Refresh UI when the deck changes.

Updates the visual deck, analytics, and sample hand after a deck change.

Here is the call graph for this function:

◆ processCardClickDatabaseDisplay

void TabDeckEditorVisual::processCardClickDatabaseDisplay ( QMouseEvent * event,
CardInfoPictureWithTextOverlayWidget * instance )
slot

Handle card clicks in the database visual display.

Handles clicks on cards in the database display.

Parameters
eventMouse event triggering the action.
instanceWidget representing the clicked card.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ processMainboardCardClick

void TabDeckEditorVisual::processMainboardCardClick ( QMouseEvent * event,
CardInfoPictureWithTextOverlayWidget * instance,
const QString & zoneName )
slot

Handle card clicks in the mainboard visual deck.

Parameters
eventMouse event triggering the action.
instanceWidget representing the clicked card.
zoneNameDeck zone of the card.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ refreshShortcuts

void TabDeckEditorVisual::refreshShortcuts ( )
overrideprotectedslot

Refresh keyboard shortcuts for this tab.

Refreshes keyboard shortcuts for this tab from settings.

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

◆ restartLayout

void TabDeckEditorVisual::restartLayout ( )
overrideprotectedslot

Reset and restart the layout to default.

Resets the layout to default positions and dock states.

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

◆ retranslateUi()

void TabDeckEditorVisual::retranslateUi ( )
overridevirtual

Retranslate UI strings (for i18n support).

Retranslates UI elements for localization.

Implements AbstractTabDeckEditor.

Here is the caller graph for this function:

◆ showPrintingSelector

void TabDeckEditorVisual::showPrintingSelector ( )
overrideslot

Show the printing selector dock for the currently active card.

Shows the printing selector dock and updates it with the current card.

Member Data Documentation

◆ centralFrame

QVBoxLayout* TabDeckEditorVisual::centralFrame
protected

Layout for central widgets.

◆ centralWidget

QWidget* TabDeckEditorVisual::centralWidget
protected

Central widget of the editor.

◆ searchAndDatabaseDock

QDockWidget* TabDeckEditorVisual::searchAndDatabaseDock
protected

Dock widget for search/database display.

◆ searchAndDatabaseFrame

QVBoxLayout* TabDeckEditorVisual::searchAndDatabaseFrame
protected

Layout for search and database display.

◆ searchLayout

QHBoxLayout* TabDeckEditorVisual::searchLayout
protected

Layout for search bar.

◆ tabContainer

TabDeckEditorVisualTabWidget* TabDeckEditorVisual::tabContainer
protected

Tab container holding different visual widgets.


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