Commit cf9b8b19 authored by twanvl's avatar twanvl

Package icons will be loaded from installers if possible

parent ac08c3f1
......@@ -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)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment