Skip to content
Permalink
Browse files

NOISSUE recognize curseforge URLs dropped on top of MultiMC

  • Loading branch information...
peterix committed Jul 9, 2019
1 parent 739a86f commit 725ec356350175ba08bca0eae8475dc2654dd10a
@@ -21,6 +21,11 @@ void Flame::UrlResolvingTask::resolveUrl()
{
setStatus(tr("Resolving URL..."));
setProgress(0, 1);
QUrl actualUrl(m_url);
if(actualUrl.host() != "www.curseforge.com") {
emitFailed(tr("Not a Twitch URL."));
return;
}
m_dljob.reset(new NetJob("URL resolver"));

bool weAreDigging = false;
@@ -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)
};
}

@@ -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 slots:

QString InstIconKey;
ImportPage *importPage = nullptr;
TwitchPage *twitchPage = nullptr;
std::unique_ptr<InstanceTask> creationTask;

bool importIcon = false;
@@ -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();
@@ -38,7 +38,7 @@ class TwitchPage : public QWidget, public BasePage
virtual ~TwitchPage();
virtual QString displayName() const override
{
return tr("Twitch");
return tr("Twitch URL");
}
virtual QIcon icon() const override
{
@@ -56,6 +56,8 @@ class TwitchPage : public QWidget, public BasePage

void openedImpl() override;

void setUrl(const QString & url);

private slots:
void triggerCheck(bool checked);
void checkDone();

0 comments on commit 725ec35

Please sign in to comment.
You can’t perform that action at this time.