diff --git a/lib/logging.properties b/lib/logging.properties index 4f5a7672b..85b86d01e 100644 --- a/lib/logging.properties +++ b/lib/logging.properties @@ -57,25 +57,26 @@ java.util.logging.ConsoleHandler.formatter = net.java.sip.communicator.util.ScLo # We don't want trace logs from joscar and joustsim net.kano.level = INFO -ymsg.network.level = FINEST +ymsg.network.level = INFO # We don't want trace logs from java-jml net.sf.cindy.impl.level = INFO # But we want everything coming from the sip-comm net.java.sip.communicator.impl.level = INFO -net.java.sip.communicator.impl.protocol.level = FINEST -net.java.sip.communicator.impl.shutdown.level = FINEST -net.java.sip.communicator.impl.contactlist.level = FINEST -net.java.sip.communicator.slick.level = FINEST -net.java.sip.communicator.impl.level = FINEST -net.java.sip.communicator.service.level = FINEST -net.java.sip.communicator.util.level = FINEST -net.java.sip.communicator.service.configuration.level = FINEST -net.java.sip.communicator.impl.configuration.level = FINEST +net.java.sip.communicator.impl.protocol.level = INFO +net.java.sip.communicator.impl.shutdown.level = INFO +net.java.sip.communicator.impl.contactlist.level = INFO +net.java.sip.communicator.slick.level = INFO +net.java.sip.communicator.impl.level = INFO +net.java.sip.communicator.service.level = INFO +net.java.sip.communicator.util.level = INFO +net.java.sip.communicator.service.configuration.level = INFO +net.java.sip.communicator.impl.configuration.level = INFO net.java.sip.communicator.impl.history.level = INFO net.java.sip.communicator.impl.gui.level = INFO -net.java.sip.communicator.impl.protocol.zeroconf.jmdns.level=INFO +net.java.sip.communicator.impl.protocol.zeroconf.jmdns.level = WARN +net.java.sip.communicator.impl.media.level = WARN # For example, set the com.xyz.foo logger to only log SEVERE # messages: diff --git a/resources/languages/resources.properties b/resources/languages/resources.properties index a00edb07e..b5f218ad1 100644 --- a/resources/languages/resources.properties +++ b/resources/languages/resources.properties @@ -578,12 +578,10 @@ knownHosts=Known Hosts: accountDetails=SSH Account Details # status update -cancel=Cancel -enable=Enable -info=Information +automaticStatus=Automatic Status +enableChangeStatus=Change status while away +awayMinutes=Minutes before being away : infotext=Set "Idle", when your computer is not used for X minutes. The status is reset to the status before, when activity is detected. -menuEntry=Automatic Status -minutes=Minutes # updatechecker dialogTitle=New version available diff --git a/src/net/java/sip/communicator/impl/media/ProcessorUtility.java b/src/net/java/sip/communicator/impl/media/ProcessorUtility.java index ff5ab7ad3..ace645a70 100644 --- a/src/net/java/sip/communicator/impl/media/ProcessorUtility.java +++ b/src/net/java/sip/communicator/impl/media/ProcessorUtility.java @@ -94,10 +94,11 @@ public void controllerUpdate(ControllerEvent ce) { * indicating success or failure of the operation. * * @param processor Processor - * @param state int - * @return boolean + * @param state one of the Processor.XXXed sate vars + * @return boolean true if the state has been reached and false otherwise */ - public synchronized boolean waitForState(Processor processor, int state) { + public synchronized boolean waitForState(Processor processor, int state) + { processor.addControllerListener(this); setFailed(false); diff --git a/src/net/java/sip/communicator/impl/media/device/DeviceConfiguration.java b/src/net/java/sip/communicator/impl/media/device/DeviceConfiguration.java index ce8fc5c0d..d49aaa961 100644 --- a/src/net/java/sip/communicator/impl/media/device/DeviceConfiguration.java +++ b/src/net/java/sip/communicator/impl/media/device/DeviceConfiguration.java @@ -80,7 +80,8 @@ private void extractConfiguredCaptureDevices() { logger.info("Scanning for configured Audio Devices."); Vector audioCaptureDevices = CaptureDeviceManager.getDeviceList(new - AudioFormat(AudioFormat.LINEAR, 44100, 16, 1)); + AudioFormat(AudioFormat.LINEAR, 44100, 16, + 1));//1 means 1 channel for mono if (audioCaptureDevices.size() < 1) { logger.error("No Audio Device was found."); audioCaptureDevice = null; diff --git a/src/net/java/sip/communicator/impl/media/device/JmfDeviceDetector.java b/src/net/java/sip/communicator/impl/media/device/JmfDeviceDetector.java index 67265e70f..0a4ab91b4 100644 --- a/src/net/java/sip/communicator/impl/media/device/JmfDeviceDetector.java +++ b/src/net/java/sip/communicator/impl/media/device/JmfDeviceDetector.java @@ -78,38 +78,38 @@ public JmfDeviceDetector() */ private void initialize() { - if (FMJConditionals.USE_JMF_INTERNAL_REGISTRY) - { - // This uses JMF internals: - // see if the registry has already been "tagged" by us, skip auto-detection if - // it has. - // This was probably done because JMF auto-detection is very slow, especially - // for video devices. FMJ does this quickly, so there is no need for this - // kind of workaround (besides the fact that these internal functions are not - // implemented in FMJ). - String author = (String)Registry.get(PROP_REGISTRY_AUTHOR); - - if(author != null) - { - return; - } - - Registry.set(PROP_ALLOW_CAPTURE_FROM_APPLETS, new Boolean(true)); - Registry.set(PROP_ALLOW_SAVE_FILE_FROM_APPLETS, new Boolean(true)); - - Registry.set(PROP_REGISTRY_AUTHOR, PROP_REGISTRY_AUTHOR_VALUE); + if (FMJConditionals.USE_JMF_INTERNAL_REGISTRY) + { + // This uses JMF internals: + // see if the registry has already been "tagged" by us, skip auto-detection if + // it has. + // This was probably done because JMF auto-detection is very slow, especially + // for video devices. FMJ does this quickly, so there is no need for this + // kind of workaround (besides the fact that these internal functions are not + // implemented in FMJ). + String author = (String)Registry.get(PROP_REGISTRY_AUTHOR); + + if(author != null) + { + return; + } + + Registry.set(PROP_ALLOW_CAPTURE_FROM_APPLETS, new Boolean(true)); + Registry.set(PROP_ALLOW_SAVE_FILE_FROM_APPLETS, new Boolean(true)); + + Registry.set(PROP_REGISTRY_AUTHOR, PROP_REGISTRY_AUTHOR_VALUE); - try - { - Registry.commit(); - } - catch (Exception exc) - { - logger.error( - "Failed to initially commit JMFRegistry. Ignoring err." - , exc); - } - } + try + { + Registry.commit(); + } + catch (Exception exc) + { + logger.error( + "Failed to initially commit JMFRegistry. Ignoring err." + , exc); + } + } detectDirectAudio(); detectS8DirectAudio(); diff --git a/src/net/java/sip/communicator/impl/protocol/sip/OperationSetBasicTelephonySipImpl.java b/src/net/java/sip/communicator/impl/protocol/sip/OperationSetBasicTelephonySipImpl.java index 3ea5a51d8..59d9108dd 100644 --- a/src/net/java/sip/communicator/impl/protocol/sip/OperationSetBasicTelephonySipImpl.java +++ b/src/net/java/sip/communicator/impl/protocol/sip/OperationSetBasicTelephonySipImpl.java @@ -233,7 +233,6 @@ private CallSipImpl createOutgoingCall(Address calleeAddress) CallParticipantSipImpl callParticipant = createCallParticipantFor(inviteTransaction, jainSipProvider); - //invite content try { @@ -279,10 +278,10 @@ private CallSipImpl createOutgoingCall(Address calleeAddress) catch (MediaException ex) { logger.error( - "Failed to parse sdp data while creating invite request!" + "Could not access media devices!" , ex); throw new OperationFailedException( - "Failed to parse sdp data while creating invite request!" + "Could not access media devices!" , OperationFailedException.INTERNAL_ERROR , ex); } diff --git a/src/net/java/sip/communicator/plugin/statusupdate/ConfigurationDialog.java b/src/net/java/sip/communicator/plugin/statusupdate/ConfigurationDialog.java index 4ca1a1c52..e69de29bb 100644 --- a/src/net/java/sip/communicator/plugin/statusupdate/ConfigurationDialog.java +++ b/src/net/java/sip/communicator/plugin/statusupdate/ConfigurationDialog.java @@ -1,200 +0,0 @@ -/* - * 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.plugin.statusupdate; - -import java.awt.*; -import java.awt.event.*; - -import javax.swing.*; - -import net.java.sip.communicator.service.configuration.*; - -/** - * The configuration Dialog for the Mail Notification Plugin - * - * @author Thomas Hofer - * - */ -public class ConfigurationDialog extends JDialog -{ - /** - * - */ - private static final long serialVersionUID = -3850044618335728627L; - - private JCheckBox enable; - private JSpinner timer; - - /** - * Default Constructor - */ - public ConfigurationDialog() - { - super(); - init(); - initValues(); - - getContentPane().setPreferredSize(new Dimension(400, 200)); - getContentPane().setLayout(new GridLayout(1, 1)); - - // move window to middle of screen - setLocationRelativeTo(null); - - // Set title - setTitle(Resources.getString("menuEntry")); - - // Set closing system - addWindowListener(new WindowAdapter() - { - public void windowClosing(WindowEvent e) - { - dispose(); - } - }); - } - - /** - * Initialize the ui-components - */ - private void init() - { - // Main panel - JPanel mainPanel = new JPanel(); - mainPanel.setLayout(new GridBagLayout()); - mainPanel.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5)); - - // Description - JTextArea infoLabel = new JTextArea(Resources.getString("infotext")); - infoLabel.setBorder(BorderFactory.createTitledBorder(Resources - .getString("info"))); - infoLabel.setEditable(false); - infoLabel.setWrapStyleWord(true); - infoLabel.setLineWrap(true); - - // Checkbox - enable = new JCheckBox(Resources.getString("enable")); - enable.addActionListener(new ActionListener() - { - public void actionPerformed(ActionEvent e) - { - timer.setEnabled(enable.isSelected()); - } - }); - - // Spinner - timer = new JSpinner(new SpinnerNumberModel(15, 1, 180, 1)); - - // Button panel : OK and Cancel button - JPanel okCancelPanel = new JPanel(new FlowLayout(FlowLayout.RIGHT)); - JButton ok = new JButton(Resources.getString("ok")); - ok.addActionListener(new ActionListener() - { - public void actionPerformed(ActionEvent e) - { - saveData(); - dispose(); - } - }); - JButton cancel = new JButton(Resources.getString("cancel")); - cancel.addActionListener(new ActionListener() - { - public void actionPerformed(ActionEvent e) - { - dispose(); - } - }); - - okCancelPanel.add(ok); - okCancelPanel.add(cancel); - - GridBagConstraints mainGBC = new GridBagConstraints(); - mainGBC.gridx = 0; - mainGBC.gridy = 0; - mainGBC.weightx = 1; - mainGBC.fill = GridBagConstraints.BOTH; - mainGBC.anchor = GridBagConstraints.NORTHWEST; - mainGBC.weighty = 1; - mainGBC.gridwidth = 3; - - mainPanel.add(infoLabel, mainGBC); - - mainGBC.fill = GridBagConstraints.HORIZONTAL; - mainGBC.gridwidth = 1; - mainGBC.gridy++; - mainGBC.weightx = 1; - mainGBC.weighty = 0; - mainGBC.gridx = 0; - mainPanel.add(enable, mainGBC); - - mainGBC.weightx = 0; - mainGBC.gridx++; - mainPanel.add(timer, mainGBC); - mainGBC.weightx = 1; - mainGBC.gridx++; - mainPanel.add(new JLabel(Resources.getString("minutes")), mainGBC); - - mainGBC.gridwidth = 3; - mainGBC.gridx = 0; - mainGBC.gridy++; - mainGBC.weighty = 0; - mainPanel.add(okCancelPanel, mainGBC); - - this.getContentPane().add(mainPanel); - } - - /** - * (Re-)Initializes the values of the settings dependent on the selected - * account - */ - private void initValues() - { - ConfigurationService configService = StatusUpdateActivator - .getConfigService(); - - String e = (String) configService.getProperty(Preferences.ENABLE); - if (e != null) - { - try - { - enable.setSelected(Boolean.parseBoolean(e)); - timer.setEnabled(Boolean.parseBoolean(e)); - } catch (NumberFormatException ex) - { - enable.setSelected(false); - timer.setEnabled(false); - } - } - else - { - enable.setSelected(false); - timer.setEnabled(false); - } - - String t = (String) configService.getString(Preferences.TIMER); - if (t != null) - { - try - { - timer.setValue(Integer.parseInt(t)); - } - catch (NumberFormatException ex) - { - } - } - } - - private void saveData() - { - ConfigurationService configService = StatusUpdateActivator - .getConfigService(); - - configService.setProperty(Preferences.ENABLE, Boolean - .toString(enable.isSelected())); - Integer interval = (Integer) timer.getValue(); - configService.setProperty(Preferences.TIMER, interval); - } -} diff --git a/src/net/java/sip/communicator/plugin/statusupdate/Resources.java b/src/net/java/sip/communicator/plugin/statusupdate/Resources.java index 7b7490219..ccb15f570 100644 --- a/src/net/java/sip/communicator/plugin/statusupdate/Resources.java +++ b/src/net/java/sip/communicator/plugin/statusupdate/Resources.java @@ -6,8 +6,6 @@ */ package net.java.sip.communicator.plugin.statusupdate; -import java.util.*; - import net.java.sip.communicator.service.resources.*; import org.osgi.framework.*; diff --git a/src/net/java/sip/communicator/plugin/statusupdate/SettingsWindowMenuEntry.java b/src/net/java/sip/communicator/plugin/statusupdate/SettingsWindowMenuEntry.java index 364c6901b..e69de29bb 100644 --- a/src/net/java/sip/communicator/plugin/statusupdate/SettingsWindowMenuEntry.java +++ b/src/net/java/sip/communicator/plugin/statusupdate/SettingsWindowMenuEntry.java @@ -1,68 +0,0 @@ -package net.java.sip.communicator.plugin.statusupdate; - -import java.awt.Dialog.*; -import java.awt.event.*; - -import javax.swing.JMenuItem; - -import net.java.sip.communicator.service.contactlist.*; -import net.java.sip.communicator.service.gui.*; - -public class SettingsWindowMenuEntry implements PluginComponent -{ - - private JMenuItem settingsMenuEntry = new JMenuItem(Resources - .getString("menuEntry")); - - private Container container; - - public SettingsWindowMenuEntry(Container container) - { - settingsMenuEntry.addActionListener(new ActionListener() - { - public void actionPerformed(ActionEvent e) - { - ConfigurationDialog dialog = new ConfigurationDialog(); - dialog.pack(); - dialog.setModal(true); - dialog.setVisible(true); - - StatusUpdateActivator.startThread(); - } - }); - this.container = container; - } - - public Object getComponent() - { - return settingsMenuEntry; - } - - public String getConstraints() - { - return null; - } - - public Container getContainer() - { - return container; - } - - public String getName() - { - return Resources.getString("aboutMenuEntry"); - } - - public void setCurrentContact(MetaContact metaContact) - { - } - - public void setCurrentContactGroup(MetaContactGroup metaGroup) - { - } - - public int getPositionIndex() - { - return -1; - } -} diff --git a/src/net/java/sip/communicator/plugin/statusupdate/StatusConfigForm.java b/src/net/java/sip/communicator/plugin/statusupdate/StatusConfigForm.java new file mode 100644 index 000000000..903653c93 --- /dev/null +++ b/src/net/java/sip/communicator/plugin/statusupdate/StatusConfigForm.java @@ -0,0 +1,189 @@ +/* + * 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.plugin.statusupdate; + +import java.awt.*; +import java.awt.event.*; + +import javax.swing.*; +import javax.swing.event.*; + +import net.java.sip.communicator.service.configuration.*; +import net.java.sip.communicator.service.gui.*; + +/** + * The ConfigurationForm that would be added in the user interface + * configuration window. + * + * @author ROTH Damien + */ +public class StatusConfigForm + extends JPanel + implements ConfigurationForm +{ + private JPanel mainPanel; + + private JCheckBox enable; + + private JSpinner timer; + + /** + * Create an instance of StatusConfigForm + */ + public StatusConfigForm() + { + super(new BorderLayout(10, 10)); + + mainPanel = new JPanel(); + mainPanel.setLayout(new BorderLayout()); + + init(); + initValues(); + + this.add(mainPanel); + } + + /** + * Init the widgets + */ + private void init() + { + JPanel autoStatusPanel = new JPanel(new BorderLayout()); + + // Title : automatic status + JLabel autoStatusLabel = new JLabel(Resources.getString("automaticStatus")); + + + Font bold = autoStatusLabel.getFont().deriveFont(Font.BOLD); + autoStatusLabel.setFont(bold); + + JPanel fieldsPanel = new JPanel(new BorderLayout(5, 5)); + fieldsPanel.setBorder(BorderFactory.createEmptyBorder(10,30,0,0)); + + enable = new JCheckBox(Resources.getString("enableChangeStatus")); + fieldsPanel.add(enable, BorderLayout.NORTH); + enable.addActionListener(new ActionListener() { + public void actionPerformed(ActionEvent e) + { + timer.setEnabled(enable.isSelected()); + saveData(); + } + }); + + + JPanel timerPanel = new JPanel(new FlowLayout(FlowLayout.LEFT)); + // Texte + timerPanel.add(new JLabel(Resources.getString("awayMinutes"))); + // Spinner + timer = new JSpinner(new SpinnerNumberModel(15, 1, 180, 1)); + timerPanel.add(timer); + timer.addChangeListener(new ChangeListener() + { + public void stateChanged(ChangeEvent e) + { + saveData(); + } + }); + + fieldsPanel.add(timerPanel, BorderLayout.WEST); + autoStatusPanel.add(autoStatusLabel, BorderLayout.NORTH); + autoStatusPanel.add(fieldsPanel, BorderLayout.CENTER); + + mainPanel.add(autoStatusPanel, BorderLayout.NORTH); + } + + /** + * Init the values of the widgets + */ + private void initValues() + { + ConfigurationService configService = StatusUpdateActivator + .getConfigService(); + + String e = (String) configService.getProperty(Preferences.ENABLE); + if (e != null) + { + try + { + this.enable.setSelected(Boolean.parseBoolean(e)); + this.timer.setEnabled(Boolean.parseBoolean(e)); + } + catch (NumberFormatException ex) + { + this.enable.setSelected(false); + this.timer.setEnabled(false); + } + } + else + { + this.enable.setSelected(false); + this.timer.setEnabled(false); + } + + String t = (String) configService.getString(Preferences.TIMER); + if (t != null) + { + try + { + this.timer.setValue(Integer.parseInt(t)); + } + catch (NumberFormatException ex) + { + } + } + } + + /** + * Save data in the configuration file + */ + private void saveData() + { + ConfigurationService configService = StatusUpdateActivator + .getConfigService(); + + configService.setProperty(Preferences.ENABLE, Boolean + .toString(enable.isSelected())); + Integer interval = (Integer) timer.getValue(); + configService.setProperty(Preferences.TIMER, interval); + } + + /** + * Implements the ConfigurationForm.getForm() method. Returns the + * component corresponding to this configuration form. + */ + public Object getForm() + { + return this; + } + + /** + * Implements the ConfigurationForm.getIcon() method. Returns the + * icon of this configuration form. + */ + public byte[] getIcon() + { + return null; + } + + /** + * Implements the ConfigurationForm.getIndex() method. + */ + public int getIndex() + { + return -1; + } + + /** + * Implements the ConfigurationForm.getIcon() method. Returns the + * icon of this configuration form. + */ + public String getTitle() + { + return Resources.getString("automaticStatus"); + } + +} diff --git a/src/net/java/sip/communicator/plugin/statusupdate/StatusUpdateActivator.java b/src/net/java/sip/communicator/plugin/statusupdate/StatusUpdateActivator.java index faaf19e8d..58cd6215e 100644 --- a/src/net/java/sip/communicator/plugin/statusupdate/StatusUpdateActivator.java +++ b/src/net/java/sip/communicator/plugin/statusupdate/StatusUpdateActivator.java @@ -31,8 +31,6 @@ public class StatusUpdateActivator implements BundleActivator private static Thread thread = null; private static StatusUpdateThread runner = null; - private ServiceRegistration menuRegistration; - /** * Starts this bundle * @@ -43,6 +41,15 @@ public class StatusUpdateActivator implements BundleActivator public void start(BundleContext bc) throws Exception { bundleContext = bc; + + + + // Set config form + StatusConfigForm statusCF = new StatusConfigForm(); + bundleContext.registerService(ConfigurationForm.class.getName(), + statusCF, + null); + new Thread(new Runnable() { @@ -58,7 +65,6 @@ public void run() startThread(); } }).start(); - registerMenuEntry(); } static void startThread() @@ -104,7 +110,6 @@ static void startThread() public void stop(BundleContext bundleContext) throws Exception { stopThread(); - unRegisterMenuEntry(); } static void stopThread() @@ -171,26 +176,4 @@ static ConfigurationService getConfigService() return (ConfigurationService) bundleContext.getService(confServiceRefs); } - - private void registerMenuEntry() - { - SettingsWindowMenuEntry menuEntry = new SettingsWindowMenuEntry( - Container.CONTAINER_TOOLS_MENU); - - Hashtable toolsMenuFilter = new Hashtable(); - toolsMenuFilter.put(Container.CONTAINER_ID, - Container.CONTAINER_TOOLS_MENU.getID()); - - menuRegistration = bundleContext.registerService(PluginComponent.class - .getName(), menuEntry, toolsMenuFilter); - } - - private void unRegisterMenuEntry() - { - if (menuRegistration != null) - { - menuRegistration.unregister(); - } - } - } \ No newline at end of file diff --git a/src/net/java/sip/communicator/plugin/statusupdate/statusupdate.manifest.mf b/src/net/java/sip/communicator/plugin/statusupdate/statusupdate.manifest.mf index 24d261759..d76b4a10c 100644 --- a/src/net/java/sip/communicator/plugin/statusupdate/statusupdate.manifest.mf +++ b/src/net/java/sip/communicator/plugin/statusupdate/statusupdate.manifest.mf @@ -10,7 +10,5 @@ Import-Package: org.osgi.framework, net.java.sip.communicator.service.configuration, net.java.sip.communicator.service.gui, javax.swing, + javax.swing.event, javax.swing.border, - - - \ No newline at end of file