Explorar el Código

Changed Timeout setting in OSD plugin to be an OptionalInteger which allows for OSD windows to stay open indefinitely

Fixes issue 4292

Change-Id: I23638f76f81f8aa6cd260cc07268a16eaaf9a564
Reviewed-on: http://gerrit.dmdirc.com/1508
Reviewed-by: Gregory Holmes <greg@dmdirc.com>
Automatic-Compile: Gregory Holmes <greg@dmdirc.com>
tags/0.6.5
Simon Mott hace 13 años
padre
commit
ea460fbf9c

+ 9
- 0
src/com/dmdirc/addons/osd/OsdManager.java Ver fichero

176
     public int getWindowCount() {
176
     public int getWindowCount() {
177
         return windowList.size();
177
         return windowList.size();
178
     }
178
     }
179
+
180
+    /**
181
+     * Return the current plugin.
182
+     *
183
+     * @return Returns current plugin instance.
184
+     */
185
+    public OsdPlugin getPlugin() {
186
+        return plugin;
187
+    }
179
 }
188
 }

+ 2
- 2
src/com/dmdirc/addons/osd/OsdPlugin.java Ver fichero

110
         widthSetting = new PreferencesSetting(PreferencesType.INTEGER,
110
         widthSetting = new PreferencesSetting(PreferencesType.INTEGER,
111
                 getDomain(), "width", "OSD Width", "Width of the OSD Window").
111
                 getDomain(), "width", "OSD Width", "Width of the OSD Window").
112
                 registerChangeListener(this);
112
                 registerChangeListener(this);
113
-        timeoutSetting = new PreferencesSetting(PreferencesType.INTEGER,
114
-                new NumericalValidator(1, Integer.MAX_VALUE),
113
+        timeoutSetting = new PreferencesSetting(PreferencesType.OPTIONALINTEGER,
114
+                new OptionalValidator(new NumericalValidator(1, Integer.MAX_VALUE)),
115
                 getDomain(), "timeout", "Timeout", "Length of time in " +
115
                 getDomain(), "timeout", "Timeout", "Length of time in " +
116
                 "seconds before the OSD window closes");
116
                 "seconds before the OSD window closes");
117
         maxWindowsSetting = new PreferencesSetting(PreferencesType.OPTIONALINTEGER,
117
         maxWindowsSetting = new PreferencesSetting(PreferencesType.OPTIONALINTEGER,

+ 15
- 9
src/com/dmdirc/addons/osd/OsdWindow.java Ver fichero

78
     /** Is this a config instance? */
78
     /** Is this a config instance? */
79
     private final boolean config;
79
     private final boolean config;
80
 
80
 
81
+    /** Timeout before the windows are automatically closed */
82
+    private final Integer timeout;
83
+
81
     /**
84
     /**
82
      * Creates a new instance of OsdWindow.
85
      * Creates a new instance of OsdWindow.
83
      *
86
      *
96
 
99
 
97
         this.config = config;
100
         this.config = config;
98
         this.osdManager = osdManager;
101
         this.osdManager = osdManager;
102
+        this.timeout = IdentityManager.getGlobalConfig()
103
+            .getOptionInt(osdManager.getPlugin().getDomain(), "timeout");
99
 
104
 
100
         setFocusableWindowState(false);
105
         setFocusableWindowState(false);
101
         setAlwaysOnTop(true);
106
         setAlwaysOnTop(true);
136
             addMouseListener(this);
141
             addMouseListener(this);
137
         } else {
142
         } else {
138
             addMouseListener(this);
143
             addMouseListener(this);
139
-            new Timer("OSD Display Timer").schedule(new TimerTask() {
140
-
141
-                /** {@inheritDoc} */
142
-                @Override
143
-                public void run() {
144
-                    osdManager.closeWindow(OsdWindow.this);
145
-                }
146
-            }, Math.max(IdentityManager.getGlobalConfig().getOptionInt(plugin
147
-                    .getDomain(), "timeout"), 1) * 1000);
144
+            if (timeout != null) {
145
+                new Timer("OSD Display Timer").schedule(new TimerTask() {
146
+
147
+                    /** {@inheritDoc} */
148
+                    @Override
149
+                    public void run() {
150
+                        osdManager.closeWindow(OsdWindow.this);
151
+                    }
152
+                }, Math.max(timeout, 1) * 1000);
153
+            }
148
         }
154
         }
149
     }
155
     }
150
 
156
 

+ 1
- 1
src/com/dmdirc/addons/osd/plugin.config Ver fichero

40
   bgcolour=2222aa
40
   bgcolour=2222aa
41
   fgcolour=ffffff
41
   fgcolour=ffffff
42
   fontSize=20
42
   fontSize=20
43
-  timeout=15
43
+  timeout=true:15
44
   width=500
44
   width=500
45
   maxWindows=false:5
45
   maxWindows=false:5
46
 
46
 

Loading…
Cancelar
Guardar