summaryrefslogtreecommitdiffstats
path: root/application/pages
diff options
context:
space:
mode:
authorPetr Mrázek <peterix@gmail.com>2019-07-09 21:51:19 +0200
committerPetr Mrázek <peterix@gmail.com>2019-07-09 21:51:19 +0200
commit739a86f17194e60f44767d5830d7c214edc5d276 (patch)
tree4fd43d9a4f97670895d3c7fd77f9be40e36bbfe3 /application/pages
parent48b2f95129cb8ad67932ae000e32ce212080e037 (diff)
downloadMultiMC-739a86f17194e60f44767d5830d7c214edc5d276.tar
MultiMC-739a86f17194e60f44767d5830d7c214edc5d276.tar.gz
MultiMC-739a86f17194e60f44767d5830d7c214edc5d276.tar.lz
MultiMC-739a86f17194e60f44767d5830d7c214edc5d276.tar.xz
MultiMC-739a86f17194e60f44767d5830d7c214edc5d276.zip
Revert "NOISSUE Import page is now a MultiMC pack page"
This reverts commit f74e3db804f2fb3d73cbf7ab5fbdb12ecea0f259.
Diffstat (limited to 'application/pages')
-rw-r--r--application/pages/global/MultiMCPage.cpp (renamed from application/pages/global/MultiMCSettingsPage.cpp)32
-rw-r--r--application/pages/global/MultiMCPage.h (renamed from application/pages/global/MultiMCSettingsPage.h)10
-rw-r--r--application/pages/global/MultiMCPage.ui (renamed from application/pages/global/MultiMCSettingsPage.ui)4
-rw-r--r--application/pages/modplatform/ImportPage.cpp (renamed from application/pages/modplatform/MultiMCPage.cpp)29
-rw-r--r--application/pages/modplatform/ImportPage.h (renamed from application/pages/modplatform/MultiMCPage.h)18
-rw-r--r--application/pages/modplatform/ImportPage.ui (renamed from application/pages/modplatform/MultiMCPage.ui)4
6 files changed, 51 insertions, 46 deletions
diff --git a/application/pages/global/MultiMCSettingsPage.cpp b/application/pages/global/MultiMCPage.cpp
index b5505127..9baaa55b 100644
--- a/application/pages/global/MultiMCSettingsPage.cpp
+++ b/application/pages/global/MultiMCPage.cpp
@@ -13,8 +13,8 @@
* limitations under the License.
*/
-#include "MultiMCSettingsPage.h"
-#include "ui_MultiMCSettingsPage.h"
+#include "MultiMCPage.h"
+#include "ui_MultiMCPage.h"
#include <QFileDialog>
#include <QMessageBox>
@@ -38,7 +38,7 @@ enum InstSortMode
Sort_LastLaunch
};
-MultiMCSettingsPage::MultiMCSettingsPage(QWidget *parent) : QWidget(parent), ui(new Ui::MultiMCSettingsPage)
+MultiMCPage::MultiMCPage(QWidget *parent) : QWidget(parent), ui(new Ui::MultiMCPage)
{
ui->setupUi(this);
auto origForeground = ui->fontPreview->palette().color(ui->fontPreview->foregroundRole());
@@ -56,7 +56,7 @@ MultiMCSettingsPage::MultiMCSettingsPage(QWidget *parent) : QWidget(parent), ui(
if(BuildConfig.UPDATER_ENABLED)
{
QObject::connect(MMC->updateChecker().get(), &UpdateChecker::channelListLoaded, this,
- &MultiMCSettingsPage::refreshUpdateChannelList);
+ &MultiMCPage::refreshUpdateChannelList);
if (MMC->updateChecker()->hasChannels())
{
@@ -81,18 +81,18 @@ MultiMCSettingsPage::MultiMCSettingsPage(QWidget *parent) : QWidget(parent), ui(
connect(ui->languageBox, SIGNAL(currentIndexChanged(int)), SLOT(languageIndexChanged(int)));
}
-MultiMCSettingsPage::~MultiMCSettingsPage()
+MultiMCPage::~MultiMCPage()
{
delete ui;
}
-bool MultiMCSettingsPage::apply()
+bool MultiMCPage::apply()
{
applySettings();
return true;
}
-void MultiMCSettingsPage::on_instDirBrowseBtn_clicked()
+void MultiMCPage::on_instDirBrowseBtn_clicked()
{
QString raw_dir = QFileDialog::getExistingDirectory(this, tr("Instance Folder"), ui->instDirTextBox->text());
@@ -124,7 +124,7 @@ void MultiMCSettingsPage::on_instDirBrowseBtn_clicked()
}
}
-void MultiMCSettingsPage::on_iconsDirBrowseBtn_clicked()
+void MultiMCPage::on_iconsDirBrowseBtn_clicked()
{
QString raw_dir = QFileDialog::getExistingDirectory(this, tr("Icons Folder"), ui->iconsDirTextBox->text());
@@ -135,7 +135,7 @@ void MultiMCSettingsPage::on_iconsDirBrowseBtn_clicked()
ui->iconsDirTextBox->setText(cooked_dir);
}
}
-void MultiMCSettingsPage::on_modsDirBrowseBtn_clicked()
+void MultiMCPage::on_modsDirBrowseBtn_clicked()
{
QString raw_dir = QFileDialog::getExistingDirectory(this, tr("Mods Folder"), ui->modsDirTextBox->text());
@@ -147,7 +147,7 @@ void MultiMCSettingsPage::on_modsDirBrowseBtn_clicked()
}
}
-void MultiMCSettingsPage::languageIndexChanged(int index)
+void MultiMCPage::languageIndexChanged(int index)
{
auto languageCode = ui->languageBox->itemData(ui->languageBox->currentIndex()).toString();
if(languageCode.isEmpty())
@@ -160,7 +160,7 @@ void MultiMCSettingsPage::languageIndexChanged(int index)
translations->updateLanguage(languageCode);
}
-void MultiMCSettingsPage::refreshUpdateChannelList()
+void MultiMCPage::refreshUpdateChannelList()
{
// Stop listening for selection changes. It's going to change a lot while we update it and
// we don't need to update the
@@ -205,12 +205,12 @@ void MultiMCSettingsPage::refreshUpdateChannelList()
ui->updateChannelComboBox->setEnabled(true);
}
-void MultiMCSettingsPage::updateChannelSelectionChanged(int index)
+void MultiMCPage::updateChannelSelectionChanged(int index)
{
refreshUpdateChannelDesc();
}
-void MultiMCSettingsPage::refreshUpdateChannelDesc()
+void MultiMCPage::refreshUpdateChannelDesc()
{
// Get the channel list.
QList<UpdateChecker::ChannelListEntry> channelList = MMC->updateChecker()->getChannelList();
@@ -232,7 +232,7 @@ void MultiMCSettingsPage::refreshUpdateChannelDesc()
}
}
-void MultiMCSettingsPage::applySettings()
+void MultiMCPage::applySettings()
{
auto s = MMC->settings();
@@ -329,7 +329,7 @@ void MultiMCSettingsPage::applySettings()
s->set("Analytics", ui->analyticsCheck->isChecked());
}
}
-void MultiMCSettingsPage::loadSettings()
+void MultiMCPage::loadSettings()
{
auto s = MMC->settings();
// Language
@@ -437,7 +437,7 @@ void MultiMCSettingsPage::loadSettings()
}
}
-void MultiMCSettingsPage::refreshFontPreview()
+void MultiMCPage::refreshFontPreview()
{
int fontSize = ui->fontSizeBox->value();
QString fontFamily = ui->consoleFont->currentFont().family();
diff --git a/application/pages/global/MultiMCSettingsPage.h b/application/pages/global/MultiMCPage.h
index 7b508ad9..7e7f655d 100644
--- a/application/pages/global/MultiMCSettingsPage.h
+++ b/application/pages/global/MultiMCPage.h
@@ -29,16 +29,16 @@ class SettingsObject;
namespace Ui
{
-class MultiMCSettingsPage;
+class MultiMCPage;
}
-class MultiMCSettingsPage : public QWidget, public BasePage
+class MultiMCPage : public QWidget, public BasePage
{
Q_OBJECT
public:
- explicit MultiMCSettingsPage(QWidget *parent = 0);
- ~MultiMCSettingsPage();
+ explicit MultiMCPage(QWidget *parent = 0);
+ ~MultiMCPage();
QString displayName() const override
{
@@ -88,7 +88,7 @@ slots:
void updateChannelSelectionChanged(int index);
private:
- Ui::MultiMCSettingsPage *ui;
+ Ui::MultiMCPage *ui;
/*!
* Stores the currently selected update channel.
diff --git a/application/pages/global/MultiMCSettingsPage.ui b/application/pages/global/MultiMCPage.ui
index 5e02d0aa..124401c3 100644
--- a/application/pages/global/MultiMCSettingsPage.ui
+++ b/application/pages/global/MultiMCPage.ui
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
- <class>MultiMCSettingsPage</class>
- <widget class="QWidget" name="MultiMCSettingsPage">
+ <class>MultiMCPage</class>
+ <widget class="QWidget" name="MultiMCPage">
<property name="geometry">
<rect>
<x>0</x>
diff --git a/application/pages/modplatform/MultiMCPage.cpp b/application/pages/modplatform/ImportPage.cpp
index c98596c2..3910dfda 100644
--- a/application/pages/modplatform/MultiMCPage.cpp
+++ b/application/pages/modplatform/ImportPage.cpp
@@ -1,5 +1,5 @@
-#include "MultiMCPage.h"
-#include "ui_MultiMCPage.h"
+#include "ImportPage.h"
+#include "ui_ImportPage.h"
#include "MultiMC.h"
#include "dialogs/NewInstanceDialog.h"
@@ -30,30 +30,30 @@ public:
}
};
-MultiMCPage::MultiMCPage(NewInstanceDialog* dialog, QWidget *parent)
- : QWidget(parent), ui(new Ui::MultiMCPage), dialog(dialog)
+ImportPage::ImportPage(NewInstanceDialog* dialog, QWidget *parent)
+ : QWidget(parent), ui(new Ui::ImportPage), dialog(dialog)
{
ui->setupUi(this);
ui->modpackEdit->setValidator(new UrlValidator(ui->modpackEdit));
- connect(ui->modpackEdit, &QLineEdit::textChanged, this, &MultiMCPage::updateState);
+ connect(ui->modpackEdit, &QLineEdit::textChanged, this, &ImportPage::updateState);
}
-MultiMCPage::~MultiMCPage()
+ImportPage::~ImportPage()
{
delete ui;
}
-bool MultiMCPage::shouldDisplay() const
+bool ImportPage::shouldDisplay() const
{
return true;
}
-void MultiMCPage::openedImpl()
+void ImportPage::openedImpl()
{
updateState();
}
-void MultiMCPage::updateState()
+void ImportPage::updateState()
{
if(!isOpened)
{
@@ -75,6 +75,11 @@ void MultiMCPage::updateState()
}
else
{
+ if(input.endsWith("?client=y")) {
+ input.chop(9);
+ input.append("/file");
+ url = QUrl::fromUserInput(input);
+ }
// hook, line and sinker.
QFileInfo fi(url.fileName());
dialog->setSuggestedPack(fi.completeBaseName(), new InstanceImportTask(url));
@@ -86,13 +91,13 @@ void MultiMCPage::updateState()
}
}
-void MultiMCPage::setUrl(const QString& url)
+void ImportPage::setUrl(const QString& url)
{
ui->modpackEdit->setText(url);
updateState();
}
-void MultiMCPage::on_modpackBtn_clicked()
+void ImportPage::on_modpackBtn_clicked()
{
const QUrl url = QFileDialog::getOpenFileUrl(this, tr("Choose modpack"), modpackUrl(), tr("Zip (*.zip)"));
if (url.isValid())
@@ -109,7 +114,7 @@ void MultiMCPage::on_modpackBtn_clicked()
}
-QUrl MultiMCPage::modpackUrl() const
+QUrl ImportPage::modpackUrl() const
{
const QUrl url(ui->modpackEdit->text());
if (url.isValid() && !url.isRelative() && !url.host().isEmpty())
diff --git a/application/pages/modplatform/MultiMCPage.h b/application/pages/modplatform/ImportPage.h
index 1d9b7744..3afb0045 100644
--- a/application/pages/modplatform/MultiMCPage.h
+++ b/application/pages/modplatform/ImportPage.h
@@ -23,33 +23,33 @@
namespace Ui
{
-class MultiMCPage;
+class ImportPage;
}
class NewInstanceDialog;
-class MultiMCPage : public QWidget, public BasePage
+class ImportPage : public QWidget, public BasePage
{
Q_OBJECT
public:
- explicit MultiMCPage(NewInstanceDialog* dialog, QWidget *parent = 0);
- virtual ~MultiMCPage();
+ explicit ImportPage(NewInstanceDialog* dialog, QWidget *parent = 0);
+ virtual ~ImportPage();
virtual QString displayName() const override
{
- return tr("MultiMC");
+ return tr("Import from zip");
}
virtual QIcon icon() const override
{
- return MMC->getThemedIcon("multimc");
+ return MMC->getThemedIcon("viewfolder");
}
virtual QString id() const override
{
- return "multimc";
+ return "import";
}
virtual QString helpPage() const override
{
- return "MultiMC-packs";
+ return "Zip-import";
}
virtual bool shouldDisplay() const override;
@@ -64,7 +64,7 @@ private:
QUrl modpackUrl() const;
private:
- Ui::MultiMCPage *ui = nullptr;
+ Ui::ImportPage *ui = nullptr;
NewInstanceDialog* dialog = nullptr;
};
diff --git a/application/pages/modplatform/MultiMCPage.ui b/application/pages/modplatform/ImportPage.ui
index dc329c4c..eb63cbe9 100644
--- a/application/pages/modplatform/MultiMCPage.ui
+++ b/application/pages/modplatform/ImportPage.ui
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
- <class>MultiMCPage</class>
- <widget class="QWidget" name="MultiMCPage">
+ <class>ImportPage</class>
+ <widget class="QWidget" name="ImportPage">
<property name="geometry">
<rect>
<x>0</x>