Change systray icons according to global status.

cusax-fix
Damian Minkov 18 years ago
parent 1cbc9a0d77
commit 5fbcf0a164

Binary file not shown.

After

Width:  |  Height:  |  Size: 822 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 895 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 441 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 772 B

@ -4,7 +4,13 @@
# See terms of license at gnu.org.
trayIcon=resources/images/impl/systray/systrayIcon.png
trayIconOffline=resources/images/impl/systray/systrayIconOffline.png
trayIconAway=resources/images/impl/systray/systrayIconAway.png
trayIconFFC=resources/images/impl/systray/systrayIconFFC.png
trayIconWindows=resources/images/impl/systray/systrayIconWindows.png
trayIconWindowsOffline=resources/images/impl/systray/systrayIconWindowsOffline.png
trayIconWindowsAway=resources/images/impl/systray/systrayIconWindowsAway.png
trayIconWindowsFFC=resources/images/impl/systray/systrayIconWindowsFFC.png
trayIconMacOSX=resources/images/impl/systray/systrayIconMacOSX.png
trayIconMacOSXWhite=resources/images/impl/systray/systrayIconMacOSXWhite.png
addContactIcon=resources/images/impl/gui/buttons/addContactIcon.png

@ -295,6 +295,9 @@ public static SystrayService getSystrayService()
ServiceReference serviceReference = bundleContext
.getServiceReference(SystrayService.class.getName());
if(serviceReference == null)
return null;
systrayService = (SystrayService) bundleContext
.getService(serviceReference);
}

@ -12,11 +12,13 @@
import javax.swing.*;
import net.java.sip.communicator.impl.gui.*;
import net.java.sip.communicator.impl.gui.customcontrols.*;
import net.java.sip.communicator.impl.gui.i18n.*;
import net.java.sip.communicator.impl.gui.main.*;
import net.java.sip.communicator.impl.gui.utils.*;
import net.java.sip.communicator.service.protocol.*;
import net.java.sip.communicator.service.systray.*;
import net.java.sip.communicator.util.*;
/**
@ -373,6 +375,36 @@ public void updateStatus()
JMenuItem item = getItemFromStatus(status);
setSelected(item, (ImageIcon)item.getIcon());
setSystrayIcon(status);
}
private void setSystrayIcon(int status)
{
SystrayService trayServce = GuiActivator.getSystrayService();
if(trayServce == null)
return;
int imgType = SystrayService.SC_IMG_OFFLINE_TYPE;
if(status < PresenceStatus.ONLINE_THRESHOLD)
{
imgType = SystrayService.SC_IMG_OFFLINE_TYPE;
}
else if(status < PresenceStatus.AVAILABLE_THRESHOLD)
{
imgType = SystrayService.SC_IMG_AWAY_TYPE;
}
else if(status < PresenceStatus.EAGER_TO_COMMUNICATE_THRESHOLD)
{
imgType = SystrayService.SC_IMG_TYPE;
}
else if(status < PresenceStatus.MAX_STATUS_VALUE)
{
imgType = SystrayService.SC_IMG_FFC_TYPE;
}
trayServce.setSystrayIcon(imgType);
}
/**

@ -6,11 +6,9 @@
*/
package net.java.sip.communicator.impl.systray;
import net.java.sip.communicator.impl.notification.*;
import net.java.sip.communicator.impl.systray.jdic.*;
import net.java.sip.communicator.service.configuration.*;
import net.java.sip.communicator.service.gui.*;
import net.java.sip.communicator.service.notification.*;
import net.java.sip.communicator.service.systray.*;
import net.java.sip.communicator.util.*;

@ -87,6 +87,9 @@ public class SystrayServiceJdicImpl
*/
private ImageIcon currentIcon;
private ImageIcon logoIcon;
private ImageIcon logoIconOffline;
private ImageIcon logoIconAway;
private ImageIcon logoIconFFC;
private ImageIcon logoIconWhite;
private ImageIcon envelopeIcon;
private ImageIcon envelopeIconWhite;
@ -136,6 +139,9 @@ private void initSystray()
if (osName.startsWith("Windows"))
{
logoIcon = Resources.getImage("trayIconWindows");
logoIconOffline = Resources.getImage("trayIconWindowsOffline");
logoIconAway = Resources.getImage("trayIconWindowsAway");
logoIconFFC = Resources.getImage("trayIconWindowsFFC");
envelopeIcon = Resources.getImage("messageIconWindows");
}
// If we're running under MacOSX, we use a special black and
@ -150,11 +156,16 @@ else if (osName.startsWith("Mac OS X"))
else
{
logoIcon = Resources.getImage("trayIcon");
logoIconOffline = Resources.getImage("trayIconOffline");
logoIconAway = Resources.getImage("trayIconAway");
logoIconFFC = Resources.getImage("trayIconFFC");
envelopeIcon = Resources.getImage("messageIcon");
}
currentIcon = logoIcon;
trayIcon = new TrayIcon(logoIcon,
// default to set offline , if any protocols become
// online will set it to online
currentIcon = logoIconOffline;
trayIcon = new TrayIcon(currentIcon,
Resources.getApplicationString("applicationName"),
menu);
@ -434,6 +445,24 @@ public void setSystrayIcon(int imageType)
this.currentIcon = logoIcon;
}
}
else if (imageType == SystrayService.SC_IMG_OFFLINE_TYPE)
{
if (!osName.startsWith("Mac OS X"))
{
this.trayIcon.setIcon(logoIconOffline);
this.currentIcon = logoIconOffline;
}
}
else if (imageType == SystrayService.SC_IMG_AWAY_TYPE)
{
this.trayIcon.setIcon(logoIconAway);
this.currentIcon = logoIconAway;
}
else if (imageType == SystrayService.SC_IMG_FFC_TYPE)
{
this.trayIcon.setIcon(logoIconFFC);
this.currentIcon = logoIconFFC;
}
else if (imageType == SystrayService.ENVELOPE_IMG_TYPE)
{
if (osName.startsWith("Mac OS X") && this.menu.isVisible())

@ -150,6 +150,7 @@ public Contact getContact( String contactAddress,
/**
* Get all details with given name.
* @param name the name of the details we are searching.
* @return list of string values for the details with the given name.
*/
public List getDetails(String name);
}

@ -41,6 +41,21 @@ public interface SystrayService
*/
public static final int SC_IMG_TYPE = 0;
/**
* Image type corresponding to the sip-communicator offline icon
*/
public static final int SC_IMG_OFFLINE_TYPE = 2;
/**
* Image type corresponding to the sip-communicator offline icon
*/
public static final int SC_IMG_AWAY_TYPE = 3;
/**
* Image type corresponding to the sip-communicator offline icon
*/
public static final int SC_IMG_FFC_TYPE = 4;
/**
* Image type corresponding to the envelope icon
*/

Loading…
Cancel
Save