[jitsi-dev] Re: [jitsi~svn:9188] Adds default values for global shortcuts (answer, hangup, contactlist and


#1

Hey

Would such defaults not better be placed inside resources/config/defaults.properties instead of being hardcoded?

Regards,
Ingo

···

-----Original Message-----
From: s_vincent@java.net [mailto:s_vincent@java.net]
Sent: Montag, 5. Dezember 2011 14:56
To: commits@jitsi.java.net
Subject: [jitsi~svn:9188] Adds default values for global shortcuts (answer,
hangup, contactlist and

Project: jitsi
Repository: svn
Revision: 9188
Author: s_vincent
Date: 2011-12-05 13:55:58 UTC
Link:

Log Message:
------------
Adds default values for global shortcuts (answer, hangup, contactlist and
mute).

Revisions:
----------
9188

Modified Paths:
---------------
trunk/src/net/java/sip/communicator/impl/keybindings/KeybindingsServiceImpl.j
ava

Diffs:
------
Index:
trunk/src/net/java/sip/communicator/impl/keybindings/KeybindingsServiceImpl.j
ava

---
trunk/src/net/java/sip/communicator/impl/keybindings/KeybindingsServiceImpl.j
ava (revision 9187)
+++
trunk/src/net/java/sip/communicator/impl/keybindings/KeybindingsServiceImpl.j
ava (revision 9188)
@@ -230,11 +230,12 @@
                 new KeybindingSetImpl(merged, category, customFile);
             this.bindings.put(category, newSet);
             newSet.addObserver(this);
-
- globalBindings = new GlobalKeybindingSetImpl();
-
globalBindings.setBindings(getGlobalShortcutFromConfiguration());
         }

+ // global shortcut initialization
+ globalBindings = new GlobalKeybindingSetImpl();
+ globalBindings.setBindings(getGlobalShortcutFromConfiguration());
+
         this.isRunning = true;
     }

@@ -330,7 +331,49 @@
         String propName2 = null;
         String names[] = new String[]{"answer", "hangup", "contactlist",
             "mute"};
+ Object configured = configService.getProperty(
+ "net.java.sip.communicator.impl.keybinding.global.configured");

+ if(configured == null)
+ {
+ // default keystrokes
+ for(String name : names)
+ {
+ List<AWTKeyStroke> kss = new ArrayList<AWTKeyStroke>();
+
+ if(name.equals("answer"))
+ {
+ kss.add(AWTKeyStroke.getAWTKeyStroke(
+ "shift ctrl pressed A"));
+ }
+ else if(name.equals("hangup"))
+ {
+ kss.add(AWTKeyStroke.getAWTKeyStroke(
+ "shift ctrl pressed H"));
+ }
+ else if(name.equals("contactlist"))
+ {
+ kss.add(AWTKeyStroke.getAWTKeyStroke(
+ "shift ctrl pressed L"));
+ }
+ else if(name.equals("mute"))
+ {
+ kss.add(AWTKeyStroke.getAWTKeyStroke(
+ "shift ctrl pressed M"));
+ }
+ else
+ continue;
+
+ gBindings.put(name, kss);
+ }
+
+ configService.setProperty(
+
"net.java.sip.communicator.impl.keybinding.global.configured",
+ "true");
+
+ return gBindings;
+ }
+
         for(String name : names)
         {
             List<AWTKeyStroke> kss = new ArrayList<AWTKeyStroke>();


#2

Hi Ingo,

Yes indeed.

Regards,

···

--
Seb

Le 05/12/11 15:22, Bauersachs Ingo a écrit :

Hey

Would such defaults not better be placed inside resources/config/defaults.properties instead of being hardcoded?

Regards,
Ingo

-----Original Message-----
From: s_vincent@java.net [mailto:s_vincent@java.net]
Sent: Montag, 5. Dezember 2011 14:56
To: commits@jitsi.java.net
Subject: [jitsi~svn:9188] Adds default values for global shortcuts (answer,
hangup, contactlist and

Project: jitsi
Repository: svn
Revision: 9188
Author: s_vincent
Date: 2011-12-05 13:55:58 UTC
Link:

Log Message:
------------
Adds default values for global shortcuts (answer, hangup, contactlist and
mute).

Revisions:
----------
9188

Modified Paths:
---------------
trunk/src/net/java/sip/communicator/impl/keybindings/KeybindingsServiceImpl.j
ava

Diffs:
------
Index:
trunk/src/net/java/sip/communicator/impl/keybindings/KeybindingsServiceImpl.j
ava

---
trunk/src/net/java/sip/communicator/impl/keybindings/KeybindingsServiceImpl.j
ava (revision 9187)
+++
trunk/src/net/java/sip/communicator/impl/keybindings/KeybindingsServiceImpl.j
ava (revision 9188)
@@ -230,11 +230,12 @@
                  new KeybindingSetImpl(merged, category, customFile);
              this.bindings.put(category, newSet);
              newSet.addObserver(this);
-
- globalBindings = new GlobalKeybindingSetImpl();
-
globalBindings.setBindings(getGlobalShortcutFromConfiguration());
          }

+ // global shortcut initialization
+ globalBindings = new GlobalKeybindingSetImpl();
+ globalBindings.setBindings(getGlobalShortcutFromConfiguration());
+
          this.isRunning = true;
      }

@@ -330,7 +331,49 @@
          String propName2 = null;
          String names[] = new String[]{"answer", "hangup", "contactlist",
              "mute"};
+ Object configured = configService.getProperty(
+ "net.java.sip.communicator.impl.keybinding.global.configured");

+ if(configured == null)
+ {
+ // default keystrokes
+ for(String name : names)
+ {
+ List<AWTKeyStroke> kss = new ArrayList<AWTKeyStroke>();
+
+ if(name.equals("answer"))
+ {
+ kss.add(AWTKeyStroke.getAWTKeyStroke(
+ "shift ctrl pressed A"));
+ }
+ else if(name.equals("hangup"))
+ {
+ kss.add(AWTKeyStroke.getAWTKeyStroke(
+ "shift ctrl pressed H"));
+ }
+ else if(name.equals("contactlist"))
+ {
+ kss.add(AWTKeyStroke.getAWTKeyStroke(
+ "shift ctrl pressed L"));
+ }
+ else if(name.equals("mute"))
+ {
+ kss.add(AWTKeyStroke.getAWTKeyStroke(
+ "shift ctrl pressed M"));
+ }
+ else
+ continue;
+
+ gBindings.put(name, kss);
+ }
+
+ configService.setProperty(
+
"net.java.sip.communicator.impl.keybinding.global.configured",
+ "true");
+
+ return gBindings;
+ }
+
          for(String name : names)
          {
              List<AWTKeyStroke> kss = new ArrayList<AWTKeyStroke>();


#3

+1

-- sent from my mobile

···

On Dec 5, 2011 3:23 PM, "Bauersachs Ingo" <ingo.bauersachs@fhnw.ch> wrote:

Hey

Would such defaults not better be placed inside
resources/config/defaults.properties instead of being hardcoded?

Regards,
Ingo

> -----Original Message-----
> From: s_vincent@java.net [mailto:s_vincent@java.net]
> Sent: Montag, 5. Dezember 2011 14:56
> To: commits@jitsi.java.net
> Subject: [jitsi~svn:9188] Adds default values for global shortcuts
(answer,
> hangup, contactlist and
>
> Project: jitsi
> Repository: svn
> Revision: 9188
> Author: s_vincent
> Date: 2011-12-05 13:55:58 UTC
> Link:
>
> Log Message:
> ------------
> Adds default values for global shortcuts (answer, hangup, contactlist and
> mute).
>
>
> Revisions:
> ----------
> 9188
>
>
> Modified Paths:
> ---------------
>
trunk/src/net/java/sip/communicator/impl/keybindings/KeybindingsServiceImpl.j
> ava
>
>
> Diffs:
> ------
> Index:
>
trunk/src/net/java/sip/communicator/impl/keybindings/KeybindingsServiceImpl.j
> ava
> ===================================================================
> ---
>
trunk/src/net/java/sip/communicator/impl/keybindings/KeybindingsServiceImpl.j
> ava (revision 9187)
> +++
>
trunk/src/net/java/sip/communicator/impl/keybindings/KeybindingsServiceImpl.j
> ava (revision 9188)
> @@ -230,11 +230,12 @@
> new KeybindingSetImpl(merged, category, customFile);
> this.bindings.put(category, newSet);
> newSet.addObserver(this);
> -
> - globalBindings = new GlobalKeybindingSetImpl();
> -
> globalBindings.setBindings(getGlobalShortcutFromConfiguration());
> }
>
> + // global shortcut initialization
> + globalBindings = new GlobalKeybindingSetImpl();
> +
globalBindings.setBindings(getGlobalShortcutFromConfiguration());
> +
> this.isRunning = true;
> }
>
> @@ -330,7 +331,49 @@
> String propName2 = null;
> String names[] = new String[]{"answer", "hangup", "contactlist",
> "mute"};
> + Object configured = configService.getProperty(
> +
"net.java.sip.communicator.impl.keybinding.global.configured");
>
> + if(configured == null)
> + {
> + // default keystrokes
> + for(String name : names)
> + {
> + List<AWTKeyStroke> kss = new ArrayList<AWTKeyStroke>();
> +
> + if(name.equals("answer"))
> + {
> + kss.add(AWTKeyStroke.getAWTKeyStroke(
> + "shift ctrl pressed A"));
> + }
> + else if(name.equals("hangup"))
> + {
> + kss.add(AWTKeyStroke.getAWTKeyStroke(
> + "shift ctrl pressed H"));
> + }
> + else if(name.equals("contactlist"))
> + {
> + kss.add(AWTKeyStroke.getAWTKeyStroke(
> + "shift ctrl pressed L"));
> + }
> + else if(name.equals("mute"))
> + {
> + kss.add(AWTKeyStroke.getAWTKeyStroke(
> + "shift ctrl pressed M"));
> + }
> + else
> + continue;
> +
> + gBindings.put(name, kss);
> + }
> +
> + configService.setProperty(
> +
> "net.java.sip.communicator.impl.keybinding.global.configured",
> + "true");
> +
> + return gBindings;
> + }
> +
> for(String name : names)
> {
> List<AWTKeyStroke> kss = new ArrayList<AWTKeyStroke>();
>
>