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

Settings pages with grouped left navigation and search, without any dialog chrome. More...

#include <settings_view.h>

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

Public Types

enum  SettingsPage {
  GeneralPage = 0 , AppearancePage , UserInterfacePage , DeckEditorPage ,
  StoragePage , MessagesPage , SoundPage , ShortcutsPage ,
  NumPages
}
 Page order in the navigation, matching the order pages are added in setupUi(). More...

Public Member Functions

 SettingsView (QWidget *parent=nullptr)
void setTab (int index)
AbstractSettingsPage * page (SettingsPage which) const

Protected Member Functions

bool eventFilter (QObject *watched, QEvent *event) override

Private Slots

void onTabClicked (int index)
void onSearchTextChanged (const QString &text)
void onSearchResultClicked (const QModelIndex &index)

Private Member Functions

void setupUi ()
void setupNavTree ()
void buildSearchIndex ()
void switchToTabMode ()
void switchToSearchMode ()
void navigateToSearchResult (const QModelIndex &index)
void navigateToSection (int pageIndex, QWidget *sectionWidget)
void setActiveTab (int index)
void switchPageContent (int index)
void applySectionFilter (int pageIndex, QWidget *sectionWidget)
 Shows only the given section of a page, hiding its siblings.
void selectSectionRow (int pageIndex, QWidget *sectionWidget)
 Selects the nav row for a section, expanding its page row.
QTreeWidgetItem * findSectionItem (int pageIndex, QWidget *sectionWidget) const
 Finds the nav row for a section widget.
void retranslateUi ()
void retranslateNavNames ()

Static Private Member Functions

static void flashWidget (QWidget *widget)
static void scrollToAndFlash (QWidget *target)
static QStringList translatedPageNames ()
static QStringList translatedGroupNames ()

Private Attributes

QLineEdit * searchEdit
 Search bar for filtering settings.
QTreeWidget * navTree
 Grouped navigation tree for the pages.
QList< QTreeWidgetItem * > groupItems
 Group header rows, indexed by group.
QList< QTreeWidgetItem * > pageItems
 Page rows, indexed by SettingsPage.
QStackedWidget * pagesWidget
 Stacked widget containing settings pages.
QListView * searchResultsView
 Search results list view.
QWidget * pagesContainer
 Container stacking pages and search results.
QList< AbstractSettingsPage * > pages
 All settings page instances.
SettingsSearchModel * searchModel
 Model for search results.
SettingsSearchDelegate * searchDelegate
 Delegate for search result rendering.
int currentTabIndex
 Currently active tab index.
bool searchActive
 Whether search mode is active.
QWidget * isolatedSection = nullptr
 Isolated section group box, or nullptr for full pages.
bool pressWasOnCurrentItem = false
 True when the mouse press started on the already-current item.

Detailed Description

Settings pages with grouped left navigation and search, without any dialog chrome.

Owns the search bar, the navigation tree, the stacked settings pages and the search results view. The settings dialog only adds its own frame (buttons, titles).

Member Enumeration Documentation

◆ SettingsPage

Page order in the navigation, matching the order pages are added in setupUi().

Use these values instead of raw indices so reordering pages never silently breaks external callers like tab_room.cpp.

Enumerator
GeneralPage 
AppearancePage 
UserInterfacePage 
DeckEditorPage 
StoragePage 
MessagesPage 
SoundPage 
ShortcutsPage 
NumPages 

Constructor & Destructor Documentation

◆ SettingsView()

SettingsView::SettingsView ( QWidget * parent = nullptr)
explicit
Here is the call graph for this function:
Here is the caller graph for this function:

Member Function Documentation

◆ applySectionFilter()

void SettingsView::applySectionFilter ( int pageIndex,
QWidget * sectionWidget )
private

Shows only the given section of a page, hiding its siblings.

A null sectionWidget restores the full page. Unknown widgets fall back to the full page so a stale reference can never leave a blank page.

Parameters
pageIndexSettingsPage to filter
sectionWidgetSection's group box, or nullptr to show all sections
Here is the caller graph for this function:

◆ buildSearchIndex()

void SettingsView::buildSearchIndex ( )
private
Here is the call graph for this function:
Here is the caller graph for this function:

◆ eventFilter()

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

◆ findSectionItem()

QTreeWidgetItem * SettingsView::findSectionItem ( int pageIndex,
QWidget * sectionWidget ) const
private

Finds the nav row for a section widget.

Parameters
pageIndexSettingsPage owning the section
sectionWidgetSection's group box
Returns
The section's tree item, or nullptr when it has no row
Here is the caller graph for this function:

◆ flashWidget()

void SettingsView::flashWidget ( QWidget * widget)
staticprivate
Here is the caller graph for this function:

◆ navigateToSearchResult()

void SettingsView::navigateToSearchResult ( const QModelIndex & index)
private
Here is the call graph for this function:
Here is the caller graph for this function:

◆ navigateToSection()

void SettingsView::navigateToSection ( int pageIndex,
QWidget * sectionWidget )
private
Here is the call graph for this function:
Here is the caller graph for this function:

◆ onSearchResultClicked

void SettingsView::onSearchResultClicked ( const QModelIndex & index)
privateslot
Here is the call graph for this function:
Here is the caller graph for this function:

◆ onSearchTextChanged

void SettingsView::onSearchTextChanged ( const QString & text)
privateslot
Here is the call graph for this function:
Here is the caller graph for this function:

◆ onTabClicked

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

◆ page()

AbstractSettingsPage * SettingsView::page ( SettingsPage which) const
Here is the caller graph for this function:

◆ retranslateNavNames()

void SettingsView::retranslateNavNames ( )
private
Here is the call graph for this function:
Here is the caller graph for this function:

◆ retranslateUi()

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

◆ scrollToAndFlash()

void SettingsView::scrollToAndFlash ( QWidget * target)
staticprivate
Here is the call graph for this function:
Here is the caller graph for this function:

◆ selectSectionRow()

void SettingsView::selectSectionRow ( int pageIndex,
QWidget * sectionWidget )
private

Selects the nav row for a section, expanding its page row.

A null or unknown section (a page whose sections are its own group boxes) leaves the current selection untouched, so callers can pass a lookup result directly.

Parameters
pageIndexSettingsPage owning the section
sectionWidgetSection's group box, or nullptr for no section
Here is the call graph for this function:
Here is the caller graph for this function:

◆ setActiveTab()

void SettingsView::setActiveTab ( int index)
private
Here is the call graph for this function:
Here is the caller graph for this function:

◆ setTab()

void SettingsView::setTab ( int index)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ setupNavTree()

void SettingsView::setupNavTree ( )
private
Here is the call graph for this function:
Here is the caller graph for this function:

◆ setupUi()

void SettingsView::setupUi ( )
private
Here is the call graph for this function:
Here is the caller graph for this function:

◆ switchPageContent()

void SettingsView::switchPageContent ( int index)
private
Here is the call graph for this function:
Here is the caller graph for this function:

◆ switchToSearchMode()

void SettingsView::switchToSearchMode ( )
private
Here is the call graph for this function:
Here is the caller graph for this function:

◆ switchToTabMode()

void SettingsView::switchToTabMode ( )
private
Here is the call graph for this function:
Here is the caller graph for this function:

◆ translatedGroupNames()

QStringList SettingsView::translatedGroupNames ( )
staticprivate
Here is the caller graph for this function:

◆ translatedPageNames()

QStringList SettingsView::translatedPageNames ( )
staticprivate
Here is the caller graph for this function:

Member Data Documentation

◆ currentTabIndex

int SettingsView::currentTabIndex
private

Currently active tab index.

◆ groupItems

QList<QTreeWidgetItem *> SettingsView::groupItems
private

Group header rows, indexed by group.

◆ isolatedSection

QWidget* SettingsView::isolatedSection = nullptr
private

Isolated section group box, or nullptr for full pages.

◆ navTree

QTreeWidget* SettingsView::navTree
private

Grouped navigation tree for the pages.

◆ pageItems

QList<QTreeWidgetItem *> SettingsView::pageItems
private

Page rows, indexed by SettingsPage.

◆ pages

QList<AbstractSettingsPage *> SettingsView::pages
private

All settings page instances.

◆ pagesContainer

QWidget* SettingsView::pagesContainer
private

Container stacking pages and search results.

◆ pagesWidget

QStackedWidget* SettingsView::pagesWidget
private

Stacked widget containing settings pages.

◆ pressWasOnCurrentItem

bool SettingsView::pressWasOnCurrentItem = false
private

True when the mouse press started on the already-current item.

◆ searchActive

bool SettingsView::searchActive
private

Whether search mode is active.

◆ searchDelegate

SettingsSearchDelegate* SettingsView::searchDelegate
private

Delegate for search result rendering.

◆ searchEdit

QLineEdit* SettingsView::searchEdit
private

Search bar for filtering settings.

◆ searchModel

SettingsSearchModel* SettingsView::searchModel
private

Model for search results.

◆ searchResultsView

QListView* SettingsView::searchResultsView
private

Search results list view.


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