Cockatrice 2026-10-19-Development-3.1.2-beta.2
A virtual tabletop for multiplayer card games
Loading...
Searching...
No Matches
DeckPreviewWidget Class Referencefinal

#include <deck_preview_widget.h>

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

Public Slots

void syncFromModel ()
 Re-reads the row's data from the model and syncs every child widget. Connected to the model's dataChanged signal.
void reloadIfModified ()
 Reloads the deck file if its modification time is newer than the stored one.
void refreshBannerCardToolTip ()
void updateColorIdentityVisibility (bool visible)
void updateBannerCardComboBoxVisibility (bool visible)
void updateTagsVisibility (bool visible)
void setBannerCard (int)
void setTags (const QStringList &tags)

Signals

void deckLoadRequested (const QString &filePath)
void openDeckEditor (const LoadedDeck &deck)
void shareDeckRequested (const QString &filePath)
void shareSelectionToggled (bool selected)

Public Member Functions

 DeckPreviewWidget (QWidget *parent, VisualDeckStorageWidget *_visualDeckStorageWidget, VisualDeckStorageModel *_model, const QString &_filePath)
void retranslateUi ()
void setShareSelectable (bool selectable)
void setShareSelected (bool selected)
bool isShareSelected () const
bool isShareSelectable () const

Public Attributes

DeckPreviewCardPictureWidget * bannerCardDisplayWidget
 The banner card picture; the parent widget wires its size to the card size setting.
QString filePath
 The path of the deck file backing this preview.

Protected Member Functions

void enterEvent (QEnterEvent *event) override
void resizeEvent (QResizeEvent *event) override
bool eventFilter (QObject *watched, QEvent *event) override

Private Member Functions

int row () const
 The row of this deck in the source model, or -1 if it no longer exists.
QString getDisplayName () const
 The display name is given by the deck name, or the filename if the deck name is not set.
void refreshBannerCardText ()
void updateBannerCardComboBox (const QString &currentText)
bool promptFileConversionIfRequired ()
QMenu * createRightClickMenu ()
void addSetBannerCardMenu (QMenu *menu)
void imageClickedEvent (QMouseEvent *event, DeckPreviewCardPictureWidget *instance)
void imageSingleClicked ()
void imageDoubleClickedEvent (QMouseEvent *event, DeckPreviewCardPictureWidget *instance)
void actRenameDeck ()
void actRenameFile ()
void actDeleteFile ()
void updateSelectionStyle ()
void updateSelectionFrameGeometry ()

Private Attributes

VisualDeckStorageWidget * visualDeckStorageWidget
VisualDeckStorageModel * model
QVBoxLayout * layout
ColorIdentityWidget * colorIdentityWidget
DeckPreviewDeckTagsDisplayWidget * deckTagsDisplayWidget
QLabel * bannerCardLabel
QComboBox * bannerCardComboBox
QList< QWidget * > fixedWidthChildren
 Children clamped to the picture width on resize.
int lastKnownBannerWidth = -1
 The picture width last applied to the children.
QFrame * selectionFrame = nullptr
bool shareSelectable = false
bool shareSelected = false

Constructor & Destructor Documentation

◆ DeckPreviewWidget()

DeckPreviewWidget::DeckPreviewWidget ( QWidget * parent,
VisualDeckStorageWidget * _visualDeckStorageWidget,
VisualDeckStorageModel * _model,
const QString & _filePath )
explicit
Here is the call graph for this function:
Here is the caller graph for this function:

Member Function Documentation

◆ actDeleteFile()

void DeckPreviewWidget::actDeleteFile ( )
private
Here is the call graph for this function:
Here is the caller graph for this function:

◆ actRenameDeck()

void DeckPreviewWidget::actRenameDeck ( )
private
Here is the call graph for this function:
Here is the caller graph for this function:

◆ actRenameFile()

void DeckPreviewWidget::actRenameFile ( )
private
Here is the call graph for this function:
Here is the caller graph for this function:

◆ addSetBannerCardMenu()

void DeckPreviewWidget::addSetBannerCardMenu ( QMenu * menu)
private

Adds the "Set Banner Card" submenu to the given menu. Does nothing if bannerCardComboBox is null.

Parameters
menuThe menu to add the submenu to
Here is the caller graph for this function:

◆ createRightClickMenu()

QMenu * DeckPreviewWidget::createRightClickMenu ( )
private
Here is the call graph for this function:
Here is the caller graph for this function:

◆ deckLoadRequested

void DeckPreviewWidget::deckLoadRequested ( const QString & filePath)
signal
Here is the caller graph for this function:

◆ enterEvent()

void DeckPreviewWidget::enterEvent ( QEnterEvent * event)
overrideprotected
Here is the call graph for this function:
Here is the caller graph for this function:

◆ eventFilter()

bool DeckPreviewWidget::eventFilter ( QObject * watched,
QEvent * event )
overrideprotected
Here is the call graph for this function:
Here is the caller graph for this function:

◆ getDisplayName()

QString DeckPreviewWidget::getDisplayName ( ) const
nodiscardprivate

The display name is given by the deck name, or the filename if the deck name is not set.

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

◆ imageClickedEvent()

void DeckPreviewWidget::imageClickedEvent ( QMouseEvent * event,
DeckPreviewCardPictureWidget * instance )
private
Here is the call graph for this function:
Here is the caller graph for this function:

◆ imageDoubleClickedEvent()

void DeckPreviewWidget::imageDoubleClickedEvent ( QMouseEvent * event,
DeckPreviewCardPictureWidget * instance )
private
Here is the call graph for this function:
Here is the caller graph for this function:

◆ imageSingleClicked()

void DeckPreviewWidget::imageSingleClicked ( )
private
Here is the call graph for this function:
Here is the caller graph for this function:

◆ isShareSelectable()

bool DeckPreviewWidget::isShareSelectable ( ) const
nodiscard
Here is the caller graph for this function:

◆ isShareSelected()

bool DeckPreviewWidget::isShareSelected ( ) const
nodiscard
Here is the caller graph for this function:

◆ openDeckEditor

void DeckPreviewWidget::openDeckEditor ( const LoadedDeck & deck)
signal
Here is the caller graph for this function:

◆ promptFileConversionIfRequired()

bool DeckPreviewWidget::promptFileConversionIfRequired ( )
private

Checks if the deck's file format supports tags. If not, then prompt the user for file conversion.

Returns
whether the resulting file can support adding tags
Here is the call graph for this function:
Here is the caller graph for this function:

◆ refreshBannerCardText()

void DeckPreviewWidget::refreshBannerCardText ( )
private

Refreshes the banner card text. This also calls refreshBannerCardToolTip, since those two often need to be updated together.

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

◆ refreshBannerCardToolTip

void DeckPreviewWidget::refreshBannerCardToolTip ( )
slot
Here is the call graph for this function:
Here is the caller graph for this function:

◆ reloadIfModified

void DeckPreviewWidget::reloadIfModified ( )
slot

Reloads the deck file if its modification time is newer than the stored one.

Reloads the deck if the file's last modified time has increased since we last checked.

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

◆ resizeEvent()

void DeckPreviewWidget::resizeEvent ( QResizeEvent * event)
overrideprotected
Here is the call graph for this function:
Here is the caller graph for this function:

◆ retranslateUi()

void DeckPreviewWidget::retranslateUi ( )
Here is the caller graph for this function:

◆ row()

int DeckPreviewWidget::row ( ) const
nodiscardprivate

The row of this deck in the source model, or -1 if it no longer exists.

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

◆ setBannerCard

void DeckPreviewWidget::setBannerCard ( int )
slot
Here is the call graph for this function:
Here is the caller graph for this function:

◆ setShareSelectable()

void DeckPreviewWidget::setShareSelectable ( bool selectable)
Here is the call graph for this function:

◆ setShareSelected()

void DeckPreviewWidget::setShareSelected ( bool selected)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ setTags

void DeckPreviewWidget::setTags ( const QStringList & tags)
slot
Here is the call graph for this function:
Here is the caller graph for this function:

◆ shareDeckRequested

void DeckPreviewWidget::shareDeckRequested ( const QString & filePath)
signal
Here is the caller graph for this function:

◆ shareSelectionToggled

void DeckPreviewWidget::shareSelectionToggled ( bool selected)
signal
Here is the call graph for this function:
Here is the caller graph for this function:

◆ syncFromModel

void DeckPreviewWidget::syncFromModel ( )
slot

Re-reads the row's data from the model and syncs every child widget. Connected to the model's dataChanged signal.

Syncs the contents of the child widgets with the current row's data.

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

◆ updateBannerCardComboBox()

void DeckPreviewWidget::updateBannerCardComboBox ( const QString & currentText)
private
Here is the call graph for this function:
Here is the caller graph for this function:

◆ updateBannerCardComboBoxVisibility

void DeckPreviewWidget::updateBannerCardComboBoxVisibility ( bool visible)
slot
Here is the caller graph for this function:

◆ updateColorIdentityVisibility

void DeckPreviewWidget::updateColorIdentityVisibility ( bool visible)
slot
Here is the caller graph for this function:

◆ updateSelectionFrameGeometry()

void DeckPreviewWidget::updateSelectionFrameGeometry ( )
private
Here is the caller graph for this function:

◆ updateSelectionStyle()

void DeckPreviewWidget::updateSelectionStyle ( )
private
Here is the call graph for this function:
Here is the caller graph for this function:

◆ updateTagsVisibility

void DeckPreviewWidget::updateTagsVisibility ( bool visible)
slot
Here is the caller graph for this function:

Member Data Documentation

◆ bannerCardComboBox

QComboBox* DeckPreviewWidget::bannerCardComboBox
private

◆ bannerCardDisplayWidget

DeckPreviewCardPictureWidget* DeckPreviewWidget::bannerCardDisplayWidget

The banner card picture; the parent widget wires its size to the card size setting.

◆ bannerCardLabel

QLabel* DeckPreviewWidget::bannerCardLabel
private

◆ colorIdentityWidget

ColorIdentityWidget* DeckPreviewWidget::colorIdentityWidget
private

◆ deckTagsDisplayWidget

DeckPreviewDeckTagsDisplayWidget* DeckPreviewWidget::deckTagsDisplayWidget
private

◆ filePath

QString DeckPreviewWidget::filePath

The path of the deck file backing this preview.

◆ fixedWidthChildren

QList<QWidget *> DeckPreviewWidget::fixedWidthChildren
private

Children clamped to the picture width on resize.

◆ lastKnownBannerWidth

int DeckPreviewWidget::lastKnownBannerWidth = -1
private

The picture width last applied to the children.

◆ layout

QVBoxLayout* DeckPreviewWidget::layout
private

◆ model

VisualDeckStorageModel* DeckPreviewWidget::model
private

◆ selectionFrame

QFrame* DeckPreviewWidget::selectionFrame = nullptr
private

◆ shareSelectable

bool DeckPreviewWidget::shareSelectable = false
private

◆ shareSelected

bool DeckPreviewWidget::shareSelected = false
private

◆ visualDeckStorageWidget

VisualDeckStorageWidget* DeckPreviewWidget::visualDeckStorageWidget
private

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