Search in sources :

Example 1 with SystemIconsPolicy

use of com.mucommander.conf.SystemIconsPolicy in project mucommander by mucommander.

the class AppearancePanel method commit.

// /////////////////////
// PrefPanel methods //
// /////////////////////
@Override
protected void commit() {
    // Look and Feel
    if (MuConfigurations.getPreferences().setVariable(MuPreference.LOOK_AND_FEEL, lookAndFeels[lookAndFeelComboBox.getSelectedIndex()].getClassName())) {
        resetLookAndFeelButtons();
        SwingUtilities.updateComponentTreeUI(parent);
    }
    // Set ToolBar's icon size
    float scaleFactor = ICON_SCALE_FACTORS[toolbarIconsSizeComboBox.getSelectedIndex()];
    MuConfigurations.getPreferences().setVariable(MuPreference.TOOLBAR_ICON_SCALE, scaleFactor);
    // Set CommandBar's icon size
    scaleFactor = ICON_SCALE_FACTORS[commandBarIconsSizeComboBox.getSelectedIndex()];
    MuConfigurations.getPreferences().setVariable(MuPreference.COMMAND_BAR_ICON_SCALE, scaleFactor);
    // Set file icon size
    scaleFactor = ICON_SCALE_FACTORS[fileIconsSizeComboBox.getSelectedIndex()];
    // Set scale factor in FileIcons first so that it has the new value when ConfigurationListener instances call it
    FileIcons.setScaleFactor(scaleFactor);
    MuConfigurations.getPreferences().setVariable(MuPreference.TABLE_ICON_SCALE, scaleFactor);
    // Sets the current theme.
    if (!ThemeManager.isCurrentTheme((Theme) themeComboBox.getSelectedItem())) {
        ThemeManager.setCurrentTheme((Theme) themeComboBox.getSelectedItem());
        resetThemeButtons((Theme) themeComboBox.getSelectedItem());
        themeComboBox.repaint();
    }
    // Set system icons policy
    SystemIconsPolicy systemIconsPolicy;
    switch(useSystemFileIconsComboBox.getSelectedIndex()) {
        case 0:
            systemIconsPolicy = SystemIconsPolicy.NEVER;
            break;
        case 1:
            systemIconsPolicy = SystemIconsPolicy.APPLICATIONS_ONLY;
            break;
        case 2:
            systemIconsPolicy = SystemIconsPolicy.FOLDERS_ONLY;
            break;
        case 3:
        default:
            systemIconsPolicy = SystemIconsPolicy.ALWAYS;
    }
    FileIcons.setSystemIconsPolicy(systemIconsPolicy);
    MuConfigurations.getPreferences().setVariable(MuPreference.USE_SYSTEM_FILE_ICONS, systemIconsPolicy.toString());
}
Also used : Theme(com.mucommander.ui.theme.Theme) SystemIconsPolicy(com.mucommander.conf.SystemIconsPolicy)

Example 2 with SystemIconsPolicy

use of com.mucommander.conf.SystemIconsPolicy in project mucommander by mucommander.

the class Application method setSystemIconsPolicy.

private static void setSystemIconsPolicy() {
    String conf = MuConfigurations.getPreferences().getVariable(MuPreference.USE_SYSTEM_FILE_ICONS, MuPreferences.DEFAULT_USE_SYSTEM_FILE_ICONS);
    SystemIconsPolicy policy = SystemIconsPolicy.APPLICATIONS_ONLY;
    for (SystemIconsPolicy value : SystemIconsPolicy.values()) {
        if (value.toString().equals(conf)) {
            policy = value;
            break;
        }
    }
    FileIcons.setSystemIconsPolicy(policy);
}
Also used : SystemIconsPolicy(com.mucommander.conf.SystemIconsPolicy)

Example 3 with SystemIconsPolicy

use of com.mucommander.conf.SystemIconsPolicy in project mucommander by mucommander.

the class AppearancePanel method createSystemIconsPanel.

/**
 * Creates the system icons panel.
 *
 * @return the system icons panel.
 */
private JPanel createSystemIconsPanel() {
    /* 'Use system file icons' combo box */
    this.useSystemFileIconsComboBox = new PrefComboBox<String>() {

        public boolean hasChanged() {
            SystemIconsPolicy systemIconsPolicy;
            // TODO use objects instead of index.....
            switch(useSystemFileIconsComboBox.getSelectedIndex()) {
                case 0:
                    systemIconsPolicy = SystemIconsPolicy.NEVER;
                    break;
                case 1:
                    systemIconsPolicy = SystemIconsPolicy.APPLICATIONS_ONLY;
                    break;
                case 2:
                    systemIconsPolicy = SystemIconsPolicy.FOLDERS_ONLY;
                    break;
                default:
                    systemIconsPolicy = SystemIconsPolicy.ALWAYS;
            }
            return !systemIconsPolicy.toString().equals(MuConfigurations.getPreferences().getVariable(MuPreference.USE_SYSTEM_FILE_ICONS, systemIconsPolicy.toString()));
        }
    };
    useSystemFileIconsComboBox.addItem(Translator.get("prefs_dialog.use_system_file_icons.never"));
    useSystemFileIconsComboBox.addItem(Translator.get("prefs_dialog.use_system_file_icons.applications"));
    useSystemFileIconsComboBox.addItem(Translator.get("prefs_dialog.use_system_file_icons.folders"));
    useSystemFileIconsComboBox.addItem(Translator.get("prefs_dialog.use_system_file_icons.always"));
    // TODO use objects instead of index.....
    switch(FileIcons.getSystemIconsPolicy()) {
        case ALWAYS:
            useSystemFileIconsComboBox.setSelectedIndex(3);
            break;
        case FOLDERS_ONLY:
            useSystemFileIconsComboBox.setSelectedIndex(2);
            break;
        case APPLICATIONS_ONLY:
            useSystemFileIconsComboBox.setSelectedIndex(1);
            break;
        case NEVER:
            useSystemFileIconsComboBox.setSelectedIndex(0);
    }
    JPanel panel = new JPanel(new FlowLayout(FlowLayout.LEFT));
    panel.setBorder(BorderFactory.createTitledBorder(Translator.get("prefs_dialog.use_system_file_icons")));
    panel.add(useSystemFileIconsComboBox);
    return panel;
}
Also used : JPanel(javax.swing.JPanel) FlowLayout(java.awt.FlowLayout) SystemIconsPolicy(com.mucommander.conf.SystemIconsPolicy)

Aggregations

SystemIconsPolicy (com.mucommander.conf.SystemIconsPolicy)3 Theme (com.mucommander.ui.theme.Theme)1 FlowLayout (java.awt.FlowLayout)1 JPanel (javax.swing.JPanel)1