Move volume buttons next to sound indicators.

cusax-fix
Damian Minkov 15 years ago
parent b51c5d585e
commit afd0c563b0

@ -201,6 +201,8 @@ service.gui.soundlevel.SOUND_LEVEL_ACTIVE=resources/images/impl/gui/common/sound
service.gui.soundlevel.SOUND_LEVEL_INACTIVE=resources/images/impl/gui/common/soundlevel/soundInactive.png
service.gui.soundlevel.MICROPHONE=resources/images/impl/gui/common/soundlevel/Microphone.png
service.gui.soundlevel.HEADPHONE=resources/images/impl/gui/common/soundlevel/Headphone.png
service.gui.soundlevel.VOLUME_BUTTON=resources/images/impl/gui/common/soundlevel/volumeButton.png
service.gui.soundlevel.VOLUME_BUTTON_PRESSED=resources/images/impl/gui/common/soundlevel/volumeButtonPressed.png
# Smileys icons
service.gui.smileys.SMILEY1=resources/images/impl/gui/common/smileys/default/smiley1.gif

Binary file not shown.

Before

Width:  |  Height:  |  Size: 412 B

After

Width:  |  Height:  |  Size: 441 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 289 B

After

Width:  |  Height:  |  Size: 406 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 578 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 658 B

@ -6,9 +6,11 @@
*/
package net.java.sip.communicator.impl.gui.main.call;
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.service.protocol.*;
import net.java.sip.communicator.service.resources.*;
import net.java.sip.communicator.util.swing.*;
import javax.swing.*;
import javax.swing.event.*;
@ -22,8 +24,23 @@
* @author Yana Stamcheva
*/
public abstract class AbstractVolumeControlButton
extends AbstractCallToggleButton
extends SIPCommButton
{
/**
* The background image.
*/
protected ImageID bgImage;
/**
* The pressed image.
*/
protected ImageID pressedImage;
/**
* The icon image.
*/
protected ImageID iconImageID;
/**
* The multiplier would just convert the float volume value coming from
* the service to the int value needed for the volume control slider
@ -33,22 +50,48 @@ public abstract class AbstractVolumeControlButton
/**
* Creates an instance of <tt>VolumeControlButton</tt>.
* @param inSettingsPanel <tt>true</tt> when the button is used in a menu,
* to use different background.
*/
public AbstractVolumeControlButton(
Call call,
final boolean fullScreen,
boolean selected,
boolean inSettingsPanel,
ImageID iconImageID,
String toolTipTextKey)
{
super(call, fullScreen, selected, iconImageID, toolTipTextKey);
super(ImageLoader.getImage(ImageLoader.VOLUME_BUTTON_PRESSED),
ImageLoader.getImage(iconImageID));
// we don't want new thread when button is pressed
setSpawnActionInNewThread(false);
this.iconImageID = iconImageID;
if (fullScreen)
{
bgImage = ImageLoader.FULL_SCREEN_BUTTON_BG;
pressedImage = ImageLoader.FULL_SCREEN_BUTTON_BG_PRESSED;
}
else
{
if(inSettingsPanel)
{
bgImage = ImageLoader.CALL_SETTING_BUTTON_BG;
pressedImage = ImageLoader.CALL_SETTING_BUTTON_PRESSED_BG;
}
else
{
bgImage = ImageLoader.VOLUME_BUTTON;
pressedImage = ImageLoader.VOLUME_BUTTON_PRESSED;
}
}
// Loads the skin of this button.
loadSkin();
if (toolTipTextKey != null)
{
setToolTipText(
GuiActivator.getResources().getI18NString(toolTipTextKey));
}
final JSlider volumeSlider
= new JSlider(JSlider.VERTICAL, 0, 100, 50);
@ -115,12 +158,13 @@ public void actionPerformed(ActionEvent arg0)
}
/**
*
* Loads images.
*/
public void buttonPressed()
public void loadSkin()
{
// just a # bypass the toggle functionality as we don't use it
setSelected(!isSelected());
setBackgroundImage(ImageLoader.getImage(bgImage));
setPressedImage(ImageLoader.getImage(pressedImage));
setIconImage(ImageLoader.getImage(iconImageID));
}
/**

@ -102,11 +102,6 @@ public class CallDialog
*/
private HoldButton holdButton;
/**
* The mute button.
*/
private MuteButton muteButton;
/**
* The button which allows starting and stopping the recording of the
* {@link #call}.
@ -133,11 +128,6 @@ public class CallDialog
*/
private FullScreenButton fullScreenButton;
/**
* The volume control button.
*/
private VolumeControlButton volumeControlButton;
/**
* The dial button, which opens a keypad dialog.
*/
@ -182,6 +172,16 @@ public class CallDialog
*/
private Timer callDurationTimer;
/**
* Sound local level label.
*/
private AbstractVolumeControlButton localLevel;
/**
* Sound remote level label.
*/
private AbstractVolumeControlButton remoteLevel;
/**
* Creates a <tt>CallDialog</tt> by specifying the underlying call panel.
*
@ -247,13 +247,18 @@ private void init()
ImageLoader.getImage(ImageLoader.HANGUP_BUTTON_BG));
holdButton = new HoldButton(call);
muteButton = new MuteButton(call);
recordButton = new RecordButton(call);
videoButton = new LocalVideoButton(call);
desktopSharingButton = new DesktopSharingButton(call);
transferCallButton = new TransferCallButton(call);
fullScreenButton = new FullScreenButton(this);
volumeControlButton = new VolumeControlButton();
localLevel = new InputVolumeControlButton(
call,
ImageLoader.MUTE_BUTTON,
false, true, false);
remoteLevel = new OutputVolumeControlButton(
ImageLoader.VOLUME_CONTROL_BUTTON, false, true);
dialButton.setName(DIAL_BUTTON);
dialButton.setToolTipText(
@ -278,15 +283,11 @@ private void init()
dialButton.setEnabled(false);
conferenceButton.setEnabled(false);
holdButton.setEnabled(false);
muteButton.setEnabled(false);
recordButton.setEnabled(false);
volumeControlButton.setEnabled(false);
settingsPanel.add(dialButton);
settingsPanel.add(conferenceButton);
settingsPanel.add(holdButton);
settingsPanel.add(muteButton);
settingsPanel.add(volumeControlButton);
settingsPanel.add(recordButton);
if (!isLastConference)
@ -301,8 +302,6 @@ private void init()
addOneToOneSpecificComponents();
}
settingsPanel.add(volumeControlButton);
dtmfHandler = new DTMFHandler(this);
JComponent bottomBar = createBottomBar();
@ -441,34 +440,6 @@ public void updateHoldButtonState()
this.holdButton.setSelected(isAllLocallyOnHold);
}
/**
* Updates the state of the general mute button. The mute buttons is
* selected only if all call peers are muted at the same time. In all other
* cases the mute button is unselected.
*/
public void updateMuteButtonState()
{
// Check if all the call peers are muted and change the state of
// the button.
Iterator<? extends CallPeer> callPeers = call.getCallPeers();
boolean isAllMute = true;
while(callPeers.hasNext())
{
CallPeer callPeer = callPeers.next();
if (!callPeer.isMute())
{
isAllMute = false;
break;
}
}
// If we have clicked the mute button in a full screen mode or selected
// mute of the peer menu in a conference call we need to update the
// state of the call dialog hold button.
muteButton.setSelected(isAllMute);
}
/**
* Selects or unselects the video button in this call dialog.
*
@ -576,9 +547,7 @@ public void enableButtons()
dialButton.setEnabled(true);
conferenceButton.setEnabled(true);
holdButton.setEnabled(true);
muteButton.setEnabled(true);
recordButton.setEnabled(true);
volumeControlButton.setEnabled(true);
if (!isLastConference)
{
@ -989,6 +958,9 @@ private void removeOneToOneSpecificComponents()
settingsPanel.remove(desktopSharingButton);
settingsPanel.remove(transferCallButton);
settingsPanel.remove(fullScreenButton);
//settingsPanel.add(localLevel);
//settingsPanel.add(remoteLevel);
}
/**
@ -1000,6 +972,9 @@ private void addOneToOneSpecificComponents()
settingsPanel.add(desktopSharingButton);
settingsPanel.add(transferCallButton);
settingsPanel.add(fullScreenButton);
//settingsPanel.remove(localLevel);
//settingsPanel.remove(remoteLevel);
}
/**

@ -207,9 +207,6 @@ public void propertyChange(PropertyChangeEvent evt)
boolean isMute = (Boolean) evt.getNewValue();
renderer.setMute(isMute);
// Update the state of the mute button.
renderer.getCallDialog().updateMuteButtonState();
}
}

@ -11,6 +11,7 @@
import net.java.sip.communicator.service.neomedia.*;
import net.java.sip.communicator.service.neomedia.event.*;
import net.java.sip.communicator.service.protocol.*;
import net.java.sip.communicator.service.resources.*;
/**
* Represents an UI means to mute the audio stream sent in an associated
@ -19,12 +20,18 @@
* @author Lubomir Marinov
* @author Yana Stamcheva
* @author Dmitri Melnikov
* @author Damian Minkov
*/
public class MuteButton
public class InputVolumeControlButton
extends AbstractVolumeControlButton
implements VolumeChangeListener,
Runnable
{
/**
* The <tt>Call</tt> that this button controls.
*/
private final Call call;
/**
* Mutes the call in other thread.
*/
@ -47,7 +54,7 @@ public class MuteButton
* @param call the <tt>Call</tt> to be associated with the new instance and
* to have the audio stream sent to muted
*/
public MuteButton(Call call)
public InputVolumeControlButton(Call call)
{
this(call, false, false);
}
@ -63,11 +70,37 @@ public MuteButton(Call call)
* @param selected <tt>true</tt> if the new toggle button is to be initially
* selected; otherwise, <tt>false</tt>
*/
public MuteButton(Call call, boolean fullScreen, boolean selected)
public InputVolumeControlButton(Call call,
boolean fullScreen,
boolean selected)
{
this(call, ImageLoader.MUTE_BUTTON, true, fullScreen, selected);
}
/**
* Initializes a new <tt>MuteButton</tt> instance which is to mute the audio
* stream to a specific <tt>Call</tt>.
*
* @param call the <tt>Call</tt> to be associated with the new instance and
* whose audio stream is to be muted upon performing its action
* @param fullScreen <tt>true</tt> if the new instance is to be used in
* full-screen UI; otherwise, <tt>false</tt>
* @param selected <tt>true</tt> if the new toggle button is to be initially
* selected; otherwise, <tt>false</tt>
* @param inSettingsPanel <tt>true</tt> when the button is used in a menu,
* to use different background.
*/
public InputVolumeControlButton(Call call,
ImageID iconImageID,
boolean fullScreen,
boolean inSettingsPanel,
boolean selected)
{
super(call, fullScreen, selected, ImageLoader.MUTE_BUTTON,
super(fullScreen, inSettingsPanel, iconImageID,
"service.gui.MUTE_BUTTON_TOOL_TIP");
this.call = call;
this.mute = selected;
}

@ -275,10 +275,10 @@ private Component createFullScreenButtonBar()
new HoldButton(call,
true,
CallPeerState.isOnHold(callPeer.getState())),
new MuteButton(call,
new InputVolumeControlButton(call,
true,
callPeer.isMute()),
new VolumeControlButton(true),
new OutputVolumeControlButton(true),
new RecordButton(call, true, callDialog.isRecordingStarted()),
CallPeerRendererUtils.createExitFullScreenButton(this)
};

@ -168,12 +168,12 @@ public class OneToOneCallPeerPanel
/**
* Sound local level label.
*/
private JLabel localLevelLabel;
private AbstractVolumeControlButton localLevel;
/**
* Sound remote level label.
*/
private JLabel remoteLevelLabel;
private AbstractVolumeControlButton remoteLevel;
/**
* The center component.
@ -366,12 +366,13 @@ private void createSoundLevelIndicators()
TransparentPanel remoteLevelPanel
= new TransparentPanel(new BorderLayout(5, 0));
localLevelLabel
= new JLabel(new ImageIcon(
ImageLoader.getImage(ImageLoader.MICROPHONE)));
remoteLevelLabel
= new JLabel(new ImageIcon(
ImageLoader.getImage(ImageLoader.HEADPHONE)));
localLevel = new InputVolumeControlButton(
callPeer.getCall(),
ImageLoader.MICROPHONE,
false, false, false);
remoteLevel = new OutputVolumeControlButton(
ImageLoader.HEADPHONE, false, false);
final SoundLevelIndicator localLevelIndicator
= new SoundLevelIndicator( SoundLevelChangeEvent.MIN_LEVEL,
@ -381,9 +382,9 @@ private void createSoundLevelIndicators()
= new SoundLevelIndicator( SoundLevelChangeEvent.MIN_LEVEL,
SoundLevelChangeEvent.MAX_LEVEL);
localLevelPanel.add(localLevelLabel, BorderLayout.WEST);
localLevelPanel.add(localLevel, BorderLayout.WEST);
localLevelPanel.add(localLevelIndicator, BorderLayout.CENTER);
remoteLevelPanel.add(remoteLevelLabel, BorderLayout.WEST);
remoteLevelPanel.add(remoteLevel, BorderLayout.WEST);
remoteLevelPanel.add(remoteLevelIndicator, BorderLayout.CENTER);
GridBagConstraints constraints = new GridBagConstraints();
@ -1455,12 +1456,12 @@ public void remoteControlRevoked(RemoteControlRevokedEvent event)
*/
public void loadSkin()
{
if(localLevelLabel != null)
localLevelLabel.setIcon(new ImageIcon(
if(localLevel != null)
localLevel.setIcon(new ImageIcon(
ImageLoader.getImage(ImageLoader.MICROPHONE)));
if(remoteLevelLabel != null)
remoteLevelLabel.setIcon(new ImageIcon(
if(remoteLevel != null)
remoteLevel.setIcon(new ImageIcon(
ImageLoader.getImage(ImageLoader.HEADPHONE)));
if(muteStatusLabel.getIcon() != null)

@ -9,27 +9,49 @@
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.service.resources.*;
/**
* The <tt>VolumeControlButton</tt> is the button shown in the call window,
* which allows to adjust the playback volume of your call.
*
* @author Yana Stamcheva
* @author Damian Minkov
*/
public class VolumeControlButton
public class OutputVolumeControlButton
extends AbstractVolumeControlButton
{
public VolumeControlButton()
/**
* Creates not full screen button.
*/
public OutputVolumeControlButton()
{
this(false);
}
public VolumeControlButton(boolean fullScreen)
/**
* Creates volume control button.
* @param fullScreen is full screen.
*/
public OutputVolumeControlButton(boolean fullScreen)
{
this(ImageLoader.VOLUME_CONTROL_BUTTON, fullScreen, false);
}
/**
* Creates volume control button.
* @param iconImageID the image.
* @param fullScreen is full screen.
*/
public OutputVolumeControlButton(ImageID iconImageID,
boolean fullScreen,
boolean inSettingsPanel)
{
super(null, fullScreen, false, ImageLoader.VOLUME_CONTROL_BUTTON,
super(fullScreen, inSettingsPanel, iconImageID,
"service.gui.VOLUME_CONTROL_TOOL_TIP");
}
/**
* Volume control used by the button.
*

@ -76,7 +76,7 @@ public SoundLevelIndicator(int minSoundLevel, int maxSoundLevel)
loadSkin();
this.setLayout(new FlowLayout(FlowLayout.LEFT, 1, 0));
this.setLayout(new BoxLayout(this, BoxLayout.X_AXIS));
this.initSoundBars();
@ -110,6 +110,7 @@ private void initSoundBars()
for (int i = 0; i < soundBarNumber; i++)
{
JLabel block = new JLabel(soundLevelInactiveImage);
block.setVerticalAlignment(JLabel.CENTER);
this.add(block);
}

@ -1286,6 +1286,12 @@ public class ImageLoader
public static final ImageID HEADPHONE
= new ImageID("service.gui.soundlevel.HEADPHONE");
public static final ImageID VOLUME_BUTTON
= new ImageID("service.gui.soundlevel.VOLUME_BUTTON");
public static final ImageID VOLUME_BUTTON_PRESSED
= new ImageID("service.gui.soundlevel.VOLUME_BUTTON_PRESSED");
/**
* Loads an image from a given image identifier.
*

Loading…
Cancel
Save