diff options
author | Petr Mrázek <peterix@gmail.com> | 2019-06-29 01:13:39 +0200 |
---|---|---|
committer | Petr Mrázek <peterix@gmail.com> | 2019-06-29 01:13:39 +0200 |
commit | f74e3db804f2fb3d73cbf7ab5fbdb12ecea0f259 (patch) | |
tree | 11e91448dd85a701142fbbd11b7b3d3f4bc1372b /application | |
parent | fde43c993e0a143b9dddcaff2190c91f4e5e3cb9 (diff) | |
download | MultiMC-f74e3db804f2fb3d73cbf7ab5fbdb12ecea0f259.tar MultiMC-f74e3db804f2fb3d73cbf7ab5fbdb12ecea0f259.tar.gz MultiMC-f74e3db804f2fb3d73cbf7ab5fbdb12ecea0f259.tar.lz MultiMC-f74e3db804f2fb3d73cbf7ab5fbdb12ecea0f259.tar.xz MultiMC-f74e3db804f2fb3d73cbf7ab5fbdb12ecea0f259.zip |
NOISSUE Import page is now a MultiMC pack page
Diffstat (limited to 'application')
-rw-r--r-- | application/CMakeLists.txt | 12 | ||||
-rw-r--r-- | application/MultiMC.cpp | 4 | ||||
-rw-r--r-- | application/dialogs/NewInstanceDialog.cpp | 6 | ||||
-rw-r--r-- | application/dialogs/NewInstanceDialog.h | 4 | ||||
-rw-r--r-- | application/pages/global/MultiMCSettingsPage.cpp (renamed from application/pages/global/MultiMCPage.cpp) | 32 | ||||
-rw-r--r-- | application/pages/global/MultiMCSettingsPage.h (renamed from application/pages/global/MultiMCPage.h) | 10 | ||||
-rw-r--r-- | application/pages/global/MultiMCSettingsPage.ui (renamed from application/pages/global/MultiMCPage.ui) | 4 | ||||
-rw-r--r-- | application/pages/modplatform/MultiMCPage.cpp (renamed from application/pages/modplatform/ImportPage.cpp) | 29 | ||||
-rw-r--r-- | application/pages/modplatform/MultiMCPage.h (renamed from application/pages/modplatform/ImportPage.h) | 18 | ||||
-rw-r--r-- | application/pages/modplatform/MultiMCPage.ui (renamed from application/pages/modplatform/ImportPage.ui) | 4 |
10 files changed, 59 insertions, 64 deletions
diff --git a/application/CMakeLists.txt b/application/CMakeLists.txt index f8709cfd..10e1afc7 100644 --- a/application/CMakeLists.txt +++ b/application/CMakeLists.txt @@ -119,8 +119,8 @@ SET(MULTIMC_SOURCES pages/global/LanguagePage.h pages/global/MinecraftPage.cpp pages/global/MinecraftPage.h - pages/global/MultiMCPage.cpp - pages/global/MultiMCPage.h + pages/global/MultiMCSettingsPage.cpp + pages/global/MultiMCSettingsPage.h pages/global/ProxyPage.cpp pages/global/ProxyPage.h pages/global/PasteEEPage.cpp @@ -139,8 +139,8 @@ SET(MULTIMC_SOURCES pages/modplatform/TwitchPage.h pages/modplatform/TechnicPage.cpp pages/modplatform/TechnicPage.h - pages/modplatform/ImportPage.cpp - pages/modplatform/ImportPage.h + pages/modplatform/MultiMCPage.cpp + pages/modplatform/MultiMCPage.h # GUI - dialogs dialogs/AboutDialog.cpp @@ -245,7 +245,7 @@ SET(MULTIMC_UIS pages/global/ExternalToolsPage.ui pages/global/JavaPage.ui pages/global/MinecraftPage.ui - pages/global/MultiMCPage.ui + pages/global/MultiMCSettingsPage.ui pages/global/ProxyPage.ui pages/global/PasteEEPage.ui pages/global/PackagesPage.ui @@ -255,7 +255,7 @@ SET(MULTIMC_UIS pages/modplatform/FTBPage.ui pages/modplatform/TwitchPage.ui pages/modplatform/TechnicPage.ui - pages/modplatform/ImportPage.ui + pages/modplatform/MultiMCPage.ui # Dialogs dialogs/CopyInstanceDialog.ui diff --git a/application/MultiMC.cpp b/application/MultiMC.cpp index 179839fe..d76bd0a7 100644 --- a/application/MultiMC.cpp +++ b/application/MultiMC.cpp @@ -3,7 +3,7 @@ #include "MainWindow.h" #include "InstanceWindow.h" #include "pages/BasePageProvider.h" -#include "pages/global/MultiMCPage.h" +#include "pages/global/MultiMCSettingsPage.h" #include "pages/global/MinecraftPage.h" #include "pages/global/JavaPage.h" #include "pages/global/LanguagePage.h" @@ -517,7 +517,7 @@ MultiMC::MultiMC(int &argc, char **argv) : QApplication(argc, argv) // Init page provider { m_globalSettingsProvider = std::make_shared<GenericPageProvider>(tr("Settings")); - m_globalSettingsProvider->addPage<MultiMCPage>(); + m_globalSettingsProvider->addPage<MultiMCSettingsPage>(); m_globalSettingsProvider->addPage<MinecraftPage>(); m_globalSettingsProvider->addPage<JavaPage>(); m_globalSettingsProvider->addPage<LanguagePage>(); diff --git a/application/dialogs/NewInstanceDialog.cpp b/application/dialogs/NewInstanceDialog.cpp index 402a3417..e850d728 100644 --- a/application/dialogs/NewInstanceDialog.cpp +++ b/application/dialogs/NewInstanceDialog.cpp @@ -36,7 +36,7 @@ #include <pages/modplatform/VanillaPage.h> #include <pages/modplatform/FTBPage.h> #include <pages/modplatform/TwitchPage.h> -#include <pages/modplatform/ImportPage.h> +#include <pages/modplatform/MultiMCPage.h> #include <pages/modplatform/TechnicPage.h> NewInstanceDialog::NewInstanceDialog(const QString & initialGroup, const QString & url, QWidget *parent) @@ -118,13 +118,13 @@ void NewInstanceDialog::accept() QList<BasePage *> NewInstanceDialog::getPages() { - importPage = new ImportPage(this); + importPage = new MultiMCPage(this); return { new VanillaPage(this), - new FTBPage(this), importPage, new TwitchPage(this), + new FTBPage(this), new TechnicPage(this) }; } diff --git a/application/dialogs/NewInstanceDialog.h b/application/dialogs/NewInstanceDialog.h index c86ab73f..afeab4d1 100644 --- a/application/dialogs/NewInstanceDialog.h +++ b/application/dialogs/NewInstanceDialog.h @@ -28,7 +28,7 @@ class NewInstanceDialog; class PageContainer; class QDialogButtonBox; -class ImportPage; +class MultiMCPage; class NewInstanceDialog : public QDialog, public BasePageProvider { @@ -66,7 +66,7 @@ private: QDialogButtonBox * m_buttons = nullptr; QString InstIconKey; - ImportPage *importPage = nullptr; + MultiMCPage *importPage = nullptr; std::unique_ptr<InstanceTask> creationTask; bool importIcon = false; diff --git a/application/pages/global/MultiMCPage.cpp b/application/pages/global/MultiMCSettingsPage.cpp index 9baaa55b..b5505127 100644 --- a/application/pages/global/MultiMCPage.cpp +++ b/application/pages/global/MultiMCSettingsPage.cpp @@ -13,8 +13,8 @@ * limitations under the License. */ -#include "MultiMCPage.h" -#include "ui_MultiMCPage.h" +#include "MultiMCSettingsPage.h" +#include "ui_MultiMCSettingsPage.h" #include <QFileDialog> #include <QMessageBox> @@ -38,7 +38,7 @@ enum InstSortMode Sort_LastLaunch }; -MultiMCPage::MultiMCPage(QWidget *parent) : QWidget(parent), ui(new Ui::MultiMCPage) +MultiMCSettingsPage::MultiMCSettingsPage(QWidget *parent) : QWidget(parent), ui(new Ui::MultiMCSettingsPage) { ui->setupUi(this); auto origForeground = ui->fontPreview->palette().color(ui->fontPreview->foregroundRole()); @@ -56,7 +56,7 @@ MultiMCPage::MultiMCPage(QWidget *parent) : QWidget(parent), ui(new Ui::MultiMCP if(BuildConfig.UPDATER_ENABLED) { QObject::connect(MMC->updateChecker().get(), &UpdateChecker::channelListLoaded, this, - &MultiMCPage::refreshUpdateChannelList); + &MultiMCSettingsPage::refreshUpdateChannelList); if (MMC->updateChecker()->hasChannels()) { @@ -81,18 +81,18 @@ MultiMCPage::MultiMCPage(QWidget *parent) : QWidget(parent), ui(new Ui::MultiMCP connect(ui->languageBox, SIGNAL(currentIndexChanged(int)), SLOT(languageIndexChanged(int))); } -MultiMCPage::~MultiMCPage() +MultiMCSettingsPage::~MultiMCSettingsPage() { delete ui; } -bool MultiMCPage::apply() +bool MultiMCSettingsPage::apply() { applySettings(); return true; } -void MultiMCPage::on_instDirBrowseBtn_clicked() +void MultiMCSettingsPage::on_instDirBrowseBtn_clicked() { QString raw_dir = QFileDialog::getExistingDirectory(this, tr("Instance Folder"), ui->instDirTextBox->text()); @@ -124,7 +124,7 @@ void MultiMCPage::on_instDirBrowseBtn_clicked() } } -void MultiMCPage::on_iconsDirBrowseBtn_clicked() +void MultiMCSettingsPage::on_iconsDirBrowseBtn_clicked() { QString raw_dir = QFileDialog::getExistingDirectory(this, tr("Icons Folder"), ui->iconsDirTextBox->text()); @@ -135,7 +135,7 @@ void MultiMCPage::on_iconsDirBrowseBtn_clicked() ui->iconsDirTextBox->setText(cooked_dir); } } -void MultiMCPage::on_modsDirBrowseBtn_clicked() +void MultiMCSettingsPage::on_modsDirBrowseBtn_clicked() { QString raw_dir = QFileDialog::getExistingDirectory(this, tr("Mods Folder"), ui->modsDirTextBox->text()); @@ -147,7 +147,7 @@ void MultiMCPage::on_modsDirBrowseBtn_clicked() } } -void MultiMCPage::languageIndexChanged(int index) +void MultiMCSettingsPage::languageIndexChanged(int index) { auto languageCode = ui->languageBox->itemData(ui->languageBox->currentIndex()).toString(); if(languageCode.isEmpty()) @@ -160,7 +160,7 @@ void MultiMCPage::languageIndexChanged(int index) translations->updateLanguage(languageCode); } -void MultiMCPage::refreshUpdateChannelList() +void MultiMCSettingsPage::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 MultiMCPage::refreshUpdateChannelList() ui->updateChannelComboBox->setEnabled(true); } -void MultiMCPage::updateChannelSelectionChanged(int index) +void MultiMCSettingsPage::updateChannelSelectionChanged(int index) { refreshUpdateChannelDesc(); } -void MultiMCPage::refreshUpdateChannelDesc() +void MultiMCSettingsPage::refreshUpdateChannelDesc() { // Get the channel list. QList<UpdateChecker::ChannelListEntry> channelList = MMC->updateChecker()->getChannelList(); @@ -232,7 +232,7 @@ void MultiMCPage::refreshUpdateChannelDesc() } } -void MultiMCPage::applySettings() +void MultiMCSettingsPage::applySettings() { auto s = MMC->settings(); @@ -329,7 +329,7 @@ void MultiMCPage::applySettings() s->set("Analytics", ui->analyticsCheck->isChecked()); } } -void MultiMCPage::loadSettings() +void MultiMCSettingsPage::loadSettings() { auto s = MMC->settings(); // Language @@ -437,7 +437,7 @@ void MultiMCPage::loadSettings() } } -void MultiMCPage::refreshFontPreview() +void MultiMCSettingsPage::refreshFontPreview() { int fontSize = ui->fontSizeBox->value(); QString fontFamily = ui->consoleFont->currentFont().family(); diff --git a/application/pages/global/MultiMCPage.h b/application/pages/global/MultiMCSettingsPage.h index 7e7f655d..7b508ad9 100644 --- a/application/pages/global/MultiMCPage.h +++ b/application/pages/global/MultiMCSettingsPage.h @@ -29,16 +29,16 @@ class SettingsObject; namespace Ui { -class MultiMCPage; +class MultiMCSettingsPage; } -class MultiMCPage : public QWidget, public BasePage +class MultiMCSettingsPage : public QWidget, public BasePage { Q_OBJECT public: - explicit MultiMCPage(QWidget *parent = 0); - ~MultiMCPage(); + explicit MultiMCSettingsPage(QWidget *parent = 0); + ~MultiMCSettingsPage(); QString displayName() const override { @@ -88,7 +88,7 @@ slots: void updateChannelSelectionChanged(int index); private: - Ui::MultiMCPage *ui; + Ui::MultiMCSettingsPage *ui; /*! * Stores the currently selected update channel. diff --git a/application/pages/global/MultiMCPage.ui b/application/pages/global/MultiMCSettingsPage.ui index 124401c3..5e02d0aa 100644 --- a/application/pages/global/MultiMCPage.ui +++ b/application/pages/global/MultiMCSettingsPage.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>MultiMCSettingsPage</class> + <widget class="QWidget" name="MultiMCSettingsPage"> <property name="geometry"> <rect> <x>0</x> diff --git a/application/pages/modplatform/ImportPage.cpp b/application/pages/modplatform/MultiMCPage.cpp index 3910dfda..c98596c2 100644 --- a/application/pages/modplatform/ImportPage.cpp +++ b/application/pages/modplatform/MultiMCPage.cpp @@ -1,5 +1,5 @@ -#include "ImportPage.h" -#include "ui_ImportPage.h" +#include "MultiMCPage.h" +#include "ui_MultiMCPage.h" #include "MultiMC.h" #include "dialogs/NewInstanceDialog.h" @@ -30,30 +30,30 @@ public: } }; -ImportPage::ImportPage(NewInstanceDialog* dialog, QWidget *parent) - : QWidget(parent), ui(new Ui::ImportPage), dialog(dialog) +MultiMCPage::MultiMCPage(NewInstanceDialog* dialog, QWidget *parent) + : QWidget(parent), ui(new Ui::MultiMCPage), dialog(dialog) { ui->setupUi(this); ui->modpackEdit->setValidator(new UrlValidator(ui->modpackEdit)); - connect(ui->modpackEdit, &QLineEdit::textChanged, this, &ImportPage::updateState); + connect(ui->modpackEdit, &QLineEdit::textChanged, this, &MultiMCPage::updateState); } -ImportPage::~ImportPage() +MultiMCPage::~MultiMCPage() { delete ui; } -bool ImportPage::shouldDisplay() const +bool MultiMCPage::shouldDisplay() const { return true; } -void ImportPage::openedImpl() +void MultiMCPage::openedImpl() { updateState(); } -void ImportPage::updateState() +void MultiMCPage::updateState() { if(!isOpened) { @@ -75,11 +75,6 @@ void ImportPage::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)); @@ -91,13 +86,13 @@ void ImportPage::updateState() } } -void ImportPage::setUrl(const QString& url) +void MultiMCPage::setUrl(const QString& url) { ui->modpackEdit->setText(url); updateState(); } -void ImportPage::on_modpackBtn_clicked() +void MultiMCPage::on_modpackBtn_clicked() { const QUrl url = QFileDialog::getOpenFileUrl(this, tr("Choose modpack"), modpackUrl(), tr("Zip (*.zip)")); if (url.isValid()) @@ -114,7 +109,7 @@ void ImportPage::on_modpackBtn_clicked() } -QUrl ImportPage::modpackUrl() const +QUrl MultiMCPage::modpackUrl() const { const QUrl url(ui->modpackEdit->text()); if (url.isValid() && !url.isRelative() && !url.host().isEmpty()) diff --git a/application/pages/modplatform/ImportPage.h b/application/pages/modplatform/MultiMCPage.h index 3afb0045..1d9b7744 100644 --- a/application/pages/modplatform/ImportPage.h +++ b/application/pages/modplatform/MultiMCPage.h @@ -23,33 +23,33 @@ namespace Ui { -class ImportPage; +class MultiMCPage; } class NewInstanceDialog; -class ImportPage : public QWidget, public BasePage +class MultiMCPage : public QWidget, public BasePage { Q_OBJECT public: - explicit ImportPage(NewInstanceDialog* dialog, QWidget *parent = 0); - virtual ~ImportPage(); + explicit MultiMCPage(NewInstanceDialog* dialog, QWidget *parent = 0); + virtual ~MultiMCPage(); virtual QString displayName() const override { - return tr("Import from zip"); + return tr("MultiMC"); } virtual QIcon icon() const override { - return MMC->getThemedIcon("viewfolder"); + return MMC->getThemedIcon("multimc"); } virtual QString id() const override { - return "import"; + return "multimc"; } virtual QString helpPage() const override { - return "Zip-import"; + return "MultiMC-packs"; } virtual bool shouldDisplay() const override; @@ -64,7 +64,7 @@ private: QUrl modpackUrl() const; private: - Ui::ImportPage *ui = nullptr; + Ui::MultiMCPage *ui = nullptr; NewInstanceDialog* dialog = nullptr; }; diff --git a/application/pages/modplatform/ImportPage.ui b/application/pages/modplatform/MultiMCPage.ui index eb63cbe9..dc329c4c 100644 --- a/application/pages/modplatform/ImportPage.ui +++ b/application/pages/modplatform/MultiMCPage.ui @@ -1,7 +1,7 @@ <?xml version="1.0" encoding="UTF-8"?> <ui version="4.0"> - <class>ImportPage</class> - <widget class="QWidget" name="ImportPage"> + <class>MultiMCPage</class> + <widget class="QWidget" name="MultiMCPage"> <property name="geometry"> <rect> <x>0</x> |