summaryrefslogtreecommitdiffstats
path: root/application
diff options
context:
space:
mode:
authorPetr Mrázek <peterix@gmail.com>2017-03-11 01:39:45 +0100
committerPetr Mrázek <peterix@gmail.com>2017-04-07 00:20:01 +0200
commitab868df50eb6f9f3958bdc0a7ab9199dcdf46b3c (patch)
tree0dfb9713e99f5d89d75e05e2ceb4b1378a2aa6b3 /application
parent1fbe03f982f130bf675b7f94dd9c06aee62da54f (diff)
downloadMultiMC-ab868df50eb6f9f3958bdc0a7ab9199dcdf46b3c.tar
MultiMC-ab868df50eb6f9f3958bdc0a7ab9199dcdf46b3c.tar.gz
MultiMC-ab868df50eb6f9f3958bdc0a7ab9199dcdf46b3c.tar.lz
MultiMC-ab868df50eb6f9f3958bdc0a7ab9199dcdf46b3c.tar.xz
MultiMC-ab868df50eb6f9f3958bdc0a7ab9199dcdf46b3c.zip
NOISSUE Wonko is the new Meta
And then Wonko was the Meta.
Diffstat (limited to 'application')
-rw-r--r--application/BuildConfig.cpp.in1
-rw-r--r--application/BuildConfig.h5
-rw-r--r--application/CMakeLists.txt11
-rw-r--r--application/WonkoGui.cpp74
-rw-r--r--application/WonkoGui.h29
-rw-r--r--application/pages/global/MetadataPage.cpp (renamed from application/pages/global/WonkoPage.cpp)74
-rw-r--r--application/pages/global/MetadataPage.h (renamed from application/pages/global/WonkoPage.h)14
-rw-r--r--application/pages/global/MetadataPage.ui (renamed from application/pages/global/WonkoPage.ui)4
8 files changed, 50 insertions, 162 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..55457b1c 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/MetadataPage.cpp
+ pages/global/MetadataPage.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/MetadataPage.ui
# Dialogs
dialogs/CopyInstanceDialog.ui
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/pages/global/WonkoPage.cpp b/application/pages/global/MetadataPage.cpp
index 1a72b18d..4e355997 100644
--- a/application/pages/global/WonkoPage.cpp
+++ b/application/pages/global/MetadataPage.cpp
@@ -13,8 +13,8 @@
* limitations under the License.
*/
-#include "WonkoPage.h"
-#include "ui_WonkoPage.h"
+#include "MetadataPage.h"
+#include "ui_MetadataPage.h"
#include <QDateTime>
#include <QSortFilterProxyModel>
@@ -23,18 +23,20 @@
#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())
+ for (const Reference &ref : version->requires())
{
- const QString readable = ENV.wonkoIndex()->hasUid(ref.uid()) ? ENV.wonkoIndex()->getList(ref.uid())->humanReadable() : ref.uid();
+ const QString readable = ENV.metadataIndex()->hasUid(ref.uid()) ? ENV.metadataIndex()->getList(ref.uid())->humanReadable() : ref.uid();
if (ref.version().isEmpty())
{
lines.append(readable);
@@ -47,9 +49,9 @@ static QString formatRequires(const WonkoVersionPtr &version)
return lines.join('\n');
}
-WonkoPage::WonkoPage(QWidget *parent) :
+MetadataPage::MetadataPage(QWidget *parent) :
QWidget(parent),
- ui(new Ui::WonkoPage)
+ ui(new Ui::MetadataPage)
{
ui->setupUi(this);
ui->tabWidget->tabBar()->hide();
@@ -61,11 +63,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,40 +77,40 @@ 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, &MetadataPage::updateCurrentVersionList);
+ connect(ui->versionsView->selectionModel(), &QItemSelectionModel::currentChanged, this, &MetadataPage::updateVersion);
+ connect(m_filterProxy, &QSortFilterProxyModel::dataChanged, this, &MetadataPage::versionListDataChanged);
updateCurrentVersionList(QModelIndex());
updateVersion();
}
-WonkoPage::~WonkoPage()
+MetadataPage::~MetadataPage()
{
delete ui;
}
-QIcon WonkoPage::icon() const
+QIcon MetadataPage::icon() const
{
return MMC->getThemedIcon("looney");
}
-void WonkoPage::on_refreshIndexBtn_clicked()
+void MetadataPage::on_refreshIndexBtn_clicked()
{
- ProgressDialog(this).execWithTask(ENV.wonkoIndex()->remoteUpdateTask());
+ ProgressDialog(this).execWithTask(ENV.metadataIndex()->remoteUpdateTask());
}
-void WonkoPage::on_refreshFileBtn_clicked()
+void MetadataPage::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());
}
-void WonkoPage::on_refreshVersionBtn_clicked()
+void MetadataPage::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;
@@ -116,7 +118,7 @@ void WonkoPage::on_refreshVersionBtn_clicked()
ProgressDialog(this).execWithTask(version->remoteUpdateTask());
}
-void WonkoPage::on_fileSearchEdit_textChanged(const QString &search)
+void MetadataPage::on_fileSearchEdit_textChanged(const QString &search)
{
if (search.isEmpty())
{
@@ -129,7 +131,7 @@ void WonkoPage::on_fileSearchEdit_textChanged(const QString &search)
m_fileProxy->setFilterRegExp(".*" + parts.join(".*") + ".*");
}
}
-void WonkoPage::on_versionSearchEdit_textChanged(const QString &search)
+void MetadataPage::on_versionSearchEdit_textChanged(const QString &search)
{
if (search.isEmpty())
{
@@ -143,11 +145,11 @@ void WonkoPage::on_versionSearchEdit_textChanged(const QString &search)
}
}
-void WonkoPage::updateCurrentVersionList(const QModelIndex &index)
+void MetadataPage::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);
@@ -183,7 +185,7 @@ void WonkoPage::updateCurrentVersionList(const QModelIndex &index)
}
}
-void WonkoPage::versionListDataChanged(const QModelIndex &tl, const QModelIndex &br)
+void MetadataPage::versionListDataChanged(const QModelIndex &tl, const QModelIndex &br)
{
if (QItemSelection(tl, br).contains(ui->versionsView->currentIndex()))
{
@@ -191,10 +193,10 @@ void WonkoPage::versionListDataChanged(const QModelIndex &tl, const QModelIndex
}
}
-void WonkoPage::updateVersion()
+void MetadataPage::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);
@@ -223,16 +225,16 @@ void WonkoPage::updateVersion()
}
}
-void WonkoPage::opened()
+void MetadataPage::opened()
{
- if (!ENV.wonkoIndex()->isLocalLoaded())
+ if (!ENV.metadataIndex()->isLocalLoaded())
{
- std::unique_ptr<Task> task = ENV.wonkoIndex()->localUpdateTask();
+ std::unique_ptr<Task> task = ENV.metadataIndex()->localUpdateTask();
connect(task.get(), &Task::finished, this, [this]()
{
- if (!ENV.wonkoIndex()->isRemoteLoaded())
+ if (!ENV.metadataIndex()->isRemoteLoaded())
{
- ProgressDialog(this).execWithTask(ENV.wonkoIndex()->remoteUpdateTask());
+ ProgressDialog(this).execWithTask(ENV.metadataIndex()->remoteUpdateTask());
}
});
ProgressDialog(this).execWithTask(task);
diff --git a/application/pages/global/WonkoPage.h b/application/pages/global/MetadataPage.h
index 1d576c15..f75b4952 100644
--- a/application/pages/global/WonkoPage.h
+++ b/application/pages/global/MetadataPage.h
@@ -20,21 +20,21 @@
#include "pages/BasePage.h"
namespace Ui {
-class WonkoPage;
+class MetadataPage;
}
class QSortFilterProxyModel;
class VersionProxyModel;
-class WonkoPage : public QWidget, public BasePage
+class MetadataPage : public QWidget, public BasePage
{
Q_OBJECT
public:
- explicit WonkoPage(QWidget *parent = 0);
- ~WonkoPage();
+ explicit MetadataPage(QWidget *parent = 0);
+ ~MetadataPage();
- QString id() const override { return "wonko-global"; }
- QString displayName() const override { return tr("Wonko"); }
+ QString id() const override { return "metadata-global"; }
+ QString displayName() const override { return tr("Metadata"); }
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::MetadataPage *ui;
QSortFilterProxyModel *m_fileProxy;
QSortFilterProxyModel *m_filterProxy;
VersionProxyModel *m_versionProxy;
diff --git a/application/pages/global/WonkoPage.ui b/application/pages/global/MetadataPage.ui
index 2d14ceca..0bd33f32 100644
--- a/application/pages/global/WonkoPage.ui
+++ b/application/pages/global/MetadataPage.ui
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
- <class>WonkoPage</class>
- <widget class="QWidget" name="WonkoPage">
+ <class>MetadataPage</class>
+ <widget class="QWidget" name="MetadataPage">
<property name="geometry">
<rect>
<x>0</x>