summaryrefslogtreecommitdiffstats
path: root/application
diff options
context:
space:
mode:
Diffstat (limited to 'application')
-rw-r--r--application/dialogs/NewInstanceDialog.cpp19
-rw-r--r--application/dialogs/NewInstanceDialog.h2
-rw-r--r--application/pages/modplatform/TwitchPage.cpp7
-rw-r--r--application/pages/modplatform/TwitchPage.h4
4 files changed, 25 insertions, 7 deletions
diff --git a/application/dialogs/NewInstanceDialog.cpp b/application/dialogs/NewInstanceDialog.cpp
index 402a3417..3533763d 100644
--- a/application/dialogs/NewInstanceDialog.cpp
+++ b/application/dialogs/NewInstanceDialog.cpp
@@ -39,6 +39,8 @@
#include <pages/modplatform/ImportPage.h>
#include <pages/modplatform/TechnicPage.h>
+
+
NewInstanceDialog::NewInstanceDialog(const QString & initialGroup, const QString & url, QWidget *parent)
: QDialog(parent), ui(new Ui::NewInstanceDialog)
{
@@ -94,8 +96,15 @@ NewInstanceDialog::NewInstanceDialog(const QString & initialGroup, const QString
if(!url.isEmpty())
{
- m_container->selectPage("import");
- importPage->setUrl(url);
+ QUrl actualUrl(url);
+ if(actualUrl.host() == "www.curseforge.com") {
+ m_container->selectPage("twitch");
+ twitchPage->setUrl(url);
+ }
+ else {
+ m_container->selectPage("import");
+ importPage->setUrl(url);
+ }
}
updateDialogState();
@@ -119,13 +128,13 @@ void NewInstanceDialog::accept()
QList<BasePage *> NewInstanceDialog::getPages()
{
importPage = new ImportPage(this);
+ twitchPage = new TwitchPage(this);
return
{
new VanillaPage(this),
- new FTBPage(this),
importPage,
- new TwitchPage(this),
- new TechnicPage(this)
+ twitchPage,
+ new FTBPage(this)
};
}
diff --git a/application/dialogs/NewInstanceDialog.h b/application/dialogs/NewInstanceDialog.h
index c86ab73f..0b8b2fb8 100644
--- a/application/dialogs/NewInstanceDialog.h
+++ b/application/dialogs/NewInstanceDialog.h
@@ -29,6 +29,7 @@ class NewInstanceDialog;
class PageContainer;
class QDialogButtonBox;
class ImportPage;
+class TwitchPage;
class NewInstanceDialog : public QDialog, public BasePageProvider
{
@@ -67,6 +68,7 @@ private:
QString InstIconKey;
ImportPage *importPage = nullptr;
+ TwitchPage *twitchPage = nullptr;
std::unique_ptr<InstanceTask> creationTask;
bool importIcon = false;
diff --git a/application/pages/modplatform/TwitchPage.cpp b/application/pages/modplatform/TwitchPage.cpp
index 52d87fa4..ea0f9267 100644
--- a/application/pages/modplatform/TwitchPage.cpp
+++ b/application/pages/modplatform/TwitchPage.cpp
@@ -30,7 +30,6 @@ void TwitchPage::openedImpl()
void TwitchPage::triggerCheck(bool)
{
if(m_modIdResolver) {
- qDebug() << "Click!";
return;
}
auto task = new Flame::UrlResolvingTask(ui->lineEdit->text());
@@ -39,6 +38,12 @@ void TwitchPage::triggerCheck(bool)
task->start();
}
+void TwitchPage::setUrl(const QString& url)
+{
+ ui->lineEdit->setText(url);
+ triggerCheck(true);
+}
+
void TwitchPage::checkDone()
{
auto result = m_modIdResolver->getResults();
diff --git a/application/pages/modplatform/TwitchPage.h b/application/pages/modplatform/TwitchPage.h
index 6d5146cc..600913cd 100644
--- a/application/pages/modplatform/TwitchPage.h
+++ b/application/pages/modplatform/TwitchPage.h
@@ -38,7 +38,7 @@ public:
virtual ~TwitchPage();
virtual QString displayName() const override
{
- return tr("Twitch");
+ return tr("Twitch URL");
}
virtual QIcon icon() const override
{
@@ -56,6 +56,8 @@ public:
void openedImpl() override;
+ void setUrl(const QString & url);
+
private slots:
void triggerCheck(bool checked);
void checkDone();