mirror of
https://github.com/amyinspace/MagicSetEditor2.git
synced 2026-06-10 13:06:59 -04:00
Package icons will be loaded from installers if possible
git-svn-id: svn://svn.code.sf.net/p/magicseteditor/code/trunk@1114 0fc631ac-6414-0410-93d0-97cfa31319b6
This commit is contained in:
+19
-1
@@ -42,6 +42,24 @@ IMPLEMENT_REFLECTION(Installer) {
|
||||
REFLECT(packages);
|
||||
}
|
||||
|
||||
void Installer::validate(Version file_app_version) {
|
||||
Packaged::validate(file_app_version);
|
||||
// load icons where possible
|
||||
FOR_EACH(p,packages) {
|
||||
if (!p->icon_url.empty() && !starts_with(p->icon_url,_("http:"))) {
|
||||
// TODO: support absolute icon names
|
||||
try{
|
||||
String filename = p->name + _("/") + p->icon_url;
|
||||
InputStreamP img = openIn(p->name + _("/") + p->icon_url);
|
||||
p->icon.LoadFile(*img);
|
||||
} catch (...) {
|
||||
// ignore errors, it's just an image
|
||||
p->icon_url.clear();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#if 0
|
||||
// ----------------------------------------------------------------------------- : Installing
|
||||
|
||||
@@ -191,7 +209,7 @@ PackageDescription::PackageDescription(const Packaged& package)
|
||||
, version(package.version)
|
||||
, short_name(package.short_name)
|
||||
, full_name(package.full_name)
|
||||
, icon_url(_(""))
|
||||
, icon_url(package.icon_filename)
|
||||
, installer_group(package.installer_group)
|
||||
, position_hint(package.position_hint)
|
||||
//, description(package.description)
|
||||
|
||||
@@ -44,8 +44,9 @@ class Installer : public Packaged {
|
||||
void addPackage(Packaged& package);
|
||||
|
||||
protected:
|
||||
String typeName() const;
|
||||
Version fileVersion() const;
|
||||
virtual String typeName() const;
|
||||
virtual Version fileVersion() const;
|
||||
virtual void validate(Version file_app_version);
|
||||
DECLARE_REFLECTION();
|
||||
};
|
||||
|
||||
|
||||
@@ -158,6 +158,7 @@ class SeekAtStartInputStream : public wxFilterInputStream {
|
||||
Byte buffer[1024];
|
||||
};
|
||||
|
||||
/// Retrieve the icon for a package
|
||||
class PackageIconRequest : public ThumbnailRequest {
|
||||
public:
|
||||
PackageIconRequest(PackageUpdateList* list, PackageUpdateList::TreeItem* ti)
|
||||
|
||||
Reference in New Issue
Block a user