diff --git a/resources/images/images.properties b/resources/images/images.properties index 30cd87c5f..26bdb9c1a 100644 --- a/resources/images/images.properties +++ b/resources/images/images.properties @@ -135,6 +135,7 @@ service.gui.buttons.DESKTOP_BUTTON_SMALL_PRESSED=resources/images/impl/gui/butto service.gui.buttons.CALL_DESKTOP_BUTTON=resources/images/impl/gui/buttons/callDesktopSharing.png service.gui.buttons.CHAT_BUTTON_SMALL=resources/images/impl/gui/buttons/chatSmall.png service.gui.buttons.CHAT_BUTTON_SMALL_PRESSED=resources/images/impl/gui/buttons/chatSmallPressed.png +service.gui.buttons.CHAT_BUTTON_SMALL_WHITE=resources/images/impl/gui/buttons/chatSmallWhite.png service.gui.buttons.ADD_CONTACT_BUTTON_SMALL=resources/images/impl/gui/buttons/addContactSmall.png service.gui.buttons.ADD_CONTACT_BUTTON_SMALL_PRESSED=resources/images/impl/gui/buttons/addContactSmallPressed.png service.gui.buttons.CALL_BUTTON_PRESSED_BG=resources/images/impl/gui/buttons/callButtonPressed.png diff --git a/resources/images/impl/gui/buttons/chatSmallWhite.png b/resources/images/impl/gui/buttons/chatSmallWhite.png new file mode 100644 index 000000000..49b1a2df1 Binary files /dev/null and b/resources/images/impl/gui/buttons/chatSmallWhite.png differ diff --git a/resources/images/impl/gui/buttons/src/contactListButtons.svg b/resources/images/impl/gui/buttons/src/contactListButtons.svg new file mode 100644 index 000000000..dd1d39b95 --- /dev/null +++ b/resources/images/impl/gui/buttons/src/contactListButtons.svg @@ -0,0 +1,1659 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Background only used tosee the white icon + + + + + + + diff --git a/src/net/java/sip/communicator/impl/gui/main/call/CallPanel.java b/src/net/java/sip/communicator/impl/gui/main/call/CallPanel.java index ac5c3cfc3..d1c0fbeba 100644 --- a/src/net/java/sip/communicator/impl/gui/main/call/CallPanel.java +++ b/src/net/java/sip/communicator/impl/gui/main/call/CallPanel.java @@ -21,6 +21,7 @@ import net.java.sip.communicator.impl.gui.event.*; import net.java.sip.communicator.impl.gui.main.call.conference.*; import net.java.sip.communicator.impl.gui.utils.*; +import net.java.sip.communicator.service.contactlist.*; import net.java.sip.communicator.service.gui.*; import net.java.sip.communicator.service.neomedia.*; import net.java.sip.communicator.service.neomedia.device.*; @@ -65,6 +66,11 @@ public class CallPanel */ private static final String CONFERENCE_BUTTON = "CONFERENCE_BUTTON"; + /** + * The chat button name. + */ + private static final String CHAT_BUTTON = "CHAT_BUTTON"; + /** * The hang up button name. */ @@ -147,6 +153,11 @@ public class CallPanel ImageLoader.getImage(ImageLoader.CALL_SETTING_BUTTON_BG), ImageLoader.getImage(ImageLoader.ADD_TO_CALL_BUTTON)); + /** + * Chat button. + */ + private SIPCommButton chatButton; + /** * HangUp button. */ @@ -307,6 +318,14 @@ public void stateChanged(ChangeEvent e) transferCallButton = new TransferCallButton(call); fullScreenButton = new FullScreenButton(this); + chatButton = new SIPCommButton( + ImageLoader.getImage(ImageLoader.CALL_SETTING_BUTTON_BG), + ImageLoader.getImage(ImageLoader.CHAT_BUTTON_SMALL_WHITE)); + chatButton.setName(CHAT_BUTTON); + chatButton.setToolTipText( + GuiActivator.getResources().getI18NString("service.gui.CHAT")); + chatButton.addActionListener(this); + localLevel = new InputVolumeControlButton( call, ImageLoader.MICROPHONE, @@ -367,6 +386,18 @@ public void stateChanged(ChangeEvent e) addConferenceSpecificComponents(); } + //chatButton.setEnabled(false); + //Collection collectionIMCapableContacts = + // getIMCapableCallPeers(); + // Enables the button only if there is 1 and only 1 peer which is + // basicIM capable. + //if(collectionIMCapableContacts.size() == 1) + if(getIMCapableCallPeers().size() == 1) + { + settingsPanel.add(chatButton); + //chatButton.setEnabled(true); + } + dtmfHandler = new DTMFHandler(this); JComponent bottomBar = createBottomBar(); @@ -424,6 +455,22 @@ else if (buttonName.equals(CONFERENCE_BUTTON)) inviteDialog.setVisible(true); } + else if (buttonName.equals(CHAT_BUTTON)) + { + Collection collectionIMCapableContacts = + getIMCapableCallPeers(); + // If a single peer is basic instant messaging capable, then we + // create a chat with this account. + if(collectionIMCapableContacts.size() == 1) + { + Contact contact = collectionIMCapableContacts.iterator().next(); + MetaContact metaContact = + GuiActivator.getContactListService() + .findMetaContactByContact(contact); + GuiActivator.getUIService().getChatWindowManager() + .startChat(metaContact); + } + } } /** @@ -1432,4 +1479,42 @@ private void fireTitleChangeEvent() listeners.next().callTitleChanged(this); } } + + /** + * Returns the list of call peers which are capable to manage basic instant + * messaging operations. + * + * @return The collection of contacts for this call which are IM capable. + */ + private Collection getIMCapableCallPeers() + { + Vector contactVector = new Vector( + call.getCallPeerCount()); + Iterator callPeers = call.getCallPeers(); + CallPeer callPeer; + Contact contact; + // Checks if the protocol provider of this call supports basic + // instant messaging. + if(call.getProtocolProvider().getOperationSet( + OperationSetBasicInstantMessaging.class) != null) + { + // For each peers of this call, checks if it is basic instant + // mesaging capable. + while(callPeers.hasNext()) + { + callPeer = callPeers.next(); + contact = callPeer.getContact(); + + // If a peer is basic instant messaging capable, then add + // its account to the list of IM capable peers. + if(callPeer.getProtocolProvider().getOperationSet( + OperationSetBasicInstantMessaging.class) != null && + contact != null) + { + contactVector.add(contact); + } + } + } + return contactVector; + } } diff --git a/src/net/java/sip/communicator/impl/gui/utils/ImageLoader.java b/src/net/java/sip/communicator/impl/gui/utils/ImageLoader.java index 7d12c87d9..11bfa8ace 100644 --- a/src/net/java/sip/communicator/impl/gui/utils/ImageLoader.java +++ b/src/net/java/sip/communicator/impl/gui/utils/ImageLoader.java @@ -331,6 +331,12 @@ public class ImageLoader public static final ImageID CHAT_BUTTON_SMALL = new ImageID("service.gui.buttons.CHAT_BUTTON_SMALL"); + /** + * The chat button small image white on transparent version. + */ + public static final ImageID CHAT_BUTTON_SMALL_WHITE + = new ImageID("service.gui.buttons.CHAT_BUTTON_SMALL_WHITE"); + /** * The chat call button image. */ @@ -1821,4 +1827,4 @@ else if(protocolIcon.isSizeSupported(ProtocolIcon.ICON_SIZE_48x48)) return null; } -} \ No newline at end of file +}