@@ -26,12 +26,20 @@ export class MonitorModel implements FrontendApplicationContribution {
26
26
protected _timestamp : boolean ;
27
27
protected _lineEnding : MonitorModel . EOL ;
28
28
protected _interpolate : boolean ;
29
+ protected _darkTheme : boolean ;
30
+ protected _wsPort : number ;
31
+ protected _serialPort : string ;
32
+ protected _connected : boolean ;
29
33
30
34
constructor ( ) {
31
35
this . _autoscroll = true ;
32
36
this . _timestamp = false ;
33
37
this . _interpolate = false ;
34
38
this . _lineEnding = MonitorModel . EOL . DEFAULT ;
39
+ this . _darkTheme = false ;
40
+ this . _wsPort = 0 ;
41
+ this . _serialPort = '' ;
42
+ this . _connected = false ;
35
43
36
44
this . onChangeEmitter = new Emitter <
37
45
MonitorModel . State . Change < keyof MonitorModel . State >
@@ -60,6 +68,7 @@ export class MonitorModel implements FrontendApplicationContribution {
60
68
this . _timestamp = state . timestamp ;
61
69
this . _lineEnding = state . lineEnding ;
62
70
this . _interpolate = state . interpolate ;
71
+ this . _serialPort = state . serialPort ;
63
72
}
64
73
65
74
protected async storeState ( ) : Promise < void > {
@@ -68,6 +77,7 @@ export class MonitorModel implements FrontendApplicationContribution {
68
77
timestamp : this . _timestamp ,
69
78
lineEnding : this . _lineEnding ,
70
79
interpolate : this . _interpolate ,
80
+ serialPort : this . _serialPort ,
71
81
} ) ;
72
82
}
73
83
@@ -151,16 +161,94 @@ export class MonitorModel implements FrontendApplicationContribution {
151
161
) ;
152
162
}
153
163
164
+ get darkTheme ( ) : boolean {
165
+ return this . _darkTheme ;
166
+ }
167
+
168
+ set darkTheme ( darkTheme : boolean ) {
169
+ if ( darkTheme === this . _darkTheme ) return ;
170
+ this . _darkTheme = darkTheme ;
171
+ this . monitorManagerProxy . changeSettings ( {
172
+ monitorUISettings : { darkTheme } ,
173
+ } ) ;
174
+ this . onChangeEmitter . fire ( {
175
+ property : 'darkTheme' ,
176
+ value : this . _darkTheme ,
177
+ } ) ;
178
+ }
179
+
180
+ get wsPort ( ) : number {
181
+ return this . _wsPort ;
182
+ }
183
+
184
+ set wsPort ( wsPort : number ) {
185
+ if ( wsPort === this . _wsPort ) return ;
186
+ this . _wsPort = wsPort ;
187
+ this . monitorManagerProxy . changeSettings ( {
188
+ monitorUISettings : { wsPort } ,
189
+ } ) ;
190
+ this . onChangeEmitter . fire ( {
191
+ property : 'wsPort' ,
192
+ value : this . _wsPort ,
193
+ } ) ;
194
+ }
195
+
196
+ get serialPort ( ) : string {
197
+ return this . _serialPort ;
198
+ }
199
+
200
+ set serialPort ( serialPort : string ) {
201
+ if ( serialPort === this . _serialPort ) return ;
202
+ this . _serialPort = serialPort ;
203
+ this . monitorManagerProxy . changeSettings ( {
204
+ monitorUISettings : { serialPort } ,
205
+ } ) ;
206
+ this . storeState ( ) . then ( ( ) =>
207
+ this . onChangeEmitter . fire ( {
208
+ property : 'serialPort' ,
209
+ value : this . _serialPort ,
210
+ } )
211
+ ) ;
212
+ }
213
+
214
+ get connected ( ) : boolean {
215
+ return this . _connected ;
216
+ }
217
+
218
+ set connected ( connected : boolean ) {
219
+ if ( connected === this . _connected ) return ;
220
+ this . _connected = connected ;
221
+ this . monitorManagerProxy . changeSettings ( {
222
+ monitorUISettings : { connected } ,
223
+ } ) ;
224
+ this . onChangeEmitter . fire ( {
225
+ property : 'connected' ,
226
+ value : this . _connected ,
227
+ } ) ;
228
+ }
229
+
154
230
protected onMonitorSettingsDidChange = ( settings : MonitorSettings ) : void => {
155
231
const { monitorUISettings } = settings ;
156
232
if ( ! monitorUISettings ) return ;
157
- const { autoscroll, interpolate, lineEnding, timestamp } =
158
- monitorUISettings ;
233
+ const {
234
+ autoscroll,
235
+ interpolate,
236
+ lineEnding,
237
+ timestamp,
238
+ darkTheme,
239
+ wsPort,
240
+ serialPort,
241
+ connected,
242
+ } = monitorUISettings ;
159
243
160
244
if ( ! isNullOrUndefined ( autoscroll ) ) this . autoscroll = autoscroll ;
161
245
if ( ! isNullOrUndefined ( interpolate ) ) this . interpolate = interpolate ;
162
246
if ( ! isNullOrUndefined ( lineEnding ) ) this . lineEnding = lineEnding ;
163
247
if ( ! isNullOrUndefined ( timestamp ) ) this . timestamp = timestamp ;
248
+ if ( ! isNullOrUndefined ( darkTheme ) ) this . darkTheme = darkTheme ;
249
+ if ( ! isNullOrUndefined ( wsPort ) ) this . wsPort = wsPort ;
250
+ if ( ! isNullOrUndefined ( serialPort ) ) this . serialPort = serialPort ;
251
+ if ( ! isNullOrUndefined ( connected ) ) this . connected = connected ;
164
252
} ;
165
253
}
166
254
@@ -171,6 +259,10 @@ export namespace MonitorModel {
171
259
timestamp : boolean ;
172
260
lineEnding : EOL ;
173
261
interpolate : boolean ;
262
+ darkTheme : boolean ;
263
+ wsPort : number ;
264
+ serialPort : string ;
265
+ connected : boolean ;
174
266
}
175
267
export namespace State {
176
268
export interface Change < K extends keyof State > {
0 commit comments