From a1a3b02d3a6eadc3b597df4e1ae1464b092baf9e Mon Sep 17 00:00:00 2001 From: BruebachL <44814898+BruebachL@users.noreply.github.com> Date: Fri, 28 Nov 2025 00:42:46 +0100 Subject: [PATCH] Add clearer labeling, more tooltips, condense layout. (#6361) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Took 17 minutes Co-authored-by: Lukas BrĂ¼bach --- .../visual_deck_editor_widget.cpp | 27 ++++++++++--------- .../visual_deck_editor_widget.h | 4 +-- 2 files changed, 17 insertions(+), 14 deletions(-) diff --git a/cockatrice/src/interface/widgets/visual_deck_editor/visual_deck_editor_widget.cpp b/cockatrice/src/interface/widgets/visual_deck_editor/visual_deck_editor_widget.cpp index 27f5b8e2e..c1e5ead3a 100644 --- a/cockatrice/src/interface/widgets/visual_deck_editor/visual_deck_editor_widget.cpp +++ b/cockatrice/src/interface/widgets/visual_deck_editor/visual_deck_editor_widget.cpp @@ -38,10 +38,6 @@ VisualDeckEditorWidget::VisualDeckEditorWidget(QWidget *parent, mainLayout->setContentsMargins(9, 0, 9, 5); mainLayout->setSpacing(0); - searchContainer = new QWidget(this); - searchLayout = new QHBoxLayout(searchContainer); - searchContainer->setLayout(searchLayout); - searchBar = new QLineEdit(this); connect(searchBar, &QLineEdit::returnPressed, this, [=, this]() { if (!searchBar->hasFocus()) @@ -114,16 +110,13 @@ VisualDeckEditorWidget::VisualDeckEditorWidget(QWidget *parent, } }); - searchLayout->addWidget(searchBar); - searchLayout->addWidget(searchPushButton); - - mainLayout->addWidget(searchContainer); - groupAndSortContainer = new QWidget(this); groupAndSortLayout = new QHBoxLayout(groupAndSortContainer); groupAndSortLayout->setAlignment(Qt::AlignLeft); groupAndSortContainer->setLayout(groupAndSortLayout); + groupByLabel = new QLabel(groupAndSortContainer); + groupByComboBox = new QComboBox(this); if (auto tabWidget = qobject_cast(parent)) { // Inside a central widget QWidget container inside TabDeckEditorVisual @@ -149,6 +142,8 @@ VisualDeckEditorWidget::VisualDeckEditorWidget(QWidget *parent, actChangeActiveGroupCriteria(); } + sortByLabel = new QLabel(groupAndSortContainer); + sortCriteriaButton = new SettingsButtonWidget(this); sortLabel = new QLabel(sortCriteriaButton); @@ -177,9 +172,13 @@ VisualDeckEditorWidget::VisualDeckEditorWidget(QWidget *parent, displayTypeButton = new QPushButton(this); connect(displayTypeButton, &QPushButton::clicked, this, &VisualDeckEditorWidget::updateDisplayType); + groupAndSortLayout->addWidget(groupByLabel); groupAndSortLayout->addWidget(groupByComboBox); + groupAndSortLayout->addWidget(sortByLabel); groupAndSortLayout->addWidget(sortCriteriaButton); groupAndSortLayout->addWidget(displayTypeButton); + groupAndSortLayout->addWidget(searchBar); + groupAndSortLayout->addWidget(searchPushButton); scrollArea = new QScrollArea(this); scrollArea->setWidgetResizable(true); @@ -219,12 +218,16 @@ VisualDeckEditorWidget::VisualDeckEditorWidget(QWidget *parent, void VisualDeckEditorWidget::retranslateUi() { + searchBar->setPlaceholderText(tr("Type a card name here for suggestions from the database...")); + groupByLabel->setText(tr("Group by:")); + groupByComboBox->setToolTip(tr("Change how cards are divided into categories/groups.")); + sortByLabel->setText(tr("Sort by:")); sortLabel->setText(tr("Click and drag to change the sort order within the groups")); searchPushButton->setText(tr("Quick search and add card")); searchPushButton->setToolTip(tr("Search for closest match in the database (with auto-suggestions) and add " "preferred printing to the deck on pressing enter")); sortCriteriaButton->setToolTip(tr("Configure how cards are sorted within their groups")); - displayTypeButton->setText(tr("Overlap Layout")); + displayTypeButton->setText(tr("Toggle Layout: Overlap")); displayTypeButton->setToolTip( tr("Change how cards are displayed within zones (i.e. overlapped or fully visible.)")); } @@ -376,10 +379,10 @@ void VisualDeckEditorWidget::updateDisplayType() // Update UI and emit signal switch (currentDisplayType) { case DisplayType::Flat: - displayTypeButton->setText(tr("Flat Layout")); + displayTypeButton->setText(tr("Toggle Layout: Flat")); break; case DisplayType::Overlap: - displayTypeButton->setText(tr("Overlap Layout")); + displayTypeButton->setText(tr("Toggle Layout: Overlap")); break; } emit displayTypeChanged(currentDisplayType); diff --git a/cockatrice/src/interface/widgets/visual_deck_editor/visual_deck_editor_widget.h b/cockatrice/src/interface/widgets/visual_deck_editor/visual_deck_editor_widget.h index 4cff68407..e8ededc77 100644 --- a/cockatrice/src/interface/widgets/visual_deck_editor/visual_deck_editor_widget.h +++ b/cockatrice/src/interface/widgets/visual_deck_editor/visual_deck_editor_widget.h @@ -82,8 +82,6 @@ private: DeckListModel *deckListModel; QItemSelectionModel *selectionModel; QVBoxLayout *mainLayout; - QWidget *searchContainer; - QHBoxLayout *searchLayout; CardDatabaseModel *cardDatabaseModel; CardDatabaseDisplayModel *cardDatabaseDisplayModel; CardCompleterProxyModel *proxyModel; @@ -93,9 +91,11 @@ private: QPushButton *displayTypeButton; QWidget *groupAndSortContainer; QHBoxLayout *groupAndSortLayout; + QLabel *groupByLabel; QComboBox *groupByComboBox; QString activeGroupCriteria = "maintype"; SettingsButtonWidget *sortCriteriaButton; + QLabel *sortByLabel; QLabel *sortLabel; QListWidget *sortByListWidget; QStringList activeSortCriteria = {"name", "cmc", "colors", "maintype"};