feat:refactored modpack ux

Signed-off-by: Trial97 <alexandru.tripon97@gmail.com>
This commit is contained in:
Trial97
2023-08-18 20:03:02 +03:00
parent e88418ab7f
commit 44ff247f5f
32 changed files with 679 additions and 163 deletions

View File

@ -35,6 +35,7 @@
*/
#include "Page.h"
#include "ui/widgets/ProjectItem.h"
#include "ui_Page.h"
#include <QInputDialog>
@ -110,6 +111,8 @@ Page::Page(NewInstanceDialog* dialog, QWidget* parent) : QWidget(parent), dialog
connect(ui->sortByBox, &QComboBox::currentTextChanged, this, &Page::onSortingSelectionChanged);
connect(ui->versionSelectionBox, &QComboBox::currentTextChanged, this, &Page::onVersionSelectionItemChanged);
connect(ui->searchEdit, &QLineEdit::textChanged, this, &Page::triggerSearch);
connect(ui->publicPackList->selectionModel(), &QItemSelectionModel::currentChanged, this, &Page::onPublicPackSelectionChanged);
connect(ui->thirdPartyPackList->selectionModel(), &QItemSelectionModel::currentChanged, this, &Page::onThirdPartyPackSelectionChanged);
connect(ui->privatePackList->selectionModel(), &QItemSelectionModel::currentChanged, this, &Page::onPrivatePackSelectionChanged);
@ -125,6 +128,9 @@ Page::Page(NewInstanceDialog* dialog, QWidget* parent) : QWidget(parent), dialog
ui->thirdPartyPackList->selectionModel()->reset();
ui->privatePackList->selectionModel()->reset();
ui->publicPackList->setItemDelegate(new ProjectItemDelegate(this));
ui->thirdPartyPackList->setItemDelegate(new ProjectItemDelegate(this));
ui->privatePackList->setItemDelegate(new ProjectItemDelegate(this));
onTabChanged(ui->tabWidget->currentIndex());
}
@ -319,6 +325,8 @@ void Page::onTabChanged(int tab)
currentModpackInfo = ui->publicPackDescription;
}
triggerSearch();
currentList->selectionModel()->reset();
QModelIndex idx = currentList->currentIndex();
if (idx.isValid()) {
@ -358,4 +366,9 @@ void Page::onRemovePackClicked()
onPackSelectionChanged();
}
void Page::triggerSearch()
{
currentModel->setSearchTerm(ui->searchEdit->text());
}
} // namespace LegacyFTB