diff options
author | Jamie Mansfield <jmansfield@cadixdev.org> | 2021-10-16 23:36:31 +0100 |
---|---|---|
committer | Jamie Mansfield <jmansfield@cadixdev.org> | 2021-10-16 23:36:31 +0100 |
commit | 1869dd0de3bf490abb0fe789236dd6f6909ecf8d (patch) | |
tree | 4160d3ab5fc5c765c1a98bfb36bbb555642e017b /launcher | |
parent | 175132539b14be2681bfbaf3f380f0a9b8a69a26 (diff) | |
download | PrismLauncher-1869dd0de3bf490abb0fe789236dd6f6909ecf8d.tar.gz PrismLauncher-1869dd0de3bf490abb0fe789236dd6f6909ecf8d.tar.bz2 PrismLauncher-1869dd0de3bf490abb0fe789236dd6f6909ecf8d.zip |
NOISSUE Search as you type for modpacks.ch
Since we just filter data locally now, this isn't painfully slow -
indeed it's very quick. This also matches other platforms, such as
ATLauncher.
Diffstat (limited to 'launcher')
-rw-r--r-- | launcher/pages/modplatform/ftb/FtbPage.cpp | 8 | ||||
-rw-r--r-- | launcher/pages/modplatform/ftb/FtbPage.h | 2 | ||||
-rw-r--r-- | launcher/pages/modplatform/ftb/FtbPage.ui | 12 |
3 files changed, 15 insertions, 7 deletions
diff --git a/launcher/pages/modplatform/ftb/FtbPage.cpp b/launcher/pages/modplatform/ftb/FtbPage.cpp index 5917b979..aca93cfe 100644 --- a/launcher/pages/modplatform/ftb/FtbPage.cpp +++ b/launcher/pages/modplatform/ftb/FtbPage.cpp @@ -32,7 +32,8 @@ FtbPage::FtbPage(NewInstanceDialog* dialog, QWidget *parent) } ui->sortByBox->setCurrentText(filterModel->translateCurrentSorting()); - connect(ui->searchButton, &QPushButton::clicked, this, &FtbPage::triggerSearch); + connect(ui->searchEdit, &QLineEdit::textChanged, this, &FtbPage::triggerSearch); + connect(ui->resetButton, &QPushButton::clicked, this, &FtbPage::resetSearch); connect(ui->sortByBox, &QComboBox::currentTextChanged, this, &FtbPage::onSortingSelectionChanged); connect(ui->packView->selectionModel(), &QItemSelectionModel::currentChanged, this, &FtbPage::onSelectionChanged); connect(ui->versionSelectionBox, &QComboBox::currentTextChanged, this, &FtbPage::onVersionSelectionChanged); @@ -104,6 +105,11 @@ void FtbPage::triggerSearch() filterModel->setSearchTerm(ui->searchEdit->text()); } +void FtbPage::resetSearch() +{ + ui->searchEdit->setText(""); +} + void FtbPage::onSortingSelectionChanged(QString data) { auto toSet = filterModel->getAvailableSortings().value(data); diff --git a/launcher/pages/modplatform/ftb/FtbPage.h b/launcher/pages/modplatform/ftb/FtbPage.h index bca09e25..0dfac1a4 100644 --- a/launcher/pages/modplatform/ftb/FtbPage.h +++ b/launcher/pages/modplatform/ftb/FtbPage.h @@ -65,6 +65,8 @@ private: private slots: void triggerSearch(); + void resetSearch(); + void onSortingSelectionChanged(QString data); void onSelectionChanged(QModelIndex first, QModelIndex second); void onVersionSelectionChanged(QString data); diff --git a/launcher/pages/modplatform/ftb/FtbPage.ui b/launcher/pages/modplatform/ftb/FtbPage.ui index 135afc6d..dc800497 100644 --- a/launcher/pages/modplatform/ftb/FtbPage.ui +++ b/launcher/pages/modplatform/ftb/FtbPage.ui @@ -39,9 +39,9 @@ </widget> </item> <item row="0" column="1"> - <widget class="QPushButton" name="searchButton"> + <widget class="QPushButton" name="resetButton"> <property name="text"> - <string>Search</string> + <string>Reset</string> </property> </widget> </item> @@ -49,15 +49,15 @@ <layout class="QGridLayout" name="gridLayout_3"> <item row="0" column="0"> <widget class="QTreeView" name="packView"> + <property name="alternatingRowColors"> + <bool>true</bool> + </property> <property name="iconSize"> <size> <width>48</width> <height>48</height> </size> </property> - <property name="alternatingRowColors"> - <bool>true</bool> - </property> </widget> </item> <item row="0" column="1"> @@ -76,7 +76,7 @@ </widget> <tabstops> <tabstop>searchEdit</tabstop> - <tabstop>searchButton</tabstop> + <tabstop>resetButton</tabstop> <tabstop>versionSelectionBox</tabstop> </tabstops> <resources/> |