mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-07-18 08:22:15 -07:00
Lint some stuff.
This commit is contained in:
parent
6fd3fd55a9
commit
238a6266d6
5 changed files with 41 additions and 11 deletions
|
|
@ -103,8 +103,9 @@ DeckPreviewColorIdentityFilterWidget::DeckPreviewColorIdentityFilterWidget(Visua
|
|||
connect(circle, &DeckPreviewColorIdentityFilterCircleWidget::colorToggled, this,
|
||||
&DeckPreviewColorIdentityFilterWidget::handleColorToggled);
|
||||
}
|
||||
toggleButton = new QPushButton("Mode: Includes", this);
|
||||
toggleButton->setCheckable(true); // Enable checkable state
|
||||
|
||||
toggleButton = new QPushButton(this);
|
||||
toggleButton->setCheckable(true);
|
||||
layout->addWidget(toggleButton);
|
||||
|
||||
// Connect the button's toggled signal
|
||||
|
|
@ -113,6 +114,15 @@ DeckPreviewColorIdentityFilterWidget::DeckPreviewColorIdentityFilterWidget(Visua
|
|||
&VisualDeckStorageWidget::refreshBannerCards);
|
||||
connect(this, &DeckPreviewColorIdentityFilterWidget::filterModeChanged, parent,
|
||||
&VisualDeckStorageWidget::refreshBannerCards);
|
||||
|
||||
// Call retranslateUi to set the initial text
|
||||
retranslateUi();
|
||||
}
|
||||
|
||||
void DeckPreviewColorIdentityFilterWidget::retranslateUi()
|
||||
{
|
||||
// Set the toggle button text based on the current mode
|
||||
toggleButton->setText(exactMatchMode ? tr("Mode: Exact Match") : tr("Mode: Includes"));
|
||||
}
|
||||
|
||||
void DeckPreviewColorIdentityFilterWidget::handleColorToggled(QChar color, bool active)
|
||||
|
|
@ -124,7 +134,7 @@ void DeckPreviewColorIdentityFilterWidget::handleColorToggled(QChar color, bool
|
|||
void DeckPreviewColorIdentityFilterWidget::updateFilterMode(bool checked)
|
||||
{
|
||||
exactMatchMode = checked; // Toggle between modes
|
||||
toggleButton->setText(checked ? "Mode: Exact Match" : "Mode: Includes");
|
||||
retranslateUi(); // Update the button text
|
||||
emit filterModeChanged(exactMatchMode);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -41,6 +41,7 @@ class DeckPreviewColorIdentityFilterWidget : public QWidget
|
|||
|
||||
public:
|
||||
explicit DeckPreviewColorIdentityFilterWidget(VisualDeckStorageWidget *parent);
|
||||
void retranslateUi();
|
||||
QList<DeckPreviewWidget *> filterWidgets(QList<DeckPreviewWidget *> &widgets);
|
||||
|
||||
signals:
|
||||
|
|
|
|||
|
|
@ -16,12 +16,11 @@ VisualDeckStorageSortWidget::VisualDeckStorageSortWidget(VisualDeckStorageWidget
|
|||
layout = new QHBoxLayout(this);
|
||||
setLayout(layout);
|
||||
|
||||
// ComboBox for sorting options
|
||||
// Initialize the ComboBox
|
||||
sortComboBox = new QComboBox(this);
|
||||
sortComboBox->addItem("Sort Alphabetically (Deck Name)", ByName);
|
||||
sortComboBox->addItem("Sort Alphabetically (Filename)", Alphabetical);
|
||||
sortComboBox->addItem("Sort by Last Modified", ByLastModified);
|
||||
sortComboBox->addItem("Sort by Last Loaded", ByLastLoaded);
|
||||
layout->addWidget(sortComboBox);
|
||||
|
||||
// Set the current sort order
|
||||
sortComboBox->setCurrentIndex(SettingsCache::instance().getVisualDeckStorageSortingOrder());
|
||||
|
||||
// Connect sorting change signal to refresh the file list
|
||||
|
|
@ -29,7 +28,26 @@ VisualDeckStorageSortWidget::VisualDeckStorageSortWidget(VisualDeckStorageWidget
|
|||
&VisualDeckStorageSortWidget::updateSortOrder);
|
||||
connect(this, &VisualDeckStorageSortWidget::sortOrderChanged, parent, &VisualDeckStorageWidget::updateSortOrder);
|
||||
|
||||
layout->addWidget(sortComboBox);
|
||||
retranslateUi();
|
||||
}
|
||||
|
||||
void VisualDeckStorageSortWidget::retranslateUi()
|
||||
{
|
||||
// Block signals to avoid triggering unnecessary updates while changing text
|
||||
sortComboBox->blockSignals(true);
|
||||
|
||||
// Clear and repopulate the ComboBox with translated items
|
||||
sortComboBox->clear();
|
||||
sortComboBox->addItem(tr("Sort Alphabetically (Deck Name)"), ByName);
|
||||
sortComboBox->addItem(tr("Sort Alphabetically (Filename)"), Alphabetical);
|
||||
sortComboBox->addItem(tr("Sort by Last Modified"), ByLastModified);
|
||||
sortComboBox->addItem(tr("Sort by Last Loaded"), ByLastLoaded);
|
||||
|
||||
// Restore the current index
|
||||
sortComboBox->setCurrentIndex(SettingsCache::instance().getVisualDeckStorageSortingOrder());
|
||||
|
||||
// Re-enable signals
|
||||
sortComboBox->blockSignals(false);
|
||||
}
|
||||
|
||||
void VisualDeckStorageSortWidget::showEvent(QShowEvent *event)
|
||||
|
|
|
|||
|
|
@ -14,6 +14,7 @@ class VisualDeckStorageSortWidget : public QWidget
|
|||
|
||||
public:
|
||||
explicit VisualDeckStorageSortWidget(VisualDeckStorageWidget *parent);
|
||||
void retranslateUi();
|
||||
void updateSortOrder();
|
||||
QString getSearchText();
|
||||
QList<DeckPreviewWidget *> &filterFiles(QList<DeckPreviewWidget *> &widgets);
|
||||
|
|
|
|||
|
|
@ -432,8 +432,8 @@ bool DeckList::readElement(QXmlStreamReader *xml)
|
|||
bannerCard = QPair<QString, QString>(cardName, providerId);
|
||||
} else if (childName == "tags") {
|
||||
tags.clear(); // Clear existing tags
|
||||
while (!(xml->isEndElement() && childName == "tags")) {
|
||||
if (xml->readNextStartElement() && childName == "tag") {
|
||||
while (xml->readNextStartElement()) {
|
||||
if (xml->name().toString() == "tag") {
|
||||
tags.append(xml->readElementText());
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue