Java Code Examples for org.jitsi.util.OSUtils#IS_WINDOWS

The following examples show how to use org.jitsi.util.OSUtils#IS_WINDOWS . These examples are extracted from open source projects. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source Project: jitsi   File: SelectScreenDialog.java    License: Apache License 2.0 6 votes vote down vote up
/**
 * Constructs <tt>DeviceComboBoxField</tt> instance.
 * @param desktopDevices list with the available devices.
 * @param devicePanel the container of the field.
 */
public DeviceComboBoxField(Container devicePanel, 
    List<MediaDevice> desktopDevices)
{
    if(!OSUtils.IS_WINDOWS)
    {
        deviceComboBox = new JComboBox(desktopDevices.toArray());
        deviceComboBox.setRenderer(new ComboRenderer());
        devicePanel.add(deviceComboBox);
        deviceComponent = deviceComboBox;
    }
    else
    {
        deviceList = new JList(desktopDevices.toArray());
        deviceList.setCellRenderer(new ComboRenderer());
        JScrollPane listScroller = new JScrollPane(deviceList);
        listScroller.setPreferredSize(new Dimension(200, 38));
        deviceList.setSelectionMode(ListSelectionModel.SINGLE_INTERVAL_SELECTION);
        deviceList.setLayoutOrientation(JList.VERTICAL);
        deviceList.setVisibleRowCount(-1);
        deviceList.setSelectedValue(desktopDevices.get(0), true);
        devicePanel.add(listScroller, BorderLayout.NORTH);
        deviceComponent = deviceList;
    }
}
 
Example 2
Source Project: jitsi   File: ConfigurationUtils.java    License: Apache License 2.0 5 votes vote down vote up
private static boolean isPinnedToTaskBar()
{
    if (!OSUtils.IS_WINDOWS)
    {
        return false;
    }

    File taskbar = new File(System.getenv("appdata"),
        "Microsoft\\Internet Explorer\\Quick Launch\\User Pinned\\TaskBar");
    if (!taskbar.exists())
    {
        return false;
    }

    File[] pins = taskbar.listFiles(new FileFilter()
    {
        @Override
        public boolean accept(File f)
        {
            return f.getName().endsWith(".lnk");
        }
    });

    String title = UtilActivator.getResources()
        .getSettingsString("service.gui.APPLICATION_NAME");
    for (File pin : pins)
    {
        if (pin.getName().contains(title))
        {
            return true;
        }
    }

    return false;
}
 
Example 3
Source Project: jitsi   File: MediaConfigurationImpl.java    License: Apache License 2.0 5 votes vote down vote up
/**
 * Constructs <tt>DeviceComboBoxField</tt> instance.
 * @param type the type of the configuration panel
 * @param devicePanel the container of the field.
 */
public DeviceComboBoxField(final int type, Container devicePanel)
{
    model = new DeviceConfigurationComboBoxModel(
        mediaService.getDeviceConfiguration(),
        type);

    if(!OSUtils.IS_WINDOWS
        || type != DeviceConfigurationComboBoxModel.VIDEO)
    {
        deviceComboBox = new JComboBox();
        deviceComboBox.setEditable(false);
        deviceComboBox.setModel(model);
        devicePanel.add(deviceComboBox);
        deviceComponent = deviceComboBox;
    }
    else
    {
        deviceList = new JList();
        deviceList.setModel(model);
        JScrollPane listScroller = new JScrollPane(deviceList);
        listScroller.setPreferredSize(new Dimension(200, 38));
        deviceList.setSelectionMode(ListSelectionModel.SINGLE_INTERVAL_SELECTION);
        deviceList.setLayoutOrientation(JList.VERTICAL);
        deviceList.setVisibleRowCount(-1);
        deviceList.setSelectedValue(model.getSelectedItem(), true);
        devicePanel.add(listScroller);
        deviceComponent = deviceList;
    }
}
 
Example 4
Source Project: libjitsi   File: Pa.java    License: Apache License 2.0 5 votes vote down vote up
/**
 * Gets the suggested latency to be used when opening PortAudio streams.
 *
 * @return the suggested latency to be used when opening PortAudio streams
 */
public static double getSuggestedLatency()
{
    ConfigurationService cfg = LibJitsi.getConfigurationService();

    if (cfg != null)
    {
        String suggestedLatencyString
            = cfg.getString(PROP_SUGGESTED_LATENCY);

        if (suggestedLatencyString != null)
        {
            try
            {
                double suggestedLatency
                    = Double.parseDouble(suggestedLatencyString);

                if (suggestedLatency != LATENCY_UNSPECIFIED)
                    return suggestedLatency;
            }
            catch (NumberFormatException nfe)
            {
                logger.error(
                        "Failed to parse configuration property "
                            + PROP_SUGGESTED_LATENCY
                            + " value as a double",
                        nfe);
            }
        }
    }

    if (OSUtils.IS_MAC || OSUtils.IS_LINUX)
        return LATENCY_HIGH;
    else if (OSUtils.IS_WINDOWS)
        return 0.1d;
    else
        return LATENCY_UNSPECIFIED;
}