mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-07-18 16:32:16 -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,
|
connect(circle, &DeckPreviewColorIdentityFilterCircleWidget::colorToggled, this,
|
||||||
&DeckPreviewColorIdentityFilterWidget::handleColorToggled);
|
&DeckPreviewColorIdentityFilterWidget::handleColorToggled);
|
||||||
}
|
}
|
||||||
toggleButton = new QPushButton("Mode: Includes", this);
|
|
||||||
toggleButton->setCheckable(true); // Enable checkable state
|
toggleButton = new QPushButton(this);
|
||||||
|
toggleButton->setCheckable(true);
|
||||||
layout->addWidget(toggleButton);
|
layout->addWidget(toggleButton);
|
||||||
|
|
||||||
// Connect the button's toggled signal
|
// Connect the button's toggled signal
|
||||||
|
|
@ -113,6 +114,15 @@ DeckPreviewColorIdentityFilterWidget::DeckPreviewColorIdentityFilterWidget(Visua
|
||||||
&VisualDeckStorageWidget::refreshBannerCards);
|
&VisualDeckStorageWidget::refreshBannerCards);
|
||||||
connect(this, &DeckPreviewColorIdentityFilterWidget::filterModeChanged, parent,
|
connect(this, &DeckPreviewColorIdentityFilterWidget::filterModeChanged, parent,
|
||||||
&VisualDeckStorageWidget::refreshBannerCards);
|
&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)
|
void DeckPreviewColorIdentityFilterWidget::handleColorToggled(QChar color, bool active)
|
||||||
|
|
@ -124,7 +134,7 @@ void DeckPreviewColorIdentityFilterWidget::handleColorToggled(QChar color, bool
|
||||||
void DeckPreviewColorIdentityFilterWidget::updateFilterMode(bool checked)
|
void DeckPreviewColorIdentityFilterWidget::updateFilterMode(bool checked)
|
||||||
{
|
{
|
||||||
exactMatchMode = checked; // Toggle between modes
|
exactMatchMode = checked; // Toggle between modes
|
||||||
toggleButton->setText(checked ? "Mode: Exact Match" : "Mode: Includes");
|
retranslateUi(); // Update the button text
|
||||||
emit filterModeChanged(exactMatchMode);
|
emit filterModeChanged(exactMatchMode);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -41,6 +41,7 @@ class DeckPreviewColorIdentityFilterWidget : public QWidget
|
||||||
|
|
||||||
public:
|
public:
|
||||||
explicit DeckPreviewColorIdentityFilterWidget(VisualDeckStorageWidget *parent);
|
explicit DeckPreviewColorIdentityFilterWidget(VisualDeckStorageWidget *parent);
|
||||||
|
void retranslateUi();
|
||||||
QList<DeckPreviewWidget *> filterWidgets(QList<DeckPreviewWidget *> &widgets);
|
QList<DeckPreviewWidget *> filterWidgets(QList<DeckPreviewWidget *> &widgets);
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
|
|
|
||||||
|
|
@ -16,12 +16,11 @@ VisualDeckStorageSortWidget::VisualDeckStorageSortWidget(VisualDeckStorageWidget
|
||||||
layout = new QHBoxLayout(this);
|
layout = new QHBoxLayout(this);
|
||||||
setLayout(layout);
|
setLayout(layout);
|
||||||
|
|
||||||
// ComboBox for sorting options
|
// Initialize the ComboBox
|
||||||
sortComboBox = new QComboBox(this);
|
sortComboBox = new QComboBox(this);
|
||||||
sortComboBox->addItem("Sort Alphabetically (Deck Name)", ByName);
|
layout->addWidget(sortComboBox);
|
||||||
sortComboBox->addItem("Sort Alphabetically (Filename)", Alphabetical);
|
|
||||||
sortComboBox->addItem("Sort by Last Modified", ByLastModified);
|
// Set the current sort order
|
||||||
sortComboBox->addItem("Sort by Last Loaded", ByLastLoaded);
|
|
||||||
sortComboBox->setCurrentIndex(SettingsCache::instance().getVisualDeckStorageSortingOrder());
|
sortComboBox->setCurrentIndex(SettingsCache::instance().getVisualDeckStorageSortingOrder());
|
||||||
|
|
||||||
// Connect sorting change signal to refresh the file list
|
// Connect sorting change signal to refresh the file list
|
||||||
|
|
@ -29,7 +28,26 @@ VisualDeckStorageSortWidget::VisualDeckStorageSortWidget(VisualDeckStorageWidget
|
||||||
&VisualDeckStorageSortWidget::updateSortOrder);
|
&VisualDeckStorageSortWidget::updateSortOrder);
|
||||||
connect(this, &VisualDeckStorageSortWidget::sortOrderChanged, parent, &VisualDeckStorageWidget::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)
|
void VisualDeckStorageSortWidget::showEvent(QShowEvent *event)
|
||||||
|
|
|
||||||
|
|
@ -14,6 +14,7 @@ class VisualDeckStorageSortWidget : public QWidget
|
||||||
|
|
||||||
public:
|
public:
|
||||||
explicit VisualDeckStorageSortWidget(VisualDeckStorageWidget *parent);
|
explicit VisualDeckStorageSortWidget(VisualDeckStorageWidget *parent);
|
||||||
|
void retranslateUi();
|
||||||
void updateSortOrder();
|
void updateSortOrder();
|
||||||
QString getSearchText();
|
QString getSearchText();
|
||||||
QList<DeckPreviewWidget *> &filterFiles(QList<DeckPreviewWidget *> &widgets);
|
QList<DeckPreviewWidget *> &filterFiles(QList<DeckPreviewWidget *> &widgets);
|
||||||
|
|
|
||||||
|
|
@ -432,8 +432,8 @@ bool DeckList::readElement(QXmlStreamReader *xml)
|
||||||
bannerCard = QPair<QString, QString>(cardName, providerId);
|
bannerCard = QPair<QString, QString>(cardName, providerId);
|
||||||
} else if (childName == "tags") {
|
} else if (childName == "tags") {
|
||||||
tags.clear(); // Clear existing tags
|
tags.clear(); // Clear existing tags
|
||||||
while (!(xml->isEndElement() && childName == "tags")) {
|
while (xml->readNextStartElement()) {
|
||||||
if (xml->readNextStartElement() && childName == "tag") {
|
if (xml->name().toString() == "tag") {
|
||||||
tags.append(xml->readElementText());
|
tags.append(xml->readElementText());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue