GH-1559 Fix FTB icons
This was caused by separation of GUI and logic. Now logic has an interface that GUI implements. It should be expanded upon later.
This commit is contained in:
@ -43,6 +43,16 @@ std::shared_ptr< QNetworkAccessManager > Env::qnam()
|
||||
return m_qnam;
|
||||
}
|
||||
|
||||
std::shared_ptr<IIconList> Env::icons()
|
||||
{
|
||||
return m_iconlist;
|
||||
}
|
||||
|
||||
void Env::registerIconList(std::shared_ptr<IIconList> iconlist)
|
||||
{
|
||||
m_iconlist = iconlist;
|
||||
}
|
||||
|
||||
/*
|
||||
class NullVersion : public BaseVersion
|
||||
{
|
||||
|
@ -1,6 +1,7 @@
|
||||
#pragma once
|
||||
|
||||
#include <memory>
|
||||
#include "icons/IIconList.h"
|
||||
#include <QString>
|
||||
#include <QMap>
|
||||
|
||||
@ -32,6 +33,8 @@ public:
|
||||
|
||||
std::shared_ptr<HttpMetaCache> metacache();
|
||||
|
||||
std::shared_ptr<IIconList> icons();
|
||||
|
||||
/// init the cache. FIXME: possible future hook point
|
||||
void initHttpMetaCache();
|
||||
|
||||
@ -46,6 +49,8 @@ public:
|
||||
|
||||
void registerVersionList(QString name, std::shared_ptr<BaseVersionList> vlist);
|
||||
|
||||
void registerIconList(std::shared_ptr<IIconList> iconlist);
|
||||
|
||||
std::shared_ptr<WonkoIndex> wonkoIndex();
|
||||
|
||||
QString wonkoRootUrl() const { return m_wonkoRootUrl; }
|
||||
@ -54,6 +59,7 @@ public:
|
||||
protected:
|
||||
std::shared_ptr<QNetworkAccessManager> m_qnam;
|
||||
std::shared_ptr<HttpMetaCache> m_metacache;
|
||||
std::shared_ptr<IIconList> m_iconlist;
|
||||
QMap<QString, std::shared_ptr<BaseVersionList>> m_versionLists;
|
||||
std::shared_ptr<WonkoIndex> m_wonkoIndex;
|
||||
QString m_wonkoRootUrl;
|
||||
|
20
api/logic/icons/IIconList.h
Normal file
20
api/logic/icons/IIconList.h
Normal file
@ -0,0 +1,20 @@
|
||||
#pragma once
|
||||
|
||||
#include <QString>
|
||||
|
||||
enum IconType : unsigned
|
||||
{
|
||||
Builtin,
|
||||
Transient,
|
||||
FileBased,
|
||||
ICONS_TOTAL,
|
||||
ToBeDeleted
|
||||
};
|
||||
|
||||
class IIconList
|
||||
{
|
||||
public:
|
||||
virtual ~IIconList(){}
|
||||
virtual bool addIcon(QString key, QString name, QString path, IconType type) = 0;
|
||||
};
|
||||
|
@ -257,7 +257,11 @@ void FTBPlugin::loadInstances(SettingsObjectPtr globalSettings, QMap<QString, QS
|
||||
{
|
||||
qDebug() << "Loading FTB instance from " << record.instanceDir;
|
||||
QString iconKey = record.iconKey;
|
||||
// MMC->icons()->addIcon(iconKey, iconKey, FS::PathCombine(record.templateDir, record.logo), MMCIcon::Transient);
|
||||
auto icons = ENV.icons();
|
||||
if(icons)
|
||||
{
|
||||
icons->addIcon(iconKey, iconKey, FS::PathCombine(record.templateDir, record.logo), IconType::Transient);
|
||||
}
|
||||
auto settingsFilePath = FS::PathCombine(record.instanceDir, "instance.cfg");
|
||||
qDebug() << "ICON get!";
|
||||
|
||||
|
Reference in New Issue
Block a user