sync modpack search field
Signed-off-by: Trial97 <alexandru.tripon97@gmail.com>
This commit is contained in:
parent
fa92e6bd29
commit
946e791d39
@ -965,6 +965,9 @@ SET(LAUNCHER_SOURCES
|
|||||||
ui/pages/modplatform/ShaderPackPage.cpp
|
ui/pages/modplatform/ShaderPackPage.cpp
|
||||||
ui/pages/modplatform/ShaderPackModel.cpp
|
ui/pages/modplatform/ShaderPackModel.cpp
|
||||||
|
|
||||||
|
|
||||||
|
ui/pages/modplatform/ModpackProviderBasePage.h
|
||||||
|
|
||||||
ui/pages/modplatform/atlauncher/AtlFilterModel.cpp
|
ui/pages/modplatform/atlauncher/AtlFilterModel.cpp
|
||||||
ui/pages/modplatform/atlauncher/AtlFilterModel.h
|
ui/pages/modplatform/atlauncher/AtlFilterModel.h
|
||||||
ui/pages/modplatform/atlauncher/AtlListModel.cpp
|
ui/pages/modplatform/atlauncher/AtlListModel.cpp
|
||||||
|
@ -36,6 +36,7 @@
|
|||||||
|
|
||||||
#include "NewInstanceDialog.h"
|
#include "NewInstanceDialog.h"
|
||||||
#include "Application.h"
|
#include "Application.h"
|
||||||
|
#include "ui/pages/modplatform/ModpackProviderBasePage.h"
|
||||||
#include "ui/pages/modplatform/import_ftb/ImportFTBPage.h"
|
#include "ui/pages/modplatform/import_ftb/ImportFTBPage.h"
|
||||||
#include "ui_NewInstanceDialog.h"
|
#include "ui_NewInstanceDialog.h"
|
||||||
|
|
||||||
@ -140,6 +141,8 @@ NewInstanceDialog::NewInstanceDialog(const QString& initialGroup,
|
|||||||
auto geometry = screen->availableSize();
|
auto geometry = screen->availableSize();
|
||||||
resize(width(), qMin(geometry.height() - 50, 710));
|
resize(width(), qMin(geometry.height() - 50, 710));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
connect(m_container, &PageContainer::selectedPageChanged, this, &NewInstanceDialog::selectedPageChanged);
|
||||||
}
|
}
|
||||||
|
|
||||||
void NewInstanceDialog::reject()
|
void NewInstanceDialog::reject()
|
||||||
@ -316,3 +319,16 @@ void NewInstanceDialog::importIconNow()
|
|||||||
}
|
}
|
||||||
APPLICATION->settings()->set("NewInstanceGeometry", saveGeometry().toBase64());
|
APPLICATION->settings()->set("NewInstanceGeometry", saveGeometry().toBase64());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void NewInstanceDialog::selectedPageChanged(BasePage* previous, BasePage* selected)
|
||||||
|
{
|
||||||
|
auto prevPage = dynamic_cast<ModpackProviderBasePage*>(previous);
|
||||||
|
if (prevPage) {
|
||||||
|
m_searchTerm = prevPage->getSerachTerm();
|
||||||
|
}
|
||||||
|
|
||||||
|
auto nextPage = dynamic_cast<ModpackProviderBasePage*>(selected);
|
||||||
|
if (nextPage) {
|
||||||
|
nextPage->setSearchTerm(m_searchTerm);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@ -82,6 +82,7 @@ class NewInstanceDialog : public QDialog, public BasePageProvider {
|
|||||||
private slots:
|
private slots:
|
||||||
void on_iconButton_clicked();
|
void on_iconButton_clicked();
|
||||||
void on_instNameTextBox_textChanged(const QString& arg1);
|
void on_instNameTextBox_textChanged(const QString& arg1);
|
||||||
|
void selectedPageChanged(BasePage* previous, BasePage* selected);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Ui::NewInstanceDialog* ui = nullptr;
|
Ui::NewInstanceDialog* ui = nullptr;
|
||||||
@ -98,5 +99,7 @@ class NewInstanceDialog : public QDialog, public BasePageProvider {
|
|||||||
|
|
||||||
QString importVersion;
|
QString importVersion;
|
||||||
|
|
||||||
|
QString m_searchTerm;
|
||||||
|
|
||||||
void importIconNow();
|
void importIconNow();
|
||||||
};
|
};
|
||||||
|
29
launcher/ui/pages/modplatform/ModpackProviderBasePage.h
Normal file
29
launcher/ui/pages/modplatform/ModpackProviderBasePage.h
Normal file
@ -0,0 +1,29 @@
|
|||||||
|
// SPDX-License-Identifier: GPL-3.0-only
|
||||||
|
/*
|
||||||
|
* Prism Launcher - Minecraft Launcher
|
||||||
|
* Copyright (c) 2023 Trial97 <alexandru.tripon97@gmail.com>
|
||||||
|
*
|
||||||
|
* This program is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation, version 3.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include "ui/pages/BasePage.h"
|
||||||
|
|
||||||
|
class ModpackProviderBasePage : public BasePage {
|
||||||
|
public:
|
||||||
|
/** Programatically set the term in the search bar. */
|
||||||
|
virtual void setSearchTerm(QString) = 0;
|
||||||
|
/** Get the current term in the search bar. */
|
||||||
|
[[nodiscard]] virtual QString getSerachTerm() const = 0;
|
||||||
|
};
|
@ -164,3 +164,13 @@ void AtlPage::onVersionSelectionChanged(QString version)
|
|||||||
selectedVersion = version;
|
selectedVersion = version;
|
||||||
suggestCurrent();
|
suggestCurrent();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void AtlPage::setSearchTerm(QString term)
|
||||||
|
{
|
||||||
|
ui->searchEdit->setText(term);
|
||||||
|
}
|
||||||
|
|
||||||
|
QString AtlPage::getSerachTerm() const
|
||||||
|
{
|
||||||
|
return ui->searchEdit->text();
|
||||||
|
}
|
||||||
|
@ -42,8 +42,7 @@
|
|||||||
#include <QWidget>
|
#include <QWidget>
|
||||||
|
|
||||||
#include "Application.h"
|
#include "Application.h"
|
||||||
#include "tasks/Task.h"
|
#include "ui/pages/modplatform/ModpackProviderBasePage.h"
|
||||||
#include "ui/pages/BasePage.h"
|
|
||||||
|
|
||||||
namespace Ui {
|
namespace Ui {
|
||||||
class AtlPage;
|
class AtlPage;
|
||||||
@ -51,7 +50,7 @@ class AtlPage;
|
|||||||
|
|
||||||
class NewInstanceDialog;
|
class NewInstanceDialog;
|
||||||
|
|
||||||
class AtlPage : public QWidget, public BasePage {
|
class AtlPage : public QWidget, public ModpackProviderBasePage {
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
@ -66,6 +65,11 @@ class AtlPage : public QWidget, public BasePage {
|
|||||||
|
|
||||||
void openedImpl() override;
|
void openedImpl() override;
|
||||||
|
|
||||||
|
/** Programatically set the term in the search bar. */
|
||||||
|
virtual void setSearchTerm(QString) override;
|
||||||
|
/** Get the current term in the search bar. */
|
||||||
|
[[nodiscard]] virtual QString getSerachTerm() const override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void suggestCurrent();
|
void suggestCurrent();
|
||||||
|
|
||||||
|
@ -299,3 +299,12 @@ void FlamePage::updateUi()
|
|||||||
ui->packDescription->setHtml(StringUtils::htmlListPatch(text + current.description));
|
ui->packDescription->setHtml(StringUtils::htmlListPatch(text + current.description));
|
||||||
ui->packDescription->flush();
|
ui->packDescription->flush();
|
||||||
}
|
}
|
||||||
|
QString FlamePage::getSerachTerm() const
|
||||||
|
{
|
||||||
|
return ui->searchEdit->text();
|
||||||
|
}
|
||||||
|
|
||||||
|
void FlamePage::setSearchTerm(QString term)
|
||||||
|
{
|
||||||
|
ui->searchEdit->setText(term);
|
||||||
|
}
|
||||||
|
@ -40,7 +40,7 @@
|
|||||||
#include <Application.h>
|
#include <Application.h>
|
||||||
#include <modplatform/flame/FlamePackIndex.h>
|
#include <modplatform/flame/FlamePackIndex.h>
|
||||||
#include <QTimer>
|
#include <QTimer>
|
||||||
#include "ui/pages/BasePage.h"
|
#include "ui/pages/modplatform/ModpackProviderBasePage.h"
|
||||||
#include "ui/widgets/ProgressWidget.h"
|
#include "ui/widgets/ProgressWidget.h"
|
||||||
|
|
||||||
namespace Ui {
|
namespace Ui {
|
||||||
@ -53,7 +53,7 @@ namespace Flame {
|
|||||||
class ListModel;
|
class ListModel;
|
||||||
}
|
}
|
||||||
|
|
||||||
class FlamePage : public QWidget, public BasePage {
|
class FlamePage : public QWidget, public ModpackProviderBasePage {
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
@ -72,6 +72,11 @@ class FlamePage : public QWidget, public BasePage {
|
|||||||
|
|
||||||
bool eventFilter(QObject* watched, QEvent* event) override;
|
bool eventFilter(QObject* watched, QEvent* event) override;
|
||||||
|
|
||||||
|
/** Programatically set the term in the search bar. */
|
||||||
|
virtual void setSearchTerm(QString) override;
|
||||||
|
/** Get the current term in the search bar. */
|
||||||
|
[[nodiscard]] virtual QString getSerachTerm() const override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void suggestCurrent();
|
void suggestCurrent();
|
||||||
|
|
||||||
|
@ -135,4 +135,13 @@ void ImportFTBPage::triggerSearch()
|
|||||||
currentModel->setSearchTerm(ui->searchEdit->text());
|
currentModel->setSearchTerm(ui->searchEdit->text());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void ImportFTBPage::setSearchTerm(QString term)
|
||||||
|
{
|
||||||
|
ui->searchEdit->setText(term);
|
||||||
|
}
|
||||||
|
|
||||||
|
QString ImportFTBPage::getSerachTerm() const
|
||||||
|
{
|
||||||
|
return ui->searchEdit->text();
|
||||||
|
}
|
||||||
} // namespace FTBImportAPP
|
} // namespace FTBImportAPP
|
||||||
|
@ -25,7 +25,7 @@
|
|||||||
|
|
||||||
#include <Application.h>
|
#include <Application.h>
|
||||||
#include "modplatform/import_ftb/PackHelpers.h"
|
#include "modplatform/import_ftb/PackHelpers.h"
|
||||||
#include "ui/pages/BasePage.h"
|
#include "ui/pages/modplatform/ModpackProviderBasePage.h"
|
||||||
#include "ui/pages/modplatform/import_ftb/ListModel.h"
|
#include "ui/pages/modplatform/import_ftb/ListModel.h"
|
||||||
|
|
||||||
class NewInstanceDialog;
|
class NewInstanceDialog;
|
||||||
@ -35,7 +35,7 @@ namespace Ui {
|
|||||||
class ImportFTBPage;
|
class ImportFTBPage;
|
||||||
}
|
}
|
||||||
|
|
||||||
class ImportFTBPage : public QWidget, public BasePage {
|
class ImportFTBPage : public QWidget, public ModpackProviderBasePage {
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
@ -49,6 +49,11 @@ class ImportFTBPage : public QWidget, public BasePage {
|
|||||||
void openedImpl() override;
|
void openedImpl() override;
|
||||||
void retranslate() override;
|
void retranslate() override;
|
||||||
|
|
||||||
|
/** Programatically set the term in the search bar. */
|
||||||
|
virtual void setSearchTerm(QString) override;
|
||||||
|
/** Get the current term in the search bar. */
|
||||||
|
[[nodiscard]] virtual QString getSerachTerm() const override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void suggestCurrent();
|
void suggestCurrent();
|
||||||
void onPackSelectionChanged(Modpack* pack = nullptr);
|
void onPackSelectionChanged(Modpack* pack = nullptr);
|
||||||
|
@ -369,4 +369,13 @@ void Page::triggerSearch()
|
|||||||
currentModel->setSearchTerm(ui->searchEdit->text());
|
currentModel->setSearchTerm(ui->searchEdit->text());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Page::setSearchTerm(QString term)
|
||||||
|
{
|
||||||
|
ui->searchEdit->setText(term);
|
||||||
|
}
|
||||||
|
|
||||||
|
QString Page::getSerachTerm() const
|
||||||
|
{
|
||||||
|
return ui->searchEdit->text();
|
||||||
|
}
|
||||||
} // namespace LegacyFTB
|
} // namespace LegacyFTB
|
||||||
|
@ -43,7 +43,7 @@
|
|||||||
#include "QObjectPtr.h"
|
#include "QObjectPtr.h"
|
||||||
#include "modplatform/legacy_ftb/PackFetchTask.h"
|
#include "modplatform/legacy_ftb/PackFetchTask.h"
|
||||||
#include "modplatform/legacy_ftb/PackHelpers.h"
|
#include "modplatform/legacy_ftb/PackHelpers.h"
|
||||||
#include "ui/pages/BasePage.h"
|
#include "ui/pages/modplatform/ModpackProviderBasePage.h"
|
||||||
|
|
||||||
class NewInstanceDialog;
|
class NewInstanceDialog;
|
||||||
|
|
||||||
@ -57,7 +57,7 @@ class ListModel;
|
|||||||
class FilterModel;
|
class FilterModel;
|
||||||
class PrivatePackManager;
|
class PrivatePackManager;
|
||||||
|
|
||||||
class Page : public QWidget, public BasePage {
|
class Page : public QWidget, public ModpackProviderBasePage {
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
@ -71,6 +71,11 @@ class Page : public QWidget, public BasePage {
|
|||||||
void openedImpl() override;
|
void openedImpl() override;
|
||||||
void retranslate() override;
|
void retranslate() override;
|
||||||
|
|
||||||
|
/** Programatically set the term in the search bar. */
|
||||||
|
virtual void setSearchTerm(QString) override;
|
||||||
|
/** Get the current term in the search bar. */
|
||||||
|
[[nodiscard]] virtual QString getSerachTerm() const override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void suggestCurrent();
|
void suggestCurrent();
|
||||||
void onPackSelectionChanged(Modpack* pack = nullptr);
|
void onPackSelectionChanged(Modpack* pack = nullptr);
|
||||||
|
@ -351,3 +351,13 @@ void ModrinthPage::onVersionSelectionChanged(int index)
|
|||||||
selectedVersion = ui->versionSelectionBox->currentData().toString();
|
selectedVersion = ui->versionSelectionBox->currentData().toString();
|
||||||
suggestCurrent();
|
suggestCurrent();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void ModrinthPage::setSearchTerm(QString term)
|
||||||
|
{
|
||||||
|
ui->searchEdit->setText(term);
|
||||||
|
}
|
||||||
|
|
||||||
|
QString ModrinthPage::getSerachTerm() const
|
||||||
|
{
|
||||||
|
return ui->searchEdit->text();
|
||||||
|
}
|
||||||
|
@ -38,9 +38,9 @@
|
|||||||
|
|
||||||
#include "Application.h"
|
#include "Application.h"
|
||||||
#include "ui/dialogs/NewInstanceDialog.h"
|
#include "ui/dialogs/NewInstanceDialog.h"
|
||||||
#include "ui/pages/BasePage.h"
|
|
||||||
|
|
||||||
#include "modplatform/modrinth/ModrinthPackManifest.h"
|
#include "modplatform/modrinth/ModrinthPackManifest.h"
|
||||||
|
#include "ui/pages/modplatform/ModpackProviderBasePage.h"
|
||||||
#include "ui/widgets/ProgressWidget.h"
|
#include "ui/widgets/ProgressWidget.h"
|
||||||
|
|
||||||
#include <QTimer>
|
#include <QTimer>
|
||||||
@ -54,7 +54,7 @@ namespace Modrinth {
|
|||||||
class ModpackListModel;
|
class ModpackListModel;
|
||||||
}
|
}
|
||||||
|
|
||||||
class ModrinthPage : public QWidget, public BasePage {
|
class ModrinthPage : public QWidget, public ModpackProviderBasePage {
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
@ -78,6 +78,11 @@ class ModrinthPage : public QWidget, public BasePage {
|
|||||||
void openedImpl() override;
|
void openedImpl() override;
|
||||||
bool eventFilter(QObject* watched, QEvent* event) override;
|
bool eventFilter(QObject* watched, QEvent* event) override;
|
||||||
|
|
||||||
|
/** Programatically set the term in the search bar. */
|
||||||
|
virtual void setSearchTerm(QString) override;
|
||||||
|
/** Get the current term in the search bar. */
|
||||||
|
[[nodiscard]] virtual QString getSerachTerm() const override;
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void onSelectionChanged(QModelIndex first, QModelIndex second);
|
void onSelectionChanged(QModelIndex first, QModelIndex second);
|
||||||
void onVersionSelectionChanged(int index);
|
void onVersionSelectionChanged(int index);
|
||||||
|
@ -342,3 +342,13 @@ void TechnicPage::onVersionSelectionChanged(QString version)
|
|||||||
selectedVersion = version;
|
selectedVersion = version;
|
||||||
selectVersion();
|
selectVersion();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void TechnicPage::setSearchTerm(QString term)
|
||||||
|
{
|
||||||
|
ui->searchEdit->setText(term);
|
||||||
|
}
|
||||||
|
|
||||||
|
QString TechnicPage::getSerachTerm() const
|
||||||
|
{
|
||||||
|
return ui->searchEdit->text();
|
||||||
|
}
|
||||||
|
@ -41,7 +41,7 @@
|
|||||||
#include <Application.h>
|
#include <Application.h>
|
||||||
#include "TechnicData.h"
|
#include "TechnicData.h"
|
||||||
#include "net/NetJob.h"
|
#include "net/NetJob.h"
|
||||||
#include "ui/pages/BasePage.h"
|
#include "ui/pages/modplatform/ModpackProviderBasePage.h"
|
||||||
#include "ui/widgets/ProgressWidget.h"
|
#include "ui/widgets/ProgressWidget.h"
|
||||||
|
|
||||||
namespace Ui {
|
namespace Ui {
|
||||||
@ -54,7 +54,7 @@ namespace Technic {
|
|||||||
class ListModel;
|
class ListModel;
|
||||||
}
|
}
|
||||||
|
|
||||||
class TechnicPage : public QWidget, public BasePage {
|
class TechnicPage : public QWidget, public ModpackProviderBasePage {
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
@ -71,6 +71,11 @@ class TechnicPage : public QWidget, public BasePage {
|
|||||||
|
|
||||||
bool eventFilter(QObject* watched, QEvent* event) override;
|
bool eventFilter(QObject* watched, QEvent* event) override;
|
||||||
|
|
||||||
|
/** Programatically set the term in the search bar. */
|
||||||
|
virtual void setSearchTerm(QString) override;
|
||||||
|
/** Get the current term in the search bar. */
|
||||||
|
[[nodiscard]] virtual QString getSerachTerm() const override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void suggestCurrent();
|
void suggestCurrent();
|
||||||
void metadataLoaded();
|
void metadataLoaded();
|
||||||
|
Loading…
Reference in New Issue
Block a user