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->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<TabDeckEditorVisualTabWidget *>(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);

View File

@@ -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"};