2
0
mirror of https://github.com/fhem/fhem-mirror.git synced 2025-03-10 09:16:53 +00:00

Re-commit eventmap changes for icon search

git-svn-id: https://svn.fhem.de/fhem/trunk@1747 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
rudolfkoenig 2012-07-21 11:26:25 +00:00
parent b1371337ad
commit dd141ae963

View File

@ -2060,10 +2060,10 @@ FW_ReadIcons()
} }
sub sub
FW_IconOrOld($$) { FW_getIcon($) {
my ($old,$new)= @_; my ($name)= @_;
my $icon= "${new}.png"; my $icon= "$name.png"; # FIXME
return $FW_icons{$icon} ? $icon : $old; return $FW_icons{$icon} ? $icon : undef;
} }
@ -2071,20 +2071,24 @@ sub
FW_dev2image($) FW_dev2image($)
{ {
my ($name) = @_; my ($name) = @_;
my $icon = ""; my $d = $defs{$name};
return $icon if(!$name || !$defs{$name}); return "" if(!$name || !$d);
my ($type, $state) = ($defs{$name}{TYPE}, $defs{$name}{STATE}); my ($type, $state) = ($d->{TYPE}, $d->{STATE});
return $icon if(!$type || !defined($state)); return "" if(!$type || !$state);
#Debug "Looking for an icon for $name $type $state";
my (undef, $rstate) = ReplaceEventMap($name, [undef, $state], 0);
$state =~ s/ .*//; # Want to be able to have icons for "on-for-timer xxx" $state =~ s/ .*//; # Want to be able to have icons for "on-for-timer xxx"
$icon= FW_IconOrOld($icon,$state); # on
$icon= FW_IconOrOld($icon,$type); # FS20 my $icon;
$icon= FW_IconOrOld($icon,"$type.$state"); # FS20.on $icon = FW_getIcon("$name.$state") if(!$icon); # lamp.Aus.png
$icon= FW_IconOrOld($icon,$name); # MyLamp $icon = FW_getIcon("$name.$rstate") if(!$icon); # lamp.on.png
$icon= FW_IconOrOld($icon,"$name.$state"); # MyLamp.on $icon = FW_getIcon($name) if(!$icon); # lamp.png
$icon = FW_getIcon("$type.$state") if(!$icon); # FS20.Aus.png
$icon = FW_getIcon("$type.$rstate") if(!$icon); # FS20.on.png
$icon = FW_getIcon($type) if(!$icon); # FS20.png
$icon = FW_getIcon($state) if(!$icon); # Aus.png
$icon = FW_getIcon($rstate) if(!$icon); # on.png
return $icon; return $icon;
} }