aboutsummaryrefslogtreecommitdiffstats
path: root/src/net/java/sip/communicator/impl/neomedia
diff options
context:
space:
mode:
authorVincent Lucas <chenzo@jitsi.org>2012-12-07 14:17:19 +0000
committerVincent Lucas <chenzo@jitsi.org>2012-12-07 14:17:19 +0000
commitde80427e3297d66ab4bb6f3888c9517fc5a527cb (patch)
tree5d5282e8e6f59f35c854adc43f836b99b783ec14 /src/net/java/sip/communicator/impl/neomedia
parenta30e6955f6ac39fc94d7ac8b7ad570df11e1c496 (diff)
downloadjitsi-de80427e3297d66ab4bb6f3888c9517fc5a527cb.zip
jitsi-de80427e3297d66ab4bb6f3888c9517fc5a527cb.tar.gz
jitsi-de80427e3297d66ab4bb6f3888c9517fc5a527cb.tar.bz2
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).
Diffstat (limited to 'src/net/java/sip/communicator/impl/neomedia')
-rw-r--r--src/net/java/sip/communicator/impl/neomedia/NeomediaActivator.java102
1 files changed, 91 insertions, 11 deletions
diff --git a/src/net/java/sip/communicator/impl/neomedia/NeomediaActivator.java b/src/net/java/sip/communicator/impl/neomedia/NeomediaActivator.java
index 5c99769..81f346d 100644
--- a/src/net/java/sip/communicator/impl/neomedia/NeomediaActivator.java
+++ b/src/net/java/sip/communicator/impl/neomedia/NeomediaActivator.java
@@ -8,6 +8,7 @@ package net.java.sip.communicator.impl.neomedia;
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.*;
@@ -88,6 +89,13 @@ public class NeomediaActivator
= "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 class NeomediaActivator
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,9 +562,75 @@ public class NeomediaActivator
*/
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 class NeomediaActivator
}
// 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);
}