mirror of
https://github.com/igniterealtime/Spark.git
synced 2025-12-01 12:27:58 +00:00
Added system look and feel preferences.
git-svn-id: http://svn.igniterealtime.org/svn/repos/spark/trunk@7726 b35dd754-fafc-0310-a699-88a17e54d16e
This commit is contained in:
Binary file not shown.
@ -16,6 +16,13 @@ import org.jivesoftware.resource.Default;
|
||||
import org.jivesoftware.smack.XMPPConnection;
|
||||
import org.jivesoftware.smackx.debugger.EnhancedDebuggerWindow;
|
||||
import org.jivesoftware.spark.util.log.Log;
|
||||
import org.jivesoftware.sparkimpl.settings.local.LocalPreferences;
|
||||
import org.jivesoftware.sparkimpl.settings.local.SettingsManager;
|
||||
|
||||
import java.awt.Color;
|
||||
import java.awt.Font;
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
|
||||
import javax.swing.BorderFactory;
|
||||
import javax.swing.JFrame;
|
||||
@ -23,11 +30,6 @@ import javax.swing.JOptionPane;
|
||||
import javax.swing.SwingUtilities;
|
||||
import javax.swing.UIManager;
|
||||
|
||||
import java.awt.Color;
|
||||
import java.awt.Font;
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
|
||||
/**
|
||||
* In many cases, you will need to know the structure of the Spark installation, such as the directory structures, what
|
||||
* type of system Spark is running on, and also the arguments which were passed into Spark on startup. The <code>Spark</code>
|
||||
@ -103,12 +105,15 @@ public final class Spark {
|
||||
}
|
||||
}
|
||||
|
||||
final LocalPreferences preferences = SettingsManager.getLocalPreferences();
|
||||
boolean useSystemLookAndFeel = preferences.useSystemLookAndFeel();
|
||||
|
||||
try {
|
||||
String classname = UIManager.getSystemLookAndFeelClassName();
|
||||
|
||||
if (classname.indexOf("Windows") != -1) {
|
||||
try {
|
||||
if (isVista()) {
|
||||
if (useSystemLookAndFeel) {
|
||||
UIManager.setLookAndFeel(new com.sun.java.swing.plaf.windows.WindowsLookAndFeel());
|
||||
}
|
||||
else {
|
||||
@ -124,7 +129,12 @@ public final class Spark {
|
||||
UIManager.setLookAndFeel(classname);
|
||||
}
|
||||
else {
|
||||
UIManager.setLookAndFeel(new com.jgoodies.looks.plastic.Plastic3DLookAndFeel());
|
||||
if (useSystemLookAndFeel) {
|
||||
UIManager.setLookAndFeel(classname);
|
||||
}
|
||||
else {
|
||||
UIManager.setLookAndFeel(new com.jgoodies.looks.plastic.Plastic3DLookAndFeel());
|
||||
}
|
||||
}
|
||||
|
||||
// Update install ui properties.
|
||||
@ -229,7 +239,7 @@ public final class Spark {
|
||||
return value;
|
||||
}
|
||||
|
||||
public void setArgument(String arguments){
|
||||
public void setArgument(String arguments) {
|
||||
argument = arguments;
|
||||
}
|
||||
|
||||
|
||||
@ -15,7 +15,7 @@ LOGIN_DIALOG_LOGIN_TITLE = Spark
|
||||
LOGIN_DIALOG_AUTHENTICATING = Authenticating...
|
||||
|
||||
#MainWindow
|
||||
MAIN_IMAGE = images/message.png
|
||||
MAIN_IMAGE = images/spark-16x16.png
|
||||
MAIN_IMAGE_ICO = images/icon_16.ico
|
||||
MAIN_ICNS_FILE = images/message.icns
|
||||
SMALL_CHECK = images/smallCheck.png
|
||||
|
||||
@ -362,7 +362,7 @@ public class ChatContainer extends SparkTabbedPane implements MessageListener, C
|
||||
chatFrame.setState(Frame.NORMAL);
|
||||
chatFrame.setVisible(true);
|
||||
}
|
||||
else if (chatFrame.isVisible() && !chatFrame.isFocusOwner()) {
|
||||
else if (chatFrame.isVisible() && !chatFrame.isInFocus()) {
|
||||
startFlashing(component);
|
||||
}
|
||||
else if (chatFrame.isVisible() && chatFrame.getState() == Frame.ICONIFIED) {
|
||||
@ -442,7 +442,7 @@ public class ChatContainer extends SparkTabbedPane implements MessageListener, C
|
||||
}
|
||||
|
||||
// Handle when chat frame is visible but the Contact List is not.
|
||||
else if (chatFrame.isVisible() && !SparkManager.getMainWindow().isVisible() && !chatFrame.isFocusOwner()) {
|
||||
else if (chatFrame.isVisible() && !SparkManager.getMainWindow().isVisible() && !chatFrame.isInFocus()) {
|
||||
startFlashing(chatRoom);
|
||||
}
|
||||
else if (!chatFrame.isVisible()) {
|
||||
|
||||
@ -21,6 +21,14 @@ import org.jivesoftware.sparkimpl.plugin.emoticons.EmoticonManager;
|
||||
import org.jivesoftware.sparkimpl.settings.local.LocalPreferences;
|
||||
import org.jivesoftware.sparkimpl.settings.local.SettingsManager;
|
||||
|
||||
import java.awt.Color;
|
||||
import java.awt.GridBagConstraints;
|
||||
import java.awt.GridBagLayout;
|
||||
import java.awt.Insets;
|
||||
import java.awt.event.ActionEvent;
|
||||
import java.awt.event.ActionListener;
|
||||
import java.io.File;
|
||||
|
||||
import javax.swing.JButton;
|
||||
import javax.swing.JCheckBox;
|
||||
import javax.swing.JComboBox;
|
||||
@ -31,14 +39,6 @@ import javax.swing.JPanel;
|
||||
import javax.swing.JScrollPane;
|
||||
import javax.swing.text.BadLocationException;
|
||||
|
||||
import java.awt.Color;
|
||||
import java.awt.GridBagConstraints;
|
||||
import java.awt.GridBagLayout;
|
||||
import java.awt.Insets;
|
||||
import java.awt.event.ActionEvent;
|
||||
import java.awt.event.ActionListener;
|
||||
import java.io.File;
|
||||
|
||||
/**
|
||||
* ThemePanel is used for the setting of TranscriptWindows and Emoticon packs.
|
||||
*/
|
||||
@ -57,6 +57,8 @@ public class ThemePanel extends JPanel {
|
||||
private JCheckBox emoticonCheckBox;
|
||||
private JFileChooser fc;
|
||||
|
||||
private JCheckBox systemLookAndFeelBox;
|
||||
|
||||
/**
|
||||
* Construct UI
|
||||
*/
|
||||
@ -76,10 +78,13 @@ public class ThemePanel extends JPanel {
|
||||
|
||||
transcript = new TranscriptWindow();
|
||||
|
||||
systemLookAndFeelBox = new JCheckBox();
|
||||
|
||||
// Set ResourceUtils
|
||||
ResourceUtils.resLabel(messageStyleLabel, messageStyleBox, Res.getString("label.message.style") + ":");
|
||||
ResourceUtils.resLabel(emoticonsLabel, emoticonBox, Res.getString("label.emoticons") + ":");
|
||||
ResourceUtils.resButton(emoticonCheckBox, Res.getString("checkbox.enable.emoticons"));
|
||||
ResourceUtils.resButton(systemLookAndFeelBox, Res.getString("checkbox.use.system.look.and.feel"));
|
||||
|
||||
ResourceUtils.resButton(addThemeButton, "&Add...");
|
||||
ResourceUtils.resButton(addEmoticonButton, "A&dd...");
|
||||
@ -105,6 +110,7 @@ public class ThemePanel extends JPanel {
|
||||
add(emoticonBox, new GridBagConstraints(1, 2, 1, 1, 1.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, new Insets(5, 5, 5, 5), 0, 0));
|
||||
add(addEmoticonButton, new GridBagConstraints(2, 2, 1, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(5, 5, 5, 5), 0, 0));
|
||||
add(emoticonCheckBox, new GridBagConstraints(0, 3, 3, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(5, 5, 5, 5), 0, 0));
|
||||
add(systemLookAndFeelBox, new GridBagConstraints(0, 4, 3, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(5, 5, 5, 5), 0, 0));
|
||||
|
||||
// Activate live one.
|
||||
LocalPreferences pref = SettingsManager.getLocalPreferences();
|
||||
@ -137,6 +143,8 @@ public class ThemePanel extends JPanel {
|
||||
showSelectedEmoticon();
|
||||
|
||||
emoticonCheckBox.setSelected(pref.areEmoticonsEnabled());
|
||||
|
||||
systemLookAndFeelBox.setSelected(pref.useSystemLookAndFeel());
|
||||
}
|
||||
|
||||
/**
|
||||
@ -206,6 +214,10 @@ public class ThemePanel extends JPanel {
|
||||
return emoticonCheckBox.isSelected();
|
||||
}
|
||||
|
||||
public boolean useSystemLookAndFeel() {
|
||||
return systemLookAndFeelBox.isSelected();
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds a new Emoticon pack to Spark.
|
||||
*/
|
||||
|
||||
@ -41,7 +41,7 @@ public class ThemePreference implements Preference {
|
||||
}
|
||||
|
||||
public String getTooltip() {
|
||||
return "Change the appearance of your conversations.";
|
||||
return "Change the appearance of Spark.";
|
||||
}
|
||||
|
||||
public String getListName() {
|
||||
@ -79,12 +79,12 @@ public class ThemePreference implements Preference {
|
||||
}
|
||||
|
||||
public void commit() {
|
||||
final String theme = panel.getSelectedTheme();
|
||||
final String pack = panel.getSelectedEmoticonPack();
|
||||
boolean emotEnabled = panel.areEmoticonsEnabled();
|
||||
LocalPreferences pref = SettingsManager.getLocalPreferences();
|
||||
pref.setEmoticonPack(pack);
|
||||
pref.setEmoticonsEnabled(emotEnabled);
|
||||
pref.setUseSystemLookAndFeel(panel.useSystemLookAndFeel());
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -535,6 +535,14 @@ public class LocalPreferences {
|
||||
return getBoolean("emoticonsEnabled", true);
|
||||
}
|
||||
|
||||
public void setUseSystemLookAndFeel(boolean sysLAF) {
|
||||
setBoolean("useSystemLookAndFeel", sysLAF);
|
||||
}
|
||||
|
||||
public boolean useSystemLookAndFeel() {
|
||||
return getBoolean("useSystemLookAndFeel", false);
|
||||
}
|
||||
|
||||
private boolean getBoolean(String property, boolean defaultValue) {
|
||||
return Boolean.parseBoolean(props.getProperty(property, Boolean.toString(defaultValue)));
|
||||
}
|
||||
|
||||
@ -92,6 +92,7 @@
|
||||
## Added key: 'label.emoticons'
|
||||
## Added key: 'checkbox.enable.emoticons'
|
||||
## Added key: 'message.unable.to.retrieve.last.activity'
|
||||
## Added key: 'checkbox.use.system.look.and.feel'
|
||||
|
||||
|
||||
ok = Ok
|
||||
@ -188,6 +189,7 @@ checkbox.split.chat.window = Dock &Windows (Requires Spark restart)
|
||||
checkbox.tabs.on.top = &Chat tabs appear on top (Requires Spark restart)
|
||||
checkbox.allow.buzz = Allow users to buz&z you.
|
||||
checkbox.enable.emoticons = Enable Em&oticons
|
||||
checkbox.use.system.look.and.feel = Use System Look And &Feel (Requires Spark restart)
|
||||
|
||||
|
||||
label.user.on.public.network = User is on a public network
|
||||
|
||||
Reference in New Issue
Block a user