mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-07-16 15:32:15 -07:00
Block signals on every filter, which theoretically, should make it so that strain doesn't increase proportionally with filter amount.
This commit is contained in:
parent
d45310191f
commit
f08bd6aac4
4 changed files with 43 additions and 0 deletions
|
|
@ -1,5 +1,6 @@
|
||||||
#include "visual_database_display_color_filter_widget.h"
|
#include "visual_database_display_color_filter_widget.h"
|
||||||
|
|
||||||
|
#include "../../../../game/filters/filter_tree.h"
|
||||||
#include "../cards/additional_info/mana_symbol_widget.h"
|
#include "../cards/additional_info/mana_symbol_widget.h"
|
||||||
|
|
||||||
#include <QSet>
|
#include <QSet>
|
||||||
|
|
@ -99,6 +100,8 @@ void VisualDatabaseDisplayColorFilterWidget::updateColorFilter()
|
||||||
blockSync = true;
|
blockSync = true;
|
||||||
|
|
||||||
// Clear previous filters
|
// Clear previous filters
|
||||||
|
filterModel->blockSignals(true);
|
||||||
|
filterModel->filterTree()->blockSignals(true);
|
||||||
filterModel->clearFiltersOfType(CardFilter::Attr::AttrColor);
|
filterModel->clearFiltersOfType(CardFilter::Attr::AttrColor);
|
||||||
|
|
||||||
QSet<QString> selectedColors;
|
QSet<QString> selectedColors;
|
||||||
|
|
@ -160,6 +163,13 @@ void VisualDatabaseDisplayColorFilterWidget::updateColorFilter()
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
filterModel->blockSignals(false);
|
||||||
|
filterModel->filterTree()->blockSignals(false);
|
||||||
|
|
||||||
|
if (filterModel->filterTree()->nodeAt(0)) {
|
||||||
|
filterModel->filterTree()->nodeAt(0)->nodeChanged();
|
||||||
|
}
|
||||||
|
emit filterModel->layoutChanged();
|
||||||
blockSync = false;
|
blockSync = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,7 @@
|
||||||
#include "visual_database_display_main_type_filter_widget.h"
|
#include "visual_database_display_main_type_filter_widget.h"
|
||||||
|
|
||||||
#include "../../../../game/cards/card_database_manager.h"
|
#include "../../../../game/cards/card_database_manager.h"
|
||||||
|
#include "../../../../game/filters/filter_tree.h"
|
||||||
#include "../../../../game/filters/filter_tree_model.h"
|
#include "../../../../game/filters/filter_tree_model.h"
|
||||||
|
|
||||||
#include <QPushButton>
|
#include <QPushButton>
|
||||||
|
|
@ -102,6 +103,8 @@ void VisualDatabaseDisplayMainTypeFilterWidget::handleMainTypeToggled(const QStr
|
||||||
void VisualDatabaseDisplayMainTypeFilterWidget::updateMainTypeFilter()
|
void VisualDatabaseDisplayMainTypeFilterWidget::updateMainTypeFilter()
|
||||||
{
|
{
|
||||||
// Clear existing filters related to main type
|
// Clear existing filters related to main type
|
||||||
|
filterModel->blockSignals(true);
|
||||||
|
filterModel->filterTree()->blockSignals(true);
|
||||||
filterModel->clearFiltersOfType(CardFilter::Attr::AttrMainType);
|
filterModel->clearFiltersOfType(CardFilter::Attr::AttrMainType);
|
||||||
|
|
||||||
if (exactMatchMode) {
|
if (exactMatchMode) {
|
||||||
|
|
@ -140,6 +143,14 @@ void VisualDatabaseDisplayMainTypeFilterWidget::updateMainTypeFilter()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
filterModel->blockSignals(false);
|
||||||
|
filterModel->filterTree()->blockSignals(false);
|
||||||
|
|
||||||
|
if (filterModel->filterTree()->nodeAt(0)) {
|
||||||
|
filterModel->filterTree()->nodeAt(0)->nodeChanged();
|
||||||
|
}
|
||||||
|
emit filterModel->layoutChanged();
|
||||||
}
|
}
|
||||||
|
|
||||||
void VisualDatabaseDisplayMainTypeFilterWidget::updateFilterMode(bool checked)
|
void VisualDatabaseDisplayMainTypeFilterWidget::updateFilterMode(bool checked)
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,7 @@
|
||||||
#include "visual_database_display_set_filter_widget.h"
|
#include "visual_database_display_set_filter_widget.h"
|
||||||
|
|
||||||
#include "../../../../game/cards/card_database_manager.h"
|
#include "../../../../game/cards/card_database_manager.h"
|
||||||
|
#include "../../../../game/filters/filter_tree.h"
|
||||||
#include "../../../../game/filters/filter_tree_model.h"
|
#include "../../../../game/filters/filter_tree_model.h"
|
||||||
|
|
||||||
#include <QLineEdit>
|
#include <QLineEdit>
|
||||||
|
|
@ -48,6 +49,9 @@ void VisualDatabaseDisplaySetFilterWidget::createSetButtons()
|
||||||
std::sort(shared_pointerses.begin(), shared_pointerses.end(),
|
std::sort(shared_pointerses.begin(), shared_pointerses.end(),
|
||||||
[](const auto &a, const auto &b) { return a->getReleaseDate() > b->getReleaseDate(); });
|
[](const auto &a, const auto &b) { return a->getReleaseDate() > b->getReleaseDate(); });
|
||||||
|
|
||||||
|
int setsToPreactivate = 10;
|
||||||
|
int setsActivated = 0;
|
||||||
|
|
||||||
for (const auto &shared_pointer : shared_pointerses) {
|
for (const auto &shared_pointer : shared_pointerses) {
|
||||||
QString shortName = shared_pointer->getShortName();
|
QString shortName = shared_pointer->getShortName();
|
||||||
QString longName = shared_pointer->getLongName();
|
QString longName = shared_pointer->getLongName();
|
||||||
|
|
@ -63,7 +67,13 @@ void VisualDatabaseDisplaySetFilterWidget::createSetButtons()
|
||||||
// Connect toggle signal
|
// Connect toggle signal
|
||||||
connect(button, &QPushButton::toggled, this,
|
connect(button, &QPushButton::toggled, this,
|
||||||
[this, shortName](bool checked) { handleSetToggled(shortName, checked); });
|
[this, shortName](bool checked) { handleSetToggled(shortName, checked); });
|
||||||
|
if (setsActivated < setsToPreactivate) {
|
||||||
|
setsActivated++;
|
||||||
|
activeSets[shortName] = true;
|
||||||
|
button->setChecked(true);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
updateSetFilter();
|
||||||
updateSetButtonsVisibility(); // Ensure visibility is updated initially
|
updateSetButtonsVisibility(); // Ensure visibility is updated initially
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -95,6 +105,8 @@ void VisualDatabaseDisplaySetFilterWidget::handleSetToggled(const QString &setSh
|
||||||
void VisualDatabaseDisplaySetFilterWidget::updateSetFilter()
|
void VisualDatabaseDisplaySetFilterWidget::updateSetFilter()
|
||||||
{
|
{
|
||||||
// Clear existing filters related to sets
|
// Clear existing filters related to sets
|
||||||
|
filterModel->blockSignals(true);
|
||||||
|
filterModel->filterTree()->blockSignals(true);
|
||||||
filterModel->clearFiltersOfType(CardFilter::Attr::AttrSet);
|
filterModel->clearFiltersOfType(CardFilter::Attr::AttrSet);
|
||||||
|
|
||||||
if (exactMatchMode) {
|
if (exactMatchMode) {
|
||||||
|
|
@ -131,6 +143,13 @@ void VisualDatabaseDisplaySetFilterWidget::updateSetFilter()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
filterModel->blockSignals(false);
|
||||||
|
filterModel->filterTree()->blockSignals(false);
|
||||||
|
|
||||||
|
if (filterModel->filterTree()->nodeAt(0)) {
|
||||||
|
filterModel->filterTree()->nodeAt(0)->nodeChanged();
|
||||||
|
}
|
||||||
|
emit filterModel->layoutChanged();
|
||||||
}
|
}
|
||||||
|
|
||||||
void VisualDatabaseDisplaySetFilterWidget::syncWithFilterModel()
|
void VisualDatabaseDisplaySetFilterWidget::syncWithFilterModel()
|
||||||
|
|
|
||||||
|
|
@ -110,6 +110,7 @@ void VisualDatabaseDisplaySubTypeFilterWidget::handleSubTypeToggled(const QStrin
|
||||||
|
|
||||||
void VisualDatabaseDisplaySubTypeFilterWidget::updateSubTypeFilter()
|
void VisualDatabaseDisplaySubTypeFilterWidget::updateSubTypeFilter()
|
||||||
{
|
{
|
||||||
|
filterModel->blockSignals(true);
|
||||||
// Clear existing filters related to sub types
|
// Clear existing filters related to sub types
|
||||||
filterModel->clearFiltersOfType(CardFilter::Attr::AttrSubType);
|
filterModel->clearFiltersOfType(CardFilter::Attr::AttrSubType);
|
||||||
|
|
||||||
|
|
@ -149,6 +150,8 @@ void VisualDatabaseDisplaySubTypeFilterWidget::updateSubTypeFilter()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
filterModel->blockSignals(false);
|
||||||
|
emit filterModel->layoutChanged();
|
||||||
}
|
}
|
||||||
|
|
||||||
void VisualDatabaseDisplaySubTypeFilterWidget::updateFilterMode(bool checked)
|
void VisualDatabaseDisplaySubTypeFilterWidget::updateFilterMode(bool checked)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue