From 22f98f28e015a467f71262bf6ae692ac00e84546 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lukas=20Br=C3=BCbach?= Date: Wed, 18 Jun 2025 22:59:40 +0200 Subject: [PATCH] Add the button to the print selector instead. --- cockatrice/CMakeLists.txt | 1 + .../printing_selector/printing_selector.cpp | 16 ---------------- .../printing_selector/printing_selector.h | 6 ++++-- .../printing_selector_card_selection_widget.cpp | 16 ++++++++++++++++ .../printing_selector_card_selection_widget.h | 4 ++++ .../src/dialogs/dlg_select_set_for_cards.cpp | 2 ++ 6 files changed, 27 insertions(+), 18 deletions(-) diff --git a/cockatrice/CMakeLists.txt b/cockatrice/CMakeLists.txt index fbb779701..f69f3de15 100644 --- a/cockatrice/CMakeLists.txt +++ b/cockatrice/CMakeLists.txt @@ -169,6 +169,7 @@ set(cockatrice_SOURCES src/dialogs/dlg_move_top_cards_until.cpp src/dialogs/dlg_register.cpp src/dialogs/dlg_roll_dice.cpp + src/dialogs/dlg_select_set_for_cards.cpp src/dialogs/dlg_settings.cpp src/dialogs/dlg_tip_of_the_day.cpp src/dialogs/dlg_update.cpp diff --git a/cockatrice/src/client/ui/widgets/printing_selector/printing_selector.cpp b/cockatrice/src/client/ui/widgets/printing_selector/printing_selector.cpp index 1746c1b93..0bb7061fd 100644 --- a/cockatrice/src/client/ui/widgets/printing_selector/printing_selector.cpp +++ b/cockatrice/src/client/ui/widgets/printing_selector/printing_selector.cpp @@ -88,13 +88,6 @@ PrintingSelector::PrintingSelector(QWidget *parent, AbstractTabDeckEditor *_deck sortAndOptionsLayout->addWidget(searchBar); sortAndOptionsLayout->addWidget(displayOptionsWidget); - searchAndSetLayout->addWidget(searchBar); - - selectSetForCardsButton = new QPushButton(this); - connect(selectSetForCardsButton, &QPushButton::clicked, this, &PrintingSelector::selectSetForCards); - searchAndSetLayout->addWidget(selectSetForCardsButton); - - layout->addLayout(searchAndSetLayout); layout->addWidget(sortAndOptionsContainer); @@ -114,7 +107,6 @@ PrintingSelector::PrintingSelector(QWidget *parent, AbstractTabDeckEditor *_deck void PrintingSelector::retranslateUi() { navigationCheckBox->setText(tr("Display Navigation Buttons")); - selectSetForCardsButton->setText(tr("Bulk Selection")); if (warningLabel) { warningLabel->setText( @@ -277,11 +269,3 @@ void PrintingSelector::toggleVisibilityNavigationButtons(bool _state) { cardSelectionBar->setVisible(_state); } - -void PrintingSelector::selectSetForCards() -{ - DlgSelectSetForCards *setSelectionDialog = new DlgSelectSetForCards(nullptr, deckModel); - if (!setSelectionDialog->exec()) { - return; - } -} diff --git a/cockatrice/src/client/ui/widgets/printing_selector/printing_selector.h b/cockatrice/src/client/ui/widgets/printing_selector/printing_selector.h index 0d8b59531..388592208 100644 --- a/cockatrice/src/client/ui/widgets/printing_selector/printing_selector.h +++ b/cockatrice/src/client/ui/widgets/printing_selector/printing_selector.h @@ -30,6 +30,10 @@ public: void setCard(const CardInfoPtr &newCard, const QString &_currentZone); void getAllSetsForCurrentCard(); + DeckListModel *getDeckModel() const + { + return deckModel; + }; public slots: void retranslateUi(); @@ -37,7 +41,6 @@ public slots: void selectPreviousCard(); void selectNextCard(); void toggleVisibilityNavigationButtons(bool _state); - void selectSetForCards(); private slots: void printingsInDeckChanged(); @@ -51,7 +54,6 @@ private: QLabel *warningLabel; PrintingSelectorCardSortingWidget *sortToolBar; PrintingSelectorCardSearchWidget *searchBar; - QPushButton *selectSetForCardsButton; FlowWidget *flowWidget; CardSizeWidget *cardSizeWidget; PrintingSelectorCardSelectionWidget *cardSelectionBar; diff --git a/cockatrice/src/client/ui/widgets/printing_selector/printing_selector_card_selection_widget.cpp b/cockatrice/src/client/ui/widgets/printing_selector/printing_selector_card_selection_widget.cpp index b4cace6d0..238795273 100644 --- a/cockatrice/src/client/ui/widgets/printing_selector/printing_selector_card_selection_widget.cpp +++ b/cockatrice/src/client/ui/widgets/printing_selector/printing_selector_card_selection_widget.cpp @@ -1,5 +1,7 @@ #include "printing_selector_card_selection_widget.h" +#include "../../../../dialogs/dlg_select_set_for_cards.h" + /** * @brief Constructs a PrintingSelectorCardSelectionWidget for navigating through cards in the deck. * @@ -16,12 +18,18 @@ PrintingSelectorCardSelectionWidget::PrintingSelectorCardSelectionWidget(Printin previousCardButton = new QPushButton(this); previousCardButton->setText(tr("Previous Card in Deck")); + selectSetForCardsButton = new QPushButton(this); + connect(selectSetForCardsButton, &QPushButton::clicked, this, + &PrintingSelectorCardSelectionWidget::selectSetForCards); + selectSetForCardsButton->setText(tr("Bulk Selection")); + nextCardButton = new QPushButton(this); nextCardButton->setText(tr("Next Card in Deck")); connectSignals(); cardSelectionBarLayout->addWidget(previousCardButton); + cardSelectionBarLayout->addWidget(selectSetForCardsButton); cardSelectionBarLayout->addWidget(nextCardButton); } @@ -36,3 +44,11 @@ void PrintingSelectorCardSelectionWidget::connectSignals() connect(previousCardButton, &QPushButton::clicked, parent, &PrintingSelector::selectPreviousCard); connect(nextCardButton, &QPushButton::clicked, parent, &PrintingSelector::selectNextCard); } + +void PrintingSelectorCardSelectionWidget::selectSetForCards() +{ + DlgSelectSetForCards *setSelectionDialog = new DlgSelectSetForCards(nullptr, parent->getDeckModel()); + if (!setSelectionDialog->exec()) { + return; + } +} diff --git a/cockatrice/src/client/ui/widgets/printing_selector/printing_selector_card_selection_widget.h b/cockatrice/src/client/ui/widgets/printing_selector/printing_selector_card_selection_widget.h index 4bb2b048f..89229bda8 100644 --- a/cockatrice/src/client/ui/widgets/printing_selector/printing_selector_card_selection_widget.h +++ b/cockatrice/src/client/ui/widgets/printing_selector/printing_selector_card_selection_widget.h @@ -16,10 +16,14 @@ public: void connectSignals(); +public slots: + void selectSetForCards(); + private: PrintingSelector *parent; QHBoxLayout *cardSelectionBarLayout; QPushButton *previousCardButton; + QPushButton *selectSetForCardsButton; QPushButton *nextCardButton; }; diff --git a/cockatrice/src/dialogs/dlg_select_set_for_cards.cpp b/cockatrice/src/dialogs/dlg_select_set_for_cards.cpp index 863b380e1..e439e866f 100644 --- a/cockatrice/src/dialogs/dlg_select_set_for_cards.cpp +++ b/cockatrice/src/dialogs/dlg_select_set_for_cards.cpp @@ -128,6 +128,8 @@ DlgSelectSetForCards::DlgSelectSetForCards(QWidget *parent, DeckListModel *_mode mainLayout->addWidget(buttonBox); retranslateUi(); + setWindowFlags(Qt::Window); + showMaximized(); } void DlgSelectSetForCards::retranslateUi()