mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-07-09 01:23:57 -07:00
Change buttons to be push rather than toggle.
Took 17 minutes Took 9 seconds
This commit is contained in:
parent
19db58b28f
commit
9bf2668f15
8 changed files with 25 additions and 29 deletions
|
|
@ -53,16 +53,15 @@ VisualDatabaseDisplayFormatLegalityFilterWidget::VisualDatabaseDisplayFormatLega
|
||||||
|
|
||||||
// Create the toggle button for Exact Match/Includes mode
|
// Create the toggle button for Exact Match/Includes mode
|
||||||
toggleButton = new QPushButton(this);
|
toggleButton = new QPushButton(this);
|
||||||
toggleButton->setCheckable(true);
|
|
||||||
layout->addWidget(toggleButton);
|
layout->addWidget(toggleButton);
|
||||||
connect(toggleButton, &QPushButton::toggled, this,
|
connect(toggleButton, &QPushButton::clicked, this,
|
||||||
&VisualDatabaseDisplayFormatLegalityFilterWidget::updateFilterMode);
|
&VisualDatabaseDisplayFormatLegalityFilterWidget::updateFilterMode);
|
||||||
connect(filterModel, &FilterTreeModel::layoutChanged, this, [this]() {
|
connect(filterModel, &FilterTreeModel::layoutChanged, this, [this]() {
|
||||||
QTimer::singleShot(100, this, &VisualDatabaseDisplayFormatLegalityFilterWidget::syncWithFilterModel);
|
QTimer::singleShot(100, this, &VisualDatabaseDisplayFormatLegalityFilterWidget::syncWithFilterModel);
|
||||||
});
|
});
|
||||||
|
|
||||||
createFormatButtons(); // Populate buttons initially
|
createFormatButtons(); // Populate buttons initially
|
||||||
updateFilterMode(false); // Initialize toggle button text
|
updateFilterMode(); // Initialize toggle button text
|
||||||
|
|
||||||
retranslateUi();
|
retranslateUi();
|
||||||
}
|
}
|
||||||
|
|
@ -177,9 +176,9 @@ void VisualDatabaseDisplayFormatLegalityFilterWidget::updateFormatFilter()
|
||||||
emit filterModel->layoutChanged();
|
emit filterModel->layoutChanged();
|
||||||
}
|
}
|
||||||
|
|
||||||
void VisualDatabaseDisplayFormatLegalityFilterWidget::updateFilterMode(bool checked)
|
void VisualDatabaseDisplayFormatLegalityFilterWidget::updateFilterMode()
|
||||||
{
|
{
|
||||||
exactMatchMode = checked;
|
exactMatchMode = !exactMatchMode;
|
||||||
toggleButton->setText(exactMatchMode ? tr("Mode: Exact Match") : tr("Mode: Includes"));
|
toggleButton->setText(exactMatchMode ? tr("Mode: Exact Match") : tr("Mode: Includes"));
|
||||||
updateFormatFilter();
|
updateFormatFilter();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -24,7 +24,7 @@ public:
|
||||||
|
|
||||||
void handleFormatToggled(const QString &format, bool active);
|
void handleFormatToggled(const QString &format, bool active);
|
||||||
void updateFormatFilter();
|
void updateFormatFilter();
|
||||||
void updateFilterMode(bool checked);
|
void updateFilterMode();
|
||||||
void syncWithFilterModel();
|
void syncWithFilterModel();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
@ -40,7 +40,7 @@ private:
|
||||||
QMap<QString, bool> activeFormats; // Track active filters
|
QMap<QString, bool> activeFormats; // Track active filters
|
||||||
QMap<QString, QPushButton *> formatButtons; // Store toggle buttons
|
QMap<QString, QPushButton *> formatButtons; // Store toggle buttons
|
||||||
|
|
||||||
bool exactMatchMode = false; // Toggle between "Exact Match" and "Includes"
|
bool exactMatchMode = true; // Toggle between "Exact Match" and "Includes"
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // COCKATRICE_VISUAL_DATABASE_DISPLAY_FORMAT_LEGALITY_FILTER_WIDGET_H
|
#endif // COCKATRICE_VISUAL_DATABASE_DISPLAY_FORMAT_LEGALITY_FILTER_WIDGET_H
|
||||||
|
|
|
||||||
|
|
@ -49,15 +49,14 @@ VisualDatabaseDisplayMainTypeFilterWidget::VisualDatabaseDisplayMainTypeFilterWi
|
||||||
|
|
||||||
// Create the toggle button for Exact Match/Includes mode
|
// Create the toggle button for Exact Match/Includes mode
|
||||||
toggleButton = new QPushButton(this);
|
toggleButton = new QPushButton(this);
|
||||||
toggleButton->setCheckable(true);
|
|
||||||
layout->addWidget(toggleButton);
|
layout->addWidget(toggleButton);
|
||||||
connect(toggleButton, &QPushButton::toggled, this, &VisualDatabaseDisplayMainTypeFilterWidget::updateFilterMode);
|
connect(toggleButton, &QPushButton::clicked, this, &VisualDatabaseDisplayMainTypeFilterWidget::updateFilterMode);
|
||||||
connect(filterModel, &FilterTreeModel::layoutChanged, this, [this]() {
|
connect(filterModel, &FilterTreeModel::layoutChanged, this, [this]() {
|
||||||
QTimer::singleShot(100, this, &VisualDatabaseDisplayMainTypeFilterWidget::syncWithFilterModel);
|
QTimer::singleShot(100, this, &VisualDatabaseDisplayMainTypeFilterWidget::syncWithFilterModel);
|
||||||
});
|
});
|
||||||
|
|
||||||
createMainTypeButtons(); // Populate buttons initially
|
createMainTypeButtons(); // Populate buttons initially
|
||||||
updateFilterMode(false); // Initialize toggle button text
|
updateFilterMode(); // Initialize toggle button text
|
||||||
|
|
||||||
retranslateUi();
|
retranslateUi();
|
||||||
}
|
}
|
||||||
|
|
@ -172,9 +171,9 @@ void VisualDatabaseDisplayMainTypeFilterWidget::updateMainTypeFilter()
|
||||||
emit filterModel->layoutChanged();
|
emit filterModel->layoutChanged();
|
||||||
}
|
}
|
||||||
|
|
||||||
void VisualDatabaseDisplayMainTypeFilterWidget::updateFilterMode(bool checked)
|
void VisualDatabaseDisplayMainTypeFilterWidget::updateFilterMode()
|
||||||
{
|
{
|
||||||
exactMatchMode = checked;
|
exactMatchMode = !exactMatchMode;
|
||||||
toggleButton->setText(exactMatchMode ? tr("Mode: Exact Match") : tr("Mode: Includes"));
|
toggleButton->setText(exactMatchMode ? tr("Mode: Exact Match") : tr("Mode: Includes"));
|
||||||
updateMainTypeFilter();
|
updateMainTypeFilter();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -29,7 +29,7 @@ public:
|
||||||
|
|
||||||
void handleMainTypeToggled(const QString &mainType, bool active);
|
void handleMainTypeToggled(const QString &mainType, bool active);
|
||||||
void updateMainTypeFilter();
|
void updateMainTypeFilter();
|
||||||
void updateFilterMode(bool checked);
|
void updateFilterMode();
|
||||||
void syncWithFilterModel();
|
void syncWithFilterModel();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
@ -45,7 +45,7 @@ private:
|
||||||
QMap<QString, bool> activeMainTypes; // Track active filters
|
QMap<QString, bool> activeMainTypes; // Track active filters
|
||||||
QMap<QString, QPushButton *> typeButtons; // Store toggle buttons
|
QMap<QString, QPushButton *> typeButtons; // Store toggle buttons
|
||||||
|
|
||||||
bool exactMatchMode = false; // Toggle between "Exact Match" and "Includes"
|
bool exactMatchMode = true; // Toggle between "Exact Match" and "Includes"
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // VISUAL_DATABASE_DISPLAY_MAIN_TYPE_FILTER_WIDGET_H
|
#endif // VISUAL_DATABASE_DISPLAY_MAIN_TYPE_FILTER_WIDGET_H
|
||||||
|
|
|
||||||
|
|
@ -70,9 +70,8 @@ VisualDatabaseDisplaySetFilterWidget::VisualDatabaseDisplaySetFilterWidget(QWidg
|
||||||
|
|
||||||
// Create the toggle button for Exact Match/Includes mode
|
// Create the toggle button for Exact Match/Includes mode
|
||||||
toggleButton = new QPushButton(this);
|
toggleButton = new QPushButton(this);
|
||||||
toggleButton->setCheckable(true);
|
|
||||||
layout->addWidget(toggleButton);
|
layout->addWidget(toggleButton);
|
||||||
connect(toggleButton, &QPushButton::toggled, this, &VisualDatabaseDisplaySetFilterWidget::updateFilterMode);
|
connect(toggleButton, &QPushButton::clicked, this, &VisualDatabaseDisplaySetFilterWidget::updateFilterMode);
|
||||||
connect(filterModel, &FilterTreeModel::layoutChanged, this,
|
connect(filterModel, &FilterTreeModel::layoutChanged, this,
|
||||||
[this]() { QTimer::singleShot(100, this, &VisualDatabaseDisplaySetFilterWidget::syncWithFilterModel); });
|
[this]() { QTimer::singleShot(100, this, &VisualDatabaseDisplaySetFilterWidget::syncWithFilterModel); });
|
||||||
|
|
||||||
|
|
@ -264,9 +263,9 @@ void VisualDatabaseDisplaySetFilterWidget::syncWithFilterModel()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void VisualDatabaseDisplaySetFilterWidget::updateFilterMode(bool checked)
|
void VisualDatabaseDisplaySetFilterWidget::updateFilterMode()
|
||||||
{
|
{
|
||||||
exactMatchMode = checked;
|
exactMatchMode = !exactMatchMode;
|
||||||
updateSetFilter();
|
updateSetFilter();
|
||||||
retranslateUi();
|
retranslateUi();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -44,7 +44,7 @@ public:
|
||||||
|
|
||||||
void updateSetFilter();
|
void updateSetFilter();
|
||||||
void syncWithFilterModel();
|
void syncWithFilterModel();
|
||||||
void updateFilterMode(bool checked);
|
void updateFilterMode();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
FilterTreeModel *filterModel;
|
FilterTreeModel *filterModel;
|
||||||
|
|
@ -60,7 +60,7 @@ private:
|
||||||
QMap<QString, QPushButton *> setButtons; // Store set filter buttons
|
QMap<QString, QPushButton *> setButtons; // Store set filter buttons
|
||||||
QMap<QString, bool> activeSets; // Track active set filters
|
QMap<QString, bool> activeSets; // Track active set filters
|
||||||
|
|
||||||
bool exactMatchMode = false; // Toggle between "Exact Match" and "Includes"
|
bool exactMatchMode = true; // Toggle between "Exact Match" and "Includes"
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // VISUAL_DATABASE_DISPLAY_SET_FILTER_WIDGET_H
|
#endif // VISUAL_DATABASE_DISPLAY_SET_FILTER_WIDGET_H
|
||||||
|
|
|
||||||
|
|
@ -54,15 +54,14 @@ VisualDatabaseDisplaySubTypeFilterWidget::VisualDatabaseDisplaySubTypeFilterWidg
|
||||||
|
|
||||||
// Toggle button setup (Exact Match / Includes mode)
|
// Toggle button setup (Exact Match / Includes mode)
|
||||||
toggleButton = new QPushButton(this);
|
toggleButton = new QPushButton(this);
|
||||||
toggleButton->setCheckable(true);
|
|
||||||
layout->addWidget(toggleButton);
|
layout->addWidget(toggleButton);
|
||||||
connect(toggleButton, &QPushButton::toggled, this, &VisualDatabaseDisplaySubTypeFilterWidget::updateFilterMode);
|
connect(toggleButton, &QPushButton::clicked, this, &VisualDatabaseDisplaySubTypeFilterWidget::updateFilterMode);
|
||||||
connect(filterModel, &FilterTreeModel::layoutChanged, this, [this]() {
|
connect(filterModel, &FilterTreeModel::layoutChanged, this, [this]() {
|
||||||
QTimer::singleShot(100, this, &VisualDatabaseDisplaySubTypeFilterWidget::syncWithFilterModel);
|
QTimer::singleShot(100, this, &VisualDatabaseDisplaySubTypeFilterWidget::syncWithFilterModel);
|
||||||
});
|
});
|
||||||
|
|
||||||
createSubTypeButtons(); // Populate buttons initially
|
createSubTypeButtons(); // Populate buttons initially
|
||||||
updateFilterMode(false); // Initialize the toggle button text
|
updateFilterMode(); // Initialize the toggle button text
|
||||||
|
|
||||||
retranslateUi();
|
retranslateUi();
|
||||||
}
|
}
|
||||||
|
|
@ -180,9 +179,9 @@ void VisualDatabaseDisplaySubTypeFilterWidget::updateSubTypeFilter()
|
||||||
emit filterModel->layoutChanged();
|
emit filterModel->layoutChanged();
|
||||||
}
|
}
|
||||||
|
|
||||||
void VisualDatabaseDisplaySubTypeFilterWidget::updateFilterMode(bool checked)
|
void VisualDatabaseDisplaySubTypeFilterWidget::updateFilterMode()
|
||||||
{
|
{
|
||||||
exactMatchMode = checked;
|
exactMatchMode = !exactMatchMode;
|
||||||
toggleButton->setText(exactMatchMode ? tr("Mode: Exact Match") : tr("Mode: Includes"));
|
toggleButton->setText(exactMatchMode ? tr("Mode: Exact Match") : tr("Mode: Includes"));
|
||||||
updateSubTypeFilter();
|
updateSubTypeFilter();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -28,7 +28,7 @@ public:
|
||||||
|
|
||||||
void handleSubTypeToggled(const QString &mainType, bool active);
|
void handleSubTypeToggled(const QString &mainType, bool active);
|
||||||
void updateSubTypeFilter();
|
void updateSubTypeFilter();
|
||||||
void updateFilterMode(bool checked);
|
void updateFilterMode();
|
||||||
void syncWithFilterModel();
|
void syncWithFilterModel();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
@ -45,7 +45,7 @@ private:
|
||||||
QMap<QString, bool> activeSubTypes; // Track active filters
|
QMap<QString, bool> activeSubTypes; // Track active filters
|
||||||
QMap<QString, QPushButton *> typeButtons; // Store toggle buttons
|
QMap<QString, QPushButton *> typeButtons; // Store toggle buttons
|
||||||
|
|
||||||
bool exactMatchMode = false; // Toggle between "Exact Match" and "Includes"
|
bool exactMatchMode = true; // Toggle between "Exact Match" and "Includes"
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // VISUAL_DATABASE_DISPLAY_SUB_TYPE_FILTER_WIDGET_H
|
#endif // VISUAL_DATABASE_DISPLAY_SUB_TYPE_FILTER_WIDGET_H
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue