Search in sources :

Example 11 with LocalPreferences

use of org.jivesoftware.sparkimpl.settings.local.LocalPreferences in project Spark by igniterealtime.

the class JmfMediaManager method getPreferredFormat.

/**
 * reads the codec-order from the user-preferences
 *
 * @return
 */
// TODO REMOVE
@SuppressWarnings("unused")
private AudioFormat getPreferredFormat(ArrayList<String> formate) {
    LocalPreferences localPreferences = SettingsManager.getLocalPreferences();
    // gets the selected order from preferences
    String[] codecs = localPreferences.getSelectedCodecs().split("\\^");
    for (String codec : codecs) {
        for (String format : formate) {
            if (format != null && format.toLowerCase().equals(codec.toLowerCase()))
                return new AudioFormat(format);
        }
    }
    // this return shouldn't be executed, but if no codec was found, then use the first
    return new AudioFormat(formate.get(0));
}
Also used : LocalPreferences(org.jivesoftware.sparkimpl.settings.local.LocalPreferences) AudioFormat(javax.media.format.AudioFormat)

Example 12 with LocalPreferences

use of org.jivesoftware.sparkimpl.settings.local.LocalPreferences in project Spark by igniterealtime.

the class JmfMediaManager method getSelectedFormats.

private List<AudioFormat> getSelectedFormats() {
    List<AudioFormat> format = new ArrayList<AudioFormat>();
    List<AudioFormat> all = getAudioFormats();
    LocalPreferences localPreferences = SettingsManager.getLocalPreferences();
    // gets the selected order from preferences
    String[] codecs = localPreferences.getSelectedCodecs().split("\\^");
    for (AudioFormat form : all) {
        for (String codec : codecs) {
            if (form.getEncoding().toLowerCase().equals(codec.toLowerCase())) {
                format.add(form);
            }
        }
    }
    System.out.println("FORMATE NEU: " + format);
    return format;
}
Also used : ArrayList(java.util.ArrayList) AudioFormat(javax.media.format.AudioFormat) LocalPreferences(org.jivesoftware.sparkimpl.settings.local.LocalPreferences)

Example 13 with LocalPreferences

use of org.jivesoftware.sparkimpl.settings.local.LocalPreferences in project Spark by igniterealtime.

the class MediaPreference method commit.

@Override
public void commit() {
    LocalPreferences pref = SettingsManager.getLocalPreferences();
    pref.setAudioSystem(panel.getAudioSystem());
    pref.setAudioDevice(panel.getAudioDevice());
    pref.setVideoDevice(panel.getVideoDevice());
    pref.setStunFallbackHost(panel.getStunServer());
    pref.setStunFallbackPort(panel.getStunPort());
    pref.setPlaybackDevice(panel.getPlaybackDevice());
    SettingsManager.saveSettings();
}
Also used : LocalPreferences(org.jivesoftware.sparkimpl.settings.local.LocalPreferences)

Example 14 with LocalPreferences

use of org.jivesoftware.sparkimpl.settings.local.LocalPreferences in project Spark by igniterealtime.

the class MediaPreference method load.

@Override
public void load() {
    LocalPreferences localPreferences = SettingsManager.getLocalPreferences();
    panel.setAudioSystem(localPreferences.getAudioSystem());
    panel.setVideoDevice(localPreferences.getVideoDevice());
    panel.setAudioDevice(localPreferences.getAudioDevice());
    panel.setStunServer(localPreferences.getStunFallbackHost());
    panel.setStunPort(localPreferences.getStunFallbackPort());
    panel.setPlaybackDevice(localPreferences.getPlaybackDevice());
}
Also used : LocalPreferences(org.jivesoftware.sparkimpl.settings.local.LocalPreferences)

Example 15 with LocalPreferences

use of org.jivesoftware.sparkimpl.settings.local.LocalPreferences in project Spark by igniterealtime.

the class ChatManager method createConferenceRoom.

/**
 * Creates a new public Conference Room.
 *
 * @param roomName    the name of the room.
 * @param serviceName the service name to use (ex.conference.jivesoftware.com)
 * @return the new ChatRoom created. If an error occured, null will be returned.
 */
public ChatRoom createConferenceRoom(String roomName, String serviceName) {
    final MultiUserChat chatRoom = MultiUserChatManager.getInstanceFor(SparkManager.getConnection()).getMultiUserChat(roomName + "@" + serviceName);
    final GroupChatRoom room = UIComponentRegistry.createGroupChatRoom(chatRoom);
    try {
        LocalPreferences pref = SettingsManager.getLocalPreferences();
        chatRoom.create(pref.getNickname());
        // Send an empty room configuration form which indicates that we want
        // an instant room
        chatRoom.sendConfigurationForm(new Form(DataForm.Type.submit));
    } catch (XMPPException | SmackException e1) {
        Log.error("Unable to send conference room chat configuration form.", e1);
        return null;
    }
    getChatContainer().addChatRoom(room);
    return room;
}
Also used : GroupChatRoom(org.jivesoftware.spark.ui.rooms.GroupChatRoom) MultiUserChat(org.jivesoftware.smackx.muc.MultiUserChat) DataForm(org.jivesoftware.smackx.xdata.packet.DataForm) Form(org.jivesoftware.smackx.xdata.Form) SmackException(org.jivesoftware.smack.SmackException) LocalPreferences(org.jivesoftware.sparkimpl.settings.local.LocalPreferences) XMPPException(org.jivesoftware.smack.XMPPException)

Aggregations

LocalPreferences (org.jivesoftware.sparkimpl.settings.local.LocalPreferences)48 SmackException (org.jivesoftware.smack.SmackException)9 XMPPException (org.jivesoftware.smack.XMPPException)8 SwingWorker (org.jivesoftware.spark.util.SwingWorker)8 File (java.io.File)7 Message (org.jivesoftware.smack.packet.Message)5 MultiUserChat (org.jivesoftware.smackx.muc.MultiUserChat)5 Form (org.jivesoftware.smackx.xdata.Form)5 GroupChatRoom (org.jivesoftware.spark.ui.rooms.GroupChatRoom)5 ActionEvent (java.awt.event.ActionEvent)4 ArrayList (java.util.ArrayList)4 AbstractAction (javax.swing.AbstractAction)4 Action (javax.swing.Action)4 IOException (java.io.IOException)3 Collection (java.util.Collection)3 Date (java.util.Date)3 JPopupMenu (javax.swing.JPopupMenu)3 ChatManager (org.jivesoftware.spark.ChatManager)3 GridBagConstraints (java.awt.GridBagConstraints)2 GridBagLayout (java.awt.GridBagLayout)2