Cockatrice 2026-09-01-Development-3.1.0-beta.10
A virtual tabletop for multiplayer card games
Loading...
Searching...
No Matches
VisualDeckStorageFolderDisplayWidget Class Reference

#include <visual_deck_storage_folder_display_widget.h>

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

Public Slots

void reconcile ()
 Starts a new chunked reconcile pass that re-reads the proxy and rebuilds the deck previews and subfolder widgets to match.
void scheduleReconcile ()
 Coalesces proxy change signals (a burst of deck loads or filter invalidations) into a single reconcile on the next event loop turn.
void updateShowFolders (bool enabled)

Signals

void contentVisibilityChanged ()
 Emitted whenever this folder's visible content changes, so parent folders can re-evaluate their own visibility.

Public Member Functions

 VisualDeckStorageFolderDisplayWidget (QWidget *parent, VisualDeckStorageWidget *visualDeckStorageWidget, const QString &folderPath, bool canBeHidden, bool showFolders)

Private Member Functions

void beginDeckPass ()
void continueDeckPass ()
void finishDeckPass ()
DeckPreviewWidgetcreateDeckPreviewWidget (const QString &filePath)
 Creates a deck preview widget and wires it up to the storage widget.
void createSubFolderWidgets ()
 Creates, removes and keeps in sync the subfolder widgets of this folder.
void refreshVisibility ()
 Hides the folder when it contains nothing visible, and reports the change upward.
bool hasContent () const
 Whether this folder shows any deck previews or has any visible subfolder.
QStringList childFolderPaths () const
 The direct child folder paths of this folder, sorted by name.

Private Attributes

bool showFolders
QString folderPath
 Path relative to the deck folder, empty for the root folder.
int visibleDeckCount = 0
 The number of this folder's deck previews not filtered out.
QVBoxLayout * layout
QWidget * container
QVBoxLayout * containerLayout
FlowWidgetflowWidget
BannerWidgetheader
VisualDeckStorageWidgetvisualDeckStorageWidget
QHash< QString, DeckPreviewWidget * > deckWidgets
 Deck file path -> preview widget.
QHash< QString, VisualDeckStorageFolderDisplayWidget * > subFolderWidgets
 Folder path -> subfolder widget.
QTimer * reconcileTimer = nullptr
 Coalesces proxy change bursts.
QStringList lastOrderedFilePaths
 The deck order last applied to the flow layout.
bool deckPassActive = false
 Whether a chunked reconcile pass is currently running.
bool deckPassRestartRequested = false
bool initialPassCompleted = false
 Whether the first reconcile pass has run to completion at least once.
int deckPassRow = 0
 Next proxy row to scan in the active pass.
QSet< QString > deckPassPresentPaths
 File paths seen so far in the active pass.

Static Private Attributes

static constexpr int DECK_PASS_TIME_BUDGET_MS = 20
 The maximum time in milliseconds spent creating deck previews per event loop turn.

Constructor & Destructor Documentation

◆ VisualDeckStorageFolderDisplayWidget()

VisualDeckStorageFolderDisplayWidget::VisualDeckStorageFolderDisplayWidget ( QWidget * parent,
VisualDeckStorageWidget * visualDeckStorageWidget,
const QString & folderPath,
bool canBeHidden,
bool showFolders )
Here is the call graph for this function:
Here is the caller graph for this function:

Member Function Documentation

◆ beginDeckPass()

void VisualDeckStorageFolderDisplayWidget::beginDeckPass ( )
private
Here is the call graph for this function:
Here is the caller graph for this function:

◆ childFolderPaths()

QStringList VisualDeckStorageFolderDisplayWidget::childFolderPaths ( ) const
nodiscardprivate

The direct child folder paths of this folder, sorted by name.

Here is the caller graph for this function:

◆ contentVisibilityChanged

void VisualDeckStorageFolderDisplayWidget::contentVisibilityChanged ( )
signal

Emitted whenever this folder's visible content changes, so parent folders can re-evaluate their own visibility.

Here is the caller graph for this function:

◆ continueDeckPass()

void VisualDeckStorageFolderDisplayWidget::continueDeckPass ( )
private
Here is the call graph for this function:
Here is the caller graph for this function:

◆ createDeckPreviewWidget()

DeckPreviewWidget * VisualDeckStorageFolderDisplayWidget::createDeckPreviewWidget ( const QString & filePath)
nodiscardprivate

Creates a deck preview widget and wires it up to the storage widget.

Parameters
filePathThe absolute path of the deck file to preview.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ createSubFolderWidgets()

void VisualDeckStorageFolderDisplayWidget::createSubFolderWidgets ( )
private

Creates, removes and keeps in sync the subfolder widgets of this folder.

Only direct child folders are created here; each child manages its own children, mirroring the folder tree on disk.

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

◆ finishDeckPass()

void VisualDeckStorageFolderDisplayWidget::finishDeckPass ( )
private
Here is the call graph for this function:
Here is the caller graph for this function:

◆ hasContent()

bool VisualDeckStorageFolderDisplayWidget::hasContent ( ) const
nodiscardprivate

Whether this folder shows any deck previews or has any visible subfolder.

While the first pass is still building, the folder counts as having content so it doesn't flicker or hide prematurely before its previews have been created.

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

◆ reconcile

void VisualDeckStorageFolderDisplayWidget::reconcile ( )
slot

Starts a new chunked reconcile pass that re-reads the proxy and rebuilds the deck previews and subfolder widgets to match.

Starts a new chunked scan of the source model, yielding to the event loop between chunks.

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

◆ refreshVisibility()

void VisualDeckStorageFolderDisplayWidget::refreshVisibility ( )
private

Hides the folder when it contains nothing visible, and reports the change upward.

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

◆ scheduleReconcile

void VisualDeckStorageFolderDisplayWidget::scheduleReconcile ( )
slot

Coalesces proxy change signals (a burst of deck loads or filter invalidations) into a single reconcile on the next event loop turn.

Here is the caller graph for this function:

◆ updateShowFolders

void VisualDeckStorageFolderDisplayWidget::updateShowFolders ( bool enabled)
slot
Here is the call graph for this function:

Member Data Documentation

◆ container

QWidget* VisualDeckStorageFolderDisplayWidget::container
private

◆ containerLayout

QVBoxLayout* VisualDeckStorageFolderDisplayWidget::containerLayout
private

◆ DECK_PASS_TIME_BUDGET_MS

int VisualDeckStorageFolderDisplayWidget::DECK_PASS_TIME_BUDGET_MS = 20
staticconstexprprivate

The maximum time in milliseconds spent creating deck previews per event loop turn.

Creating all previews of a large folder at once blocks the ui thread for hundreds of milliseconds, so the pass is split into chunks that yield to the event loop instead.

◆ deckPassActive

bool VisualDeckStorageFolderDisplayWidget::deckPassActive = false
private

Whether a chunked reconcile pass is currently running.

◆ deckPassPresentPaths

QSet<QString> VisualDeckStorageFolderDisplayWidget::deckPassPresentPaths
private

File paths seen so far in the active pass.

◆ deckPassRestartRequested

bool VisualDeckStorageFolderDisplayWidget::deckPassRestartRequested = false
private

Set when the model changes mid-pass. Discards progress and restarts the scan once the current chunk finishes so the pass always converges on the latest model state.

◆ deckPassRow

int VisualDeckStorageFolderDisplayWidget::deckPassRow = 0
private

Next proxy row to scan in the active pass.

◆ deckWidgets

QHash<QString, DeckPreviewWidget *> VisualDeckStorageFolderDisplayWidget::deckWidgets
private

Deck file path -> preview widget.

◆ flowWidget

FlowWidget* VisualDeckStorageFolderDisplayWidget::flowWidget
private

◆ folderPath

QString VisualDeckStorageFolderDisplayWidget::folderPath
private

Path relative to the deck folder, empty for the root folder.

◆ header

BannerWidget* VisualDeckStorageFolderDisplayWidget::header
private

◆ initialPassCompleted

bool VisualDeckStorageFolderDisplayWidget::initialPassCompleted = false
private

Whether the first reconcile pass has run to completion at least once.

◆ lastOrderedFilePaths

QStringList VisualDeckStorageFolderDisplayWidget::lastOrderedFilePaths
private

The deck order last applied to the flow layout.

◆ layout

QVBoxLayout* VisualDeckStorageFolderDisplayWidget::layout
private

◆ reconcileTimer

QTimer* VisualDeckStorageFolderDisplayWidget::reconcileTimer = nullptr
private

Coalesces proxy change bursts.

◆ showFolders

bool VisualDeckStorageFolderDisplayWidget::showFolders
private

◆ subFolderWidgets

QHash<QString, VisualDeckStorageFolderDisplayWidget *> VisualDeckStorageFolderDisplayWidget::subFolderWidgets
private

Folder path -> subfolder widget.

◆ visibleDeckCount

int VisualDeckStorageFolderDisplayWidget::visibleDeckCount = 0
private

The number of this folder's deck previews not filtered out.

◆ visualDeckStorageWidget

VisualDeckStorageWidget* VisualDeckStorageFolderDisplayWidget::visualDeckStorageWidget
private

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