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

#include <tab_supervisor.h>

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

Public Types

enum  DeckEditorType { ClassicDeckEditor , VisualDeckEditor }

Public Slots

void openDeckInNewTab (const LoadedDeck &deckToOpen)
TabDeckEditoraddDeckEditorTab (const LoadedDeck &deckToOpen)
TabDeckEditorVisualaddVisualDeckEditorTab (const LoadedDeck &deckToOpen)
TabVisualDatabaseDisplayaddVisualDatabaseDisplayTab ()
TabEdhRecMainaddEdhrecMainTab ()
TabArchidektaddArchidektTab ()
TabEdhRecaddEdhrecTab (const CardInfoPtr &cardToQuery, bool isCommander=false)
void openReplay (GameReplay *replay)
void joinReportGame (int gameId, int roomId)
void openTabModeration (const QString &userName={})
void switchToFirstAvailableNetworkTab ()
void maximizeMainWindow ()
void actTabVisualDeckStorage (bool checked)
void actTabReplays (bool checked)
void openTabServer ()
void addRoomTab (const ServerInfo_Room &info, bool setCurrent)

Signals

void setMenu (const QList< QMenu * > &newMenuList=QList< QMenu * >())
void localGameEnded ()
void adminLockChanged (bool lock)
void showWindowIfHidden ()
void cockatriceLinkActivated (const QString &url)

Public Member Functions

 TabSupervisor (AbstractClient *_client, QMenu *tabsMenu, QWidget *parent=nullptr)
 ~TabSupervisor () override
void retranslateUi ()
void initStartupTabs ()
void start (const ServerInfo_User &userInfo)
void startLocal (const QList< AbstractClient * > &_clients)
void stop ()
bool getIsLocalGame () const
int getGameCount () const
TabAccountgetTabAccount () const
ServerInfo_UsergetUserInfo () const
AbstractClientgetClient () const
UserListManagergetUserListManager () const
TabServergetTabServer () const
const QMap< int, TabRoom * > & getRoomTabs () const
QList< AbstractTabDeckEditor * > getDeckEditorTabs () const
QList< GameInviteOptiongetGameInviteLinksForRoom (int roomId) const
void sendInviteToUser (const QString &userName, const QString &inviteText)
bool getAdminLocked () const
void closeEvent (QCloseEvent *event) override
bool switchToGameTabIfAlreadyExists (const int gameId)

Static Public Member Functions

static void actShowPopup (const QString &message)

Private Slots

void refreshShortcuts ()
void actTabHome (bool checked)
void actTabServer (bool checked)
void actTabAccount (bool checked)
void actTabDeckStorage (bool checked)
void actTabAdmin (bool checked)
void actTabLog (bool checked)
void actTabReport (bool checked)
void actTabModeration (bool checked)
void openTabVisualDeckStorage ()
void openTabHome ()
void openTabAccount ()
void openTabDeckStorage ()
void openTabReplays ()
void openTabAdmin ()
void actTabCardArtRules (bool checked)
void openTabCardArtRules ()
void openTabLog ()
void openTabReport ()
void updateCurrent (int index)
void updatePingTime (int value, int max)
void updateLatencyTooltip (const LatencyTracker::Stats &stats)
void gameJoined (const Event_GameJoined &event)
void localGameJoined (const Event_GameJoined &event)
void gameLeft (TabGame *tab)
void roomLeft (TabRoom *tab)
TabMessageaddMessageTab (const QString &userName, bool focus)
void replayLeft (TabGame *tab)
void processUserLeft (const QString &userName)
void processUserJoined (const ServerInfo_User &userInfo)
void talkLeft (TabMessage *tab)
void deckEditorClosed (AbstractTabDeckEditor *tab)
void tabUserEvent (bool globalEvent)
void updateTabText (Tab *tab, const QString &newTabText)
void processRoomEvent (const RoomEvent &event)
void processGameEventContainer (const GameEventContainer &cont)
void processUserMessageEvent (const Event_UserMessage &event)
void processNotifyUserEvent (const Event_NotifyUser &event)

Private Member Functions

int myAddTab (Tab *tab, QAction *manager=nullptr)
void addCloseButtonToTab (Tab *tab, int tabIndex, QAction *manager)
void resetTabsMenu ()

Static Private Member Functions

static QString sanitizeTabName (QString dirty)
static QString sanitizeHtml (QString dirty)

Private Attributes

ServerInfo_UseruserInfo
AbstractClientclient
UserListManageruserListManager
QList< AbstractClient * > localClients
QMenu * tabsMenu
TabHometabHome
TabDeckStorageVisualtabVisualDeckStorage
TabServertabServer
TabAccounttabAccount
TabDeckStoragetabDeckStorage
TabReplaystabReplays
TabAdmintabAdmin
TabCardArtRulestabCardArtRules
TabLogtabLog
TabReporttabReport
TabModerationtabModeration
QMap< int, TabRoom * > roomTabs
QMap< int, TabGame * > gameTabs
QList< TabGame * > replayTabs
QMap< QString, TabMessage * > messageTabs
QList< AbstractTabDeckEditor * > deckEditorTabs
bool isLocalGame
QAction * aTabHome
QAction * aTabDeckEditor
QAction * aTabVisualDeckEditor
QAction * aTabEdhRec
QAction * aTabArchidekt
QAction * aTabVisualDeckStorage
QAction * aTabVisualDatabaseDisplay
QAction * aTabServer
QAction * aTabAccount
QAction * aTabDeckStorage
QAction * aTabReplays
QAction * aTabAdmin
QAction * aTabCardArtRules
QAction * aTabLog
QAction * aTabReport
QAction * aTabModeration

Member Enumeration Documentation

◆ DeckEditorType

Enumerator
ClassicDeckEditor 
VisualDeckEditor 

Constructor & Destructor Documentation

◆ TabSupervisor()

TabSupervisor::TabSupervisor ( AbstractClient * _client,
QMenu * tabsMenu,
QWidget * parent = nullptr )
explicit
Here is the call graph for this function:

◆ ~TabSupervisor()

TabSupervisor::~TabSupervisor ( )
override

Member Function Documentation

◆ actShowPopup()

void TabSupervisor::actShowPopup ( const QString & message)
static
Here is the caller graph for this function:

◆ actTabAccount

void TabSupervisor::actTabAccount ( bool checked)
privateslot
Here is the call graph for this function:
Here is the caller graph for this function:

◆ actTabAdmin

void TabSupervisor::actTabAdmin ( bool checked)
privateslot
Here is the call graph for this function:
Here is the caller graph for this function:

◆ actTabCardArtRules

void TabSupervisor::actTabCardArtRules ( bool checked)
privateslot
Here is the call graph for this function:
Here is the caller graph for this function:

◆ actTabDeckStorage

void TabSupervisor::actTabDeckStorage ( bool checked)
privateslot
Here is the call graph for this function:
Here is the caller graph for this function:

◆ actTabHome

void TabSupervisor::actTabHome ( bool checked)
privateslot
Here is the call graph for this function:
Here is the caller graph for this function:

◆ actTabLog

void TabSupervisor::actTabLog ( bool checked)
privateslot
Here is the call graph for this function:
Here is the caller graph for this function:

◆ actTabModeration

void TabSupervisor::actTabModeration ( bool checked)
privateslot
Here is the call graph for this function:
Here is the caller graph for this function:

◆ actTabReplays

void TabSupervisor::actTabReplays ( bool checked)
slot
Here is the call graph for this function:
Here is the caller graph for this function:

◆ actTabReport

void TabSupervisor::actTabReport ( bool checked)
privateslot
Here is the call graph for this function:
Here is the caller graph for this function:

◆ actTabServer

void TabSupervisor::actTabServer ( bool checked)
privateslot
Here is the call graph for this function:
Here is the caller graph for this function:

◆ actTabVisualDeckStorage

void TabSupervisor::actTabVisualDeckStorage ( bool checked)
slot
Here is the call graph for this function:
Here is the caller graph for this function:

◆ addArchidektTab

TabArchidekt * TabSupervisor::addArchidektTab ( )
slot
Here is the call graph for this function:
Here is the caller graph for this function:

◆ addCloseButtonToTab()

void TabSupervisor::addCloseButtonToTab ( Tab * tab,
int tabIndex,
QAction * manager )
private

Adds a usable close button to the tab.

Parameters
tabThe Tab
tabIndexThe tab bar index of the tab
managerThe menu action that corresponds to this tab, if this is a single-instance managed tab. Pass in nullptr if this is not a managed tab.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ addDeckEditorTab

TabDeckEditor * TabSupervisor::addDeckEditorTab ( const LoadedDeck & deckToOpen)
slot

Creates a new deck editor tab

Parameters
deckToOpenThe deck to open in the tab.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ addEdhrecMainTab

TabEdhRecMain * TabSupervisor::addEdhrecMainTab ( )
slot
Here is the call graph for this function:
Here is the caller graph for this function:

◆ addEdhrecTab

TabEdhRec * TabSupervisor::addEdhrecTab ( const CardInfoPtr & cardToQuery,
bool isCommander = false )
slot
Here is the call graph for this function:
Here is the caller graph for this function:

◆ addMessageTab

TabMessage * TabSupervisor::addMessageTab ( const QString & userName,
bool focus )
privateslot
Here is the call graph for this function:
Here is the caller graph for this function:

◆ addRoomTab

void TabSupervisor::addRoomTab ( const ServerInfo_Room & info,
bool setCurrent )
slot
Here is the call graph for this function:
Here is the caller graph for this function:

◆ addVisualDatabaseDisplayTab

TabVisualDatabaseDisplay * TabSupervisor::addVisualDatabaseDisplayTab ( )
slot
Here is the call graph for this function:
Here is the caller graph for this function:

◆ addVisualDeckEditorTab

TabDeckEditorVisual * TabSupervisor::addVisualDeckEditorTab ( const LoadedDeck & deckToOpen)
slot
Here is the call graph for this function:
Here is the caller graph for this function:

◆ adminLockChanged

void TabSupervisor::adminLockChanged ( bool lock)
signal
Here is the caller graph for this function:

◆ closeEvent()

void TabSupervisor::closeEvent ( QCloseEvent * event)
override
Here is the call graph for this function:

◆ cockatriceLinkActivated

void TabSupervisor::cockatriceLinkActivated ( const QString & url)
signal
Here is the caller graph for this function:

◆ deckEditorClosed

void TabSupervisor::deckEditorClosed ( AbstractTabDeckEditor * tab)
privateslot
Here is the call graph for this function:
Here is the caller graph for this function:

◆ gameJoined

void TabSupervisor::gameJoined ( const Event_GameJoined & event)
privateslot
Here is the call graph for this function:
Here is the caller graph for this function:

◆ gameLeft

void TabSupervisor::gameLeft ( TabGame * tab)
privateslot
Here is the call graph for this function:
Here is the caller graph for this function:

◆ getAdminLocked()

bool TabSupervisor::getAdminLocked ( ) const
nodiscard

Determine if a user is a moderator/administrator By seeing if they have the admin tab open & unlocked

Returns
if the admin tab is open & unlocked

◆ getClient()

AbstractClient * TabSupervisor::getClient ( ) const
nodiscard

◆ getDeckEditorTabs()

QList< AbstractTabDeckEditor * > TabSupervisor::getDeckEditorTabs ( ) const
inlinenodiscard

◆ getGameCount()

int TabSupervisor::getGameCount ( ) const
inlinenodiscard
Here is the caller graph for this function:

◆ getGameInviteLinksForRoom()

QList< GameInviteOption > TabSupervisor::getGameInviteLinksForRoom ( int roomId) const
nodiscard
Here is the call graph for this function:

◆ getIsLocalGame()

bool TabSupervisor::getIsLocalGame ( ) const
inlinenodiscard

◆ getRoomTabs()

const QMap< int, TabRoom * > & TabSupervisor::getRoomTabs ( ) const
inlinenodiscard

◆ getTabAccount()

TabAccount * TabSupervisor::getTabAccount ( ) const
inlinenodiscard
Here is the caller graph for this function:

◆ getTabServer()

TabServer * TabSupervisor::getTabServer ( ) const
inlinenodiscard

◆ getUserInfo()

ServerInfo_User * TabSupervisor::getUserInfo ( ) const
inlinenodiscard

◆ getUserListManager()

UserListManager * TabSupervisor::getUserListManager ( ) const
inlinenodiscard

◆ initStartupTabs()

void TabSupervisor::initStartupTabs ( )

Opens the always-available tabs, depending on settings, and lands on the configured startup tab.

The startup destination is a request: tabs that were not open before (deck editors, storage tabs disabled in the Tabs menu) are opened as part of the startup flow. Destinations that require a server connection (Server, Server Room) are handled asynchronously by MainWindow through the intent system, since this class has no RemoteClient.

Here is the call graph for this function:

◆ joinReportGame

void TabSupervisor::joinReportGame ( int gameId,
int roomId )
slot
Here is the call graph for this function:
Here is the caller graph for this function:

◆ localGameEnded

void TabSupervisor::localGameEnded ( )
signal
Here is the caller graph for this function:

◆ localGameJoined

void TabSupervisor::localGameJoined ( const Event_GameJoined & event)
privateslot
Here is the call graph for this function:
Here is the caller graph for this function:

◆ maximizeMainWindow

void TabSupervisor::maximizeMainWindow ( )
slot
Here is the call graph for this function:
Here is the caller graph for this function:

◆ myAddTab()

int TabSupervisor::myAddTab ( Tab * tab,
QAction * manager = nullptr )
private

Adds the tab to the TabSupervisor's tab bar.

Parameters
tabThe Tab to add
managerThe menu action that corresponds to this tab, if this is a single-instance managed tab. Pass in nullptr if this is not a managed tab.
Returns
The index of the added tab in the tab widget's tab menu
Here is the call graph for this function:
Here is the caller graph for this function:

◆ openDeckInNewTab

void TabSupervisor::openDeckInNewTab ( const LoadedDeck & deckToOpen)
slot

Creates a new deck editor tab and loads the deck into it. Creates either a classic or visual deck editor tab depending on settings

Parameters
deckToOpenThe deck to open in the tab.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ openReplay

void TabSupervisor::openReplay ( GameReplay * replay)
slot
Here is the call graph for this function:
Here is the caller graph for this function:

◆ openTabAccount

void TabSupervisor::openTabAccount ( )
privateslot
Here is the call graph for this function:
Here is the caller graph for this function:

◆ openTabAdmin

void TabSupervisor::openTabAdmin ( )
privateslot
Here is the call graph for this function:
Here is the caller graph for this function:

◆ openTabCardArtRules

void TabSupervisor::openTabCardArtRules ( )
privateslot
Here is the call graph for this function:
Here is the caller graph for this function:

◆ openTabDeckStorage

void TabSupervisor::openTabDeckStorage ( )
privateslot
Here is the call graph for this function:
Here is the caller graph for this function:

◆ openTabHome

void TabSupervisor::openTabHome ( )
privateslot
Here is the call graph for this function:
Here is the caller graph for this function:

◆ openTabLog

void TabSupervisor::openTabLog ( )
privateslot
Here is the call graph for this function:
Here is the caller graph for this function:

◆ openTabModeration

void TabSupervisor::openTabModeration ( const QString & userName = {})
slot
Here is the call graph for this function:
Here is the caller graph for this function:

◆ openTabReplays

void TabSupervisor::openTabReplays ( )
privateslot
Here is the call graph for this function:
Here is the caller graph for this function:

◆ openTabReport

void TabSupervisor::openTabReport ( )
privateslot
Here is the call graph for this function:
Here is the caller graph for this function:

◆ openTabServer

void TabSupervisor::openTabServer ( )
slot
Here is the call graph for this function:
Here is the caller graph for this function:

◆ openTabVisualDeckStorage

void TabSupervisor::openTabVisualDeckStorage ( )
privateslot
Here is the call graph for this function:
Here is the caller graph for this function:

◆ processGameEventContainer

void TabSupervisor::processGameEventContainer ( const GameEventContainer & cont)
privateslot
Here is the call graph for this function:
Here is the caller graph for this function:

◆ processNotifyUserEvent

void TabSupervisor::processNotifyUserEvent ( const Event_NotifyUser & event)
privateslot
Here is the call graph for this function:
Here is the caller graph for this function:

◆ processRoomEvent

void TabSupervisor::processRoomEvent ( const RoomEvent & event)
privateslot
Here is the call graph for this function:
Here is the caller graph for this function:

◆ processUserJoined

void TabSupervisor::processUserJoined ( const ServerInfo_User & userInfo)
privateslot
Here is the call graph for this function:
Here is the caller graph for this function:

◆ processUserLeft

void TabSupervisor::processUserLeft ( const QString & userName)
privateslot
Here is the call graph for this function:
Here is the caller graph for this function:

◆ processUserMessageEvent

void TabSupervisor::processUserMessageEvent ( const Event_UserMessage & event)
privateslot
Here is the call graph for this function:
Here is the caller graph for this function:

◆ refreshShortcuts

void TabSupervisor::refreshShortcuts ( )
privateslot
Here is the call graph for this function:
Here is the caller graph for this function:

◆ replayLeft

void TabSupervisor::replayLeft ( TabGame * tab)
privateslot
Here is the call graph for this function:
Here is the caller graph for this function:

◆ resetTabsMenu()

void TabSupervisor::resetTabsMenu ( )
private

Resets the tabs menu to the tabs that are always available

Here is the caller graph for this function:

◆ retranslateUi()

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

◆ roomLeft

void TabSupervisor::roomLeft ( TabRoom * tab)
privateslot
Here is the call graph for this function:
Here is the caller graph for this function:

◆ sanitizeHtml()

QString TabSupervisor::sanitizeHtml ( QString dirty)
staticprivate
Here is the caller graph for this function:

◆ sanitizeTabName()

QString TabSupervisor::sanitizeTabName ( QString dirty)
staticprivate
Here is the caller graph for this function:

◆ sendInviteToUser()

void TabSupervisor::sendInviteToUser ( const QString & userName,
const QString & inviteText )
Here is the call graph for this function:

◆ setMenu

void TabSupervisor::setMenu ( const QList< QMenu * > & newMenuList = QList< QMenu * >())
signal
Here is the caller graph for this function:

◆ showWindowIfHidden

void TabSupervisor::showWindowIfHidden ( )
signal
Here is the caller graph for this function:

◆ start()

void TabSupervisor::start ( const ServerInfo_User & userInfo)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ startLocal()

void TabSupervisor::startLocal ( const QList< AbstractClient * > & _clients)
Here is the call graph for this function:

◆ stop()

void TabSupervisor::stop ( )

Call this when Cockatrice disconnects from the server in order to clean up.

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

◆ switchToFirstAvailableNetworkTab

void TabSupervisor::switchToFirstAvailableNetworkTab ( )
slot
Here is the call graph for this function:
Here is the caller graph for this function:

◆ switchToGameTabIfAlreadyExists()

bool TabSupervisor::switchToGameTabIfAlreadyExists ( const int gameId)

◆ tabUserEvent

void TabSupervisor::tabUserEvent ( bool globalEvent)
privateslot
Here is the call graph for this function:
Here is the caller graph for this function:

◆ talkLeft

void TabSupervisor::talkLeft ( TabMessage * tab)
privateslot
Here is the call graph for this function:
Here is the caller graph for this function:

◆ updateCurrent

void TabSupervisor::updateCurrent ( int index)
privateslot
Here is the call graph for this function:
Here is the caller graph for this function:

◆ updateLatencyTooltip

void TabSupervisor::updateLatencyTooltip ( const LatencyTracker::Stats & stats)
privateslot
Here is the caller graph for this function:

◆ updatePingTime

void TabSupervisor::updatePingTime ( int value,
int max )
privateslot
Here is the call graph for this function:
Here is the caller graph for this function:

◆ updateTabText

void TabSupervisor::updateTabText ( Tab * tab,
const QString & newTabText )
privateslot
Here is the call graph for this function:
Here is the caller graph for this function:

Member Data Documentation

◆ aTabAccount

QAction * TabSupervisor::aTabAccount
private

◆ aTabAdmin

QAction * TabSupervisor::aTabAdmin
private

◆ aTabArchidekt

QAction * TabSupervisor::aTabArchidekt
private

◆ aTabCardArtRules

QAction * TabSupervisor::aTabCardArtRules
private

◆ aTabDeckEditor

QAction * TabSupervisor::aTabDeckEditor
private

◆ aTabDeckStorage

QAction * TabSupervisor::aTabDeckStorage
private

◆ aTabEdhRec

QAction * TabSupervisor::aTabEdhRec
private

◆ aTabHome

QAction* TabSupervisor::aTabHome
private

◆ aTabLog

QAction * TabSupervisor::aTabLog
private

◆ aTabModeration

QAction * TabSupervisor::aTabModeration
private

◆ aTabReplays

QAction * TabSupervisor::aTabReplays
private

◆ aTabReport

QAction * TabSupervisor::aTabReport
private

◆ aTabServer

QAction * TabSupervisor::aTabServer
private

◆ aTabVisualDatabaseDisplay

QAction * TabSupervisor::aTabVisualDatabaseDisplay
private

◆ aTabVisualDeckEditor

QAction * TabSupervisor::aTabVisualDeckEditor
private

◆ aTabVisualDeckStorage

QAction * TabSupervisor::aTabVisualDeckStorage
private

◆ client

AbstractClient* TabSupervisor::client
private

◆ deckEditorTabs

QList<AbstractTabDeckEditor *> TabSupervisor::deckEditorTabs
private

◆ gameTabs

QMap<int, TabGame *> TabSupervisor::gameTabs
private

◆ isLocalGame

bool TabSupervisor::isLocalGame
private

◆ localClients

QList<AbstractClient *> TabSupervisor::localClients
private

◆ messageTabs

QMap<QString, TabMessage *> TabSupervisor::messageTabs
private

◆ replayTabs

QList<TabGame *> TabSupervisor::replayTabs
private

◆ roomTabs

QMap<int, TabRoom *> TabSupervisor::roomTabs
private

◆ tabAccount

TabAccount* TabSupervisor::tabAccount
private

◆ tabAdmin

TabAdmin* TabSupervisor::tabAdmin
private

◆ tabCardArtRules

TabCardArtRules* TabSupervisor::tabCardArtRules
private

◆ tabDeckStorage

TabDeckStorage* TabSupervisor::tabDeckStorage
private

◆ tabHome

TabHome* TabSupervisor::tabHome
private

◆ tabLog

TabLog* TabSupervisor::tabLog
private

◆ tabModeration

TabModeration* TabSupervisor::tabModeration
private

◆ tabReplays

TabReplays* TabSupervisor::tabReplays
private

◆ tabReport

TabReport* TabSupervisor::tabReport
private

◆ tabServer

TabServer* TabSupervisor::tabServer
private

◆ tabsMenu

QMenu* TabSupervisor::tabsMenu
private

◆ tabVisualDeckStorage

TabDeckStorageVisual* TabSupervisor::tabVisualDeckStorage
private

◆ userInfo

ServerInfo_User* TabSupervisor::userInfo
private

◆ userListManager

UserListManager* TabSupervisor::userListManager
private

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