diff options
Diffstat (limited to 'application')
25 files changed, 201 insertions, 1163 deletions
diff --git a/application/BuildConfig.cpp.in b/application/BuildConfig.cpp.in index 70bc93d3..99551867 100644 --- a/application/BuildConfig.cpp.in +++ b/application/BuildConfig.cpp.in @@ -33,7 +33,6 @@ Config::Config() VERSION_STR = "@MultiMC_VERSION_STRING@"; NEWS_RSS_URL = "@MultiMC_NEWS_RSS_URL@"; PASTE_EE_KEY = "@MultiMC_PASTE_EE_API_KEY@"; - WONKO_ROOT_URL = "@MultiMC_WONKO_ROOT_URL@"; } QString Config::printableVersionString() const diff --git a/application/BuildConfig.h b/application/BuildConfig.h index 75109b1c..1c9466ba 100644 --- a/application/BuildConfig.h +++ b/application/BuildConfig.h @@ -61,11 +61,6 @@ public: QString PASTE_EE_KEY; /** - * Root URL for wonko things. Other wonko URLs will be resolved relative to this. - */ - QString WONKO_ROOT_URL; - - /** * \brief Converts the Version to a string. * \return The version number in string format (major.minor.revision.build). */ diff --git a/application/CMakeLists.txt b/application/CMakeLists.txt index 90fa1aca..f03225da 100644 --- a/application/CMakeLists.txt +++ b/application/CMakeLists.txt @@ -30,9 +30,6 @@ set(MultiMC_ANALYTICS_ID "" CACHE STRING "ID you can get from Google analytics") include(GetGitRevisionDescription) get_git_head_revision(MultiMC_GIT_REFSPEC MultiMC_GIT_COMMIT) -# Root URL for wonko files -set(MultiMC_WONKO_ROOT_URL "" CACHE STRING "Root URL for wonko stuff") - message(STATUS "Git commit: ${MultiMC_GIT_COMMIT}") message(STATUS "Git refspec: ${MultiMC_GIT_REFSPEC}") @@ -99,8 +96,6 @@ SET(MULTIMC_SOURCES VersionProxyModel.cpp ColorCache.h ColorCache.cpp - WonkoGui.h - WonkoGui.cpp # GUI - windows MainWindow.h @@ -189,8 +184,8 @@ SET(MULTIMC_SOURCES pages/global/ProxyPage.h pages/global/PasteEEPage.cpp pages/global/PasteEEPage.h - pages/global/WonkoPage.cpp - pages/global/WonkoPage.h + pages/global/PackagesPage.cpp + pages/global/PackagesPage.h # GUI - dialogs dialogs/AboutDialog.cpp @@ -289,7 +284,7 @@ SET(MULTIMC_UIS pages/global/MultiMCPage.ui pages/global/ProxyPage.ui pages/global/PasteEEPage.ui - pages/global/WonkoPage.ui + pages/global/PackagesPage.ui # Dialogs dialogs/CopyInstanceDialog.ui @@ -318,7 +313,6 @@ set(MULTIMC_QRCS resources/pe_blue/pe_blue.qrc resources/OSX/OSX.qrc resources/iOS/iOS.qrc - resources/versions/versions.qrc resources/certs/certs.qrc ) diff --git a/application/MainWindow.cpp b/application/MainWindow.cpp index 3bdf540d..e0870d06 100644 --- a/application/MainWindow.cpp +++ b/application/MainWindow.cpp @@ -54,7 +54,6 @@ #include <java/JavaUtils.h> #include <java/JavaInstallList.h> #include <launch/LaunchTask.h> -#include <minecraft/MinecraftVersionList.h> #include <minecraft/legacy/LwjglVersionList.h> #include <minecraft/auth/MojangAccountList.h> #include <SkinUtils.h> @@ -555,19 +554,8 @@ MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent), ui(new MainWindow job->start(); } - // run the things that load and download other things... FIXME: this is NOT the place - // FIXME: invisible actions in the background = NOPE. + // load the news { - if (!MMC->minecraftlist()->isLoaded()) - { - m_versionLoadTask = MMC->minecraftlist()->getLoadTask(); - startTask(m_versionLoadTask); - } - if (!MMC->lwjgllist()->isLoaded()) - { - MMC->lwjgllist()->loadList(); - } - m_newsChecker->reloadNews(); updateNewsLabel(); } @@ -1014,18 +1002,6 @@ void MainWindow::setCatBackground(bool enabled) } } -// FIXME: eliminate, should not be needed -void MainWindow::waitForMinecraftVersions() -{ - if (!MMC->minecraftlist()->isLoaded() && m_versionLoadTask && m_versionLoadTask->isRunning()) - { - QEventLoop waitLoop; - waitLoop.connect(m_versionLoadTask, &Task::failed, &waitLoop, &QEventLoop::quit); - waitLoop.connect(m_versionLoadTask, &Task::succeeded, &waitLoop, &QEventLoop::quit); - waitLoop.exec(); - } -} - void MainWindow::runModalTask(Task *task) { connect(task, &Task::failed, [this](QString reason) @@ -1117,8 +1093,6 @@ void MainWindow::on_actionAddInstance_triggered() groupName = map["group"].toString(); } while(0); - waitForMinecraftVersions(); - if(groupName.isEmpty()) { groupName = MMC->settings()->get("LastUsedGroupForNewInstance").toString(); diff --git a/application/MainWindow.h b/application/MainWindow.h index 6b30c86e..a7ab9172 100644 --- a/application/MainWindow.h +++ b/application/MainWindow.h @@ -167,7 +167,6 @@ private: void updateInstanceToolIcon(QString new_icon); void setSelectedInstanceById(const QString &id); - void waitForMinecraftVersions(); void runModalTask(Task *task); void instanceFromVersion(QString instName, QString instGroup, QString instIcon, BaseVersionPtr version); void instanceFromZipPack(QString instName, QString instGroup, QString instIcon, QUrl url); diff --git a/application/MultiMC.cpp b/application/MultiMC.cpp index 081de41c..942b1d93 100644 --- a/application/MultiMC.cpp +++ b/application/MultiMC.cpp @@ -10,6 +10,7 @@ #include "pages/global/ExternalToolsPage.h" #include "pages/global/AccountListPage.h" #include "pages/global/PasteEEPage.h" +#include "pages/global/PackagesPage.h" #include "themes/ITheme.h" #include "themes/SystemTheme.h" @@ -41,9 +42,6 @@ #include "icons/IconList.h" //FIXME: get rid of this #include "minecraft/legacy/LwjglVersionList.h" -#include "minecraft/MinecraftVersionList.h" -#include "minecraft/liteloader/LiteLoaderVersionList.h" -#include "minecraft/forge/ForgeVersionList.h" #include "net/HttpMetaCache.h" #include "net/URLConstants.h" @@ -337,7 +335,6 @@ MultiMC::MultiMC(int &argc, char **argv) : QApplication(argc, argv) initIcons(); initThemes(); // make sure we have at least some minecraft versions before we init instances - minecraftlist(); initInstances(); initAccounts(); initNetwork(); @@ -842,6 +839,7 @@ void MultiMC::initGlobalSettings() m_globalSettingsProvider->addPage<MinecraftPage>(); m_globalSettingsProvider->addPage<JavaPage>(); m_globalSettingsProvider->addPage<ProxyPage>(); + m_globalSettingsProvider->addPage<PackagesPage>(); m_globalSettingsProvider->addPage<ExternalToolsPage>(); m_globalSettingsProvider->addPage<AccountListPage>(); m_globalSettingsProvider->addPage<PasteEEPage>(); @@ -868,36 +866,6 @@ std::shared_ptr<LWJGLVersionList> MultiMC::lwjgllist() return m_lwjgllist; } -std::shared_ptr<ForgeVersionList> MultiMC::forgelist() -{ - if (!m_forgelist) - { - m_forgelist.reset(new ForgeVersionList()); - ENV.registerVersionList("net.minecraftforge", m_forgelist); - } - return m_forgelist; -} - -std::shared_ptr<LiteLoaderVersionList> MultiMC::liteloaderlist() -{ - if (!m_liteloaderlist) - { - m_liteloaderlist.reset(new LiteLoaderVersionList()); - ENV.registerVersionList("com.mumfrey.liteloader", m_liteloaderlist); - } - return m_liteloaderlist; -} - -std::shared_ptr<MinecraftVersionList> MultiMC::minecraftlist() -{ - if (!m_minecraftlist) - { - m_minecraftlist.reset(new MinecraftVersionList()); - ENV.registerVersionList("net.minecraft", m_minecraftlist); - } - return m_minecraftlist; -} - std::shared_ptr<JavaInstallList> MultiMC::javalist() { if (!m_javalist) diff --git a/application/MultiMC.h b/application/MultiMC.h index d8062bb5..a9cbdec7 100644 --- a/application/MultiMC.h +++ b/application/MultiMC.h @@ -18,7 +18,6 @@ class SetupWizard; class FolderInstanceProvider; class GenericPageProvider; class QFile; -class MinecraftVersionList; class LWJGLVersionList; class HttpMetaCache; class SettingsObject; @@ -26,8 +25,6 @@ class InstanceList; class MojangAccountList; class IconList; class QNetworkAccessManager; -class ForgeVersionList; -class LiteLoaderVersionList; class JavaInstallList; class UpdateChecker; class BaseProfilerFactory; @@ -96,10 +93,7 @@ public: } std::shared_ptr<TranslationsModel> translations(); - std::shared_ptr<MinecraftVersionList> minecraftlist(); std::shared_ptr<LWJGLVersionList> lwjgllist(); - std::shared_ptr<ForgeVersionList> forgelist(); - std::shared_ptr<LiteLoaderVersionList> liteloaderlist(); std::shared_ptr<JavaInstallList> javalist(); std::shared_ptr<InstanceList> instances() const @@ -202,9 +196,6 @@ private: std::shared_ptr<UpdateChecker> m_updateChecker; std::shared_ptr<MojangAccountList> m_accounts; std::shared_ptr<LWJGLVersionList> m_lwjgllist; - std::shared_ptr<ForgeVersionList> m_forgelist; - std::shared_ptr<LiteLoaderVersionList> m_liteloaderlist; - std::shared_ptr<MinecraftVersionList> m_minecraftlist; std::shared_ptr<JavaInstallList> m_javalist; std::shared_ptr<TranslationsModel> m_translations; std::shared_ptr<GenericPageProvider> m_globalSettingsProvider; diff --git a/application/VersionProxyModel.cpp b/application/VersionProxyModel.cpp index 22df7e09..96bdc9ab 100644 --- a/application/VersionProxyModel.cpp +++ b/application/VersionProxyModel.cpp @@ -26,19 +26,9 @@ public: switch(role) { - case BaseVersionList::ParentGameVersionRole: + case BaseVersionList::ParentVersionRole: case BaseVersionList::VersionIdRole: - { - auto versionString = data.toString(); - if(it.value().exact) - { - return versionString == it.value().string; - } - else - { - return versionIsInInterval(versionString, it.value().string); - } - } + // TODO: work with metadata here. Previous implementation based on the Version class is not sufficient default: { auto match = data.toString(); @@ -146,7 +136,7 @@ QVariant VersionProxyModel::data(const QModelIndex &index, int role) const case Name: return sourceModel()->data(parentIndex, BaseVersionList::VersionRole); case ParentVersion: - return sourceModel()->data(parentIndex, BaseVersionList::ParentGameVersionRole); + return sourceModel()->data(parentIndex, BaseVersionList::ParentVersionRole); case Branch: return sourceModel()->data(parentIndex, BaseVersionList::BranchRole); case Type: @@ -313,9 +303,9 @@ void VersionProxyModel::setSourceModel(QAbstractItemModel *replacingRaw) auto replacing = dynamic_cast<BaseVersionList *>(replacingRaw); beginResetModel(); + m_columns.clear(); if(!replacing) { - m_columns.clear(); roles.clear(); filterModel->setSourceModel(replacing); return; @@ -327,7 +317,7 @@ void VersionProxyModel::setSourceModel(QAbstractItemModel *replacingRaw) m_columns.push_back(Name); } /* - if(roles.contains(BaseVersionList::ParentGameVersionRole)) + if(roles.contains(BaseVersionList::ParentVersionRole)) { m_columns.push_back(ParentVersion); } diff --git a/application/WonkoGui.cpp b/application/WonkoGui.cpp deleted file mode 100644 index 4d376fdc..00000000 --- a/application/WonkoGui.cpp +++ /dev/null @@ -1,74 +0,0 @@ -#include "WonkoGui.h" - -#include "dialogs/ProgressDialog.h" -#include "wonko/WonkoIndex.h" -#include "wonko/WonkoVersionList.h" -#include "wonko/WonkoVersion.h" -#include "Env.h" - -WonkoIndexPtr Wonko::ensureIndexLoaded(QWidget *parent) -{ - if (!ENV.wonkoIndex()->isLocalLoaded()) - { - ProgressDialog(parent).execWithTask(ENV.wonkoIndex()->localUpdateTask()); - if (!ENV.wonkoIndex()->isRemoteLoaded() && ENV.wonkoIndex()->lists().size() == 0) - { - ProgressDialog(parent).execWithTask(ENV.wonkoIndex()->remoteUpdateTask()); - } - } - return ENV.wonkoIndex(); -} - -WonkoVersionListPtr Wonko::ensureVersionListExists(const QString &uid, QWidget *parent) -{ - ensureIndexLoaded(parent); - if (!ENV.wonkoIndex()->isRemoteLoaded() && !ENV.wonkoIndex()->hasUid(uid)) - { - ProgressDialog(parent).execWithTask(ENV.wonkoIndex()->remoteUpdateTask()); - } - return ENV.wonkoIndex()->getList(uid); -} -WonkoVersionListPtr Wonko::ensureVersionListLoaded(const QString &uid, QWidget *parent) -{ - WonkoVersionListPtr list = ensureVersionListExists(uid, parent); - if (!list) - { - return nullptr; - } - if (!list->isLocalLoaded()) - { - ProgressDialog(parent).execWithTask(list->localUpdateTask()); - if (!list->isLocalLoaded()) - { - ProgressDialog(parent).execWithTask(list->remoteUpdateTask()); - } - } - return list->isComplete() ? list : nullptr; -} - -WonkoVersionPtr Wonko::ensureVersionExists(const QString &uid, const QString &version, QWidget *parent) -{ - WonkoVersionListPtr list = ensureVersionListLoaded(uid, parent); - if (!list) - { - return nullptr; - } - return list->getVersion(version); -} -WonkoVersionPtr Wonko::ensureVersionLoaded(const QString &uid, const QString &version, QWidget *parent, const UpdateType update) -{ - WonkoVersionPtr vptr = ensureVersionExists(uid, version, parent); - if (!vptr) - { - return nullptr; - } - if (!vptr->isLocalLoaded() || update == AlwaysUpdate) - { - ProgressDialog(parent).execWithTask(vptr->localUpdateTask()); - if (!vptr->isLocalLoaded() || update == AlwaysUpdate) - { - ProgressDialog(parent).execWithTask(vptr->remoteUpdateTask()); - } - } - return vptr->isComplete() ? vptr : nullptr; -} diff --git a/application/WonkoGui.h b/application/WonkoGui.h deleted file mode 100644 index ad0bee89..00000000 --- a/application/WonkoGui.h +++ /dev/null @@ -1,29 +0,0 @@ -#pragma once - -#include <memory> -#include "QObjectPtr.h" - -class QWidget; -class QString; - -using WonkoIndexPtr = shared_qobject_ptr<class WonkoIndex>; -using WonkoVersionListPtr = std::shared_ptr<class WonkoVersionList>; -using WonkoVersionPtr = std::shared_ptr<class WonkoVersion>; - -namespace Wonko -{ -enum UpdateType -{ - AlwaysUpdate, - UpdateIfNeeded -}; - -/// Ensures that the index has been loaded, either from the local cache or remotely -WonkoIndexPtr ensureIndexLoaded(QWidget *parent); -/// Ensures that the given uid exists. Returns a nullptr if it doesn't. -WonkoVersionListPtr ensureVersionListExists(const QString &uid, QWidget *parent); -/// Ensures that the given uid exists and is loaded, either from the local cache or remotely. Returns nullptr if it doesn't exist or couldn't be loaded. -WonkoVersionListPtr ensureVersionListLoaded(const QString &uid, QWidget *parent); -WonkoVersionPtr ensureVersionExists(const QString &uid, const QString &version, QWidget *parent); -WonkoVersionPtr ensureVersionLoaded(const QString &uid, const QString &version, QWidget *parent, const UpdateType update = UpdateIfNeeded); -} diff --git a/application/dialogs/NewInstanceDialog.cpp b/application/dialogs/NewInstanceDialog.cpp index d53e1959..8180aa27 100644 --- a/application/dialogs/NewInstanceDialog.cpp +++ b/application/dialogs/NewInstanceDialog.cpp @@ -19,7 +19,6 @@ #include <BaseVersion.h> #include <icons/IconList.h> -#include <minecraft/MinecraftVersionList.h> #include <tasks/Task.h> #include <InstanceList.h> @@ -32,6 +31,9 @@ #include <QFileDialog> #include <QValidator> +#include <meta/Index.h> +#include <meta/VersionList.h> + class UrlValidator : public QValidator { public: @@ -62,7 +64,25 @@ NewInstanceDialog::NewInstanceDialog(const QString & initialGroup, QWidget *pare resize(minimumSizeHint()); layout()->setSizeConstraint(QLayout::SetFixedSize); - setSelectedVersion(MMC->minecraftlist()->getRecommended()); + auto vlist = ENV.metadataIndex()->get("net.minecraft"); + if(vlist->isLoaded()) + { + setSelectedVersion(vlist->getRecommended()); + } + else + { + vlist->load(); + auto task = vlist->getLoadTask(); + if(vlist->isLoaded()) + { + setSelectedVersion(vlist->getRecommended()); + } + if(task) + { + connect(task.get(), &Task::succeeded, this, &NewInstanceDialog::versionListUpdated); + } + } + InstIconKey = "default"; ui->iconButton->setIcon(MMC->icons()->getIcon(InstIconKey)); @@ -95,6 +115,15 @@ NewInstanceDialog::NewInstanceDialog(const QString & initialGroup, QWidget *pare updateDialogState(); } +void NewInstanceDialog::versionListUpdated() +{ + if(!m_versionSetByUser) + { + auto vlist = ENV.metadataIndex()->get("net.minecraft"); + setSelectedVersion(vlist->getRecommended()); + } +} + NewInstanceDialog::~NewInstanceDialog() { delete ui; @@ -134,7 +163,7 @@ void NewInstanceDialog::setSelectedVersion(BaseVersionPtr version) if (m_selectedVersion) { - ui->versionTextBox->setText(version->name()); + ui->versionTextBox->setText(version->descriptor()); } else { @@ -192,14 +221,16 @@ BaseVersionPtr NewInstanceDialog::selectedVersion() const void NewInstanceDialog::on_btnChangeVersion_clicked() { - VersionSelectDialog vselect(MMC->minecraftlist().get(), tr("Change Minecraft version"), - this); + VersionSelectDialog vselect(ENV.metadataIndex()->get("net.minecraft").get(), tr("Change Minecraft version"), this); vselect.exec(); if (vselect.result() == QDialog::Accepted) { BaseVersionPtr version = vselect.selectedVersion(); if (version) + { + m_versionSetByUser = true; setSelectedVersion(version); + } } } diff --git a/application/dialogs/NewInstanceDialog.h b/application/dialogs/NewInstanceDialog.h index 1f7fadfb..1741dab8 100644 --- a/application/dialogs/NewInstanceDialog.h +++ b/application/dialogs/NewInstanceDialog.h @@ -36,8 +36,6 @@ public: void setSelectedVersion(BaseVersionPtr version); - void loadVersionList(); - QString instName() const; QString instGroup() const; QString iconKey() const; @@ -50,10 +48,12 @@ slots: void on_iconButton_clicked(); void on_modpackBtn_clicked(); void on_instNameTextBox_textChanged(const QString &arg1); + void versionListUpdated(); private: Ui::NewInstanceDialog *ui; + bool m_versionSetByUser = false; BaseVersionPtr m_selectedVersion; QString InstIconKey; QString originalPlaceholderText; diff --git a/application/main.cpp b/application/main.cpp index fde9e10d..0f258926 100644 --- a/application/main.cpp +++ b/application/main.cpp @@ -38,7 +38,6 @@ int main(int argc, char *argv[]) { Q_INIT_RESOURCE(multimc); Q_INIT_RESOURCE(backgrounds); - Q_INIT_RESOURCE(versions); Q_INIT_RESOURCE(pe_dark); Q_INIT_RESOURCE(pe_light); diff --git a/application/pages/VersionPage.cpp b/application/pages/VersionPage.cpp index 8decc649..8e8c3d5f 100644 --- a/application/pages/VersionPage.cpp +++ b/application/pages/VersionPage.cpp @@ -36,19 +36,16 @@ #include <QUrl> #include "minecraft/MinecraftProfile.h" -#include "minecraft/forge/ForgeVersionList.h" -#include "minecraft/forge/ForgeInstaller.h" -#include "minecraft/liteloader/LiteLoaderVersionList.h" -#include "minecraft/liteloader/LiteLoaderInstaller.h" #include "minecraft/auth/MojangAccountList.h" #include "minecraft/Mod.h" -#include "minecraft/MinecraftVersion.h" -#include "minecraft/MinecraftVersionList.h" #include "icons/IconList.h" #include "Exception.h" #include "MultiMC.h" +#include <meta/Index.h> +#include <meta/VersionList.h> + class IconProxy : public QIdentityProxyModel { Q_OBJECT @@ -155,14 +152,14 @@ void VersionPage::packageCurrent(const QModelIndex ¤t, const QModelIndex & auto severity = patch->getProblemSeverity(); switch(severity) { - case PROBLEM_WARNING: + case ProblemSeverity::Warning: ui->frame->setModText(tr("%1 possibly has issues.").arg(patch->getName())); break; - case PROBLEM_ERROR: + case ProblemSeverity::Error: ui->frame->setModText(tr("%1 has issues!").arg(patch->getName())); break; default: - case PROBLEM_NONE: + case ProblemSeverity::None: ui->frame->clear(); return; } @@ -171,11 +168,11 @@ void VersionPage::packageCurrent(const QModelIndex ¤t, const QModelIndex & QString problemOut; for (auto &problem: problems) { - if(problem.getSeverity() == PROBLEM_ERROR) + if(problem.getSeverity() == ProblemSeverity::Error) { problemOut += tr("Error: "); } - else if(problem.getSeverity() == PROBLEM_WARNING) + else if(problem.getSeverity() == ProblemSeverity::Warning) { problemOut += tr("Warning: "); } @@ -326,8 +323,20 @@ void VersionPage::on_moveDownBtn_clicked() void VersionPage::on_changeVersionBtn_clicked() { - VersionSelectDialog vselect(m_inst->versionList().get(), tr("Change Minecraft version"), - this); + auto versionRow = currentRow(); + if(versionRow == -1) + { + return; + } + auto patch = m_profile->versionPatch(versionRow); + auto name = patch->getName(); + auto list = patch->getVersionList(); + if(!list) + { + return; + } + auto uid = list->uid(); + VersionSelectDialog vselect(list.get(), tr("Change %1 version").arg(name), this); if (!vselect.exec() || !vselect.selectedVersion()) return; @@ -341,21 +350,25 @@ void VersionPage::on_changeVersionBtn_clicked() return; } - if (!m_profile->isVanilla()) + qDebug() << "Change" << uid << "to" << vselect.selectedVersion()->descriptor(); + if(uid == "net.minecraft") { - auto result = CustomMessageBox::selectable( - this, tr("Are you sure?"), - tr("This will remove any library/version customization you did previously. " - "This includes things like Forge install and similar."), - QMessageBox::Warning, QMessageBox::Ok | QMessageBox::Abort, - QMessageBox::Abort)->exec(); - - if (result != QMessageBox::Ok) - return; - m_profile->revertToVanilla(); - reloadMinecraftProfile(); + if (!m_profile->isVanilla()) + { + auto result = CustomMessageBox::selectable( + this, tr("Are you sure?"), + tr("This will remove any library/version customization you did previously. " + "This includes things like Forge install and similar."), + QMessageBox::Warning, QMessageBox::Ok | QMessageBox::Abort, + QMessageBox::Abort)->exec(); + + if (result != QMessageBox::Ok) + return; + m_profile->revertToVanilla(); + reloadMinecraftProfile(); + } } - m_inst->setIntendedVersionId(vselect.selectedVersion()->descriptor()); + m_inst->setComponentVersion(uid, vselect.selectedVersion()->descriptor()); doUpdate(); m_container->refreshContainer(); } @@ -377,16 +390,21 @@ int VersionPage::doUpdate() void VersionPage::on_forgeBtn_clicked() { - VersionSelectDialog vselect(MMC->forgelist().get(), tr("Select Forge version"), this); - vselect.setExactFilter(BaseVersionList::ParentGameVersionRole, m_inst->currentVersionId()); - vselect.setEmptyString(tr("No Forge versions are currently available for Minecraft ") + - m_inst->currentVersionId()); + auto vlist = ENV.metadataIndex()->get("net.minecraftforge"); + if(!vlist) + { + return; + } + VersionSelectDialog vselect(vlist.get(), tr("Select Forge version"), this); + vselect.setExactFilter(BaseVersionList::ParentVersionRole, m_inst->currentVersionId()); + vselect.setEmptyString(tr("No Forge versions are currently available for Minecraft ") + m_inst->currentVersionId()); vselect.setEmptyErrorString(tr("Couldn't load or download the Forge version lists!")); if (vselect.exec() && vselect.selectedVersion()) { - ProgressDialog dialog(this); - dialog.execWithTask( - ForgeInstaller().createInstallTask(m_inst, vselect.selectedVersion(), this)); + auto vsn = vselect.selectedVersion(); + m_inst->setComponentVersion("net.minecraftforge", vsn->descriptor()); + m_profile->reload(); + // m_profile->installVersion(); preselect(m_profile->rowCount(QModelIndex())-1); m_container->refreshContainer(); } @@ -394,17 +412,21 @@ void VersionPage::on_forgeBtn_clicked() void VersionPage::on_liteloaderBtn_clicked() { - VersionSelectDialog vselect(MMC->liteloaderlist().get(), tr("Select LiteLoader version"), - this); - vselect.setExactFilter(BaseVersionList::ParentGameVersionRole, m_inst->currentVersionId()); - vselect.setEmptyString(tr("No LiteLoader versions are currently available for Minecraft ") + - m_inst->currentVersionId()); + auto vlist = ENV.metadataIndex()->get("com.mumfrey.liteloader"); + if(!vlist) + { + return; + } + VersionSelectDialog vselect(vlist.get(), tr("Select LiteLoader version"), this); + vselect.setExactFilter(BaseVersionList::ParentVersionRole, m_inst->currentVersionId()); + vselect.setEmptyString(tr("No LiteLoader versions are currently available for Minecraft ") + m_inst->currentVersionId()); vselect.setEmptyErrorString(tr("Couldn't load or download the LiteLoader version lists!")); if (vselect.exec() && vselect.selectedVersion()) { - ProgressDialog dialog(this); - dialog.execWithTask( - LiteLoaderInstaller().createInstallTask(m_inst, vselect.selectedVersion(), this)); + auto vsn = vselect.selectedVersion(); + m_inst->setComponentVersion("com.mumfrey.liteloader", vsn->descriptor()); + m_profile->reload(); + // m_profile->installVersion(vselect.selectedVersion()); preselect(m_profile->rowCount(QModelIndex())-1); m_container->refreshContainer(); } @@ -456,8 +478,9 @@ void VersionPage::updateButtons(int row) ui->moveDownBtn->setEnabled(patch->isMoveable()); ui->moveUpBtn->setEnabled(patch->isMoveable()); ui->changeVersionBtn->setEnabled(patch->isVersionChangeable()); - ui->editBtn->setEnabled(patch->isEditable()); - ui->customizeBtn->setEnabled(patch->isCustomizable()); + ui->editBtn->setEnabled(patch->isCustom()); + // FIXME: temporarily disabled, bring it back when the new format is stable and ready to replace the 'OneSix' one... + ui->customizeBtn->setEnabled(false); // patch->isCustomizable() ui->revertBtn->setEnabled(patch->isRevertible()); } } @@ -489,20 +512,18 @@ int VersionPage::currentRow() void VersionPage::on_customizeBtn_clicked() { + // FIXME: temporarily disabled, bring it back when the new format is stable and ready to replace the 'OneSix' one... + return; auto version = currentRow(); if(version == -1) { return; } - //HACK HACK remove, this is dumb auto patch = m_profile->versionPatch(version); - auto mc = std::dynamic_pointer_cast<MinecraftVersion>(patch); - if(mc && mc->needsUpdate()) + if(!patch->getVersionFile()) { - if(!doUpdate()) - { - return; - } + // TODO: wait for the update task to finish here... + return; } if(!m_profile->customize(version)) { @@ -535,15 +556,6 @@ void VersionPage::on_revertBtn_clicked() { return; } - auto mcraw = MMC->minecraftlist()->findVersion(m_inst->intendedVersionId()); - auto mc = std::dynamic_pointer_cast<MinecraftVersion>(mcraw); - if(mc && mc->needsUpdate()) - { - if(!doUpdate()) - { - return; - } - } if(!m_profile->revertToBase(version)) { // TODO: some error box here diff --git a/application/pages/global/WonkoPage.cpp b/application/pages/global/PackagesPage.cpp index 1a72b18d..e15ddbab 100644 --- a/application/pages/global/WonkoPage.cpp +++ b/application/pages/global/PackagesPage.cpp @@ -13,8 +13,8 @@ * limitations under the License. */ -#include "WonkoPage.h" -#include "ui_WonkoPage.h" +#include "PackagesPage.h" +#include "ui_PackagesPage.h" #include <QDateTime> #include <QSortFilterProxyModel> @@ -23,33 +23,33 @@ #include "dialogs/ProgressDialog.h" #include "VersionProxyModel.h" -#include "wonko/WonkoIndex.h" -#include "wonko/WonkoVersionList.h" -#include "wonko/WonkoVersion.h" +#include "meta/Index.h" +#include "meta/VersionList.h" +#include "meta/Version.h" #include "Env.h" #include "MultiMC.h" -static QString formatRequires(const WonkoVersionPtr &version) +using namespace Meta; + +static QString formatRequires(const VersionPtr &version) { QStringList lines; - for (const WonkoReference &ref : version->requires()) + auto & reqs = version->requires(); + auto iter = reqs.begin(); + while (iter != reqs.end()) { - const QString readable = ENV.wonkoIndex()->hasUid(ref.uid()) ? ENV.wonkoIndex()->getList(ref.uid())->humanReadable() : ref.uid(); - if (ref.version().isEmpty()) - { - lines.append(readable); - } - else - { - lines.append(QString("%1 (%2)").arg(readable, ref.version())); - } + auto &uid = iter.key(); + auto &version = iter.value(); + const QString readable = ENV.metadataIndex()->hasUid(uid) ? ENV.metadataIndex()->get(uid)->humanReadable() : uid; + lines.append(QString("%1 (%2)").arg(readable, version)); + iter++; } return lines.join('\n'); } -WonkoPage::WonkoPage(QWidget *parent) : +PackagesPage::PackagesPage(QWidget *parent) : QWidget(parent), - ui(new Ui::WonkoPage) + ui(new Ui::PackagesPage) { ui->setupUi(this); ui->tabWidget->tabBar()->hide(); @@ -61,11 +61,11 @@ WonkoPage::WonkoPage(QWidget *parent) : m_fileProxy->setFilterRole(Qt::DisplayRole); m_fileProxy->setFilterKeyColumn(0); m_fileProxy->sort(0); - m_fileProxy->setSourceModel(ENV.wonkoIndex().get()); + m_fileProxy->setSourceModel(ENV.metadataIndex().get()); ui->indexView->setModel(m_fileProxy); m_filterProxy = new QSortFilterProxyModel(this); - m_filterProxy->setSortRole(WonkoVersionList::SortRole); + m_filterProxy->setSortRole(VersionList::SortRole); m_filterProxy->setFilterCaseSensitivity(Qt::CaseInsensitive); m_filterProxy->setFilterRole(Qt::DisplayRole); m_filterProxy->setFilterKeyColumn(0); @@ -75,48 +75,48 @@ WonkoPage::WonkoPage(QWidget *parent) : m_versionProxy = new VersionProxyModel(this); m_filterProxy->setSourceModel(m_versionProxy); - connect(ui->indexView->selectionModel(), &QItemSelectionModel::currentChanged, this, &WonkoPage::updateCurrentVersionList); - connect(ui->versionsView->selectionModel(), &QItemSelectionModel::currentChanged, this, &WonkoPage::updateVersion); - connect(m_filterProxy, &QSortFilterProxyModel::dataChanged, this, &WonkoPage::versionListDataChanged); + connect(ui->indexView->selectionModel(), &QItemSelectionModel::currentChanged, this, &PackagesPage::updateCurrentVersionList); + connect(ui->versionsView->selectionModel(), &QItemSelectionModel::currentChanged, this, &PackagesPage::updateVersion); + connect(m_filterProxy, &QSortFilterProxyModel::dataChanged, this, &PackagesPage::versionListDataChanged); updateCurrentVersionList(QModelIndex()); updateVersion(); } -WonkoPage::~WonkoPage() +PackagesPage::~PackagesPage() { delete ui; } -QIcon WonkoPage::icon() const +QIcon PackagesPage::icon() const { - return MMC->getThemedIcon("looney"); + return MMC->getThemedIcon("packages"); } -void WonkoPage::on_refreshIndexBtn_clicked() +void PackagesPage::on_refreshIndexBtn_clicked() { - ProgressDialog(this).execWithTask(ENV.wonkoIndex()->remoteUpdateTask()); + ENV.metadataIndex()->load(); } -void WonkoPage::on_refreshFileBtn_clicked() +void PackagesPage::on_refreshFileBtn_clicked() { - WonkoVersionListPtr list = ui->indexView->currentIndex().data(WonkoIndex::ListPtrRole).value<WonkoVersionListPtr>(); + VersionListPtr list = ui->indexView->currentIndex().data(Index::ListPtrRole).value<VersionListPtr>(); if (!list) { return; } - ProgressDialog(this).execWithTask(list->remoteUpdateTask()); + list->load(); } -void WonkoPage::on_refreshVersionBtn_clicked() +void PackagesPage::on_refreshVersionBtn_clicked() { - WonkoVersionPtr version = ui->versionsView->currentIndex().data(WonkoVersionList::WonkoVersionPtrRole).value<WonkoVersionPtr>(); + VersionPtr version = ui->versionsView->currentIndex().data(VersionList::VersionPtrRole).value<VersionPtr>(); if (!version) { return; } - ProgressDialog(this).execWithTask(version->remoteUpdateTask()); + version->load(); } -void WonkoPage::on_fileSearchEdit_textChanged(const QString &search) +void PackagesPage::on_fileSearchEdit_textChanged(const QString &search) { if (search.isEmpty()) { @@ -129,7 +129,7 @@ void WonkoPage::on_fileSearchEdit_textChanged(const QString &search) m_fileProxy->setFilterRegExp(".*" + parts.join(".*") + ".*"); } } -void WonkoPage::on_versionSearchEdit_textChanged(const QString &search) +void PackagesPage::on_versionSearchEdit_textChanged(const QString &search) { if (search.isEmpty()) { @@ -143,11 +143,11 @@ void WonkoPage::on_versionSearchEdit_textChanged(const QString &search) } } -void WonkoPage::updateCurrentVersionList(const QModelIndex &index) +void PackagesPage::updateCurrentVersionList(const QModelIndex &index) { if (index.isValid()) { - WonkoVersionListPtr list = index.data(WonkoIndex::ListPtrRole).value<WonkoVersionListPtr>(); + VersionListPtr list = index.data(Index::ListPtrRole).value<VersionListPtr>(); ui->versionsBox->setEnabled(true); ui->refreshFileBtn->setEnabled(true); ui->fileUidLabel->setEnabled(true); @@ -156,19 +156,7 @@ void WonkoPage::updateCurrentVersionList(const QModelIndex &index) ui->fileName->setText(list->name()); m_versionProxy->setSourceModel(list.get()); ui->refreshFileBtn->setText(tr("Refresh %1").arg(list->humanReadable())); - - if (!list->isLocalLoaded()) - { - std::unique_ptr<Task> task = list->localUpdateTask(); - connect(task.get(), &Task::finished, this, [this, list]() - { - if (list->count() == 0 && !list->isRemoteLoaded()) - { - ProgressDialog(this).execWithTask(list->remoteUpdateTask()); - } - }); - ProgressDialog(this).execWithTask(task); - } + list->load(); } else { @@ -179,11 +167,11 @@ void WonkoPage::updateCurrentVersionList(const QModelIndex &index) ui->fileNameLabel->setEnabled(false); ui->fileName->clear(); m_versionProxy->setSourceModel(nullptr); - ui->refreshFileBtn->setText(tr("Refresh ___")); + ui->refreshFileBtn->setText(tr("Refresh")); } } -void WonkoPage::versionListDataChanged(const QModelIndex &tl, const QModelIndex &br) +void PackagesPage::versionListDataChanged(const QModelIndex &tl, const QModelIndex &br) { if (QItemSelection(tl, br).contains(ui->versionsView->currentIndex())) { @@ -191,10 +179,10 @@ void WonkoPage::versionListDataChanged(const QModelIndex &tl, const QModelIndex } } -void WonkoPage::updateVersion() +void PackagesPage::updateVersion() { - WonkoVersionPtr version = std::dynamic_pointer_cast<WonkoVersion>( - ui->versionsView->currentIndex().data(WonkoVersionList::VersionPointerRole).value<BaseVersionPtr>()); + VersionPtr version = std::dynamic_pointer_cast<Version>( + ui->versionsView->currentIndex().data(VersionList::VersionPointerRole).value<BaseVersionPtr>()); if (version) { ui->refreshVersionBtn->setEnabled(true); @@ -219,22 +207,11 @@ void WonkoPage::updateVersion() ui->versionType->clear(); ui->versionRequiresLabel->setEnabled(false); ui->versionRequires->clear(); - ui->refreshVersionBtn->setText(tr("Refresh ___")); + ui->refreshVersionBtn->setText(tr("Refresh")); } } -void WonkoPage::opened() +void PackagesPage::opened() { - if (!ENV.wonkoIndex()->isLocalLoaded()) - { - std::unique_ptr<Task> task = ENV.wonkoIndex()->localUpdateTask(); - connect(task.get(), &Task::finished, this, [this]() - { - if (!ENV.wonkoIndex()->isRemoteLoaded()) - { - ProgressDialog(this).execWithTask(ENV.wonkoIndex()->remoteUpdateTask()); - } - }); - ProgressDialog(this).execWithTask(task); - } + ENV.metadataIndex()->load(); } diff --git a/application/pages/global/WonkoPage.h b/application/pages/global/PackagesPage.h index 1d576c15..80c2886d 100644 --- a/application/pages/global/WonkoPage.h +++ b/application/pages/global/PackagesPage.h @@ -20,21 +20,21 @@ #include "pages/BasePage.h" namespace Ui { -class WonkoPage; +class PackagesPage; } class QSortFilterProxyModel; class VersionProxyModel; -class WonkoPage : public QWidget, public BasePage +class PackagesPage : public QWidget, public BasePage { Q_OBJECT public: - explicit WonkoPage(QWidget *parent = 0); - ~WonkoPage(); + explicit PackagesPage(QWidget *parent = 0); + ~PackagesPage(); - QString id() const override { return "wonko-global"; } - QString displayName() const override { return tr("Wonko"); } + QString id() const override { return "packages-global"; } + QString displayName() const override { return tr("Packages"); } QIcon icon() const override; void opened() override; @@ -48,7 +48,7 @@ private slots: void versionListDataChanged(const QModelIndex &tl, const QModelIndex &br); private: - Ui::WonkoPage *ui; + Ui::PackagesPage *ui; QSortFilterProxyModel *m_fileProxy; QSortFilterProxyModel *m_filterProxy; VersionProxyModel *m_versionProxy; diff --git a/application/pages/global/WonkoPage.ui b/application/pages/global/PackagesPage.ui index 2d14ceca..158bf1b4 100644 --- a/application/pages/global/WonkoPage.ui +++ b/application/pages/global/PackagesPage.ui @@ -1,13 +1,13 @@ <?xml version="1.0" encoding="UTF-8"?> <ui version="4.0"> - <class>WonkoPage</class> - <widget class="QWidget" name="WonkoPage"> + <class>PackagesPage</class> + <widget class="QWidget" name="PackagesPage"> <property name="geometry"> <rect> <x>0</x> <y>0</y> - <width>640</width> - <height>480</height> + <width>636</width> + <height>621</height> </rect> </property> <property name="windowTitle"> @@ -67,7 +67,7 @@ <item> <widget class="QPushButton" name="refreshVersionBtn"> <property name="text"> - <string>Refresh ___</string> + <string>Refresh</string> </property> </widget> </item> @@ -180,7 +180,7 @@ <item> <widget class="QPushButton" name="refreshFileBtn"> <property name="text"> - <string>Refresh ___</string> + <string>Refresh</string> </property> </widget> </item> diff --git a/application/resources/versions/LWJGL/2.9.0.json b/application/resources/versions/LWJGL/2.9.0.json deleted file mode 100644 index 5dbd624e..00000000 --- a/application/resources/versions/LWJGL/2.9.0.json +++ /dev/null @@ -1,45 +0,0 @@ - { - "fileId": "org.lwjgl", - "name": "LWJGL", - "version": "2.9.0", - "+libraries": [ - { - "name": "net.java.jinput:jinput:2.0.5" - }, - { - "name": "net.java.jinput:jinput-platform:2.0.5", - "natives": { - "linux": "natives-linux", - "windows": "natives-windows", - "osx": "natives-osx" - }, - "extract": { - "exclude": [ - "META-INF/" - ] - } - }, - { - "name": "net.java.jutils:jutils:1.0.0" - }, - { - "name": "org.lwjgl.lwjgl:lwjgl:2.9.0" - }, - { - "name": "org.lwjgl.lwjgl:lwjgl_util:2.9.0" - }, - { - "name": "org.lwjgl.lwjgl:lwjgl-platform:2.9.0", - "natives": { - "linux": "natives-linux", - "windows": "natives-windows", - "osx": "natives-osx" - }, - "extract": { - "exclude": [ - "META-INF/" - ] - } - } - ] -} diff --git a/application/resources/versions/LWJGL/2.9.1-nightly-20130708-debug3.json b/application/resources/versions/LWJGL/2.9.1-nightly-20130708-debug3.json deleted file mode 100644 index 7265b3b0..00000000 --- a/application/resources/versions/LWJGL/2.9.1-nightly-20130708-debug3.json +++ /dev/null @@ -1,45 +0,0 @@ -{ - "fileId": "org.lwjgl", - "name": "LWJGL", - "version": "2.9.1-nightly-20130708-debug3", - "+libraries": [ - { - "name": "net.java.jinput:jinput:2.0.5" - }, - { - "name": "net.java.jinput:jinput-platform:2.0.5", - "natives": { - "linux": "natives-linux", - "windows": "natives-windows", - "osx": "natives-osx" - }, - "extract": { - "exclude": [ - "META-INF/" - ] - } - }, - { - "name": "net.java.jutils:jutils:1.0.0" - }, - { - "name": "org.lwjgl.lwjgl:lwjgl:2.9.1-nightly-20130708-debug3" - }, - { - "name": "org.lwjgl.lwjgl:lwjgl_util:2.9.1-nightly-20130708-debug3" - }, - { - "name": "org.lwjgl.lwjgl:lwjgl-platform:2.9.1-nightly-20130708-debug3", - "natives": { - "linux": "natives-linux", - "windows": "natives-windows", - "osx": "natives-osx" - }, - "extract": { - "exclude": [ - "META-INF/" - ] - } - } - ] -} diff --git a/application/resources/versions/LWJGL/2.9.1.json b/application/resources/versions/LWJGL/2.9.1.json deleted file mode 100644 index e7f5e947..00000000 --- a/application/resources/versions/LWJGL/2.9.1.json +++ /dev/null @@ -1,45 +0,0 @@ - { - "fileId": "org.lwjgl", - "name": "LWJGL", - "version": "2.9.1", - "+libraries": [ - { - "name": "net.java.jinput:jinput:2.0.5" - }, - { - "name": "net.java.jinput:jinput-platform:2.0.5", - "natives": { - "linux": "natives-linux", - "windows": "natives-windows", - "osx": "natives-osx" - }, - "extract": { - "exclude": [ - "META-INF/" - ] - } - }, - { - "name": "net.java.jutils:jutils:1.0.0" - }, - { - "name": "org.lwjgl.lwjgl:lwjgl:2.9.1" - }, - { - "name": "org.lwjgl.lwjgl:lwjgl_util:2.9.1" - }, - { - "name": "org.lwjgl.lwjgl:lwjgl-platform:2.9.1", - "natives": { - "linux": "natives-linux", - "windows": "natives-windows", - "osx": "natives-osx" - }, - "extract": { - "exclude": [ - "META-INF/" - ] - } - } - ] -} diff --git a/application/resources/versions/LWJGL/2.9.2-nightly-20140822.json b/application/resources/versions/LWJGL/2.9.2-nightly-20140822.json deleted file mode 100644 index 25b22eb9..00000000 --- a/application/resources/versions/LWJGL/2.9.2-nightly-20140822.json +++ /dev/null @@ -1,45 +0,0 @@ -{ - "fileId": "org.lwjgl", - "name": "LWJGL", - "version": "2.9.2-nightly-20140822", - "+libraries": [ - { - "name": "net.java.jinput:jinput:2.0.5" - }, - { - "name": "net.java.jinput:jinput-platform:2.0.5", - "natives": { - "linux": "natives-linux", - "windows": "natives-windows", - "osx": "natives-osx" - }, - "extract": { - "exclude": [ - "META-INF/" - ] - } - }, - { - "name": "net.java.jutils:jutils:1.0.0" - }, - { - "name": "org.lwjgl.lwjgl:lwjgl:2.9.2-nightly-20140822" - }, - { - "name": "org.lwjgl.lwjgl:lwjgl_util:2.9.2-nightly-20140822" - }, - { - "name": "org.lwjgl.lwjgl:lwjgl-platform:2.9.2-nightly-20140822", - "natives": { - "linux": "natives-linux", - "windows": "natives-windows", - "osx": "natives-osx" - }, - "extract": { - "exclude": [ - "META-INF/" - ] - } - } - ] -} diff --git a/application/resources/versions/minecraft.json b/application/resources/versions/minecraft.json deleted file mode 100644 index 9c08a83f..00000000 --- a/application/resources/versions/minecraft.json +++ /dev/null @@ -1,587 +0,0 @@ -{ -"versions": [ - { - "id": "1.5.2", - "checksum": "6897c3287fb971c9f362eb3ab20f5ddd", - "releaseTime": "2013-04-25T17:45:00+02:00", - "type": "release", - "+traits": ["legacyLaunch", "texturepacks"] - }, - { - "id": "1.5.1", - "checksum": "5c1219d869b87d233de3033688ec7567", - "releaseTime": "2013-03-20T12:00:00+02:00", - "type": "release", - "+traits": ["legacyLaunch", "texturepacks"] - }, - { - "id": "1.5", - "checksum": "fd11cbc5b01aae1d62cff0145171f3d9", - "releaseTime": "2013-03-07T00:00:00+02:00", - "type": "snapshot", - "+traits": ["legacyLaunch", "texturepacks"] - }, - { - "id": "1.4.7", - "checksum": "8e80fb01b321c6b3c7efca397a3eea35", - "releaseTime": "2012-12-28T00:00:00+02:00", - "type": "release", - "+traits": ["legacyLaunch", "texturepacks"] - }, - { - "id": "1.4.6", - "checksum": "48677dc4c2b98c29918722b5ab27b4fd", - "releaseTime": "2012-12-20T00:00:00+02:00", - "type": "release", - "+traits": ["legacyLaunch", "texturepacks"] - }, - { - "id": "1.4.5", - "checksum": "b15e2b2b6b4629f0d99a95b6b44412a0", - "releaseTime": "2012-11-20T00:00:00+02:00", - "type": "release", - "+traits": ["legacyLaunch", "texturepacks"] - }, - { - "id": "1.4.4", - "checksum": "7aa46c8058cba2f38e9d2ddddcc77c72", - "releaseTime": "2012-11-14T00:00:00+02:00", - "type": "release", - "+traits": ["legacyLaunch", "texturepacks"] - }, - { - "id": "1.4.3", - "checksum": "9cc3295931edb6339f22989fe1b612a6", - "releaseTime": "2012-11-01T00:00:00+02:00", - "type": "snapshot", - "+traits": ["legacyLaunch", "texturepacks"] - }, - { - "id": "1.4.2", - "checksum": "771175c01778ea67395bc6919a5a9dc5", - "releaseTime": "2012-10-25T00:00:00+02:00", - "type": "release", - "+traits": ["legacyLaunch", "texturepacks"] - }, - { - "id": "1.4.1", - "checksum": "542621a5298659dc65f383f35170fc4c", - "releaseTime": "2012-10-23T00:00:00+02:00", - "type": "snapshot", - "+traits": ["legacyLaunch", "texturepacks"] - }, - { - "id": "1.4", - "checksum": "32a654388b54d3e4bb29c1a46e7d6a12", - "releaseTime": "2012-10-19T00:00:00+02:00", - "type": "snapshot", - "+traits": ["legacyLaunch", "texturepacks"] - }, - { - "id": "1.3.2", - "checksum": "969699f13e5bbe7f12e40ac4f32b7d9a", - "releaseTime": "2012-08-16T00:00:00+02:00", - "type": "release", - "+traits": ["legacyLaunch", "texturepacks"] - }, - { - "id": "1.3.1", - "checksum": "266ccbc9798afd2eadf3d6c01b4c562a", - "releaseTime": "2012-08-01T00:00:00+02:00", - "type": "release", - "+traits": ["legacyLaunch", "texturepacks"] - }, - { - "id": "1.3", - "checksum": "a6effac1eaccf5d429aae340cf95ed5d", - "releaseTime": "2012-07-26T00:00:00+02:00", - "type": "snapshot", - "+traits": ["legacyLaunch", "texturepacks"] - }, - { - "id": "1.2.5", - "checksum": "8e8778078a175a33603a585257f28563", - "releaseTime": "2012-03-30T00:00:00+02:00", - "type": "release", - "+traits": ["legacyLaunch", "texturepacks"] - }, - { - "id": "1.2.4", - "checksum": "25423eab6d8707f96cc6ad8a21a7250a", - "releaseTime": "2012-03-22T00:00:00+02:00", - "type": "release", - "+traits": ["legacyLaunch", "texturepacks"] - }, - { - "id": "1.2.3", - "checksum": "12f6c4b1bdcc63f029e3c088a364b8e4", - "releaseTime": "2012-03-02T00:00:00+02:00", - "type": "release", - "+traits": ["legacyLaunch", "texturepacks"] - }, - { - "id": "1.2.2", - "checksum": "6189e96efaea11e5164b4a4755574324", - "releaseTime": "2012-03-01T00:00:01+02:00", - "type": "release", - "+traits": ["legacyLaunch", "texturepacks"] - }, - { - "id": "1.2.1", - "checksum": "97067a603eba2b6eb75d3194f81f6bcd", - "releaseTime": "2012-03-01T00:00:00+02:00", - "type": "release", - "+traits": ["legacyLaunch", "texturepacks"] - }, - { - "id": "1.1", - "checksum": "e92302d2acdba7c97e0d8df1e10d2006", - "releaseTime": "2012-01-12T00:00:00+02:00", - "type": "release", - "+traits": ["legacyLaunch", "texturepacks"] - }, - { - "id": "1.0", - "checksum": "3820d222b95d0b8c520d9596a756a6e6", - "releaseTime": "2011-11-18T00:00:00+02:00", - "type": "release", - "+traits": ["legacyLaunch", "texturepacks"] - }, - { - "id": "b1.8.1", - "checksum": "f8c5a2ccd3bc996792bbe436d8cc08bc", - "releaseTime": "2011-09-19T00:00:00+02:00", - "type": "old_beta", - "+traits": ["legacyLaunch", "texturepacks"] - }, - { - "id": "b1.8", - "checksum": "a59a9fd4c726a573b0a2bdd10d857f59", - "releaseTime": "2011-09-15T00:00:00+02:00", - "type": "old_beta", - "+traits": ["legacyLaunch", "texturepacks"] - }, - { - "id": "b1.7.3", - "checksum": "eae3353fdaa7e10a59b4cb5b45bfa10d", - "releaseTime": "2011-07-08T00:00:00+02:00", - "type": "old_beta", - "+traits": ["legacyLaunch", "texturepacks"] - }, - { - "id": "b1.7.2", - "checksum": "dd9215ab1141170d4871f42bff4ab302", - "releaseTime": "2011-07-01T00:00:00+02:00", - "type": "old_beta", - "+traits": ["legacyLaunch", "texturepacks"] - }, - { - "id": "b1.7", - "checksum": "682419e9ed1a236c3067822d53cda1e4", - "releaseTime": "2011-06-30T00:00:00+02:00", - "type": "old_beta", - "+traits": ["legacyLaunch", "texturepacks"] - }, - { - "id": "b1.6.6", - "checksum": "ce80072464433cd5b05d505aa8ff29d1", - "releaseTime": "2011-05-31T00:00:00+02:00", - "type": "old_beta", - "+traits": ["legacyLaunch", "texturepacks"] - }, - { - "id": "b1.6.5", - "checksum": "2aba888864b32038c8d22ee5df71b7c8", - "releaseTime": "2011-05-28T00:00:00+02:00", - "type": "old_beta", - "+traits": ["legacyLaunch", "texturepacks"] - }, - { - "id": "b1.6.4", - "checksum": "5c4df6f120336f113180698613853dba", - "releaseTime": "2011-05-26T00:00:04+02:00", - "type": "old_beta", - "+traits": ["legacyLaunch", "texturepacks"] - }, - { - "id": "b1.6.3", - "checksum": "efc2becca965e4f8feb5b4210c6a4fd1", - "releaseTime": "2011-05-26T00:00:03+02:00", - "type": "old_beta", - "+traits": ["legacyLaunch", "texturepacks"] - }, - { - "id": "b1.6.2", - "checksum": "01330b1c930102a683a4dd8d792e632e", - "releaseTime": "2011-05-26T00:00:02+02:00", - "type": "old_beta", - "+traits": ["legacyLaunch", "texturepacks"] - }, - { - "id": "b1.6.1", - "checksum": "a7e82c441a57ef4068c533f4d777336a", - "releaseTime": "2011-05-26T00:00:01+02:00", - "type": "old_beta", - "+traits": ["legacyLaunch", "texturepacks"] - }, - { - "id": "b1.6", - "checksum": "d531e221227a65392259d3141893280d", - "releaseTime": "2011-05-26T00:00:00+02:00", - "type": "old_beta", - "+traits": ["legacyLaunch", "texturepacks"] - }, - { - "id": "b1.5_01", - "checksum": "d02fa9998e30693d8d989d5f88cf0040", - "releaseTime": "2011-04-20T00:00:00+02:00", - "type": "old_beta", - "+traits": ["legacyLaunch", "texturepacks"] - }, - { - "id": "b1.5", - "checksum": "24289130902822d73f8722b52bc07cdb", - "releaseTime": "2011-04-19T00:00:00+02:00", - "type": "old_beta", - "+traits": ["legacyLaunch", "texturepacks"] - }, - { - "id": "b1.4_01", - "checksum": "9379e54b581ba4ef3acc3e326e87db91", - "releaseTime": "2011-04-05T00:00:00+02:00", - "type": "old_beta", - "+traits": ["legacyLaunch", "texturepacks"] - }, - { - "id": "b1.4", - "checksum": "71e64b61175b371ed148b385f2d14ebf", - "releaseTime": "2011-03-31T00:00:00+02:00", - "type": "old_beta", - "+traits": ["legacyLaunch", "texturepacks"] - }, - { - "id": "b1.3_01", - "checksum": "4203826f35e1036f089919032c3d19d1", - "releaseTime": "2011-02-23T00:00:00+02:00", - "type": "old_beta", - "+traits": ["legacyLaunch", "texturepacks"] - }, - { - "id": "b1.3b", - "checksum": "de2164df461d028229ed2e101181bbd4", - "releaseTime": "2011-02-22T00:00:00+02:00", - "type": "old_beta", - "+traits": ["legacyLaunch", "texturepacks"] - }, - { - "id": "b1.2_02", - "checksum": "1736c5ba4f63a981220c2a18a4120180", - "releaseTime": "2011-01-21T00:00:00+02:00", - "type": "old_beta", - "+traits": ["legacyLaunch", "texturepacks"] - }, - { - "id": "b1.2_01", - "checksum": "486d83ec00554b45ffa21af2faa0116a", - "releaseTime": "2011-01-14T00:00:00+02:00", - "type": "old_beta", - "+traits": ["legacyLaunch", "texturepacks"] - }, - { - "id": "b1.2", - "checksum": "6426223efe23c3931a4ef89685be3349", - "releaseTime": "2011-01-13T00:00:00+02:00", - "type": "old_beta", - "+traits": ["legacyLaunch", "texturepacks"] - }, - { - "id": "b1.1_02", - "checksum": "7d547e495a770c62054ef136add43034", - "releaseTime": "2010-12-22T00:00:01+02:00", - "type": "old_beta", - "+traits": ["legacyLaunch", "texturepacks"] - }, - { - "id": "b1.1_01", - "checksum": "1f9331f2bfca81b6ce2acdfc1f105837", - "releaseTime": "2010-12-22T00:00:00+02:00", - "type": "old_beta", - "+traits": ["legacyLaunch", "texturepacks"] - }, - { - "id": "b1.0.2", - "checksum": "d200c465b8c167cc8df6537531fc9a48", - "releaseTime": "2010-12-21T00:00:00+02:00", - "type": "old_beta", - "+traits": ["legacyLaunch", "texturepacks"] - }, - { - "id": "b1.0_01", - "checksum": "03bd20b870dbbd121de5dca98af4e1ce", - "releaseTime": "2010-12-20T00:00:01+02:00", - "type": "old_beta", - "+traits": ["legacyLaunch", "texturepacks"] - }, - { - "id": "b1.0", - "checksum": "5f8733dbbf09b4e7c874661a3c29c239", - "releaseTime": "2010-12-20T00:00:00+02:00", - "type": "old_beta", - "+traits": ["legacyLaunch", "texturepacks"] - }, - { - "id": "a1.2.6", - "checksum": "ddd5e39467f28d1ea1a03b4d9e790867", - "releaseTime": "2010-12-03T00:00:00+02:00", - "type": "old_alpha", - "+traits": ["legacyLaunch", "texturepacks"] - }, - { - "id": "a1.2.5", - "checksum": "7d3a43037190970ff2e11153b5718b74", - "releaseTime": "2010-12-01T00:00:00+02:00", - "type": "old_alpha", - "+traits": ["legacyLaunch", "texturepacks"] - }, - { - "id": "a1.2.4_01", - "checksum": "0a1cc8c668faa6dc93fc418e8b4b097a", - "releaseTime": "2010-11-30T00:00:00+02:00", - "type": "old_alpha", - "+traits": ["legacyLaunch", "texturepacks"] - }, - { - "id": "a1.2.3_04", - "checksum": "b2c25a753c82a1cd228ce71469829dc1", - "releaseTime": "2010-11-26T00:00:00+02:00", - "type": "old_alpha", - "+traits": ["legacyLaunch", "texturepacks"] - }, - { - "id": "a1.2.3_02", - "checksum": "3ad4808ef2ac3b65d10305315260da03", - "releaseTime": "2010-11-25T00:00:00+02:00", - "type": "old_alpha", - "+traits": ["legacyLaunch", "texturepacks"] - }, - { - "id": "a1.2.3_01", - "checksum": "70cbab762b17c5b11fefea9b12564119", - "releaseTime": "2010-11-24T00:00:01+02:00", - "type": "old_alpha", - "+traits": ["legacyLaunch", "texturepacks"] - }, - { - "id": "a1.2.3", - "checksum": "25f053114e34b915e675f82d58f08711", - "releaseTime": "2010-11-24T00:00:00+02:00", - "type": "old_alpha", - "+traits": ["legacyLaunch", "texturepacks"] - }, - { - "id": "a1.2.2b", - "checksum": "6250fb17f8898c4d970d6bd03c229177", - "releaseTime": "2010-11-10T00:00:01+02:00", - "type": "old_alpha", - "+traits": ["legacyLaunch", "texturepacks"] - }, - { - "id": "a1.2.2a", - "checksum": "0f9fe018b344fd9dd849005f9bdca803", - "releaseTime": "2010-11-10T00:00:00+02:00", - "type": "old_alpha", - "+traits": ["legacyLaunch", "texturepacks"] - }, - { - "id": "a1.2.1_01", - "checksum": "0a496e44a7b4e2f493b5893d8e5845bd", - "releaseTime": "2010-11-05T00:00:01+02:00", - "type": "old_alpha", - "+traits": ["legacyLaunch", "no-texturepacks"] - }, - { - "id": "a1.2.1", - "checksum": "0a496e44a7b4e2f493b5893d8e5845bd", - "releaseTime": "2010-11-05T00:00:00+02:00", - "type": "old_alpha", - "+traits": ["legacyLaunch", "no-texturepacks"] - }, - { - "id": "a1.2.0_02", - "checksum": "f5bcb4d0c0e78bc220f164b89ae9bd60", - "releaseTime": "2010-11-04T00:00:00+02:00", - "type": "old_alpha", - "+traits": ["legacyLaunch", "no-texturepacks"] - }, - { - "id": "a1.2.0_01", - "checksum": "b2e9333e967cb89488884c2e5c715d4f", - "releaseTime": "2010-10-31T00:00:00+02:00", - "type": "old_alpha", - "+traits": ["legacyLaunch", "no-texturepacks"] - }, - { - "id": "a1.2.0", - "checksum": "44c384dae02390f700458b95d82c3e2a", - "releaseTime": "2010-10-30T00:00:00+02:00", - "type": "old_alpha", - "+traits": ["legacyLaunch", "no-texturepacks"] - }, - { - "id": "a1.1.2_01", - "checksum": "94346e1b8f6ad0e4a284314f0e29207b", - "releaseTime": "2010-09-23T00:00:00+02:00", - "type": "old_alpha", - "+traits": ["legacyLaunch", "no-texturepacks"] - }, - { - "id": "a1.1.2", - "checksum": "72ba1f834327805cb44164a42b331522", - "releaseTime": "2010-09-20T00:00:00+02:00", - "type": "old_alpha", - "+traits": ["legacyLaunch", "no-texturepacks"] - }, - { - "id": "a1.1.0", - "checksum": "891fd93e04f5daaf35d73c58e45c01b1", - "releaseTime": "2010-09-13T00:00:00+02:00", - "type": "old_alpha", - "+traits": ["legacyLaunch", "no-texturepacks"] - }, - { - "id": "a1.0.17_04", - "checksum": "16ed7dc58244772847991e504afcf02f", - "releaseTime": "2010-08-23T00:00:00+02:00", - "type": "old_alpha", - "+traits": ["legacyLaunch", "no-texturepacks"] - }, - { - "id": "a1.0.17_02", - "checksum": "d89760b0871ef61a55c9f336c0439d58", - "releaseTime": "2010-08-20T00:00:00+02:00", - "type": "old_alpha", - "+traits": ["legacyLaunch", "no-texturepacks"] - }, - { - "id": "a1.0.16", - "checksum": "6bbde02c13aed5766275f4398ede6aae", - "releaseTime": "2010-08-12T00:00:00+02:00", - "type": "old_alpha", - "+traits": ["legacyLaunch", "no-texturepacks"] - }, - { - "id": "a1.0.15", - "checksum": "ade257d2080d56fa983763f9c701fa14", - "releaseTime": "2010-08-04T00:00:00+02:00", - "type": "old_alpha", - "+traits": ["legacyLaunch", "no-texturepacks"] - }, - { - "id": "a1.0.14", - "checksum": "227d0c6fa896a231de6269a074c9a458", - "releaseTime": "2010-07-30T00:00:00+02:00", - "type": "old_alpha", - "+traits": ["legacyLaunch", "no-texturepacks"] - }, - { - "id": "a1.0.11", - "checksum": "6f1b1dd157fa0df39760f5be3eab01b0", - "releaseTime": "2010-07-23T00:00:00+02:00", - "type": "old_alpha", - "+traits": ["legacyLaunch", "no-texturepacks"] - }, - { - "id": "a1.0.5_01", - "checksum": "ae5f606caa18222e7568819c910ee423", - "releaseTime": "2010-07-13T00:00:00+02:00", - "type": "old_alpha", - "mainClass": "y", - "+traits": ["legacyLaunch", "no-texturepacks"] - }, - { - "id": "a1.0.4", - "checksum": "13ce7935c3670e7494e26b2704bfa3e9", - "releaseTime": "2010-07-09T00:00:00+02:00", - "type": "old_alpha", - "mainClass": "ax", - "+traits": ["legacyLaunch", "no-texturepacks"] - }, - { - "id": "inf-20100618", - "checksum": "f5f5aa34760facc10486e906a7c60196", - "releaseTime": "2010-06-16T00:00:00+02:00", - "type": "old_alpha", - "mainClass": "net.minecraft.client.d", - "appletClass": "net.minecraft.client.MinecraftApplet", - "+traits": ["legacyLaunch", "no-texturepacks"] - }, - { - "id": "c0.30_01c", - "checksum": "fcfd7f83a6b27503cf48202381a5adf2", - "releaseTime": "2009-12-22T00:00:00+02:00", - "type": "old_alpha", - "mainClass": "com.mojang.minecraft.l", - "appletClass": "com.mojang.minecraft.MinecraftApplet", - "+traits": ["legacyLaunch", "no-texturepacks"] - }, - { - "id": "c0.0.13a_03", - "checksum": "a9527cb5aef198e0f53e235ebe13dc75", - "releaseTime": "2009-05-22T00:00:00+02:00", - "type": "old_alpha", - "mainClass": "com.mojang.minecraft.c", - "appletClass": "com.mojang.minecraft.MinecraftApplet", - "+traits": ["legacyLaunch", "no-texturepacks"] - }, - { - "id": "c0.0.13a", - "checksum": "3617fbf5fbfd2b837ebf5ceb63584908", - "releaseTime": "2009-05-31T00:00:00+02:00", - "type": "old_alpha", - "mainClass": "com.mojang.minecraft.Minecraft", - "appletClass": "com.mojang.minecraft.MinecraftApplet", - "+traits": ["legacyLaunch", "no-texturepacks"] - }, - { - "id": "c0.0.11a", - "checksum": "a6e03c2eaf74709facc0d2477648e999", - "releaseTime": "2009-05-17T00:00:00+02:00", - "type": "old_alpha", - "mainClass": "com.mojang.minecraft.Minecraft", - "appletClass": "com.mojang.minecraft.MinecraftApplet", - "+traits": ["legacyLaunch", "no-texturepacks"] - }, - { - "id": "rd-161348", - "checksum": "80882b8936a5c8d91500838a6660b504", - "releaseTime": "2009-05-16T13:48:00+02:00", - "type": "old_alpha", - "mainClass": "com.mojang.minecraft.RubyDung", - "+traits": ["no-texturepacks"] - }, - { - "id": "rd-160052", - "checksum": "24c5cc99a2a612697ed2f7d5d04242fe", - "releaseTime": "2009-05-16T00:52:00+02:00", - "type": "old_alpha", - "mainClass": "com.mojang.rubydung.RubyDung", - "+traits": ["no-texturepacks"] - }, - { - "id": "rd-132328", - "checksum": "70e33a81c541b13a477e68c1207124eb", - "releaseTime": "2009-05-13T23:28:00+02:00", - "type": "old_alpha", - "mainClass": "com.mojang.rubydung.RubyDung", - "+traits": ["no-texturepacks"] - }, - { - "id": "rd-132211", - "checksum": "99fdaea10c494b9c3c3254636b98b799", - "releaseTime": "2009-05-13T22:11:00+02:00", - "type": "old_alpha", - "mainClass": "com.mojang.rubydung.RubyDung", - "+traits": ["no-texturepacks"] - } -] -} diff --git a/application/resources/versions/versions.qrc b/application/resources/versions/versions.qrc deleted file mode 100644 index e9621e97..00000000 --- a/application/resources/versions/versions.qrc +++ /dev/null @@ -1,12 +0,0 @@ -<!DOCTYPE RCC> -<RCC version="1.0"> - <qresource prefix="/versions"> - <!-- builtin legacy versions --> - <file>minecraft.json</file> - <!-- LWJGL --> - <file>LWJGL/2.9.0.json</file> - <file>LWJGL/2.9.1-nightly-20130708-debug3.json</file> - <file>LWJGL/2.9.1.json</file> - <file>LWJGL/2.9.2-nightly-20140822.json</file> - </qresource> -</RCC> diff --git a/application/widgets/VersionSelectWidget.cpp b/application/widgets/VersionSelectWidget.cpp index 18284a91..1696d9d1 100644 --- a/application/widgets/VersionSelectWidget.cpp +++ b/application/widgets/VersionSelectWidget.cpp @@ -80,52 +80,42 @@ void VersionSelectWidget::initialize() void VersionSelectWidget::closeEvent(QCloseEvent * event) { - if(loadTask) - { - loadTask->abort(); - loadTask->deleteLater(); - loadTask = nullptr; - } QWidget::closeEvent(event); } void VersionSelectWidget::loadList() { - if(loadTask) + auto newTask = m_vlist->getLoadTask(); + if (!newTask) { return; } - loadTask = m_vlist->getLoadTask(); - if (!loadTask) + loadTask = newTask.get(); + connect(loadTask, &Task::succeeded, this, &VersionSelectWidget::onTaskSucceeded); + connect(loadTask, &Task::failed, this, &VersionSelectWidget::onTaskFailed); + connect(loadTask, &Task::progress, this, &VersionSelectWidget::changeProgress); + if(!loadTask->isRunning()) { - return; + loadTask->start(); } - connect(loadTask, &Task::finished, this, &VersionSelectWidget::onTaskFinished); - connect(loadTask, &Task::progress, this, &VersionSelectWidget::changeProgress); - loadTask->start(); sneakyProgressBar->setHidden(false); } -void VersionSelectWidget::onTaskFinished() +void VersionSelectWidget::onTaskSucceeded() { - if (!loadTask->successful()) - { - CustomMessageBox::selectable(this, tr("Error"), - tr("List update failed:\n%1").arg(loadTask->failReason()), - QMessageBox::Warning)->show(); - if (m_proxyModel->rowCount() == 0) - { - listView->setEmptyMode(VersionListView::ErrorString); - } - } - else if (m_proxyModel->rowCount() == 0) + if (m_proxyModel->rowCount() == 0) { listView->setEmptyMode(VersionListView::String); } sneakyProgressBar->setHidden(true); - loadTask->deleteLater(); - loadTask = nullptr; preselect(); + loadTask = nullptr; +} + +void VersionSelectWidget::onTaskFailed(const QString& reason) +{ + CustomMessageBox::selectable(this, tr("Error"), tr("List update failed:\n%1").arg(reason), QMessageBox::Warning)->show(); + onTaskSucceeded(); } void VersionSelectWidget::changeProgress(qint64 current, qint64 total) @@ -178,4 +168,4 @@ void VersionSelectWidget::setExactFilter(BaseVersionList::ModelRoles role, QStri void VersionSelectWidget::setFuzzyFilter(BaseVersionList::ModelRoles role, QString filter) { m_proxyModel->setFilter(role, filter, false); -}
\ No newline at end of file +} diff --git a/application/widgets/VersionSelectWidget.h b/application/widgets/VersionSelectWidget.h index 0fc9f2e6..66e512ac 100644 --- a/application/widgets/VersionSelectWidget.h +++ b/application/widgets/VersionSelectWidget.h @@ -55,7 +55,8 @@ protected: virtual void closeEvent ( QCloseEvent* ); private slots: - void onTaskFinished(); + void onTaskSucceeded(); + void onTaskFailed(const QString &reason); void changeProgress(qint64 current, qint64 total); void currentRowChanged(const QModelIndex ¤t, const QModelIndex &); @@ -66,7 +67,7 @@ private: BaseVersionList *m_vlist = nullptr; VersionProxyModel *m_proxyModel = nullptr; int resizeOnColumn = 0; - Task * loadTask = nullptr; + Task * loadTask; bool preselectedAlready = false; private: |