mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-03-21 17:55:21 -05:00
Overhaul quick settings for VDS and PrintingSelector (#5602)
* Move show folders option next to the search bar. * Add a new settings button and settings popup, move the folder visibility checkbox there and the ability to hide tags. * Make popup not close when interacting with child widgets. * Fix mocks. * Include cog icon. * Move PrintingSelector Display options to new quick settings widget. * Adjust size before first show so as to not overflow. * Add option to hide card size slider in VDS. * Qt5 support. * Fix some warnings by containerizing layouts because addChildLayout is silly. * Fix an incorrect slot/signal assignment. * Correct sub-categories for settings to persist them. * Shuffle some slots and signals around to distinguish between the tag filter and the tags on the deck preview widgets. * Add a quick setting to draw unused color identities and center them. * Respect the setting on startup. * Move card size slider to the quick settings menu. * Move PrintingSelector card size slider to quick menu, adjust other layout from other options. * Improve layout, add a gray border. --------- Co-authored-by: Lukas Brübach <Bruebach.Lukas@bdosecurity.de>
This commit is contained in:
parent
d1102939a2
commit
7c9bf75393
|
|
@ -110,9 +110,9 @@ set(cockatrice_SOURCES
|
|||
src/client/ui/widgets/printing_selector/printing_selector_card_search_widget.cpp
|
||||
src/client/ui/widgets/printing_selector/printing_selector_card_selection_widget.cpp
|
||||
src/client/ui/widgets/printing_selector/printing_selector_card_sorting_widget.cpp
|
||||
src/client/ui/widgets/printing_selector/printing_selector_view_options_toolbar_widget.cpp
|
||||
src/client/ui/widgets/printing_selector/printing_selector_view_options_widget.cpp
|
||||
src/client/ui/widgets/printing_selector/set_name_and_collectors_number_display_widget.cpp
|
||||
src/client/ui/widgets/quick_settings/settings_button_widget.cpp
|
||||
src/client/ui/widgets/quick_settings/settings_popup_widget.cpp
|
||||
src/client/network/release_channel.cpp
|
||||
src/client/network/client_update_checker.cpp
|
||||
src/server/remote/remote_client.cpp
|
||||
|
|
|
|||
|
|
@ -13,6 +13,7 @@
|
|||
<file>resources/icons/arrow_top_green.svg</file>
|
||||
<file>resources/icons/arrow_up_green.svg</file>
|
||||
<file>resources/icons/clearsearch.svg</file>
|
||||
<file>resources/icons/cogwheel.svg</file>
|
||||
<file>resources/icons/conceded.svg</file>
|
||||
<file>resources/icons/decrement.svg</file>
|
||||
<file>resources/icons/delete.svg</file>
|
||||
|
|
|
|||
29
cockatrice/resources/icons/cogwheel.svg
Normal file
29
cockatrice/resources/icons/cogwheel.svg
Normal file
|
|
@ -0,0 +1,29 @@
|
|||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<!-- Created with Inkscape (http://www.inkscape.org/) -->
|
||||
<svg xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
|
||||
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd" width="102.5024mm" height="102.24421mm"
|
||||
viewBox="0 0 102.5024 102.24421" version="1.1"
|
||||
id="svg1"
|
||||
inkscape:version="1.4 (e7c3feb100, 2024-10-09)" sodipodi:docname="cog_wheel.svg"
|
||||
xmlns="http://www.w3.org/2000/svg">
|
||||
<sodipodi:namedview id="namedview1" pagecolor="#ffffff" bordercolor="#000000" borderopacity="0.25"
|
||||
inkscape:showpageshadow="2" inkscape:pageopacity="0.0" inkscape:pagecheckerboard="0"
|
||||
inkscape:deskcolor="#d1d1d1" inkscape:document-units="mm" inkscape:zoom="0.66101291"
|
||||
inkscape:cx="146.74449" inkscape:cy="193.64221" inkscape:window-width="1829"
|
||||
inkscape:window-height="951" inkscape:window-x="0" inkscape:window-y="0"
|
||||
inkscape:window-maximized="1" inkscape:current-layer="layer1"/>
|
||||
<defs id="defs1"/>
|
||||
<g inkscape:label="Layer 1" inkscape:groupmode="layer" id="layer1" transform="translate(-66.148059,-97.377896)">
|
||||
<g id="g1" transform="translate(-165.09777,-82.009607)">
|
||||
<g id="g2" transform="matrix(0.26458333,0,0,0.26458333,64.983323,161.37858)">
|
||||
<path style="fill:#333333;stroke-width:94.4882"
|
||||
d="m 721.34301,94.413051 40.00966,29.763289 29.51933,-9.27053 14.63768,-46.840589 36.83817,0.48792 13.41787,46.108699 28.29952,9.5145 40.74155,-28.299519 29.0314,21.468599 -15.85748,47.08454 16.58937,23.66426 48.30432,-2.68358 12.93,34.88648 -41.71741,27.07971 -0.48792,29.27536 40.49763,26.10387 -10.2464,34.15459 -48.54834,-0.97584 -18.78502,23.42029 15.85749,45.37681 -28.29952,21.71256 -41.22947,-29.27536 -28.54348,9.75846 -13.66184,47.57246 -38.30194,-0.73188 -14.63768,-48.30435 -27.07971,-9.27054 -40.00966,29.27537 -30.25121,-20.49276 17.32125,-46.35266 -17.80918,-24.64009 -49.76812,3.17149 -11.22222,-34.64251 40.74155,-27.07971 0.48792,-30.00725 -41.71739,-27.32367 12.19807,-32.93479 48.30435,2.68358 20.24879,-24.6401 -17.32126,-47.08455 z"
|
||||
id="path1"/>
|
||||
<circle style="fill:#f9f9f9;stroke-width:72.1317" id="path2" cx="822.09906" cy="261.28262"
|
||||
r="83.434792"/>
|
||||
<circle style="fill:#4d4d4d;stroke-width:40.5147" id="circle2" cx="822.09906" cy="261.28262"
|
||||
r="46.863361"/>
|
||||
</g>
|
||||
</g>
|
||||
</g>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 2.5 KiB |
|
|
@ -11,8 +11,8 @@
|
|||
* This widget allows users to dynamically change the card size in a linked FlowWidget
|
||||
* and updates the application's settings accordingly.
|
||||
*/
|
||||
CardSizeWidget::CardSizeWidget(QWidget *parent, FlowWidget *flowWidget, int defaultValue)
|
||||
: parent(parent), flowWidget(flowWidget)
|
||||
CardSizeWidget::CardSizeWidget(QWidget *parent, FlowWidget *_flowWidget, int defaultValue)
|
||||
: parent(parent), flowWidget(_flowWidget)
|
||||
{
|
||||
cardSizeLayout = new QHBoxLayout(this);
|
||||
cardSizeLayout->setContentsMargins(9, 0, 9, 0);
|
||||
|
|
|
|||
|
|
@ -5,7 +5,6 @@
|
|||
#include "printing_selector_card_search_widget.h"
|
||||
#include "printing_selector_card_selection_widget.h"
|
||||
#include "printing_selector_card_sorting_widget.h"
|
||||
#include "printing_selector_view_options_toolbar_widget.h"
|
||||
|
||||
#include <QScrollBar>
|
||||
|
||||
|
|
@ -29,29 +28,49 @@ PrintingSelector::PrintingSelector(QWidget *parent,
|
|||
: QWidget(parent), deckEditor(deckEditor), deckModel(deckModel), deckView(deckView)
|
||||
{
|
||||
setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
|
||||
layout = new QVBoxLayout();
|
||||
layout = new QVBoxLayout(this);
|
||||
setLayout(layout);
|
||||
|
||||
widgetLoadingBufferTimer = new QTimer(this);
|
||||
|
||||
// Initialize toolbar and widgets
|
||||
viewOptionsToolbar = new PrintingSelectorViewOptionsToolbarWidget(this, this);
|
||||
layout->addWidget(viewOptionsToolbar);
|
||||
flowWidget = new FlowWidget(this, Qt::Horizontal, Qt::ScrollBarAlwaysOff, Qt::ScrollBarAsNeeded);
|
||||
|
||||
sortToolBar = new PrintingSelectorCardSortingWidget(this);
|
||||
sortToolBar->setVisible(SettingsCache::instance().getPrintingSelectorSortOptionsVisible());
|
||||
layout->addWidget(sortToolBar);
|
||||
sortToolBar->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Preferred);
|
||||
|
||||
displayOptionsWidget = new SettingsButtonWidget(this);
|
||||
displayOptionsWidget->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Preferred);
|
||||
|
||||
// Create the checkbox for navigation buttons visibility
|
||||
navigationCheckBox = new QCheckBox(this);
|
||||
navigationCheckBox->setChecked(SettingsCache::instance().getPrintingSelectorNavigationButtonsVisible());
|
||||
connect(navigationCheckBox, &QCheckBox::QT_STATE_CHANGED, this,
|
||||
&PrintingSelector::toggleVisibilityNavigationButtons);
|
||||
connect(navigationCheckBox, &QCheckBox::QT_STATE_CHANGED, &SettingsCache::instance(),
|
||||
&SettingsCache::setPrintingSelectorNavigationButtonsVisible);
|
||||
|
||||
cardSizeWidget =
|
||||
new CardSizeWidget(displayOptionsWidget, flowWidget, SettingsCache::instance().getPrintingSelectorCardSize());
|
||||
|
||||
displayOptionsWidget->addSettingsWidget(sortToolBar);
|
||||
displayOptionsWidget->addSettingsWidget(navigationCheckBox);
|
||||
displayOptionsWidget->addSettingsWidget(cardSizeWidget);
|
||||
|
||||
sortAndOptionsContainer = new QWidget(this);
|
||||
sortAndOptionsLayout = new QHBoxLayout(sortAndOptionsContainer);
|
||||
sortAndOptionsLayout->setSpacing(3);
|
||||
sortAndOptionsLayout->setContentsMargins(0, 0, 0, 0);
|
||||
sortAndOptionsContainer->setLayout(sortAndOptionsLayout);
|
||||
|
||||
searchBar = new PrintingSelectorCardSearchWidget(this);
|
||||
searchBar->setVisible(SettingsCache::instance().getPrintingSelectorSearchBarVisible());
|
||||
layout->addWidget(searchBar);
|
||||
|
||||
flowWidget = new FlowWidget(this, Qt::Horizontal, Qt::ScrollBarAlwaysOff, Qt::ScrollBarAsNeeded);
|
||||
sortAndOptionsLayout->addWidget(searchBar);
|
||||
sortAndOptionsLayout->addWidget(displayOptionsWidget);
|
||||
|
||||
layout->addWidget(sortAndOptionsContainer);
|
||||
|
||||
layout->addWidget(flowWidget);
|
||||
|
||||
cardSizeWidget = new CardSizeWidget(this, flowWidget, SettingsCache::instance().getPrintingSelectorCardSize());
|
||||
cardSizeWidget->setVisible(SettingsCache::instance().getPrintingSelectorCardSizeSliderVisible());
|
||||
layout->addWidget(cardSizeWidget);
|
||||
|
||||
cardSelectionBar = new PrintingSelectorCardSelectionWidget(this);
|
||||
cardSelectionBar->setVisible(SettingsCache::instance().getPrintingSelectorNavigationButtonsVisible());
|
||||
layout->addWidget(cardSelectionBar);
|
||||
|
|
@ -59,6 +78,13 @@ PrintingSelector::PrintingSelector(QWidget *parent,
|
|||
// Connect deck model data change signal to update display
|
||||
connect(deckModel, &DeckListModel::rowsInserted, this, &PrintingSelector::printingsInDeckChanged);
|
||||
connect(deckModel, &DeckListModel::rowsRemoved, this, &PrintingSelector::printingsInDeckChanged);
|
||||
|
||||
retranslateUi();
|
||||
}
|
||||
|
||||
void PrintingSelector::retranslateUi()
|
||||
{
|
||||
navigationCheckBox->setText(tr("Display Navigation Buttons"));
|
||||
}
|
||||
|
||||
void PrintingSelector::printingsInDeckChanged()
|
||||
|
|
@ -206,36 +232,6 @@ void PrintingSelector::getAllSetsForCurrentCard()
|
|||
widgetLoadingBufferTimer->start(0); // Process as soon as possible
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Toggles the visibility of the sorting options toolbar.
|
||||
*
|
||||
* @param _state The visibility state to set.
|
||||
*/
|
||||
void PrintingSelector::toggleVisibilitySortOptions(bool _state)
|
||||
{
|
||||
sortToolBar->setVisible(_state);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Toggles the visibility of the search bar.
|
||||
*
|
||||
* @param _state The visibility state to set.
|
||||
*/
|
||||
void PrintingSelector::toggleVisibilitySearchBar(bool _state)
|
||||
{
|
||||
searchBar->setVisible(_state);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Toggles the visibility of the card size slider.
|
||||
*
|
||||
* @param _state The visibility state to set.
|
||||
*/
|
||||
void PrintingSelector::toggleVisibilityCardSizeSlider(bool _state)
|
||||
{
|
||||
cardSizeWidget->setVisible(_state);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Toggles the visibility of the navigation buttons.
|
||||
*
|
||||
|
|
|
|||
|
|
@ -5,7 +5,9 @@
|
|||
#include "../../../../game/cards/card_database.h"
|
||||
#include "../cards/card_size_widget.h"
|
||||
#include "../general/layout_containers/flow_widget.h"
|
||||
#include "../quick_settings/settings_button_widget.h"
|
||||
|
||||
#include <QCheckBox>
|
||||
#include <QLabel>
|
||||
#include <QTreeView>
|
||||
#include <QVBoxLayout>
|
||||
|
|
@ -16,7 +18,7 @@
|
|||
class PrintingSelectorCardSearchWidget;
|
||||
class PrintingSelectorCardSelectionWidget;
|
||||
class PrintingSelectorCardSortingWidget;
|
||||
class PrintingSelectorViewOptionsToolbarWidget;
|
||||
class PrintingSelectorViewOptionsWidget;
|
||||
class TabDeckEditor;
|
||||
class PrintingSelector : public QWidget
|
||||
{
|
||||
|
|
@ -24,16 +26,15 @@ class PrintingSelector : public QWidget
|
|||
|
||||
public:
|
||||
PrintingSelector(QWidget *parent, TabDeckEditor *deckEditor, DeckListModel *deckModel, QTreeView *deckView);
|
||||
|
||||
void setCard(const CardInfoPtr &newCard, const QString &_currentZone);
|
||||
void getAllSetsForCurrentCard();
|
||||
|
||||
public slots:
|
||||
void retranslateUi();
|
||||
void updateDisplay();
|
||||
void selectPreviousCard();
|
||||
void selectNextCard();
|
||||
void toggleVisibilitySortOptions(bool _state);
|
||||
void toggleVisibilitySearchBar(bool _state);
|
||||
void toggleVisibilityCardSizeSlider(bool _state);
|
||||
void toggleVisibilityNavigationButtons(bool _state);
|
||||
|
||||
private slots:
|
||||
|
|
@ -41,7 +42,10 @@ private slots:
|
|||
|
||||
private:
|
||||
QVBoxLayout *layout;
|
||||
PrintingSelectorViewOptionsToolbarWidget *viewOptionsToolbar;
|
||||
SettingsButtonWidget *displayOptionsWidget;
|
||||
QWidget *sortAndOptionsContainer;
|
||||
QHBoxLayout *sortAndOptionsLayout;
|
||||
QCheckBox *navigationCheckBox;
|
||||
PrintingSelectorCardSortingWidget *sortToolBar;
|
||||
PrintingSelectorCardSearchWidget *searchBar;
|
||||
FlowWidget *flowWidget;
|
||||
|
|
|
|||
|
|
@ -18,8 +18,8 @@ const QStringList PrintingSelectorCardSortingWidget::SORT_OPTIONS = {SORT_OPTION
|
|||
*/
|
||||
PrintingSelectorCardSortingWidget::PrintingSelectorCardSortingWidget(PrintingSelector *parent) : parent(parent)
|
||||
{
|
||||
setMinimumWidth(300);
|
||||
sortToolBar = new QHBoxLayout(this);
|
||||
sortToolBar->setContentsMargins(9, 0, 9, 0);
|
||||
|
||||
sortOptionsSelector = new QComboBox(this);
|
||||
sortOptionsSelector->addItems(SORT_OPTIONS);
|
||||
|
|
|
|||
|
|
@ -1,140 +0,0 @@
|
|||
#include "printing_selector_view_options_toolbar_widget.h"
|
||||
|
||||
#include <QHBoxLayout>
|
||||
#include <QLabel>
|
||||
#include <QPushButton>
|
||||
|
||||
/**
|
||||
* @class PrintingSelectorViewOptionsToolbarWidget
|
||||
* @brief A widget that provides a toolbar for view options with collapsible and expandable functionality.
|
||||
*
|
||||
* This widget allows the user to collapse or expand the view options for the PrintingSelector,
|
||||
* providing a more compact interface when collapsed and a full view of options when expanded.
|
||||
*/
|
||||
PrintingSelectorViewOptionsToolbarWidget::PrintingSelectorViewOptionsToolbarWidget(QWidget *_parent,
|
||||
PrintingSelector *_printingSelector)
|
||||
: QWidget(_parent), printingSelector(_printingSelector)
|
||||
{
|
||||
// Set up layout for the widget
|
||||
layout = new QVBoxLayout();
|
||||
layout->setContentsMargins(9, 0, 9, 0);
|
||||
layout->setSpacing(0);
|
||||
setLayout(layout);
|
||||
|
||||
// Set up the expanded widget with its layout
|
||||
expandedWidget = new QWidget(this);
|
||||
auto *expandedLayout = new QVBoxLayout(expandedWidget);
|
||||
expandedLayout->setContentsMargins(0, 0, 0, 0);
|
||||
expandedLayout->setSpacing(0);
|
||||
|
||||
// Collapse button to toggle between expanded and collapsed states
|
||||
collapseButton = new QPushButton("▼", this);
|
||||
collapseButton->setFixedSize(20, 20);
|
||||
collapseButton->setToolTip("Collapse");
|
||||
collapseButton->setStyleSheet("border: none;");
|
||||
connect(collapseButton, &QPushButton::clicked, this, &PrintingSelectorViewOptionsToolbarWidget::collapse);
|
||||
expandedLayout->addWidget(collapseButton, 0, Qt::AlignLeft);
|
||||
|
||||
// View options widget
|
||||
viewOptions = new PrintingSelectorViewOptionsWidget(expandedWidget, printingSelector);
|
||||
expandedLayout->addWidget(viewOptions);
|
||||
|
||||
expandedWidget->setLayout(expandedLayout);
|
||||
|
||||
// Set up the collapsed widget with its layout
|
||||
collapsedWidget = new QWidget(this);
|
||||
auto *collapsedLayout = new QHBoxLayout(collapsedWidget);
|
||||
collapsedLayout->setContentsMargins(5, 0, 5, 0);
|
||||
collapsedLayout->setSpacing(0);
|
||||
|
||||
// Expand button to show full options
|
||||
expandButton = new QPushButton("▲", this);
|
||||
expandButton->setFixedSize(20, 20);
|
||||
expandButton->setToolTip("Expand");
|
||||
expandButton->setStyleSheet("border: none;");
|
||||
connect(expandButton, &QPushButton::clicked, this, &PrintingSelectorViewOptionsToolbarWidget::expand);
|
||||
collapsedLayout->addWidget(expandButton);
|
||||
|
||||
// Label for collapsed state
|
||||
auto *collapsedLabel = new QLabel(tr("Display Options"), this);
|
||||
collapsedLayout->addWidget(collapsedLabel);
|
||||
|
||||
collapsedWidget->setLayout(collapsedLayout);
|
||||
|
||||
// Stack widget to switch between expanded and collapsed states
|
||||
stackedWidget = new QStackedWidget(this);
|
||||
stackedWidget->addWidget(expandedWidget);
|
||||
stackedWidget->addWidget(collapsedWidget);
|
||||
|
||||
layout->addWidget(stackedWidget);
|
||||
|
||||
setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Fixed);
|
||||
|
||||
// Default to the expanded widget
|
||||
stackedWidget->setCurrentWidget(expandedWidget);
|
||||
|
||||
// Connect the stacked widget to update the layout when it changes
|
||||
connect(stackedWidget, &QStackedWidget::currentChanged, this,
|
||||
&PrintingSelectorViewOptionsToolbarWidget::onWidgetChanged);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Toggles the widget to the collapsed state.
|
||||
*/
|
||||
void PrintingSelectorViewOptionsToolbarWidget::collapse()
|
||||
{
|
||||
stackedWidget->setCurrentWidget(collapsedWidget);
|
||||
updateGeometry();
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Toggles the widget to the expanded state.
|
||||
*/
|
||||
void PrintingSelectorViewOptionsToolbarWidget::expand()
|
||||
{
|
||||
stackedWidget->setCurrentWidget(expandedWidget);
|
||||
updateGeometry();
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Handles the geometry update when the stacked widget changes.
|
||||
*
|
||||
* This ensures that the parent layout is also updated when the widget's display state changes.
|
||||
*/
|
||||
void PrintingSelectorViewOptionsToolbarWidget::onWidgetChanged(int)
|
||||
{
|
||||
updateGeometry();
|
||||
if (parentWidget() && parentWidget()->layout()) {
|
||||
parentWidget()->layout()->invalidate();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Provides the recommended size for the widget based on the current view.
|
||||
*
|
||||
* @return QSize The suggested size for the widget.
|
||||
*/
|
||||
QSize PrintingSelectorViewOptionsToolbarWidget::sizeHint() const
|
||||
{
|
||||
return stackedWidget->currentWidget()->sizeHint();
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Provides the minimum size required for the widget based on the current view.
|
||||
*
|
||||
* @return QSize The minimum size required for the widget.
|
||||
*/
|
||||
QSize PrintingSelectorViewOptionsToolbarWidget::minimumSizeHint() const
|
||||
{
|
||||
return stackedWidget->currentWidget()->minimumSizeHint();
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Returns the view options widget contained within this toolbar.
|
||||
*
|
||||
* @return PrintingSelectorViewOptionsWidget* The view options widget.
|
||||
*/
|
||||
PrintingSelectorViewOptionsWidget *PrintingSelectorViewOptionsToolbarWidget::getViewOptionsWidget() const
|
||||
{
|
||||
return viewOptions;
|
||||
}
|
||||
|
|
@ -1,36 +0,0 @@
|
|||
#ifndef PRINTING_SELECTOR_SORT_AND_SEARCH_TOOLBAR_WIDGET_H
|
||||
#define PRINTING_SELECTOR_SORT_AND_SEARCH_TOOLBAR_WIDGET_H
|
||||
|
||||
#include "printing_selector.h"
|
||||
#include "printing_selector_view_options_widget.h"
|
||||
|
||||
#include <QPushButton>
|
||||
#include <QStackedWidget>
|
||||
#include <QVBoxLayout>
|
||||
#include <QWidget>
|
||||
|
||||
class PrintingSelectorViewOptionsToolbarWidget : public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit PrintingSelectorViewOptionsToolbarWidget(QWidget *parent, PrintingSelector *printingSelector);
|
||||
void collapse();
|
||||
void expand();
|
||||
void onWidgetChanged(int);
|
||||
QSize sizeHint() const override;
|
||||
QSize minimumSizeHint() const override;
|
||||
PrintingSelectorViewOptionsWidget *getViewOptionsWidget() const;
|
||||
|
||||
private:
|
||||
QVBoxLayout *layout;
|
||||
PrintingSelector *printingSelector;
|
||||
PrintingSelectorViewOptionsWidget *viewOptions;
|
||||
QWidget *expandedWidget;
|
||||
QPushButton *collapseButton;
|
||||
QWidget *collapsedWidget;
|
||||
QPushButton *expandButton;
|
||||
QStackedWidget *stackedWidget;
|
||||
};
|
||||
|
||||
#endif // PRINTING_SELECTOR_SORT_AND_SEARCH_TOOLBAR_WIDGET_H
|
||||
|
|
@ -1,63 +0,0 @@
|
|||
#include "printing_selector_view_options_widget.h"
|
||||
|
||||
#include "../../../../settings/cache_settings.h"
|
||||
|
||||
/**
|
||||
* @class PrintingSelectorViewOptionsWidget
|
||||
* @brief A widget that provides the view options for the PrintingSelector, including checkboxes
|
||||
* for sorting, search bar, card size slider, and navigation buttons.
|
||||
*
|
||||
* This widget allows the user to toggle the visibility of various interface components of the
|
||||
* PrintingSelector through checkboxes. The state of the checkboxes is saved and restored using
|
||||
* the `SettingsCache`.
|
||||
*/
|
||||
PrintingSelectorViewOptionsWidget::PrintingSelectorViewOptionsWidget(QWidget *parent,
|
||||
PrintingSelector *_printingSelector)
|
||||
: QWidget(parent), printingSelector(_printingSelector)
|
||||
{
|
||||
// Create the grid to hold the checkboxes
|
||||
gridLayout = new QGridLayout(this);
|
||||
setLayout(gridLayout);
|
||||
|
||||
// Create the checkbox for sorting options visibility
|
||||
sortCheckBox = new QCheckBox(this);
|
||||
sortCheckBox->setText(tr("Display Sorting Options"));
|
||||
sortCheckBox->setChecked(SettingsCache::instance().getPrintingSelectorSortOptionsVisible());
|
||||
connect(sortCheckBox, &QCheckBox::QT_STATE_CHANGED, printingSelector,
|
||||
&PrintingSelector::toggleVisibilitySortOptions);
|
||||
connect(sortCheckBox, &QCheckBox::QT_STATE_CHANGED, &SettingsCache::instance(),
|
||||
&SettingsCache::setPrintingSelectorSortOptionsVisible);
|
||||
|
||||
// Create the checkbox for search bar visibility
|
||||
searchCheckBox = new QCheckBox(this);
|
||||
searchCheckBox->setText(tr("Display Search Bar"));
|
||||
searchCheckBox->setChecked(SettingsCache::instance().getPrintingSelectorSearchBarVisible());
|
||||
connect(searchCheckBox, &QCheckBox::QT_STATE_CHANGED, printingSelector,
|
||||
&PrintingSelector::toggleVisibilitySearchBar);
|
||||
connect(searchCheckBox, &QCheckBox::QT_STATE_CHANGED, &SettingsCache::instance(),
|
||||
&SettingsCache::setPrintingSelectorSearchBarVisible);
|
||||
|
||||
// Create the checkbox for card size slider visibility
|
||||
cardSizeCheckBox = new QCheckBox(this);
|
||||
cardSizeCheckBox->setText(tr("Display Card Size Slider"));
|
||||
cardSizeCheckBox->setChecked(SettingsCache::instance().getPrintingSelectorCardSizeSliderVisible());
|
||||
connect(cardSizeCheckBox, &QCheckBox::QT_STATE_CHANGED, printingSelector,
|
||||
&PrintingSelector::toggleVisibilityCardSizeSlider);
|
||||
connect(cardSizeCheckBox, &QCheckBox::QT_STATE_CHANGED, &SettingsCache::instance(),
|
||||
&SettingsCache::setPrintingSelectorCardSizeSliderVisible);
|
||||
|
||||
// Create the checkbox for navigation buttons visibility
|
||||
navigationCheckBox = new QCheckBox(this);
|
||||
navigationCheckBox->setText(tr("Display Navigation Buttons"));
|
||||
navigationCheckBox->setChecked(SettingsCache::instance().getPrintingSelectorNavigationButtonsVisible());
|
||||
connect(navigationCheckBox, &QCheckBox::QT_STATE_CHANGED, printingSelector,
|
||||
&PrintingSelector::toggleVisibilityNavigationButtons);
|
||||
connect(navigationCheckBox, &QCheckBox::QT_STATE_CHANGED, &SettingsCache::instance(),
|
||||
&SettingsCache::setPrintingSelectorNavigationButtonsVisible);
|
||||
|
||||
// Add checkboxes to the grid
|
||||
gridLayout->addWidget(sortCheckBox, 0, 0);
|
||||
gridLayout->addWidget(searchCheckBox, 0, 1);
|
||||
gridLayout->addWidget(cardSizeCheckBox, 1, 0);
|
||||
gridLayout->addWidget(navigationCheckBox, 1, 1);
|
||||
}
|
||||
|
|
@ -1,27 +0,0 @@
|
|||
#ifndef PRINTING_SELECTOR_VIEW_OPTIONS_WIDGET_H
|
||||
#define PRINTING_SELECTOR_VIEW_OPTIONS_WIDGET_H
|
||||
|
||||
#include "../general/layout_containers/flow_widget.h"
|
||||
#include "printing_selector.h"
|
||||
|
||||
#include <QCheckBox>
|
||||
#include <QHBoxLayout>
|
||||
#include <QWidget>
|
||||
|
||||
class PrintingSelectorViewOptionsWidget : public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit PrintingSelectorViewOptionsWidget(QWidget *parent, PrintingSelector *_printingSelector);
|
||||
|
||||
private:
|
||||
QGridLayout *gridLayout;
|
||||
PrintingSelector *printingSelector;
|
||||
QCheckBox *sortCheckBox;
|
||||
QCheckBox *searchCheckBox;
|
||||
QCheckBox *cardSizeCheckBox;
|
||||
QCheckBox *navigationCheckBox;
|
||||
};
|
||||
|
||||
#endif // PRINTING_SELECTOR_VIEW_OPTIONS_WIDGET_H
|
||||
|
|
@ -0,0 +1,80 @@
|
|||
#include "settings_button_widget.h"
|
||||
|
||||
#include <QApplication>
|
||||
#include <QHBoxLayout>
|
||||
#include <QMouseEvent>
|
||||
#include <QScreen>
|
||||
|
||||
SettingsButtonWidget::SettingsButtonWidget(QWidget *parent)
|
||||
: QWidget(parent), button(new QToolButton(this)), popup(new SettingsPopupWidget(this))
|
||||
{
|
||||
|
||||
button->setIcon(QPixmap("theme:icons/cogwheel"));
|
||||
button->setCheckable(true);
|
||||
button->setFixedSize(32, 32);
|
||||
connect(button, &QToolButton::clicked, this, &SettingsButtonWidget::togglePopup);
|
||||
connect(popup, &SettingsPopupWidget::aboutToClose, this, &SettingsButtonWidget::onPopupClosed);
|
||||
|
||||
layout = new QHBoxLayout(this);
|
||||
layout->addWidget(button);
|
||||
layout->setContentsMargins(0, 0, 0, 0);
|
||||
setLayout(layout);
|
||||
}
|
||||
|
||||
void SettingsButtonWidget::addSettingsWidget(QWidget *toAdd) const
|
||||
{
|
||||
popup->addSettingsWidget(toAdd);
|
||||
}
|
||||
|
||||
void SettingsButtonWidget::togglePopup()
|
||||
{
|
||||
if (popup->isVisible()) {
|
||||
popup->close();
|
||||
} else {
|
||||
// Ensure popup size is known before positioning
|
||||
popup->adjustSize();
|
||||
QSize popupSize = popup->size();
|
||||
|
||||
// Get button position
|
||||
QPoint buttonGlobalPos = button->mapToGlobal(QPoint(0, button->height()));
|
||||
|
||||
// Get screen geometry
|
||||
QScreen *screen = QApplication::screenAt(buttonGlobalPos);
|
||||
QRect screenGeom = screen ? screen->availableGeometry() : QApplication::primaryScreen()->availableGeometry();
|
||||
|
||||
int x = buttonGlobalPos.x();
|
||||
int y = buttonGlobalPos.y();
|
||||
|
||||
// Adjust X position if popup overflows the right side of the screen
|
||||
if (x + popupSize.width() > screenGeom.right()) {
|
||||
x = buttonGlobalPos.x() - popupSize.width() + button->width(); // Move left
|
||||
}
|
||||
|
||||
// Adjust Y position if popup overflows the bottom of the screen
|
||||
if (y + popupSize.height() > screenGeom.bottom()) {
|
||||
y = buttonGlobalPos.y() - popupSize.height() - button->height(); // Move up
|
||||
}
|
||||
|
||||
popup->move(x, y);
|
||||
popup->show();
|
||||
popup->setFocus();
|
||||
button->setChecked(true); // Ensure button is checked when popup is visible
|
||||
}
|
||||
}
|
||||
|
||||
void SettingsButtonWidget::onPopupClosed() const
|
||||
{
|
||||
button->setChecked(false); // Ensure button unchecks when popup closes
|
||||
}
|
||||
|
||||
void SettingsButtonWidget::mousePressEvent(QMouseEvent *event)
|
||||
{
|
||||
#if (QT_VERSION >= QT_VERSION_CHECK(6, 0, 0))
|
||||
if (popup->isVisible() && !popup->geometry().contains(event->globalPosition().toPoint())) {
|
||||
#else
|
||||
if (popup->isVisible() && !popup->geometry().contains(event->globalPos())) {
|
||||
#endif
|
||||
popup->close();
|
||||
}
|
||||
QWidget::mousePressEvent(event);
|
||||
}
|
||||
|
|
@ -0,0 +1,30 @@
|
|||
#ifndef SETTINGS_BUTTON_WIDGET_H
|
||||
#define SETTINGS_BUTTON_WIDGET_H
|
||||
|
||||
#include "settings_popup_widget.h"
|
||||
|
||||
#include <QToolButton>
|
||||
#include <QWidget>
|
||||
|
||||
class SettingsButtonWidget : public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit SettingsButtonWidget(QWidget *parent = nullptr);
|
||||
void addSettingsWidget(QWidget *toAdd) const;
|
||||
|
||||
protected:
|
||||
void mousePressEvent(QMouseEvent *event) override;
|
||||
|
||||
private slots:
|
||||
void togglePopup();
|
||||
void onPopupClosed() const;
|
||||
|
||||
private:
|
||||
QHBoxLayout *layout;
|
||||
QToolButton *button;
|
||||
SettingsPopupWidget *popup;
|
||||
};
|
||||
|
||||
#endif // SETTINGS_BUTTON_WIDGET_H
|
||||
|
|
@ -0,0 +1,37 @@
|
|||
#include "settings_popup_widget.h"
|
||||
|
||||
#include <QApplication>
|
||||
#include <QFocusEvent>
|
||||
#include <QPainter>
|
||||
|
||||
SettingsPopupWidget::SettingsPopupWidget(QWidget *parent) : QWidget(parent, Qt::Popup | Qt::FramelessWindowHint)
|
||||
{
|
||||
layout = new QVBoxLayout(this);
|
||||
}
|
||||
|
||||
void SettingsPopupWidget::addSettingsWidget(QWidget *toAdd) const
|
||||
{
|
||||
layout->addWidget(toAdd);
|
||||
}
|
||||
|
||||
void SettingsPopupWidget::focusOutEvent(QFocusEvent *event)
|
||||
{
|
||||
if (!this->isAncestorOf(QApplication::focusWidget())) {
|
||||
close();
|
||||
}
|
||||
QWidget::focusOutEvent(event);
|
||||
}
|
||||
|
||||
void SettingsPopupWidget::closeEvent(QCloseEvent *event)
|
||||
{
|
||||
emit aboutToClose();
|
||||
QWidget::closeEvent(event);
|
||||
}
|
||||
|
||||
void SettingsPopupWidget::paintEvent(QPaintEvent *event)
|
||||
{
|
||||
QPainter painter(this);
|
||||
painter.setPen(Qt::gray);
|
||||
painter.drawRect(rect().adjusted(0, 0, -1, -1));
|
||||
QWidget::paintEvent(event);
|
||||
}
|
||||
|
|
@ -0,0 +1,27 @@
|
|||
#ifndef SETTINGS_POPUP_WIDGET_H
|
||||
#define SETTINGS_POPUP_WIDGET_H
|
||||
|
||||
#include <QLabel>
|
||||
#include <QVBoxLayout>
|
||||
#include <QWidget>
|
||||
|
||||
class SettingsPopupWidget : public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit SettingsPopupWidget(QWidget *parent = nullptr);
|
||||
void addSettingsWidget(QWidget *toAdd) const;
|
||||
|
||||
signals:
|
||||
void aboutToClose();
|
||||
|
||||
protected:
|
||||
void focusOutEvent(QFocusEvent *event) override;
|
||||
void closeEvent(QCloseEvent *event) override;
|
||||
void paintEvent(QPaintEvent *event) override;
|
||||
|
||||
QVBoxLayout *layout;
|
||||
};
|
||||
|
||||
#endif // SETTINGSPOPUP_H
|
||||
|
|
@ -119,9 +119,10 @@ QChar DeckPreviewColorCircleWidget::getColorChar() const
|
|||
DeckPreviewColorIdentityWidget::DeckPreviewColorIdentityWidget(QWidget *parent, const QString &colorIdentity)
|
||||
: QWidget(parent)
|
||||
{
|
||||
QHBoxLayout *layout = new QHBoxLayout(this);
|
||||
layout = new QHBoxLayout(this);
|
||||
layout->setSpacing(5);
|
||||
layout->setContentsMargins(0, 0, 0, 0);
|
||||
layout->setAlignment(Qt::AlignHCenter);
|
||||
setLayout(layout);
|
||||
|
||||
setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Minimum);
|
||||
|
|
@ -143,6 +144,25 @@ DeckPreviewColorIdentityWidget::DeckPreviewColorIdentityWidget(QWidget *parent,
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
connect(&SettingsCache::instance(), &SettingsCache::visualDeckStorageDrawUnusedColorIdentitiesChanged, this,
|
||||
&DeckPreviewColorIdentityWidget::toggleUnusedVisibility);
|
||||
toggleUnusedVisibility(SettingsCache::instance().getVisualDeckStorageDrawUnusedColorIdentities());
|
||||
}
|
||||
|
||||
void DeckPreviewColorIdentityWidget::toggleUnusedVisibility(bool _visible) const
|
||||
{
|
||||
if (_visible) {
|
||||
for (DeckPreviewColorCircleWidget *circle : findChildren<DeckPreviewColorCircleWidget *>()) {
|
||||
circle->setVisible(true);
|
||||
}
|
||||
} else {
|
||||
for (DeckPreviewColorCircleWidget *circle : findChildren<DeckPreviewColorCircleWidget *>()) {
|
||||
if (!circle->getIsActive()) {
|
||||
circle->setHidden(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void DeckPreviewColorIdentityWidget::resizeEvent(QResizeEvent *event)
|
||||
|
|
|
|||
|
|
@ -15,6 +15,10 @@ public:
|
|||
|
||||
void setColorActive(bool active);
|
||||
QChar getColorChar() const;
|
||||
bool getIsActive() const
|
||||
{
|
||||
return isActive;
|
||||
}
|
||||
|
||||
protected:
|
||||
void resizeEvent(QResizeEvent *event) override;
|
||||
|
|
@ -35,8 +39,14 @@ class DeckPreviewColorIdentityWidget : public QWidget
|
|||
public:
|
||||
explicit DeckPreviewColorIdentityWidget(QWidget *parent, const QString &colorIdentity);
|
||||
|
||||
public slots:
|
||||
void toggleUnusedVisibility(bool _visible) const;
|
||||
|
||||
protected:
|
||||
void resizeEvent(QResizeEvent *event) override;
|
||||
|
||||
private:
|
||||
QHBoxLayout *layout;
|
||||
};
|
||||
|
||||
#endif // DECK_PREVIEW_COLOR_IDENTITY_WIDGET_H
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
#include "deck_preview_widget.h"
|
||||
|
||||
#include "../../../../../game/cards/card_database_manager.h"
|
||||
#include "../../../../../settings/cache_settings.h"
|
||||
#include "../../cards/deck_preview_card_picture_widget.h"
|
||||
#include "deck_preview_deck_tags_display_widget.h"
|
||||
|
||||
|
|
@ -30,6 +31,9 @@ DeckPreviewWidget::DeckPreviewWidget(QWidget *_parent,
|
|||
connect(bannerCardDisplayWidget, &DeckPreviewCardPictureWidget::imageDoubleClicked, this,
|
||||
&DeckPreviewWidget::imageDoubleClickedEvent);
|
||||
|
||||
connect(&SettingsCache::instance(), &SettingsCache::visualDeckStorageShowTagsOnDeckPreviewsChanged, this,
|
||||
&DeckPreviewWidget::updateTagsVisibility);
|
||||
|
||||
layout->addWidget(bannerCardDisplayWidget);
|
||||
}
|
||||
|
||||
|
|
@ -51,6 +55,7 @@ void DeckPreviewWidget::initializeUi(const bool deckLoadSuccess)
|
|||
|
||||
colorIdentityWidget = new DeckPreviewColorIdentityWidget(this, getColorIdentity());
|
||||
deckTagsDisplayWidget = new DeckPreviewDeckTagsDisplayWidget(this, deckLoader);
|
||||
updateTagsVisibility(SettingsCache::instance().getVisualDeckStorageShowTagsOnDeckPreviews());
|
||||
|
||||
layout->addWidget(colorIdentityWidget);
|
||||
layout->addWidget(deckTagsDisplayWidget);
|
||||
|
|
@ -72,6 +77,15 @@ bool DeckPreviewWidget::checkVisibility() const
|
|||
return true;
|
||||
}
|
||||
|
||||
void DeckPreviewWidget::updateTagsVisibility(bool visible)
|
||||
{
|
||||
if (visible) {
|
||||
deckTagsDisplayWidget->setVisible(true);
|
||||
} else {
|
||||
deckTagsDisplayWidget->setHidden(true);
|
||||
}
|
||||
}
|
||||
|
||||
QString DeckPreviewWidget::getColorIdentity()
|
||||
{
|
||||
QStringList cardList = deckLoader->getCardList();
|
||||
|
|
|
|||
|
|
@ -45,6 +45,7 @@ public slots:
|
|||
void imageDoubleClickedEvent(QMouseEvent *event, DeckPreviewCardPictureWidget *instance);
|
||||
void initializeUi(bool deckLoadSuccess);
|
||||
void updateVisibility();
|
||||
void updateTagsVisibility(bool visible);
|
||||
};
|
||||
|
||||
#endif // DECK_PREVIEW_WIDGET_H
|
||||
|
|
|
|||
|
|
@ -172,7 +172,7 @@ void VisualDeckStorageFolderDisplayWidget::updateShowFolders(bool enabled)
|
|||
if (!showFolders) {
|
||||
flattenFolderStructure();
|
||||
} else {
|
||||
// if setting was switched from disabled to enabled, we assume that there isn't any existing subfolders
|
||||
// if setting was switched from disabled to enabled, we assume that there aren't any existing subfolders
|
||||
createWidgetsForFiles();
|
||||
createWidgetsForFolders();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@
|
|||
|
||||
#include "../../../../game/cards/card_database_manager.h"
|
||||
#include "../../../../settings/cache_settings.h"
|
||||
#include "../quick_settings/settings_button_widget.h"
|
||||
#include "deck_preview/deck_preview_widget.h"
|
||||
#include "visual_deck_storage_folder_display_widget.h"
|
||||
#include "visual_deck_storage_search_widget.h"
|
||||
|
|
@ -24,37 +25,59 @@ VisualDeckStorageWidget::VisualDeckStorageWidget(QWidget *parent) : QWidget(pare
|
|||
setLayout(layout);
|
||||
|
||||
// search bar row
|
||||
searchAndSortLayout = new QHBoxLayout(this);
|
||||
searchAndSortContainer = new QWidget(this);
|
||||
searchAndSortLayout = new QHBoxLayout(searchAndSortContainer);
|
||||
searchAndSortLayout->setSpacing(3);
|
||||
searchAndSortLayout->setContentsMargins(9, 0, 9, 0);
|
||||
searchAndSortContainer->setLayout(searchAndSortLayout);
|
||||
|
||||
deckPreviewColorIdentityFilterWidget = new DeckPreviewColorIdentityFilterWidget(this);
|
||||
sortWidget = new VisualDeckStorageSortWidget(this);
|
||||
searchWidget = new VisualDeckStorageSearchWidget(this);
|
||||
|
||||
searchAndSortLayout->addWidget(deckPreviewColorIdentityFilterWidget);
|
||||
searchAndSortLayout->addWidget(sortWidget);
|
||||
searchAndSortLayout->addWidget(searchWidget);
|
||||
|
||||
// checkbox row
|
||||
QHBoxLayout *checkBoxLayout = new QHBoxLayout(this);
|
||||
checkBoxLayout->setContentsMargins(9, 0, 9, 0);
|
||||
|
||||
showFoldersCheckBox = new QCheckBox(this);
|
||||
showFoldersCheckBox->setChecked(SettingsCache::instance().getVisualDeckStorageShowFolders());
|
||||
connect(showFoldersCheckBox, &QCheckBox::QT_STATE_CHANGED, this, &VisualDeckStorageWidget::updateShowFolders);
|
||||
connect(showFoldersCheckBox, &QCheckBox::QT_STATE_CHANGED, &SettingsCache::instance(),
|
||||
&SettingsCache::setVisualDeckStorageShowFolders);
|
||||
|
||||
checkBoxLayout->addWidget(showFoldersCheckBox);
|
||||
checkBoxLayout->addStretch();
|
||||
tagFilterVisibilityCheckBox = new QCheckBox(this);
|
||||
tagFilterVisibilityCheckBox->setChecked(SettingsCache::instance().getVisualDeckStorageShowTagFilter());
|
||||
connect(tagFilterVisibilityCheckBox, &QCheckBox::QT_STATE_CHANGED, this,
|
||||
&VisualDeckStorageWidget::updateTagsVisibility);
|
||||
connect(tagFilterVisibilityCheckBox, &QCheckBox::QT_STATE_CHANGED, &SettingsCache::instance(),
|
||||
&SettingsCache::setVisualDeckStorageShowTagFilter);
|
||||
|
||||
// tag filter box
|
||||
tagFilterWidget = new VisualDeckStorageTagFilterWidget(this);
|
||||
tagsOnWidgetsVisibilityCheckBox = new QCheckBox(this);
|
||||
tagsOnWidgetsVisibilityCheckBox->setChecked(SettingsCache::instance().getVisualDeckStorageShowTagsOnDeckPreviews());
|
||||
connect(tagsOnWidgetsVisibilityCheckBox, &QCheckBox::QT_STATE_CHANGED, &SettingsCache::instance(),
|
||||
&SettingsCache::setVisualDeckStorageShowTagsOnDeckPreviews);
|
||||
|
||||
drawUnusedColorIdentitiesCheckBox = new QCheckBox(this);
|
||||
drawUnusedColorIdentitiesCheckBox->setChecked(
|
||||
SettingsCache::instance().getVisualDeckStorageDrawUnusedColorIdentities());
|
||||
connect(drawUnusedColorIdentitiesCheckBox, &QCheckBox::QT_STATE_CHANGED, &SettingsCache::instance(),
|
||||
&SettingsCache::setVisualDeckStorageDrawUnusedColorIdentities);
|
||||
|
||||
// card size slider
|
||||
cardSizeWidget = new CardSizeWidget(this, nullptr, SettingsCache::instance().getVisualDeckStorageCardSize());
|
||||
|
||||
quickSettingsWidget = new SettingsButtonWidget(this);
|
||||
quickSettingsWidget->addSettingsWidget(showFoldersCheckBox);
|
||||
quickSettingsWidget->addSettingsWidget(tagFilterVisibilityCheckBox);
|
||||
quickSettingsWidget->addSettingsWidget(tagsOnWidgetsVisibilityCheckBox);
|
||||
quickSettingsWidget->addSettingsWidget(drawUnusedColorIdentitiesCheckBox);
|
||||
quickSettingsWidget->addSettingsWidget(cardSizeWidget);
|
||||
|
||||
searchAndSortLayout->addWidget(deckPreviewColorIdentityFilterWidget);
|
||||
searchAndSortLayout->addWidget(sortWidget);
|
||||
searchAndSortLayout->addWidget(searchWidget);
|
||||
searchAndSortLayout->addWidget(quickSettingsWidget);
|
||||
|
||||
// tag filter box
|
||||
tagFilterWidget = new VisualDeckStorageTagFilterWidget(this);
|
||||
updateTagsVisibility(SettingsCache::instance().getVisualDeckStorageShowTagFilter());
|
||||
|
||||
// deck area
|
||||
scrollArea = new QScrollArea(this);
|
||||
scrollArea->setVerticalScrollBarPolicy(Qt::ScrollBarAsNeeded);
|
||||
|
|
@ -62,11 +85,9 @@ VisualDeckStorageWidget::VisualDeckStorageWidget(QWidget *parent) : QWidget(pare
|
|||
scrollArea->setWidgetResizable(true);
|
||||
|
||||
// putting everything together
|
||||
layout->addLayout(searchAndSortLayout);
|
||||
layout->addLayout(checkBoxLayout);
|
||||
layout->addWidget(searchAndSortContainer);
|
||||
layout->addWidget(tagFilterWidget);
|
||||
layout->addWidget(scrollArea);
|
||||
layout->addWidget(cardSizeWidget);
|
||||
|
||||
connect(CardDatabaseManager::getInstance(), &CardDatabase::cardDatabaseLoadingFinished, this,
|
||||
&VisualDeckStorageWidget::createRootFolderWidget);
|
||||
|
|
@ -108,6 +129,9 @@ void VisualDeckStorageWidget::retranslateUi()
|
|||
databaseLoadIndicator->setText(tr("Loading database ..."));
|
||||
|
||||
showFoldersCheckBox->setText(tr("Show Folders"));
|
||||
tagFilterVisibilityCheckBox->setText(tr("Show Tag Filter"));
|
||||
tagsOnWidgetsVisibilityCheckBox->setText(tr("Show Tags On Deck Previews"));
|
||||
drawUnusedColorIdentitiesCheckBox->setText(tr("Draw not contained Color Identities"));
|
||||
}
|
||||
|
||||
void VisualDeckStorageWidget::deckPreviewClickedEvent(QMouseEvent *event, DeckPreviewWidget *instance)
|
||||
|
|
@ -174,3 +198,13 @@ void VisualDeckStorageWidget::updateSearchFilter()
|
|||
}
|
||||
emit searchFilterUpdated();
|
||||
}
|
||||
|
||||
void VisualDeckStorageWidget::updateTagsVisibility(const bool visible)
|
||||
{
|
||||
if (visible) {
|
||||
tagFilterWidget->setVisible(true);
|
||||
|
||||
} else {
|
||||
tagFilterWidget->setHidden(true);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -4,6 +4,7 @@
|
|||
#include "../../../../deck/deck_list_model.h"
|
||||
#include "../../../ui/widgets/general/layout_containers/flow_widget.h"
|
||||
#include "../cards/card_size_widget.h"
|
||||
#include "../quick_settings/settings_button_widget.h"
|
||||
#include "deck_preview/deck_preview_color_identity_filter_widget.h"
|
||||
#include "deck_preview/deck_preview_widget.h"
|
||||
#include "visual_deck_storage_folder_display_widget.h"
|
||||
|
|
@ -24,8 +25,8 @@ class VisualDeckStorageWidget final : public QWidget
|
|||
Q_OBJECT
|
||||
public:
|
||||
explicit VisualDeckStorageWidget(QWidget *parent);
|
||||
|
||||
void retranslateUi();
|
||||
|
||||
CardSizeWidget *cardSizeWidget;
|
||||
VisualDeckStorageTagFilterWidget *tagFilterWidget;
|
||||
|
||||
|
|
@ -37,6 +38,7 @@ public slots:
|
|||
void updateTagFilter();
|
||||
void updateColorFilter();
|
||||
void updateSearchFilter();
|
||||
void updateTagsVisibility(bool visible);
|
||||
void updateSortOrder();
|
||||
void resizeEvent(QResizeEvent *event) override;
|
||||
void showEvent(QShowEvent *event) override;
|
||||
|
|
@ -52,15 +54,18 @@ signals:
|
|||
|
||||
private:
|
||||
QVBoxLayout *layout;
|
||||
QWidget *searchAndSortContainer;
|
||||
QHBoxLayout *searchAndSortLayout;
|
||||
DeckListModel *deckListModel;
|
||||
QLabel *databaseLoadIndicator;
|
||||
VisualDeckStorageSortWidget *sortWidget;
|
||||
VisualDeckStorageSearchWidget *searchWidget;
|
||||
DeckPreviewColorIdentityFilterWidget *deckPreviewColorIdentityFilterWidget;
|
||||
|
||||
SettingsButtonWidget *quickSettingsWidget;
|
||||
QCheckBox *showFoldersCheckBox;
|
||||
|
||||
QCheckBox *drawUnusedColorIdentitiesCheckBox;
|
||||
QCheckBox *tagFilterVisibilityCheckBox;
|
||||
QCheckBox *tagsOnWidgetsVisibilityCheckBox;
|
||||
QScrollArea *scrollArea;
|
||||
VisualDeckStorageFolderDisplayWidget *folderWidget;
|
||||
};
|
||||
|
|
|
|||
|
|
@ -258,15 +258,14 @@ SettingsCache::SettingsCache()
|
|||
bumpSetsWithCardsInDeckToTop = settings->value("cards/bumpsetswithcardsindecktotop", true).toBool();
|
||||
printingSelectorSortOrder = settings->value("cards/printingselectorsortorder", 1).toInt();
|
||||
printingSelectorCardSize = settings->value("cards/printingselectorcardsize", 100).toInt();
|
||||
printingSelectorSortOptionsVisible = settings->value("cards/printingselectorsortoptionsvisible", true).toBool();
|
||||
printingSelectorSearchBarVisible = settings->value("cards/printingselectorcardsearchbarvisible", true).toBool();
|
||||
printingSelectorCardSizeSliderVisible =
|
||||
settings->value("cards/printingselectorcardsizeslidervisible", true).toBool();
|
||||
printingSelectorNavigationButtonsVisible =
|
||||
settings->value("cards/printingselectornavigationbuttonsvisible", true).toBool();
|
||||
visualDeckStorageCardSize = settings->value("cards/visualdeckstoragecardsize", 100).toInt();
|
||||
visualDeckStorageCardSize = settings->value("interface/visualdeckstoragecardsize", 100).toInt();
|
||||
visualDeckStorageSortingOrder = settings->value("interface/visualdeckstoragesortingorder", 0).toInt();
|
||||
visualDeckStorageShowFolders = settings->value("interface/visualdeckstorageshowfolders", true).toBool();
|
||||
visualDeckStorageShowTagFilter = settings->value("interface/visualdeckstorageshowtagfilter", true).toBool();
|
||||
visualDeckStorageShowTagsOnDeckPreviews =
|
||||
settings->value("interface/visualdeckstorageshowtagsondeckpreviews", true).toBool();
|
||||
visualDeckStorageDrawUnusedColorIdentities =
|
||||
settings->value("interface/visualdeckstoragedrawunusedcoloridentities", true).toBool();
|
||||
visualDeckStorageUnusedColorIdentitiesOpacity =
|
||||
|
|
@ -645,27 +644,6 @@ void SettingsCache::setPrintingSelectorCardSize(int _printingSelectorCardSize)
|
|||
emit printingSelectorCardSizeChanged();
|
||||
}
|
||||
|
||||
void SettingsCache::setPrintingSelectorSortOptionsVisible(QT_STATE_CHANGED_T _sortOptionsVisible)
|
||||
{
|
||||
printingSelectorSortOptionsVisible = _sortOptionsVisible;
|
||||
settings->setValue("cards/printingselectorsortoptionsvisible", printingSelectorSortOptionsVisible);
|
||||
emit printingSelectorSortOptionsVisibleChanged();
|
||||
}
|
||||
|
||||
void SettingsCache::setPrintingSelectorSearchBarVisible(QT_STATE_CHANGED_T _searchBarVisible)
|
||||
{
|
||||
printingSelectorSearchBarVisible = _searchBarVisible;
|
||||
settings->setValue("cards/printingselectorsearchbarvisible", printingSelectorSearchBarVisible);
|
||||
emit printingSelectorSearchBarVisibleChanged();
|
||||
}
|
||||
|
||||
void SettingsCache::setPrintingSelectorCardSizeSliderVisible(QT_STATE_CHANGED_T _cardSizeSliderVisible)
|
||||
{
|
||||
printingSelectorCardSizeSliderVisible = _cardSizeSliderVisible;
|
||||
settings->setValue("cards/printingselectorcardsizeslidervisible", printingSelectorCardSizeSliderVisible);
|
||||
emit printingSelectorCardSizeSliderVisibleChanged();
|
||||
}
|
||||
|
||||
void SettingsCache::setPrintingSelectorNavigationButtonsVisible(QT_STATE_CHANGED_T _navigationButtonsVisible)
|
||||
{
|
||||
printingSelectorNavigationButtonsVisible = _navigationButtonsVisible;
|
||||
|
|
@ -685,10 +663,24 @@ void SettingsCache::setVisualDeckStorageShowFolders(QT_STATE_CHANGED_T value)
|
|||
settings->setValue("interface/visualdeckstorageshowfolders", visualDeckStorageShowFolders);
|
||||
}
|
||||
|
||||
void SettingsCache::setVisualDeckStorageShowTagFilter(QT_STATE_CHANGED_T _showTags)
|
||||
{
|
||||
visualDeckStorageShowTagFilter = _showTags;
|
||||
settings->setValue("interface/visualdeckstorageshowtagfilter", visualDeckStorageShowTagFilter);
|
||||
emit visualDeckStorageShowTagFilterChanged(visualDeckStorageShowTagFilter);
|
||||
}
|
||||
|
||||
void SettingsCache::setVisualDeckStorageShowTagsOnDeckPreviews(QT_STATE_CHANGED_T _showTags)
|
||||
{
|
||||
visualDeckStorageShowTagsOnDeckPreviews = _showTags;
|
||||
settings->setValue("interface/visualdeckstorageshowtagsondeckpreviews", visualDeckStorageShowTagsOnDeckPreviews);
|
||||
emit visualDeckStorageShowTagsOnDeckPreviewsChanged(visualDeckStorageShowTagsOnDeckPreviews);
|
||||
}
|
||||
|
||||
void SettingsCache::setVisualDeckStorageCardSize(int _visualDeckStorageCardSize)
|
||||
{
|
||||
visualDeckStorageCardSize = _visualDeckStorageCardSize;
|
||||
settings->setValue("cards/visualdeckstoragecardsize", visualDeckStorageCardSize);
|
||||
settings->setValue("interface/visualdeckstoragecardsize", visualDeckStorageCardSize);
|
||||
emit visualDeckStorageCardSizeChanged();
|
||||
}
|
||||
|
||||
|
|
@ -696,13 +688,15 @@ void SettingsCache::setVisualDeckStorageDrawUnusedColorIdentities(
|
|||
QT_STATE_CHANGED_T _visualDeckStorageDrawUnusedColorIdentities)
|
||||
{
|
||||
visualDeckStorageDrawUnusedColorIdentities = _visualDeckStorageDrawUnusedColorIdentities;
|
||||
settings->setValue("cards/visualdeckstoragedrawunusedcoloridentities", visualDeckStorageDrawUnusedColorIdentities);
|
||||
settings->setValue("interface/visualdeckstoragedrawunusedcoloridentities",
|
||||
visualDeckStorageDrawUnusedColorIdentities);
|
||||
emit visualDeckStorageDrawUnusedColorIdentitiesChanged(visualDeckStorageDrawUnusedColorIdentities);
|
||||
}
|
||||
|
||||
void SettingsCache::setVisualDeckStorageUnusedColorIdentitiesOpacity(int _visualDeckStorageUnusedColorIdentitiesOpacity)
|
||||
{
|
||||
visualDeckStorageUnusedColorIdentitiesOpacity = _visualDeckStorageUnusedColorIdentitiesOpacity;
|
||||
settings->setValue("cards/visualdeckstorageunusedcoloridentitiesopacity",
|
||||
settings->setValue("interface/visualdeckstorageunusedcoloridentitiesopacity",
|
||||
visualDeckStorageUnusedColorIdentitiesOpacity);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -58,11 +58,11 @@ signals:
|
|||
void bumpSetsWithCardsInDeckToTopChanged();
|
||||
void printingSelectorSortOrderChanged();
|
||||
void printingSelectorCardSizeChanged();
|
||||
void printingSelectorSortOptionsVisibleChanged();
|
||||
void printingSelectorSearchBarVisibleChanged();
|
||||
void printingSelectorCardSizeSliderVisibleChanged();
|
||||
void printingSelectorNavigationButtonsVisibleChanged();
|
||||
void visualDeckStorageShowTagFilterChanged(bool _visible);
|
||||
void visualDeckStorageShowTagsOnDeckPreviewsChanged(bool _visible);
|
||||
void visualDeckStorageCardSizeChanged();
|
||||
void visualDeckStorageDrawUnusedColorIdentitiesChanged(bool _visible);
|
||||
void visualDeckStorageInGameChanged(bool enabled);
|
||||
void horizontalHandChanged();
|
||||
void handJustificationChanged();
|
||||
|
|
@ -126,12 +126,11 @@ private:
|
|||
bool bumpSetsWithCardsInDeckToTop;
|
||||
int printingSelectorSortOrder;
|
||||
int printingSelectorCardSize;
|
||||
bool printingSelectorSortOptionsVisible;
|
||||
bool printingSelectorSearchBarVisible;
|
||||
bool printingSelectorCardSizeSliderVisible;
|
||||
bool printingSelectorNavigationButtonsVisible;
|
||||
int visualDeckStorageSortingOrder;
|
||||
bool visualDeckStorageShowFolders;
|
||||
bool visualDeckStorageShowTagsOnDeckPreviews;
|
||||
bool visualDeckStorageShowTagFilter;
|
||||
int visualDeckStorageCardSize;
|
||||
bool visualDeckStorageDrawUnusedColorIdentities;
|
||||
int visualDeckStorageUnusedColorIdentitiesOpacity;
|
||||
|
|
@ -397,18 +396,6 @@ public:
|
|||
{
|
||||
return printingSelectorCardSize;
|
||||
}
|
||||
bool getPrintingSelectorSortOptionsVisible() const
|
||||
{
|
||||
return printingSelectorSortOptionsVisible;
|
||||
}
|
||||
bool getPrintingSelectorSearchBarVisible() const
|
||||
{
|
||||
return printingSelectorSearchBarVisible;
|
||||
}
|
||||
bool getPrintingSelectorCardSizeSliderVisible() const
|
||||
{
|
||||
return printingSelectorCardSizeSliderVisible;
|
||||
}
|
||||
bool getPrintingSelectorNavigationButtonsVisible() const
|
||||
{
|
||||
return printingSelectorNavigationButtonsVisible;
|
||||
|
|
@ -421,6 +408,14 @@ public:
|
|||
{
|
||||
return visualDeckStorageShowFolders;
|
||||
}
|
||||
bool getVisualDeckStorageShowTagFilter() const
|
||||
{
|
||||
return visualDeckStorageShowTagFilter;
|
||||
}
|
||||
bool getVisualDeckStorageShowTagsOnDeckPreviews() const
|
||||
{
|
||||
return visualDeckStorageShowTagsOnDeckPreviews;
|
||||
}
|
||||
int getVisualDeckStorageCardSize() const
|
||||
{
|
||||
return visualDeckStorageCardSize;
|
||||
|
|
@ -761,12 +756,11 @@ public slots:
|
|||
void setBumpSetsWithCardsInDeckToTop(QT_STATE_CHANGED_T _bumpSetsWithCardsInDeckToTop);
|
||||
void setPrintingSelectorSortOrder(int _printingSelectorSortOrder);
|
||||
void setPrintingSelectorCardSize(int _printingSelectorCardSize);
|
||||
void setPrintingSelectorSortOptionsVisible(QT_STATE_CHANGED_T _sortOptionsVisible);
|
||||
void setPrintingSelectorSearchBarVisible(QT_STATE_CHANGED_T _searchBarVisible);
|
||||
void setPrintingSelectorCardSizeSliderVisible(QT_STATE_CHANGED_T _cardSizeSliderVisible);
|
||||
void setPrintingSelectorNavigationButtonsVisible(QT_STATE_CHANGED_T _navigationButtonsVisible);
|
||||
void setVisualDeckStorageSortingOrder(int _visualDeckStorageSortingOrder);
|
||||
void setVisualDeckStorageShowFolders(QT_STATE_CHANGED_T value);
|
||||
void setVisualDeckStorageShowTagFilter(QT_STATE_CHANGED_T _showTags);
|
||||
void setVisualDeckStorageShowTagsOnDeckPreviews(QT_STATE_CHANGED_T _showTags);
|
||||
void setVisualDeckStorageCardSize(int _visualDeckStorageCardSize);
|
||||
void setVisualDeckStorageDrawUnusedColorIdentities(QT_STATE_CHANGED_T _visualDeckStorageDrawUnusedColorIdentities);
|
||||
void setVisualDeckStorageUnusedColorIdentitiesOpacity(int _visualDeckStorageUnusedColorIdentitiesOpacity);
|
||||
|
|
|
|||
|
|
@ -196,15 +196,6 @@ void SettingsCache::setPrintingSelectorSortOrder(int /* _printingSelectorSortOrd
|
|||
void SettingsCache::setPrintingSelectorCardSize(int /* _printingSelectorCardSize */)
|
||||
{
|
||||
}
|
||||
void SettingsCache::setPrintingSelectorSortOptionsVisible(QT_STATE_CHANGED_T /* _sortOptionsVisible */)
|
||||
{
|
||||
}
|
||||
void SettingsCache::setPrintingSelectorSearchBarVisible(QT_STATE_CHANGED_T /* _searchBarVisible */)
|
||||
{
|
||||
}
|
||||
void SettingsCache::setPrintingSelectorCardSizeSliderVisible(QT_STATE_CHANGED_T /* _cardSizeSliderVisible */)
|
||||
{
|
||||
}
|
||||
void SettingsCache::setPrintingSelectorNavigationButtonsVisible(QT_STATE_CHANGED_T /* _navigationButtonsVisible */)
|
||||
{
|
||||
}
|
||||
|
|
@ -214,6 +205,12 @@ void SettingsCache::setVisualDeckStorageSortingOrder(int /* _visualDeckStorageSo
|
|||
void SettingsCache::setVisualDeckStorageShowFolders(QT_STATE_CHANGED_T /* value */)
|
||||
{
|
||||
}
|
||||
void SettingsCache::setVisualDeckStorageShowTagFilter(QT_STATE_CHANGED_T /* _showTags */)
|
||||
{
|
||||
}
|
||||
void SettingsCache::setVisualDeckStorageShowTagsOnDeckPreviews(QT_STATE_CHANGED_T /* _showTags */)
|
||||
{
|
||||
}
|
||||
void SettingsCache::setVisualDeckStorageCardSize(int /* _visualDeckStorageCardSize */)
|
||||
{
|
||||
}
|
||||
|
|
|
|||
|
|
@ -200,15 +200,6 @@ void SettingsCache::setPrintingSelectorSortOrder(int /* _printingSelectorSortOrd
|
|||
void SettingsCache::setPrintingSelectorCardSize(int /* _printingSelectorCardSize */)
|
||||
{
|
||||
}
|
||||
void SettingsCache::setPrintingSelectorSortOptionsVisible(QT_STATE_CHANGED_T /* _sortOptionsVisible */)
|
||||
{
|
||||
}
|
||||
void SettingsCache::setPrintingSelectorSearchBarVisible(QT_STATE_CHANGED_T /* _searchBarVisible */)
|
||||
{
|
||||
}
|
||||
void SettingsCache::setPrintingSelectorCardSizeSliderVisible(QT_STATE_CHANGED_T /* _cardSizeSliderVisible */)
|
||||
{
|
||||
}
|
||||
void SettingsCache::setPrintingSelectorNavigationButtonsVisible(QT_STATE_CHANGED_T /* _navigationButtonsVisible */)
|
||||
{
|
||||
}
|
||||
|
|
@ -218,6 +209,12 @@ void SettingsCache::setVisualDeckStorageSortingOrder(int /* _visualDeckStorageSo
|
|||
void SettingsCache::setVisualDeckStorageShowFolders(QT_STATE_CHANGED_T /* value */)
|
||||
{
|
||||
}
|
||||
void SettingsCache::setVisualDeckStorageShowTagFilter(QT_STATE_CHANGED_T /* _showTags */)
|
||||
{
|
||||
}
|
||||
void SettingsCache::setVisualDeckStorageShowTagsOnDeckPreviews(QT_STATE_CHANGED_T /* _showTags */)
|
||||
{
|
||||
}
|
||||
void SettingsCache::setVisualDeckStorageCardSize(int /* _visualDeckStorageCardSize */)
|
||||
{
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user