diff options
author | flow <flowlnlnln@gmail.com> | 2022-07-15 13:18:12 -0300 |
---|---|---|
committer | flow <flowlnlnln@gmail.com> | 2022-08-01 07:33:30 -0300 |
commit | 158b7fd166f6be76b4e6c0e3f7cf14d6a4b43a17 (patch) | |
tree | 4949e06b5db3892288422cd964788dd9ca576a69 /launcher/ui/pages | |
parent | c3f647dc962a0da6e96e54f472ee764370ed4f66 (diff) | |
download | PrismLauncher-158b7fd166f6be76b4e6c0e3f7cf14d6a4b43a17.tar.gz PrismLauncher-158b7fd166f6be76b4e6c0e3f7cf14d6a4b43a17.tar.bz2 PrismLauncher-158b7fd166f6be76b4e6c0e3f7cf14d6a4b43a17.zip |
feat+refactor: clean up ProgressWidget and add progress indicatior to
mod downloader
Signed-off-by: flow <flowlnlnln@gmail.com>
Diffstat (limited to 'launcher/ui/pages')
-rw-r--r-- | launcher/ui/pages/modplatform/ModModel.h | 1 | ||||
-rw-r--r-- | launcher/ui/pages/modplatform/ModPage.cpp | 9 | ||||
-rw-r--r-- | launcher/ui/pages/modplatform/ModPage.h | 3 |
3 files changed, 12 insertions, 1 deletions
diff --git a/launcher/ui/pages/modplatform/ModModel.h b/launcher/ui/pages/modplatform/ModModel.h index de864df5..96747fbd 100644 --- a/launcher/ui/pages/modplatform/ModModel.h +++ b/launcher/ui/pages/modplatform/ModModel.h @@ -30,6 +30,7 @@ class ListModel : public QAbstractListModel { auto data(const QModelIndex& index, int role) const -> QVariant override; inline void setActiveJob(NetJob::Ptr ptr) { jobPtr = ptr; } + inline NetJob* activeJob() { return jobPtr.get(); } /* Ask the API for more information */ void fetchMore(const QModelIndex& parent) override; diff --git a/launcher/ui/pages/modplatform/ModPage.cpp b/launcher/ui/pages/modplatform/ModPage.cpp index 4fad037e..176f8fde 100644 --- a/launcher/ui/pages/modplatform/ModPage.cpp +++ b/launcher/ui/pages/modplatform/ModPage.cpp @@ -53,6 +53,7 @@ ModPage::ModPage(ModDownloadDialog* dialog, BaseInstance* instance, ModAPI* api) , ui(new Ui::ModPage) , dialog(dialog) , filter_widget(static_cast<MinecraftInstance*>(instance)->getPackProfile()->getComponentVersion("net.minecraft"), this) + , m_fetch_progress(this, false) , api(api) { ui->setupUi(this); @@ -70,7 +71,12 @@ ModPage::ModPage(ModDownloadDialog* dialog, BaseInstance* instance, ModAPI* api) ui->versionSelectionBox->view()->setVerticalScrollBarPolicy(Qt::ScrollBarAsNeeded); ui->versionSelectionBox->view()->parentWidget()->setMaximumHeight(300); - ui->gridLayout_3->addWidget(&filter_widget, 0, 0, 1, ui->gridLayout_3->columnCount()); + m_fetch_progress.hideIfInactive(true); + m_fetch_progress.setFixedHeight(24); + m_fetch_progress.progressFormat(""); + + ui->gridLayout_3->addWidget(&m_fetch_progress, 0, 0, 1, ui->gridLayout_3->columnCount()); + ui->gridLayout_3->addWidget(&filter_widget, 1, 0, 1, ui->gridLayout_3->columnCount()); filter_widget.setInstance(static_cast<MinecraftInstance*>(m_instance)); m_filter = filter_widget.getFilter(); @@ -151,6 +157,7 @@ void ModPage::triggerSearch() } listModel->searchWithTerm(getSearchTerm(), ui->sortByBox->currentIndex(), changed); + m_fetch_progress.watch(listModel->activeJob()); } QString ModPage::getSearchTerm() const diff --git a/launcher/ui/pages/modplatform/ModPage.h b/launcher/ui/pages/modplatform/ModPage.h index c58a7cbb..09c38d8b 100644 --- a/launcher/ui/pages/modplatform/ModPage.h +++ b/launcher/ui/pages/modplatform/ModPage.h @@ -8,6 +8,7 @@ #include "ui/pages/BasePage.h" #include "ui/pages/modplatform/ModModel.h" #include "ui/widgets/ModFilterWidget.h" +#include "ui/widgets/ProgressWidget.h" class ModDownloadDialog; @@ -75,6 +76,8 @@ class ModPage : public QWidget, public BasePage { ModFilterWidget filter_widget; std::shared_ptr<ModFilterWidget::Filter> m_filter; + ProgressWidget m_fetch_progress; + ModPlatform::ListModel* listModel = nullptr; ModPlatform::IndexedPack current; |