|
@@ -19,6 +19,7 @@
|
19
|
19
|
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
20
|
20
|
* SOFTWARE.
|
21
|
21
|
*/
|
|
22
|
+
|
22
|
23
|
package com.dmdirc.addons.ui_swing;
|
23
|
24
|
|
24
|
25
|
import com.dmdirc.addons.ui_swing.components.LoggingSwingWorker;
|
|
@@ -70,9 +71,8 @@ public final class MainFrame extends JFrame implements WindowListener,
|
70
|
71
|
MainWindow, ConfigChangeListener, FrameManager, PropertyChangeListener {
|
71
|
72
|
|
72
|
73
|
/** Logger to use. */
|
73
|
|
- private static final java.util.logging.Logger LOGGER = java.util.logging
|
74
|
|
- .Logger.getLogger(MainFrame.class.getName());
|
75
|
|
-
|
|
74
|
+ private static final java.util.logging.Logger LOGGER =
|
|
75
|
+ java.util.logging.Logger.getLogger(MainFrame.class.getName());
|
76
|
76
|
/**
|
77
|
77
|
* A version number for this class. It should be changed whenever the class
|
78
|
78
|
* structure is changed (or anything else that would prevent serialized
|
|
@@ -124,9 +124,12 @@ public final class MainFrame extends JFrame implements WindowListener,
|
124
|
124
|
|
125
|
125
|
addWindowListener(this);
|
126
|
126
|
|
127
|
|
- showVersion = IdentityManager.getGlobalConfig().getOptionBool("ui", "showversion");
|
128
|
|
- IdentityManager.getGlobalConfig().addChangeListener("ui", "lookandfeel", this);
|
129
|
|
- IdentityManager.getGlobalConfig().addChangeListener("ui", "showversion", this);
|
|
127
|
+ showVersion = IdentityManager.getGlobalConfig().getOptionBool("ui",
|
|
128
|
+ "showversion");
|
|
129
|
+ IdentityManager.getGlobalConfig().addChangeListener("ui", "lookandfeel",
|
|
130
|
+ this);
|
|
131
|
+ IdentityManager.getGlobalConfig().addChangeListener("ui", "showversion",
|
|
132
|
+ this);
|
130
|
133
|
IdentityManager.getGlobalConfig().addChangeListener("icon", "icon", this);
|
131
|
134
|
|
132
|
135
|
|
|
@@ -235,7 +238,8 @@ public final class MainFrame extends JFrame implements WindowListener,
|
235
|
238
|
@Override
|
236
|
239
|
public String getTitlePrefix() {
|
237
|
240
|
if (showVersion) {
|
238
|
|
- return "DMDirc " + IdentityManager.getGlobalConfig().getOption("version", "version");
|
|
241
|
+ return "DMDirc " + IdentityManager.getGlobalConfig().getOption(
|
|
242
|
+ "version", "version");
|
239
|
243
|
} else {
|
240
|
244
|
return "DMDirc";
|
241
|
245
|
}
|
|
@@ -290,7 +294,14 @@ public final class MainFrame extends JFrame implements WindowListener,
|
290
|
294
|
*/
|
291
|
295
|
@Override
|
292
|
296
|
public void windowClosed(final WindowEvent windowEvent) {
|
293
|
|
- Main.quit(exitCode);
|
|
297
|
+ new Thread(new Runnable() {
|
|
298
|
+
|
|
299
|
+ /** {@inheritDoc} */
|
|
300
|
+ @Override
|
|
301
|
+ public void run() {
|
|
302
|
+ Main.quit(exitCode);
|
|
303
|
+ }
|
|
304
|
+ }, "Quit thread").start();
|
294
|
305
|
}
|
295
|
306
|
|
296
|
307
|
/**
|
|
@@ -340,7 +351,8 @@ public final class MainFrame extends JFrame implements WindowListener,
|
340
|
351
|
/** {@inheritDoc} */
|
341
|
352
|
@Override
|
342
|
353
|
public void run() {
|
343
|
|
- final String manager = IdentityManager.getGlobalConfig().getOption("ui",
|
|
354
|
+ final String manager = IdentityManager.getGlobalConfig().
|
|
355
|
+ getOption("ui",
|
344
|
356
|
"framemanager");
|
345
|
357
|
|
346
|
358
|
try {
|
|
@@ -377,9 +389,11 @@ public final class MainFrame extends JFrame implements WindowListener,
|
377
|
389
|
|
378
|
390
|
setPreferredSize(new Dimension(800, 600));
|
379
|
391
|
|
380
|
|
- getContentPane().setLayout(new MigLayout("fill, ins rel, wrap 1, hidemode 2"));
|
|
392
|
+ getContentPane().setLayout(new MigLayout(
|
|
393
|
+ "fill, ins rel, wrap 1, hidemode 2"));
|
381
|
394
|
getContentPane().add(initSplitPane(), "grow, push");
|
382
|
|
- getContentPane().add(statusBar, "hmax 20, wmax 100%-2*rel, wmin 100%-2*rel");
|
|
395
|
+ getContentPane().add(statusBar,
|
|
396
|
+ "hmax 20, wmax 100%-2*rel, wmin 100%-2*rel");
|
383
|
397
|
|
384
|
398
|
setDefaultCloseOperation(WindowConstants.DO_NOTHING_ON_CLOSE);
|
385
|
399
|
|
|
@@ -421,7 +435,8 @@ public final class MainFrame extends JFrame implements WindowListener,
|
421
|
435
|
mainSplitPane.setBottomComponent(desktopPane);
|
422
|
436
|
mainSplitPane.setResizeWeight(0.0);
|
423
|
437
|
mainSplitPane.setOrientation(JSplitPane.VERTICAL_SPLIT);
|
424
|
|
- frameManagerPanel.setPreferredSize(new Dimension(Integer.MAX_VALUE,
|
|
438
|
+ frameManagerPanel.setPreferredSize(new Dimension(
|
|
439
|
+ Integer.MAX_VALUE,
|
425
|
440
|
IdentityManager.getGlobalConfig().
|
426
|
441
|
getOptionInt("ui", "frameManagerSize")));
|
427
|
442
|
break;
|
|
@@ -439,7 +454,8 @@ public final class MainFrame extends JFrame implements WindowListener,
|
439
|
454
|
mainSplitPane.setBottomComponent(frameManagerPanel);
|
440
|
455
|
mainSplitPane.setResizeWeight(1.0);
|
441
|
456
|
mainSplitPane.setOrientation(JSplitPane.VERTICAL_SPLIT);
|
442
|
|
- frameManagerPanel.setPreferredSize(new Dimension(Integer.MAX_VALUE,
|
|
457
|
+ frameManagerPanel.setPreferredSize(new Dimension(
|
|
458
|
+ Integer.MAX_VALUE,
|
443
|
459
|
IdentityManager.getGlobalConfig().
|
444
|
460
|
getOptionInt("ui", "frameManagerSize")));
|
445
|
461
|
break;
|
|
@@ -471,7 +487,8 @@ public final class MainFrame extends JFrame implements WindowListener,
|
471
|
487
|
* @param exitCode Exit code
|
472
|
488
|
*/
|
473
|
489
|
public void quit(final int exitCode) {
|
474
|
|
- if (exitCode == 0 && IdentityManager.getGlobalConfig().getOptionBool("ui", "confirmQuit") && JOptionPane.showConfirmDialog(this,
|
|
490
|
+ if (exitCode == 0 && IdentityManager.getGlobalConfig().getOptionBool(
|
|
491
|
+ "ui", "confirmQuit") && JOptionPane.showConfirmDialog(this,
|
475
|
492
|
"You are about to quit DMDirc, are you sure?", "Quit confirm",
|
476
|
493
|
JOptionPane.YES_NO_OPTION,
|
477
|
494
|
JOptionPane.WARNING_MESSAGE) !=
|
|
@@ -487,9 +504,11 @@ public final class MainFrame extends JFrame implements WindowListener,
|
487
|
504
|
@Override
|
488
|
505
|
protected Object doInBackground() throws Exception {
|
489
|
506
|
ActionManager.processEvent(CoreActionType.CLIENT_CLOSING, null);
|
490
|
|
- ServerManager.getServerManager().closeAll(IdentityManager.getGlobalConfig().getOption("general", "closemessage"));
|
|
507
|
+ ServerManager.getServerManager().closeAll(IdentityManager.
|
|
508
|
+ getGlobalConfig().getOption("general", "closemessage"));
|
491
|
509
|
IdentityManager.getConfigIdentity().setOption("ui",
|
492
|
|
- "frameManagerSize", String.valueOf(getFrameManagerSize()));
|
|
510
|
+ "frameManagerSize",
|
|
511
|
+ String.valueOf(getFrameManagerSize()));
|
493
|
512
|
return null;
|
494
|
513
|
}
|
495
|
514
|
|
|
@@ -509,11 +528,13 @@ public final class MainFrame extends JFrame implements WindowListener,
|
509
|
528
|
if ("lookandfeel".equals(key)) {
|
510
|
529
|
controller.updateLookAndFeel();
|
511
|
530
|
} else {
|
512
|
|
- showVersion = IdentityManager.getGlobalConfig().getOptionBool("ui",
|
|
531
|
+ showVersion = IdentityManager.getGlobalConfig().getOptionBool(
|
|
532
|
+ "ui",
|
513
|
533
|
"showversion");
|
514
|
534
|
}
|
515
|
535
|
} else {
|
516
|
|
- imageIcon = new ImageIcon(IconManager.getIconManager().getImage("icon"));
|
|
536
|
+ imageIcon = new ImageIcon(IconManager.getIconManager().getImage(
|
|
537
|
+ "icon"));
|
517
|
538
|
setIconImage(imageIcon.getImage());
|
518
|
539
|
}
|
519
|
540
|
}
|