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:
twanvl
2008-08-09 00:39:06 +00:00
parent d14af1c43a
commit 76728dfed9
3 changed files with 23 additions and 3 deletions
+19 -1
View File
@@ -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)