Adds the device name and its state (connected or disconnected) for the "Device configuration has changed" pop-up notification. Adds a "New selected device" pop-up notification when the selected audio device has changed (for audio in, audio out and notifications).

cusax-fix
Vincent Lucas 13 years ago
parent a30e6955f6
commit de80427e32

@ -1309,7 +1309,8 @@ plugin.notificationconfig.event.DTMFTone.8=DTMF tone 8
plugin.notificationconfig.event.DTMFTone.9=DTMF tone 9
plugin.notificationconfig.event.DTMFTone.*=DTMF tone *
plugin.notificationconfig.event.DTMFTone.#=DTMF tone #
plugin.notificationconfig.event.DeviceConfigurationChanged=Device configuration change
plugin.notificationconfig.event.DeviceConfigurationChanged=Device configuration has changed
plugin.notificationconfig.event.NewSelectedDevice=New selected device
# ZRTP Securing
impl.media.security.WARNING_NO_RS_MATCH=<html>No retained shared secret available.<br/><b>SAS verification is recommended</b></html>
@ -1366,7 +1367,11 @@ impl.media.configform.VIDEO_RESOLUTION=Video resolution
impl.media.configform.VIDEO_FRAME_RATE=Custom frame rate (per sec.)
impl.media.configform.VIDEO_PACKETS_POLICY=Maximum allowed bandwidth (kBytes/s)
impl.media.configform.VIDEO_RESET=Reset defaults
impl.media.configform.AUDIO_DEVICE_CONFIG_CHANGED=Audio configuration has changed
impl.media.configform.AUDIO_DEVICE_CONNECTED=Connected device:
impl.media.configform.AUDIO_DEVICE_DISCONNECTED=Disconnected device:
impl.media.configform.AUDIO_DEVICE_SELECTED_AUDIO_IN=New selected device for audio in:
impl.media.configform.AUDIO_DEVICE_SELECTED_AUDIO_OUT=New selected device for audio out:
impl.media.configform.AUDIO_DEVICE_SELECTED_AUDIO_NOTIFICATIONS=New selected device for notifications:
impl.media.configform.AUDIO_DEVICE_CONFIG_MANAGMENT_CLICK=Click here for device management
impl.neomedia.configform.AUDIO=Audio

@ -8,6 +8,7 @@
import java.beans.*;
import java.util.*;
import javax.media.*;
import net.java.sip.communicator.impl.neomedia.codec.video.h264.*;
import net.java.sip.communicator.service.gui.*;
@ -87,6 +88,13 @@ public class NeomediaActivator
private static final String DEVICE_CONFIGURATION_HAS_CHANGED
= "DeviceConfigurationChanged";
/**
* The name of the notification pop-up event displayed when a new device
* is selected (for audio in, audio out or notifications).
*/
private static final String NEW_SELECTED_DEVICE
= "NewSelectedDevice";
/**
* The context in which the one and only <tt>NeomediaActivator</tt> instance
* has started executing.
@ -480,7 +488,15 @@ public static NotificationService getNotificationService()
notificationService.registerDefaultNotificationForEvent(
DEVICE_CONFIGURATION_HAS_CHANGED,
net.java.sip.communicator.service.notification.NotificationAction.ACTION_POPUP_MESSAGE,
"Device onfiguration has changed",
"Device configuration has changed",
null);
// Register a popup message for a new device selected for audio
// in, audio out or notifications.
notificationService.registerDefaultNotificationForEvent(
NEW_SELECTED_DEVICE,
net.java.sip.communicator.service.notification.NotificationAction.ACTION_POPUP_MESSAGE,
"New selected device",
null);
}
}
@ -546,8 +562,74 @@ public void managePopupMessageListenerRegistration(boolean enable)
*/
public void propertyChange(PropertyChangeEvent event)
{
if (DeviceConfiguration.PROP_AUDIO_SYSTEM_DEVICES
String popUpEvent = null;
String title = null;
CaptureDeviceInfo device = null;
ResourceManagementService resources
= NeomediaActivator.getResources();
// If the device configuration has changed: a device has been
// plugged or un-plugged.
if(DeviceConfiguration.PROP_AUDIO_SYSTEM_DEVICES
.equals(event.getPropertyName()))
{
popUpEvent = DEVICE_CONFIGURATION_HAS_CHANGED;
// A device has been connected.
if(event.getNewValue() != null)
{
title = resources.getI18NString(
"impl.media.configform"
+ ".AUDIO_DEVICE_CONNECTED");
device = (CaptureDeviceInfo) event.getNewValue();
}
// A device has been disconnected.
else if(event.getOldValue() != null)
{
title = resources.getI18NString(
"impl.media.configform"
+ ".AUDIO_DEVICE_DISCONNECTED");
device = (CaptureDeviceInfo) event.getOldValue();
}
}
// If a new capture device has been selected.
else if(CaptureDevices.PROP_DEVICE.equals(event.getPropertyName()))
{
if(event.getNewValue() != null)
{
popUpEvent = NEW_SELECTED_DEVICE;
title = resources.getI18NString(
"impl.media.configform"
+ ".AUDIO_DEVICE_SELECTED_AUDIO_IN");
device = (CaptureDeviceInfo) event.getNewValue();
}
}
// If a new playback device has been selected.
else if(PlaybackDevices.PROP_DEVICE.equals(event.getPropertyName()))
{
if(event.getNewValue() != null)
{
popUpEvent = NEW_SELECTED_DEVICE;
title = resources.getI18NString(
"impl.media.configform"
+ ".AUDIO_DEVICE_SELECTED_AUDIO_OUT");
device = (CaptureDeviceInfo) event.getNewValue();
}
}
// If a new notify device has been selected.
else if(NotifyDevices.PROP_DEVICE.equals(event.getPropertyName()))
{
if(event.getNewValue() != null)
{
popUpEvent = NEW_SELECTED_DEVICE;
title = resources.getI18NString(
"impl.media.configform"
+ ".AUDIO_DEVICE_SELECTED_AUDIO_NOTIFICATIONS");
device = (CaptureDeviceInfo) event.getNewValue();
}
}
// Shows the pop-up notification.
if(title != null && device != null && popUpEvent != null)
{
NotificationService notificationService
= getNotificationService();
@ -563,21 +645,19 @@ public void propertyChange(PropertyChangeEvent event)
}
// Fires the popup notification.
ResourceManagementService resources
= NeomediaActivator.getResources();
Map<String,Object> extras = new HashMap<String,Object>();
extras.put(
NotificationData.POPUP_MESSAGE_HANDLER_TAG_EXTRA,
this);
notificationService.fireNotification(
DEVICE_CONFIGURATION_HAS_CHANGED,
resources.getI18NString(
"impl.media.configform"
+ ".AUDIO_DEVICE_CONFIG_CHANGED"),
resources.getI18NString(
popUpEvent,
title,
device.getName()
+ "\r\n"
+ resources.getI18NString(
"impl.media.configform"
+ ".AUDIO_DEVICE_CONFIG_MANAGMENT_CLICK"),
+ ".AUDIO_DEVICE_CONFIG_MANAGMENT_CLICK"),
null,
extras);
}

Loading…
Cancel
Save