Patch for Native Look (Linux)

Discuss issues related to PS3 Media Server development (only for programmers)

Patch for Native Look (Linux)

Postby nighty87 » Sun Jun 05, 2011 11:51 am

Hi

in this patch is a little modifcation for linux users. You can switch the native look in the general settings.

Code: Select all
Index: net/pms/newgui/LooksFrame.java
===================================================================
--- net/pms/newgui/LooksFrame.java   (Revision 611)
+++ net/pms/newgui/LooksFrame.java   (Arbeitskopie)
@@ -132,7 +132,7 @@
             selectedLaf = new PlasticLookAndFeel();
          }
       }
-      else if (System.getProperty("nativelook") == null && !Platform.isMac()) //$NON-NLS-1$
+      else if (System.getProperty("nativelook") == null && !PMS.getConfiguration().isStartInNativeLook() && !Platform.isMac()) //$NON-NLS-1$
          selectedLaf = new PlasticLookAndFeel();
       else {
          try {
 
Index: net/pms/newgui/NetworkTab.java
===================================================================
--- net/pms/newgui/NetworkTab.java   (Revision 611)
+++ net/pms/newgui/NetworkTab.java   (Arbeitskopie)
@@ -60,6 +60,7 @@
 
 public class NetworkTab {
 
+   private JCheckBox nativeLookBox;
    private JCheckBox smcheckBox;
    private JCheckBox newHTTPEngine;
    private JCheckBox preventSleep;
@@ -79,7 +80,7 @@
    public JComponent build() {
       FormLayout layout = new FormLayout(
          "left:pref, 2dlu, p, 2dlu , p, 2dlu, p, 2dlu, pref:grow", //$NON-NLS-1$
-         "p, 0dlu, p, 0dlu, p, 3dlu, p, 3dlu, p, 3dlu,p, 3dlu, p, 15dlu, p, 3dlu,p, 3dlu, p,  3dlu, p, 3dlu, p, 3dlu, p,3dlu, p, 3dlu, p, 15dlu, p,3dlu, p, 3dlu, p, 15dlu, p, 3dlu, p, 3dlu,p, 3dlu, p, 3dlu, p, 15dlu, p, 3dlu, p, 3dlu, p, 3dlu, p, 3dlu, p, 3dlu, p, 3dlu "); //$NON-NLS-1$
+         "p, 0dlu, p, 0dlu, p, 3dlu, p, 3dlu, p, 3dlu, p, 3dlu,p, 3dlu, p, 15dlu, p, 3dlu,p, 3dlu, p,  3dlu, p, 3dlu, p, 3dlu, p,3dlu, p, 3dlu, p, 15dlu, p,3dlu, p, 3dlu, p, 15dlu, p, 3dlu, p, 3dlu,p, 3dlu, p, 3dlu, p, 15dlu, p, 3dlu, p, 3dlu, p, 3dlu, p, 3dlu, p, 3dlu, p, 3dlu "); //$NON-NLS-1$
       PanelBuilder builder = new PanelBuilder(layout);
       builder.setBorder(Borders.DLU4_BORDER);
       builder.setOpaque(true);
@@ -97,6 +98,21 @@
       if (PMS.getConfiguration().isMinimized()) {
          smcheckBox.setSelected(true);
       }
+      
+      nativeLookBox = new JCheckBox("Start in Native Look");
+      nativeLookBox.setContentAreaFilled(false);
+      nativeLookBox.addItemListener(new ItemListener() {
+         
+         public void itemStateChanged(ItemEvent e) {
+            PMS.getConfiguration().setStartInNativeLook((e.getStateChange() == ItemEvent.SELECTED));
+         }
+      });
+      if (PMS.getConfiguration().isStartInNativeLook()) {
+         nativeLookBox.setSelected(true);
+      }
+      if (!Platform.isLinux()) {
+         nativeLookBox.setEnabled(false);
+      }
 
       JComponent cmp = builder.addSeparator(Messages.getString("NetworkTab.5"), cc.xyw(1, 1, 9)); //$NON-NLS-1$
       cmp = (JComponent) cmp.getComponent(0);
@@ -135,6 +151,7 @@
       builder.add(langs, cc.xyw(3, 7, 7));
 
       builder.add(smcheckBox, cc.xyw(1, 9, 9));
+      builder.add(nativeLookBox, cc.xyw(1, 11, 9));
 
       JButton service = new JButton(Messages.getString("NetworkTab.4")); //$NON-NLS-1$
       service.addActionListener(new ActionListener() {
@@ -158,7 +175,7 @@
             }
          }
       });
-      builder.add(service, cc.xy(1, 11));
+      builder.add(service, cc.xy(1, 13));
       if (System.getProperty(LooksFrame.START_SERVICE) != null || !Platform.isWindows()) {
          service.setEnabled(false);
       }
Index: net/pms/configuration/PmsConfiguration.java
===================================================================
--- net/pms/configuration/PmsConfiguration.java   (Revision 611)
+++ net/pms/configuration/PmsConfiguration.java   (Arbeitskopie)
@@ -129,6 +129,7 @@
    private static final String KEY_VIRTUAL_FOLDERS = "vfolders";
    private static final String KEY_PLUGIN_DIRECTORY = "plugins";
    private static final String KEY_PROFILE_NAME = "name";
+   private static final String KEY_START_IN_NATIVE_LOOK = "start_in_native_look";
 
    /*
     * the name of the subdirectory under which PMS config files are stored for this build.
@@ -1258,7 +1259,15 @@
    public void setPluginDirectory(String value) {
       configuration.setProperty(KEY_PLUGIN_DIRECTORY, value);
    }
+   
+   public Boolean isStartInNativeLook() {
+      return getBoolean(KEY_START_IN_NATIVE_LOOK, false);
+   }
 
+   public void setStartInNativeLook(boolean value) {
+      configuration.setProperty(KEY_START_IN_NATIVE_LOOK, value);
+   }
+
    public String getProfileName() {
       if (HOSTNAME == null) { // calculate this lazily
          try {
nighty87
 
Posts: 3
Joined: Sun Jun 05, 2011 11:45 am

Re: Patch for Native Look (Linux)

Postby chocolateboy » Sun Jun 05, 2011 12:04 pm

The patch is malformed. Please post it as a zipped attachment.
chocolateboy
Project Member
 
Posts: 2580
Joined: Wed Sep 16, 2009 10:05 am

Re: Patch for Native Look (Linux)

Postby nighty87 » Sun Jun 05, 2011 12:08 pm

Ok no problem: http://ul.to/jsp1r7n2
nighty87
 
Posts: 3
Joined: Sun Jun 05, 2011 11:45 am

Re: Patch for Native Look (Linux)

Postby nighty87 » Mon Jun 06, 2011 9:07 pm

i have added a fix for loading the web.conf.
This file loaded only if this file in the "User" Profile Folder (e.g. /home/muh/.config/PMS).
With this workaround is both possible :)
(This Patchfile include all changes from the first post)

http://ul.to/r6ji7izc
nighty87
 
Posts: 3
Joined: Sun Jun 05, 2011 11:45 am


Return to Developers

Who is online

Users browsing this forum: No registered users and 0 guests