Volume control user interface, allowing to adjust volume during a call.

cusax-fix
Yana Stamcheva 15 years ago
parent 31ac0d3104
commit 95200fca37

@ -193,6 +193,7 @@ service.gui.buttons.SEARCH_CALL_ROLLOVER_ICON=resources/images/impl/gui/buttons/
service.gui.buttons.ZOOM_OUT=resources/images/impl/gui/buttons/magnifier_zoom_out.png
service.gui.buttons.ZOOM_IN=resources/images/impl/gui/buttons/magnifier_zoom_in.png
service.gui.buttons.RESET=resources/images/impl/gui/buttons/reset.png
service.gui.buttons.VOLUME_CONTROL=resources/images/impl/gui/buttons/volumeControl.png
# Sound level icons
service.gui.soundlevel.SOUND_LEVEL_ACTIVE=resources/images/impl/gui/common/soundlevel/soundActive.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 431 B

@ -421,6 +421,7 @@ service.gui.VOICEMAIL_NO_MESSAGES=No messages.
service.gui.VOICEMAIL_TITLE=Voice messages
service.gui.VOICEMAIL_TOOLTIP=Voice messages for:
service.gui.VOICEMAIL_TIP=Click the call button to hear your messages.
service.gui.VOLUME_CONTROL_TOOL_TIP=Adjust volume
service.gui.WARNING=Warning
service.gui.YES=Yes
service.gui.YESTERDAY=Yesterday

@ -128,6 +128,11 @@ public class CallDialog
*/
private FullScreenButton fullScreenButton;
/**
* The volume control button.
*/
private VolumeControlButton volumeControlButton;
/**
* The dial button, which opens a keypad dialog.
*/
@ -246,6 +251,7 @@ private void init()
desktopSharingButton = new DesktopSharingButton(call);
transferCallButton = new TransferCallButton(call);
fullScreenButton = new FullScreenButton(this);
volumeControlButton = new VolumeControlButton();
dialButton.setName(DIAL_BUTTON);
dialButton.setToolTipText(
@ -294,6 +300,8 @@ private void init()
addOneToOneSpecificComponents();
}
settingsPanel.add(volumeControlButton);
buttonsPanel.add(settingsPanel, BorderLayout.WEST);
buttonsPanel.add(hangupButton, BorderLayout.EAST);

@ -0,0 +1,119 @@
/*
* SIP Communicator, the OpenSource Java VoIP and Instant Messaging client.
*
* Distributable under LGPL license.
* See terms of license at gnu.org.
*/
package net.java.sip.communicator.impl.gui.main.call;
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
import javax.swing.event.*;
import net.java.sip.communicator.impl.gui.*;
import net.java.sip.communicator.impl.gui.utils.*;
import net.java.sip.communicator.service.neomedia.*;
import net.java.sip.communicator.util.skin.*;
import net.java.sip.communicator.util.swing.*;
/**
* The <tt>VolumeControlButton</tt> is the button shown in the call window,
* which allows to adjust the volume of your call.
*
* @author Yana Stamcheva
*/
public class VolumeControlButton
extends SIPCommButton
implements Skinnable
{
/**
* The multiplier would just convert the float volume value coming from
* the service to the int value needed for the volume control slider
* component.
*/
private static final int MULTIPLIER = 100;
/**
* Creates an instance of <tt>VolumeControlButton</tt>.
*/
public VolumeControlButton()
{
// Loads the skin of this button.
loadSkin();
setToolTipText(GuiActivator.getResources().getI18NString(
"service.gui.VOLUME_CONTROL_TOOL_TIP"));
final JSlider volumeSlider
= new JSlider(JSlider.VERTICAL, 0, 100, 50);
volumeSlider.setPreferredSize(new Dimension(20, 100));
final VolumeControl volumeControl
= GuiActivator.getMediaService().getVolumeControl();
// Sets the minimum, maximum and default volume values for the volume
// slider.
if (volumeControl != null)
{
volumeSlider.setMinimum(
(int) (volumeControl.getMinValue()*MULTIPLIER));
volumeSlider.setMaximum(
(int) (volumeControl.getMaxValue()*MULTIPLIER));
volumeSlider.setValue(
(int) (volumeControl.getVolume()*MULTIPLIER));
}
// Adds a change listener to the slider in order to correctly set
// the volume through the VolumeControl service, on user change.
volumeSlider.addChangeListener(new ChangeListener()
{
public void stateChanged(ChangeEvent e)
{
JSlider source = (JSlider) e.getSource();
if (!source.getValueIsAdjusting())
{
int volume = source.getValue();
// Set the volume to the volume control.
volumeControl.setVolume((float) volume/MULTIPLIER);
}
}
});
// Creates the menu that would contain the volume control component.
final JPopupMenu sliderMenu = new JPopupMenu();
sliderMenu.setInvoker(this);
sliderMenu.add(volumeSlider);
this.addActionListener(new ActionListener()
{
public void actionPerformed(ActionEvent arg0)
{
Point location = new Point(getX(), getY() + getHeight());
SwingUtilities.convertPointToScreen(location,
VolumeControlButton.this.getParent());
sliderMenu.setLocation(location);
sliderMenu.setVisible(!sliderMenu.isVisible());
}
});
}
/**
* Loads volume control button skin.
*/
public void loadSkin()
{
this.setBackgroundImage(ImageLoader.getImage(
ImageLoader.CALL_SETTING_BUTTON_BG));
this.setIconImage(ImageLoader.getImage(
ImageLoader.VOLUME_CONTROL_BUTTON));
}
}

@ -878,6 +878,12 @@ public class ImageLoader
public static final ImageID DESKTOP_SHARING
= new ImageID("service.gui.icons.DESKTOP_SHARING_16x16_ICON");
/**
* The volume control button icon.
*/
public static final ImageID VOLUME_CONTROL_BUTTON
= new ImageID("service.gui.buttons.VOLUME_CONTROL");
/*
* =======================================================================
* ------------------------ EDIT TOOLBAR ICONS ---------------------------

Loading…
Cancel
Save