Formatting and forward-declaration
Signed-off-by: TheKodeToad <TheKodeToad@proton.me>
This commit is contained in:
parent
576867605d
commit
8dfa3393dc
@ -132,7 +132,7 @@ QList<BasePage*> ModDownloadDialog::getPages()
|
|||||||
if (APPLICATION->capabilities() & Application::SupportsFlame)
|
if (APPLICATION->capabilities() & Application::SupportsFlame)
|
||||||
pages.append(FlameModPage::create(this, m_instance));
|
pages.append(FlameModPage::create(this, m_instance));
|
||||||
|
|
||||||
m_selected_page = dynamic_cast<ModPage*>(pages[0]);
|
m_selectedPage = dynamic_cast<ModPage*>(pages[0]);
|
||||||
|
|
||||||
return pages;
|
return pages;
|
||||||
}
|
}
|
||||||
@ -181,14 +181,14 @@ void ModDownloadDialog::selectedPageChanged(BasePage* previous, BasePage* select
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
m_selected_page = dynamic_cast<ModPage*>(selected);
|
m_selectedPage = dynamic_cast<ModPage*>(selected);
|
||||||
if (!m_selected_page) {
|
if (!m_selectedPage) {
|
||||||
qCritical() << "Page '" << selected->displayName() << "' in ModDownloadDialog is not a ModPage!";
|
qCritical() << "Page '" << selected->displayName() << "' in ModDownloadDialog is not a ModPage!";
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Same effect as having a global search bar
|
// Same effect as having a global search bar
|
||||||
m_selected_page->setSearchTerm(prev_page->getSearchTerm());
|
m_selectedPage->setSearchTerm(prev_page->getSearchTerm());
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ModDownloadDialog::selectPage(QString pageId)
|
bool ModDownloadDialog::selectPage(QString pageId)
|
||||||
@ -198,5 +198,5 @@ bool ModDownloadDialog::selectPage(QString pageId)
|
|||||||
|
|
||||||
ModPage* ModDownloadDialog::getSelectedPage()
|
ModPage* ModDownloadDialog::getSelectedPage()
|
||||||
{
|
{
|
||||||
return m_selected_page;
|
return m_selectedPage;
|
||||||
}
|
}
|
@ -25,7 +25,6 @@
|
|||||||
#include "ModDownloadTask.h"
|
#include "ModDownloadTask.h"
|
||||||
#include "minecraft/mod/ModFolderModel.h"
|
#include "minecraft/mod/ModFolderModel.h"
|
||||||
#include "ui/pages/BasePageProvider.h"
|
#include "ui/pages/BasePageProvider.h"
|
||||||
#include "ui/pages/modplatform/ModPage.h"
|
|
||||||
|
|
||||||
namespace Ui
|
namespace Ui
|
||||||
{
|
{
|
||||||
@ -34,13 +33,14 @@ class ModDownloadDialog;
|
|||||||
|
|
||||||
class PageContainer;
|
class PageContainer;
|
||||||
class QDialogButtonBox;
|
class QDialogButtonBox;
|
||||||
|
class ModPage;
|
||||||
class ModrinthModPage;
|
class ModrinthModPage;
|
||||||
|
|
||||||
class ModDownloadDialog final : public QDialog, public BasePageProvider
|
class ModDownloadDialog final : public QDialog, public BasePageProvider
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
explicit ModDownloadDialog(const std::shared_ptr<ModFolderModel>& mods, QWidget* parent, BaseInstance* instance);
|
explicit ModDownloadDialog(const std::shared_ptr<ModFolderModel>& mods, QWidget* parent, BaseInstance* instance);
|
||||||
~ModDownloadDialog() override = default;
|
~ModDownloadDialog() override = default;
|
||||||
|
|
||||||
@ -53,27 +53,26 @@ public:
|
|||||||
bool isModSelected(QString name) const;
|
bool isModSelected(QString name) const;
|
||||||
|
|
||||||
const QList<ModDownloadTask*> getTasks();
|
const QList<ModDownloadTask*> getTasks();
|
||||||
const std::shared_ptr<ModFolderModel> &mods;
|
const std::shared_ptr<ModFolderModel>& mods;
|
||||||
|
|
||||||
bool selectPage(QString pageId);
|
bool selectPage(QString pageId);
|
||||||
|
|
||||||
ModPage* getSelectedPage();
|
ModPage* getSelectedPage();
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
void confirm();
|
void confirm();
|
||||||
void accept() override;
|
void accept() override;
|
||||||
void reject() override;
|
void reject() override;
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void selectedPageChanged(BasePage* previous, BasePage* selected);
|
void selectedPageChanged(BasePage* previous, BasePage* selected);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Ui::ModDownloadDialog *ui = nullptr;
|
Ui::ModDownloadDialog* ui = nullptr;
|
||||||
PageContainer * m_container = nullptr;
|
PageContainer* m_container = nullptr;
|
||||||
QDialogButtonBox * m_buttons = nullptr;
|
QDialogButtonBox* m_buttons = nullptr;
|
||||||
QVBoxLayout *m_verticalLayout = nullptr;
|
QVBoxLayout* m_verticalLayout = nullptr;
|
||||||
ModPage *m_selected_page = nullptr;
|
ModPage* m_selectedPage = nullptr;
|
||||||
|
|
||||||
QHash<QString, ModDownloadTask*> modTask;
|
QHash<QString, ModDownloadTask*> modTask;
|
||||||
BaseInstance *m_instance;
|
BaseInstance* m_instance;
|
||||||
};
|
};
|
||||||
|
@ -257,17 +257,15 @@ void ModPage::openUrl(const QUrl& url)
|
|||||||
int prefixLength;
|
int prefixLength;
|
||||||
const char* page;
|
const char* page;
|
||||||
|
|
||||||
if ((url.host() == "modrinth.com" || url.host() == "www.modrinth.com")
|
if ((url.host() == "modrinth.com" || url.host() == "www.modrinth.com") && url.path().startsWith("/mod/")) {
|
||||||
&& url.path().startsWith("/mod/")) {
|
|
||||||
prefixLength = 5;
|
prefixLength = 5;
|
||||||
page = "modrinth";
|
page = "modrinth";
|
||||||
} else if (APPLICATION->capabilities() & Application::SupportsFlame
|
} else if (APPLICATION->capabilities() & Application::SupportsFlame &&
|
||||||
&& (url.host() == "curseforge.com" || url.host() == "www.curseforge.com")
|
(url.host() == "curseforge.com" || url.host() == "www.curseforge.com") &&
|
||||||
&& url.path().toLower().startsWith("/minecraft/mc-mods/")) {
|
url.path().toLower().startsWith("/minecraft/mc-mods/")) {
|
||||||
prefixLength = 19;
|
prefixLength = 19;
|
||||||
page = "curseforge";
|
page = "curseforge";
|
||||||
}
|
} else
|
||||||
else
|
|
||||||
prefixLength = 0;
|
prefixLength = 0;
|
||||||
|
|
||||||
if (prefixLength != 0) {
|
if (prefixLength != 0) {
|
||||||
@ -312,7 +310,6 @@ void ModPage::openUrl(const QUrl& url)
|
|||||||
QDesktopServices::openUrl(url);
|
QDesktopServices::openUrl(url);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/******** Make changes to the UI ********/
|
/******** Make changes to the UI ********/
|
||||||
|
|
||||||
void ModPage::retranslate()
|
void ModPage::retranslate()
|
||||||
|
Loading…
Reference in New Issue
Block a user