NOISSUE Wonko is the new Meta
And then Wonko was the Meta.
This commit is contained 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
|
||||
|
@ -60,11 +60,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).
|
||||
|
@ -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
|
||||
|
@ -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;
|
||||
}
|
@ -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);
|
||||
}
|
@ -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);
|
@ -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;
|
@ -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>
|
Reference in New Issue
Block a user