annotate src/name/blackcap/clipman/SettingsDialog.kt @ 43:339e2da5bf83

Simplified the settings. Compiles, not tested.
author David Barts <n5jrn@me.com>
date Sun, 09 Feb 2020 19:23:16 -0700
parents 33fbe3a78d84
children d14298ef8b0a
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
41
33fbe3a78d84 Got the settings stuff compiling (untested).
David Barts <n5jrn@me.com>
parents:
diff changeset
1 /*
33fbe3a78d84 Got the settings stuff compiling (untested).
David Barts <n5jrn@me.com>
parents:
diff changeset
2 * The dialog that controls font corecion.
33fbe3a78d84 Got the settings stuff compiling (untested).
David Barts <n5jrn@me.com>
parents:
diff changeset
3 */
33fbe3a78d84 Got the settings stuff compiling (untested).
David Barts <n5jrn@me.com>
parents:
diff changeset
4 package name.blackcap.clipman
33fbe3a78d84 Got the settings stuff compiling (untested).
David Barts <n5jrn@me.com>
parents:
diff changeset
5
33fbe3a78d84 Got the settings stuff compiling (untested).
David Barts <n5jrn@me.com>
parents:
diff changeset
6 import java.awt.event.ActionEvent
33fbe3a78d84 Got the settings stuff compiling (untested).
David Barts <n5jrn@me.com>
parents:
diff changeset
7 import java.awt.event.ActionListener
33fbe3a78d84 Got the settings stuff compiling (untested).
David Barts <n5jrn@me.com>
parents:
diff changeset
8 import java.io.BufferedWriter
33fbe3a78d84 Got the settings stuff compiling (untested).
David Barts <n5jrn@me.com>
parents:
diff changeset
9 import java.io.FileOutputStream
33fbe3a78d84 Got the settings stuff compiling (untested).
David Barts <n5jrn@me.com>
parents:
diff changeset
10 import java.io.IOException
33fbe3a78d84 Got the settings stuff compiling (untested).
David Barts <n5jrn@me.com>
parents:
diff changeset
11 import java.io.OutputStreamWriter
33fbe3a78d84 Got the settings stuff compiling (untested).
David Barts <n5jrn@me.com>
parents:
diff changeset
12 import java.util.Hashtable
33fbe3a78d84 Got the settings stuff compiling (untested).
David Barts <n5jrn@me.com>
parents:
diff changeset
13 import java.util.Properties
33fbe3a78d84 Got the settings stuff compiling (untested).
David Barts <n5jrn@me.com>
parents:
diff changeset
14 import java.util.logging.Level
33fbe3a78d84 Got the settings stuff compiling (untested).
David Barts <n5jrn@me.com>
parents:
diff changeset
15 import java.util.logging.Logger
33fbe3a78d84 Got the settings stuff compiling (untested).
David Barts <n5jrn@me.com>
parents:
diff changeset
16 import javax.swing.*
33fbe3a78d84 Got the settings stuff compiling (untested).
David Barts <n5jrn@me.com>
parents:
diff changeset
17 import javax.swing.event.ChangeEvent
33fbe3a78d84 Got the settings stuff compiling (untested).
David Barts <n5jrn@me.com>
parents:
diff changeset
18 import javax.swing.event.ChangeListener
33fbe3a78d84 Got the settings stuff compiling (untested).
David Barts <n5jrn@me.com>
parents:
diff changeset
19 import kotlin.math.log10
33fbe3a78d84 Got the settings stuff compiling (untested).
David Barts <n5jrn@me.com>
parents:
diff changeset
20 import kotlin.math.pow
33fbe3a78d84 Got the settings stuff compiling (untested).
David Barts <n5jrn@me.com>
parents:
diff changeset
21 import kotlin.math.roundToInt
33fbe3a78d84 Got the settings stuff compiling (untested).
David Barts <n5jrn@me.com>
parents:
diff changeset
22 import kotlin.text.toInt
33fbe3a78d84 Got the settings stuff compiling (untested).
David Barts <n5jrn@me.com>
parents:
diff changeset
23
33fbe3a78d84 Got the settings stuff compiling (untested).
David Barts <n5jrn@me.com>
parents:
diff changeset
24 /* work around name shadowing */
33fbe3a78d84 Got the settings stuff compiling (untested).
David Barts <n5jrn@me.com>
parents:
diff changeset
25 private val _PROPS = PROPERTIES
33fbe3a78d84 Got the settings stuff compiling (untested).
David Barts <n5jrn@me.com>
parents:
diff changeset
26
33fbe3a78d84 Got the settings stuff compiling (untested).
David Barts <n5jrn@me.com>
parents:
diff changeset
27 class SettingsDialog: JDialog(frame.v), ActionListener, ChangeListener {
33fbe3a78d84 Got the settings stuff compiling (untested).
David Barts <n5jrn@me.com>
parents:
diff changeset
28 /* max queue length */
33fbe3a78d84 Got the settings stuff compiling (untested).
David Barts <n5jrn@me.com>
parents:
diff changeset
29 private val _qLength = _PROPS.getInt("queue.length")
33fbe3a78d84 Got the settings stuff compiling (untested).
David Barts <n5jrn@me.com>
parents:
diff changeset
30 private val _qlSlider = JSlider(10000, 30000, spinToSlide(_qLength)).also {
33fbe3a78d84 Got the settings stuff compiling (untested).
David Barts <n5jrn@me.com>
parents:
diff changeset
31 it.majorTickSpacing = 10000
33fbe3a78d84 Got the settings stuff compiling (untested).
David Barts <n5jrn@me.com>
parents:
diff changeset
32 it.paintTicks = true
33fbe3a78d84 Got the settings stuff compiling (untested).
David Barts <n5jrn@me.com>
parents:
diff changeset
33 it.labelTable = Hashtable<Int, String>().apply {
33fbe3a78d84 Got the settings stuff compiling (untested).
David Barts <n5jrn@me.com>
parents:
diff changeset
34 put(10000, "10")
33fbe3a78d84 Got the settings stuff compiling (untested).
David Barts <n5jrn@me.com>
parents:
diff changeset
35 put(20000, "100")
33fbe3a78d84 Got the settings stuff compiling (untested).
David Barts <n5jrn@me.com>
parents:
diff changeset
36 put(30000, "1000")
33fbe3a78d84 Got the settings stuff compiling (untested).
David Barts <n5jrn@me.com>
parents:
diff changeset
37 }
33fbe3a78d84 Got the settings stuff compiling (untested).
David Barts <n5jrn@me.com>
parents:
diff changeset
38 it.addChangeListener(this)
33fbe3a78d84 Got the settings stuff compiling (untested).
David Barts <n5jrn@me.com>
parents:
diff changeset
39 }
33fbe3a78d84 Got the settings stuff compiling (untested).
David Barts <n5jrn@me.com>
parents:
diff changeset
40 private val _qlSpinner = JSpinner(SpinnerNumberModel(_qLength, 10, 1000, 1)).also {
33fbe3a78d84 Got the settings stuff compiling (untested).
David Barts <n5jrn@me.com>
parents:
diff changeset
41 it.addChangeListener(this)
33fbe3a78d84 Got the settings stuff compiling (untested).
David Barts <n5jrn@me.com>
parents:
diff changeset
42 }
33fbe3a78d84 Got the settings stuff compiling (untested).
David Barts <n5jrn@me.com>
parents:
diff changeset
43 val qLength: Int
33fbe3a78d84 Got the settings stuff compiling (untested).
David Barts <n5jrn@me.com>
parents:
diff changeset
44 get() {
33fbe3a78d84 Got the settings stuff compiling (untested).
David Barts <n5jrn@me.com>
parents:
diff changeset
45 return _qlSpinner.value as Int
33fbe3a78d84 Got the settings stuff compiling (untested).
David Barts <n5jrn@me.com>
parents:
diff changeset
46 }
33fbe3a78d84 Got the settings stuff compiling (untested).
David Barts <n5jrn@me.com>
parents:
diff changeset
47
33fbe3a78d84 Got the settings stuff compiling (untested).
David Barts <n5jrn@me.com>
parents:
diff changeset
48 /* standard spacing between elements (10 pixels ≅ 1/7") and half that */
33fbe3a78d84 Got the settings stuff compiling (untested).
David Barts <n5jrn@me.com>
parents:
diff changeset
49 private val BW = 5
33fbe3a78d84 Got the settings stuff compiling (untested).
David Barts <n5jrn@me.com>
parents:
diff changeset
50 private val BW2 = 10
33fbe3a78d84 Got the settings stuff compiling (untested).
David Barts <n5jrn@me.com>
parents:
diff changeset
51
33fbe3a78d84 Got the settings stuff compiling (untested).
David Barts <n5jrn@me.com>
parents:
diff changeset
52 /* buttons */
33fbe3a78d84 Got the settings stuff compiling (untested).
David Barts <n5jrn@me.com>
parents:
diff changeset
53 private val _ok = JButton("OK").also {
33fbe3a78d84 Got the settings stuff compiling (untested).
David Barts <n5jrn@me.com>
parents:
diff changeset
54 it.actionCommand = "OK"
33fbe3a78d84 Got the settings stuff compiling (untested).
David Barts <n5jrn@me.com>
parents:
diff changeset
55 it.addActionListener(this)
33fbe3a78d84 Got the settings stuff compiling (untested).
David Barts <n5jrn@me.com>
parents:
diff changeset
56 }
33fbe3a78d84 Got the settings stuff compiling (untested).
David Barts <n5jrn@me.com>
parents:
diff changeset
57
33fbe3a78d84 Got the settings stuff compiling (untested).
David Barts <n5jrn@me.com>
parents:
diff changeset
58 private val _cancel = JButton("Cancel").also {
33fbe3a78d84 Got the settings stuff compiling (untested).
David Barts <n5jrn@me.com>
parents:
diff changeset
59 it.actionCommand = "Cancel"
33fbe3a78d84 Got the settings stuff compiling (untested).
David Barts <n5jrn@me.com>
parents:
diff changeset
60 it.addActionListener(this)
33fbe3a78d84 Got the settings stuff compiling (untested).
David Barts <n5jrn@me.com>
parents:
diff changeset
61 }
33fbe3a78d84 Got the settings stuff compiling (untested).
David Barts <n5jrn@me.com>
parents:
diff changeset
62
33fbe3a78d84 Got the settings stuff compiling (untested).
David Barts <n5jrn@me.com>
parents:
diff changeset
63 /* initializer */
33fbe3a78d84 Got the settings stuff compiling (untested).
David Barts <n5jrn@me.com>
parents:
diff changeset
64 init {
33fbe3a78d84 Got the settings stuff compiling (untested).
David Barts <n5jrn@me.com>
parents:
diff changeset
65 title = "Preferences"
33fbe3a78d84 Got the settings stuff compiling (untested).
David Barts <n5jrn@me.com>
parents:
diff changeset
66 contentPane.apply {
33fbe3a78d84 Got the settings stuff compiling (untested).
David Barts <n5jrn@me.com>
parents:
diff changeset
67 add(Box(BoxLayout.Y_AXIS).apply {
33fbe3a78d84 Got the settings stuff compiling (untested).
David Barts <n5jrn@me.com>
parents:
diff changeset
68 add(Box(BoxLayout.Y_AXIS).apply {
33fbe3a78d84 Got the settings stuff compiling (untested).
David Barts <n5jrn@me.com>
parents:
diff changeset
69 alignmentX = Box.CENTER_ALIGNMENT
33fbe3a78d84 Got the settings stuff compiling (untested).
David Barts <n5jrn@me.com>
parents:
diff changeset
70 border = BorderFactory.createEmptyBorder(BW, BW2, BW, BW2)
33fbe3a78d84 Got the settings stuff compiling (untested).
David Barts <n5jrn@me.com>
parents:
diff changeset
71 add(leftLabel("Maximum queue size:"))
33fbe3a78d84 Got the settings stuff compiling (untested).
David Barts <n5jrn@me.com>
parents:
diff changeset
72 add(Box.createVerticalStrut(BW))
33fbe3a78d84 Got the settings stuff compiling (untested).
David Barts <n5jrn@me.com>
parents:
diff changeset
73 add(Box(BoxLayout.X_AXIS).apply {
33fbe3a78d84 Got the settings stuff compiling (untested).
David Barts <n5jrn@me.com>
parents:
diff changeset
74 alignmentX = Box.LEFT_ALIGNMENT
33fbe3a78d84 Got the settings stuff compiling (untested).
David Barts <n5jrn@me.com>
parents:
diff changeset
75 add(Box.createGlue())
33fbe3a78d84 Got the settings stuff compiling (untested).
David Barts <n5jrn@me.com>
parents:
diff changeset
76 add(_qlSlider)
33fbe3a78d84 Got the settings stuff compiling (untested).
David Barts <n5jrn@me.com>
parents:
diff changeset
77 add(Box.createGlue())
33fbe3a78d84 Got the settings stuff compiling (untested).
David Barts <n5jrn@me.com>
parents:
diff changeset
78 add(_qlSpinner)
33fbe3a78d84 Got the settings stuff compiling (untested).
David Barts <n5jrn@me.com>
parents:
diff changeset
79 add(Box.createGlue())
33fbe3a78d84 Got the settings stuff compiling (untested).
David Barts <n5jrn@me.com>
parents:
diff changeset
80 })
33fbe3a78d84 Got the settings stuff compiling (untested).
David Barts <n5jrn@me.com>
parents:
diff changeset
81 })
33fbe3a78d84 Got the settings stuff compiling (untested).
David Barts <n5jrn@me.com>
parents:
diff changeset
82 add(JSeparator())
33fbe3a78d84 Got the settings stuff compiling (untested).
David Barts <n5jrn@me.com>
parents:
diff changeset
83 add(Box(BoxLayout.X_AXIS).apply {
33fbe3a78d84 Got the settings stuff compiling (untested).
David Barts <n5jrn@me.com>
parents:
diff changeset
84 alignmentX = Box.CENTER_ALIGNMENT
33fbe3a78d84 Got the settings stuff compiling (untested).
David Barts <n5jrn@me.com>
parents:
diff changeset
85 border = BorderFactory.createEmptyBorder(BW, BW2, BW, BW2)
33fbe3a78d84 Got the settings stuff compiling (untested).
David Barts <n5jrn@me.com>
parents:
diff changeset
86 add(Box.createGlue())
33fbe3a78d84 Got the settings stuff compiling (untested).
David Barts <n5jrn@me.com>
parents:
diff changeset
87 add(_cancel)
33fbe3a78d84 Got the settings stuff compiling (untested).
David Barts <n5jrn@me.com>
parents:
diff changeset
88 add(Box.createGlue())
33fbe3a78d84 Got the settings stuff compiling (untested).
David Barts <n5jrn@me.com>
parents:
diff changeset
89 add(_ok)
33fbe3a78d84 Got the settings stuff compiling (untested).
David Barts <n5jrn@me.com>
parents:
diff changeset
90 add(Box.createGlue())
33fbe3a78d84 Got the settings stuff compiling (untested).
David Barts <n5jrn@me.com>
parents:
diff changeset
91 })
33fbe3a78d84 Got the settings stuff compiling (untested).
David Barts <n5jrn@me.com>
parents:
diff changeset
92 })
33fbe3a78d84 Got the settings stuff compiling (untested).
David Barts <n5jrn@me.com>
parents:
diff changeset
93 }
33fbe3a78d84 Got the settings stuff compiling (untested).
David Barts <n5jrn@me.com>
parents:
diff changeset
94 rootPane.setDefaultButton(_ok)
33fbe3a78d84 Got the settings stuff compiling (untested).
David Barts <n5jrn@me.com>
parents:
diff changeset
95 pack()
33fbe3a78d84 Got the settings stuff compiling (untested).
David Barts <n5jrn@me.com>
parents:
diff changeset
96 setResizable(false)
33fbe3a78d84 Got the settings stuff compiling (untested).
David Barts <n5jrn@me.com>
parents:
diff changeset
97 }
33fbe3a78d84 Got the settings stuff compiling (untested).
David Barts <n5jrn@me.com>
parents:
diff changeset
98
33fbe3a78d84 Got the settings stuff compiling (untested).
David Barts <n5jrn@me.com>
parents:
diff changeset
99 override fun actionPerformed(e: ActionEvent) {
33fbe3a78d84 Got the settings stuff compiling (untested).
David Barts <n5jrn@me.com>
parents:
diff changeset
100 when (e.actionCommand) {
33fbe3a78d84 Got the settings stuff compiling (untested).
David Barts <n5jrn@me.com>
parents:
diff changeset
101 "OK" -> {
33fbe3a78d84 Got the settings stuff compiling (untested).
David Barts <n5jrn@me.com>
parents:
diff changeset
102 writeProperties()
33fbe3a78d84 Got the settings stuff compiling (untested).
David Barts <n5jrn@me.com>
parents:
diff changeset
103 queue.v.maxSize = qLength
33fbe3a78d84 Got the settings stuff compiling (untested).
David Barts <n5jrn@me.com>
parents:
diff changeset
104 setVisible(false)
33fbe3a78d84 Got the settings stuff compiling (untested).
David Barts <n5jrn@me.com>
parents:
diff changeset
105 }
43
339e2da5bf83 Simplified the settings. Compiles, not tested.
David Barts <n5jrn@me.com>
parents: 41
diff changeset
106 "Cancel" -> {
339e2da5bf83 Simplified the settings. Compiles, not tested.
David Barts <n5jrn@me.com>
parents: 41
diff changeset
107 revertValues()
339e2da5bf83 Simplified the settings. Compiles, not tested.
David Barts <n5jrn@me.com>
parents: 41
diff changeset
108 setVisible(false)
339e2da5bf83 Simplified the settings. Compiles, not tested.
David Barts <n5jrn@me.com>
parents: 41
diff changeset
109 }
41
33fbe3a78d84 Got the settings stuff compiling (untested).
David Barts <n5jrn@me.com>
parents:
diff changeset
110 }
33fbe3a78d84 Got the settings stuff compiling (untested).
David Barts <n5jrn@me.com>
parents:
diff changeset
111 }
33fbe3a78d84 Got the settings stuff compiling (untested).
David Barts <n5jrn@me.com>
parents:
diff changeset
112
33fbe3a78d84 Got the settings stuff compiling (untested).
David Barts <n5jrn@me.com>
parents:
diff changeset
113 override fun stateChanged(e: ChangeEvent) {
33fbe3a78d84 Got the settings stuff compiling (untested).
David Barts <n5jrn@me.com>
parents:
diff changeset
114 when (val source = e.source) {
33fbe3a78d84 Got the settings stuff compiling (untested).
David Barts <n5jrn@me.com>
parents:
diff changeset
115 source === _qlSlider ->
33fbe3a78d84 Got the settings stuff compiling (untested).
David Barts <n5jrn@me.com>
parents:
diff changeset
116 _qlSpinner.value = (10.0).pow(_qlSlider.value.toDouble() / 10000.0).roundToInt()
33fbe3a78d84 Got the settings stuff compiling (untested).
David Barts <n5jrn@me.com>
parents:
diff changeset
117 source === _qlSpinner ->
33fbe3a78d84 Got the settings stuff compiling (untested).
David Barts <n5jrn@me.com>
parents:
diff changeset
118 _qlSlider.value = spinToSlide(_qlSpinner.value as Int)
33fbe3a78d84 Got the settings stuff compiling (untested).
David Barts <n5jrn@me.com>
parents:
diff changeset
119 }
33fbe3a78d84 Got the settings stuff compiling (untested).
David Barts <n5jrn@me.com>
parents:
diff changeset
120 }
33fbe3a78d84 Got the settings stuff compiling (untested).
David Barts <n5jrn@me.com>
parents:
diff changeset
121
33fbe3a78d84 Got the settings stuff compiling (untested).
David Barts <n5jrn@me.com>
parents:
diff changeset
122 private fun spinToSlide(value: Int): Int =
33fbe3a78d84 Got the settings stuff compiling (untested).
David Barts <n5jrn@me.com>
parents:
diff changeset
123 (log10(value.toDouble()) * 10000.0).roundToInt()
33fbe3a78d84 Got the settings stuff compiling (untested).
David Barts <n5jrn@me.com>
parents:
diff changeset
124
33fbe3a78d84 Got the settings stuff compiling (untested).
David Barts <n5jrn@me.com>
parents:
diff changeset
125 private fun leftLabel(text: String) = JLabel(text).apply {
33fbe3a78d84 Got the settings stuff compiling (untested).
David Barts <n5jrn@me.com>
parents:
diff changeset
126 alignmentX = JLabel.LEFT_ALIGNMENT
33fbe3a78d84 Got the settings stuff compiling (untested).
David Barts <n5jrn@me.com>
parents:
diff changeset
127 }
33fbe3a78d84 Got the settings stuff compiling (untested).
David Barts <n5jrn@me.com>
parents:
diff changeset
128
43
339e2da5bf83 Simplified the settings. Compiles, not tested.
David Barts <n5jrn@me.com>
parents: 41
diff changeset
129 private fun revertValues()
41
33fbe3a78d84 Got the settings stuff compiling (untested).
David Barts <n5jrn@me.com>
parents:
diff changeset
130 {
33fbe3a78d84 Got the settings stuff compiling (untested).
David Barts <n5jrn@me.com>
parents:
diff changeset
131 val ql = _PROPS.getInt("queue.length")
33fbe3a78d84 Got the settings stuff compiling (untested).
David Barts <n5jrn@me.com>
parents:
diff changeset
132 _qlSpinner.value = ql
33fbe3a78d84 Got the settings stuff compiling (untested).
David Barts <n5jrn@me.com>
parents:
diff changeset
133 _qlSlider.value = spinToSlide(ql)
33fbe3a78d84 Got the settings stuff compiling (untested).
David Barts <n5jrn@me.com>
parents:
diff changeset
134 }
33fbe3a78d84 Got the settings stuff compiling (untested).
David Barts <n5jrn@me.com>
parents:
diff changeset
135
33fbe3a78d84 Got the settings stuff compiling (untested).
David Barts <n5jrn@me.com>
parents:
diff changeset
136 private fun writeProperties()
33fbe3a78d84 Got the settings stuff compiling (untested).
David Barts <n5jrn@me.com>
parents:
diff changeset
137 {
33fbe3a78d84 Got the settings stuff compiling (untested).
David Barts <n5jrn@me.com>
parents:
diff changeset
138 try {
33fbe3a78d84 Got the settings stuff compiling (untested).
David Barts <n5jrn@me.com>
parents:
diff changeset
139 BufferedWriter(OutputStreamWriter(FileOutputStream(PROP_FILE), CHARSET)).use {
33fbe3a78d84 Got the settings stuff compiling (untested).
David Barts <n5jrn@me.com>
parents:
diff changeset
140 _PROPS.put("queue.length", qLength.toString())
33fbe3a78d84 Got the settings stuff compiling (untested).
David Barts <n5jrn@me.com>
parents:
diff changeset
141 _PROPS.store(it, null)
33fbe3a78d84 Got the settings stuff compiling (untested).
David Barts <n5jrn@me.com>
parents:
diff changeset
142 }
33fbe3a78d84 Got the settings stuff compiling (untested).
David Barts <n5jrn@me.com>
parents:
diff changeset
143 } catch (e: IOException) {
33fbe3a78d84 Got the settings stuff compiling (untested).
David Barts <n5jrn@me.com>
parents:
diff changeset
144 LOGGER.log(Level.WARNING, "IOException writing properties file")
33fbe3a78d84 Got the settings stuff compiling (untested).
David Barts <n5jrn@me.com>
parents:
diff changeset
145 val message = e.message
33fbe3a78d84 Got the settings stuff compiling (untested).
David Barts <n5jrn@me.com>
parents:
diff changeset
146 if (message != null && !message.isEmpty()) {
33fbe3a78d84 Got the settings stuff compiling (untested).
David Barts <n5jrn@me.com>
parents:
diff changeset
147 LOGGER.log(Level.WARNING, message)
33fbe3a78d84 Got the settings stuff compiling (untested).
David Barts <n5jrn@me.com>
parents:
diff changeset
148 }
33fbe3a78d84 Got the settings stuff compiling (untested).
David Barts <n5jrn@me.com>
parents:
diff changeset
149 JOptionPane.showMessageDialog(frame.v,
33fbe3a78d84 Got the settings stuff compiling (untested).
David Barts <n5jrn@me.com>
parents:
diff changeset
150 "Unable to write settings.",
33fbe3a78d84 Got the settings stuff compiling (untested).
David Barts <n5jrn@me.com>
parents:
diff changeset
151 "Error",
33fbe3a78d84 Got the settings stuff compiling (untested).
David Barts <n5jrn@me.com>
parents:
diff changeset
152 JOptionPane.ERROR_MESSAGE)
33fbe3a78d84 Got the settings stuff compiling (untested).
David Barts <n5jrn@me.com>
parents:
diff changeset
153 }
33fbe3a78d84 Got the settings stuff compiling (untested).
David Barts <n5jrn@me.com>
parents:
diff changeset
154 }
33fbe3a78d84 Got the settings stuff compiling (untested).
David Barts <n5jrn@me.com>
parents:
diff changeset
155 }
33fbe3a78d84 Got the settings stuff compiling (untested).
David Barts <n5jrn@me.com>
parents:
diff changeset
156
33fbe3a78d84 Got the settings stuff compiling (untested).
David Barts <n5jrn@me.com>
parents:
diff changeset
157 val settingsDialog = SettingsDialog()
33fbe3a78d84 Got the settings stuff compiling (untested).
David Barts <n5jrn@me.com>
parents:
diff changeset
158
33fbe3a78d84 Got the settings stuff compiling (untested).
David Barts <n5jrn@me.com>
parents:
diff changeset
159 fun Properties.getString(key: String): String = get(key) as String
33fbe3a78d84 Got the settings stuff compiling (untested).
David Barts <n5jrn@me.com>
parents:
diff changeset
160
33fbe3a78d84 Got the settings stuff compiling (untested).
David Barts <n5jrn@me.com>
parents:
diff changeset
161 fun Properties.getInt(key: String): Int = getString(key).toInt()