aboutsummaryrefslogtreecommitdiff
path: root/launcher/ui/dialogs
diff options
context:
space:
mode:
Diffstat (limited to 'launcher/ui/dialogs')
-rw-r--r--launcher/ui/dialogs/ModDownloadDialog.cpp20
-rw-r--r--launcher/ui/dialogs/ModDownloadDialog.h5
2 files changed, 24 insertions, 1 deletions
diff --git a/launcher/ui/dialogs/ModDownloadDialog.cpp b/launcher/ui/dialogs/ModDownloadDialog.cpp
index 31253bc2..af6704d9 100644
--- a/launcher/ui/dialogs/ModDownloadDialog.cpp
+++ b/launcher/ui/dialogs/ModDownloadDialog.cpp
@@ -55,6 +55,8 @@ ModDownloadDialog::ModDownloadDialog(const std::shared_ptr<ModFolderModel>& mods
m_container->addButtons(m_buttons);
+ connect(m_container, &PageContainer::selectedPageChanged, this, &ModDownloadDialog::selectedPageChanged);
+
// Bonk Qt over its stupid head and make sure it understands which button is the default one...
// See: https://stackoverflow.com/questions/24556831/qbuttonbox-set-default-button
auto OkButton = m_buttons->button(QDialogButtonBox::Ok);
@@ -163,3 +165,21 @@ const QList<ModDownloadTask*> ModDownloadDialog::getTasks()
{
return modTask.values();
}
+
+void ModDownloadDialog::selectedPageChanged(BasePage* previous, BasePage* selected)
+{
+ auto* prev_page = dynamic_cast<ModPage*>(previous);
+ if (!prev_page) {
+ qCritical() << "Page '" << previous->displayName() << "' in ModDownloadDialog is not a ModPage!";
+ return;
+ }
+
+ auto* selected_page = dynamic_cast<ModPage*>(selected);
+ if (!selected_page) {
+ qCritical() << "Page '" << selected->displayName() << "' in ModDownloadDialog is not a ModPage!";
+ return;
+ }
+
+ // Same effect as having a global search bar
+ selected_page->setSearchTerm(prev_page->getSearchTerm());
+}
diff --git a/launcher/ui/dialogs/ModDownloadDialog.h b/launcher/ui/dialogs/ModDownloadDialog.h
index 2a26c849..18a5f0f3 100644
--- a/launcher/ui/dialogs/ModDownloadDialog.h
+++ b/launcher/ui/dialogs/ModDownloadDialog.h
@@ -34,7 +34,7 @@ class PageContainer;
class QDialogButtonBox;
class ModrinthModPage;
-class ModDownloadDialog : public QDialog, public BasePageProvider
+class ModDownloadDialog final : public QDialog, public BasePageProvider
{
Q_OBJECT
@@ -58,6 +58,9 @@ public slots:
void accept() override;
void reject() override;
+private slots:
+ void selectedPageChanged(BasePage* previous, BasePage* selected);
+
private:
Ui::ModDownloadDialog *ui = nullptr;
PageContainer * m_container = nullptr;