ui: underline search button text when changing filters

This hopefully makes it easier to the user to know that their changes
will only apply after hitting the search button.

I tried setting the background color, but it seems more unreliable on
cross-platform than underlining. Also, it could be worse for daltonic people,
so I don't know what to do :(
This commit is contained in:
flow 2022-04-14 10:52:23 -03:00
parent 277de41200
commit 5f15f51610
4 changed files with 25 additions and 5 deletions

View File

@ -824,9 +824,6 @@ SET(LAUNCHER_SOURCES
ui/dialogs/SkinUploadDialog.h ui/dialogs/SkinUploadDialog.h
ui/dialogs/ModDownloadDialog.cpp ui/dialogs/ModDownloadDialog.cpp
ui/dialogs/ModDownloadDialog.h ui/dialogs/ModDownloadDialog.h
ui/dialogs/FilterModsDialog.cpp
ui/dialogs/FilterModsDialog.h
# GUI - widgets # GUI - widgets
ui/widgets/Common.cpp ui/widgets/Common.cpp
@ -851,6 +848,8 @@ SET(LAUNCHER_SOURCES
ui/widgets/LogView.h ui/widgets/LogView.h
ui/widgets/MCModInfoFrame.cpp ui/widgets/MCModInfoFrame.cpp
ui/widgets/MCModInfoFrame.h ui/widgets/MCModInfoFrame.h
ui/widgets/ModFilterWidget.cpp
ui/widgets/ModFilterWidget.h
ui/widgets/ModListView.cpp ui/widgets/ModListView.cpp
ui/widgets/ModListView.h ui/widgets/ModListView.h
ui/widgets/PageContainer.cpp ui/widgets/PageContainer.cpp
@ -909,6 +908,7 @@ qt5_wrap_ui(LAUNCHER_UI
ui/widgets/InstanceCardWidget.ui ui/widgets/InstanceCardWidget.ui
ui/widgets/CustomCommands.ui ui/widgets/CustomCommands.ui
ui/widgets/MCModInfoFrame.ui ui/widgets/MCModInfoFrame.ui
ui/widgets/ModFilterWidget.ui
ui/dialogs/CopyInstanceDialog.ui ui/dialogs/CopyInstanceDialog.ui
ui/dialogs/ProfileSetupDialog.ui ui/dialogs/ProfileSetupDialog.ui
ui/dialogs/ProgressDialog.ui ui/dialogs/ProgressDialog.ui
@ -925,7 +925,6 @@ qt5_wrap_ui(LAUNCHER_UI
ui/dialogs/LoginDialog.ui ui/dialogs/LoginDialog.ui
ui/dialogs/EditAccountDialog.ui ui/dialogs/EditAccountDialog.ui
ui/dialogs/ReviewMessageBox.ui ui/dialogs/ReviewMessageBox.ui
ui/dialogs/FilterModsDialog.ui
) )
qt5_add_resources(LAUNCHER_RESOURCES qt5_add_resources(LAUNCHER_RESOURCES

View File

@ -28,6 +28,13 @@ ModPage::ModPage(ModDownloadDialog* dialog, BaseInstance* instance, ModAPI* api)
filter_widget.setInstance(static_cast<MinecraftInstance*>(m_instance)); filter_widget.setInstance(static_cast<MinecraftInstance*>(m_instance));
m_filter = filter_widget.getFilter(); m_filter = filter_widget.getFilter();
connect(&filter_widget, &ModFilterWidget::filterChanged, this, [&]{
ui->searchButton->setStyleSheet("text-decoration: underline");
});
connect(&filter_widget, &ModFilterWidget::filterUnchanged, this, [&]{
ui->searchButton->setStyleSheet("text-decoration: none");
});
} }
ModPage::~ModPage() ModPage::~ModPage()

View File

@ -38,6 +38,7 @@ void ModFilterWidget::setInstance(MinecraftInstance* instance)
auto ModFilterWidget::getFilter() -> std::shared_ptr<Filter> auto ModFilterWidget::getFilter() -> std::shared_ptr<Filter>
{ {
m_last_version_id = m_version_id; m_last_version_id = m_version_id;
emit filterUnchanged();
return m_filter; return m_filter;
} }
@ -70,7 +71,11 @@ void ModFilterWidget::onVersionFilterChanged(int id)
int index = 0; int index = 0;
auto cast_id = (VersionButtonID) id; auto cast_id = (VersionButtonID) id;
if (cast_id != m_version_id) {
m_version_id = cast_id; m_version_id = cast_id;
} else {
return;
}
m_filter->versions.clear(); m_filter->versions.clear();
@ -91,6 +96,11 @@ void ModFilterWidget::onVersionFilterChanged(int id)
// TODO // TODO
break; break;
} }
if(changed())
emit filterChanged();
else
emit filterUnchanged();
} }
ModFilterWidget::~ModFilterWidget() ModFilterWidget::~ModFilterWidget()

View File

@ -52,6 +52,10 @@ private:
private slots: private slots:
void onVersionFilterChanged(int id); void onVersionFilterChanged(int id);
public: signals:
void filterChanged();
void filterUnchanged();
private: private:
Ui::ModFilterWidget* ui; Ui::ModFilterWidget* ui;