Add clearer labeling, more tooltips, condense layout. (#6361)

Took 17 minutes

Co-authored-by: Lukas Brübach <Bruebach.Lukas@bdosecurity.de>
This commit is contained in:
BruebachL
2025-11-28 00:42:46 +01:00
committed by GitHub
parent bc2ae6c486
commit a1a3b02d3a
2 changed files with 17 additions and 14 deletions

View File

@@ -38,10 +38,6 @@ VisualDeckEditorWidget::VisualDeckEditorWidget(QWidget *parent,
mainLayout->setContentsMargins(9, 0, 9, 5); mainLayout->setContentsMargins(9, 0, 9, 5);
mainLayout->setSpacing(0); mainLayout->setSpacing(0);
searchContainer = new QWidget(this);
searchLayout = new QHBoxLayout(searchContainer);
searchContainer->setLayout(searchLayout);
searchBar = new QLineEdit(this); searchBar = new QLineEdit(this);
connect(searchBar, &QLineEdit::returnPressed, this, [=, this]() { connect(searchBar, &QLineEdit::returnPressed, this, [=, this]() {
if (!searchBar->hasFocus()) if (!searchBar->hasFocus())
@@ -114,16 +110,13 @@ VisualDeckEditorWidget::VisualDeckEditorWidget(QWidget *parent,
} }
}); });
searchLayout->addWidget(searchBar);
searchLayout->addWidget(searchPushButton);
mainLayout->addWidget(searchContainer);
groupAndSortContainer = new QWidget(this); groupAndSortContainer = new QWidget(this);
groupAndSortLayout = new QHBoxLayout(groupAndSortContainer); groupAndSortLayout = new QHBoxLayout(groupAndSortContainer);
groupAndSortLayout->setAlignment(Qt::AlignLeft); groupAndSortLayout->setAlignment(Qt::AlignLeft);
groupAndSortContainer->setLayout(groupAndSortLayout); groupAndSortContainer->setLayout(groupAndSortLayout);
groupByLabel = new QLabel(groupAndSortContainer);
groupByComboBox = new QComboBox(this); groupByComboBox = new QComboBox(this);
if (auto tabWidget = qobject_cast<TabDeckEditorVisualTabWidget *>(parent)) { if (auto tabWidget = qobject_cast<TabDeckEditorVisualTabWidget *>(parent)) {
// Inside a central widget QWidget container inside TabDeckEditorVisual // Inside a central widget QWidget container inside TabDeckEditorVisual
@@ -149,6 +142,8 @@ VisualDeckEditorWidget::VisualDeckEditorWidget(QWidget *parent,
actChangeActiveGroupCriteria(); actChangeActiveGroupCriteria();
} }
sortByLabel = new QLabel(groupAndSortContainer);
sortCriteriaButton = new SettingsButtonWidget(this); sortCriteriaButton = new SettingsButtonWidget(this);
sortLabel = new QLabel(sortCriteriaButton); sortLabel = new QLabel(sortCriteriaButton);
@@ -177,9 +172,13 @@ VisualDeckEditorWidget::VisualDeckEditorWidget(QWidget *parent,
displayTypeButton = new QPushButton(this); displayTypeButton = new QPushButton(this);
connect(displayTypeButton, &QPushButton::clicked, this, &VisualDeckEditorWidget::updateDisplayType); connect(displayTypeButton, &QPushButton::clicked, this, &VisualDeckEditorWidget::updateDisplayType);
groupAndSortLayout->addWidget(groupByLabel);
groupAndSortLayout->addWidget(groupByComboBox); groupAndSortLayout->addWidget(groupByComboBox);
groupAndSortLayout->addWidget(sortByLabel);
groupAndSortLayout->addWidget(sortCriteriaButton); groupAndSortLayout->addWidget(sortCriteriaButton);
groupAndSortLayout->addWidget(displayTypeButton); groupAndSortLayout->addWidget(displayTypeButton);
groupAndSortLayout->addWidget(searchBar);
groupAndSortLayout->addWidget(searchPushButton);
scrollArea = new QScrollArea(this); scrollArea = new QScrollArea(this);
scrollArea->setWidgetResizable(true); scrollArea->setWidgetResizable(true);
@@ -219,12 +218,16 @@ VisualDeckEditorWidget::VisualDeckEditorWidget(QWidget *parent,
void VisualDeckEditorWidget::retranslateUi() 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")); sortLabel->setText(tr("Click and drag to change the sort order within the groups"));
searchPushButton->setText(tr("Quick search and add card")); searchPushButton->setText(tr("Quick search and add card"));
searchPushButton->setToolTip(tr("Search for closest match in the database (with auto-suggestions) and add " searchPushButton->setToolTip(tr("Search for closest match in the database (with auto-suggestions) and add "
"preferred printing to the deck on pressing enter")); "preferred printing to the deck on pressing enter"));
sortCriteriaButton->setToolTip(tr("Configure how cards are sorted within their groups")); sortCriteriaButton->setToolTip(tr("Configure how cards are sorted within their groups"));
displayTypeButton->setText(tr("Overlap Layout")); displayTypeButton->setText(tr("Toggle Layout: Overlap"));
displayTypeButton->setToolTip( displayTypeButton->setToolTip(
tr("Change how cards are displayed within zones (i.e. overlapped or fully visible.)")); 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 // Update UI and emit signal
switch (currentDisplayType) { switch (currentDisplayType) {
case DisplayType::Flat: case DisplayType::Flat:
displayTypeButton->setText(tr("Flat Layout")); displayTypeButton->setText(tr("Toggle Layout: Flat"));
break; break;
case DisplayType::Overlap: case DisplayType::Overlap:
displayTypeButton->setText(tr("Overlap Layout")); displayTypeButton->setText(tr("Toggle Layout: Overlap"));
break; break;
} }
emit displayTypeChanged(currentDisplayType); emit displayTypeChanged(currentDisplayType);

View File

@@ -82,8 +82,6 @@ private:
DeckListModel *deckListModel; DeckListModel *deckListModel;
QItemSelectionModel *selectionModel; QItemSelectionModel *selectionModel;
QVBoxLayout *mainLayout; QVBoxLayout *mainLayout;
QWidget *searchContainer;
QHBoxLayout *searchLayout;
CardDatabaseModel *cardDatabaseModel; CardDatabaseModel *cardDatabaseModel;
CardDatabaseDisplayModel *cardDatabaseDisplayModel; CardDatabaseDisplayModel *cardDatabaseDisplayModel;
CardCompleterProxyModel *proxyModel; CardCompleterProxyModel *proxyModel;
@@ -93,9 +91,11 @@ private:
QPushButton *displayTypeButton; QPushButton *displayTypeButton;
QWidget *groupAndSortContainer; QWidget *groupAndSortContainer;
QHBoxLayout *groupAndSortLayout; QHBoxLayout *groupAndSortLayout;
QLabel *groupByLabel;
QComboBox *groupByComboBox; QComboBox *groupByComboBox;
QString activeGroupCriteria = "maintype"; QString activeGroupCriteria = "maintype";
SettingsButtonWidget *sortCriteriaButton; SettingsButtonWidget *sortCriteriaButton;
QLabel *sortByLabel;
QLabel *sortLabel; QLabel *sortLabel;
QListWidget *sortByListWidget; QListWidget *sortByListWidget;
QStringList activeSortCriteria = {"name", "cmc", "colors", "maintype"}; QStringList activeSortCriteria = {"name", "cmc", "colors", "maintype"};