Skip to content

Commit 2178d57

Browse files
authored
combine note, description textedit (#1055)
1 parent db76bac commit 2178d57

File tree

2 files changed

+19
-44
lines changed

2 files changed

+19
-44
lines changed

console_backend/src/status_bar.rs

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -182,10 +182,12 @@ impl StatusBar {
182182
status_bar_status.set_ins(&sb_update.ins_status);
183183
status_bar_status.set_data_rate(sb_update.data_rate);
184184
status_bar_status.set_solid_connection(sb_update.solid_connection);
185-
status_bar_status.set_title(&format!(
186-
"{} Swift Console {}",
187-
sb_update.port, sb_update.version
188-
));
185+
let port = if sb_update.port.is_empty() {
186+
"".to_string()
187+
} else {
188+
sb_update.port + " - "
189+
};
190+
status_bar_status.set_title(&format!("{port}Swift Console {}", sb_update.version));
189191
client_sender.send_data(serialize_capnproto_builder(builder));
190192
}
191193

resources/SettingsTabComponents/SettingsPane.qml

Lines changed: 13 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -234,59 +234,23 @@ Rectangle {
234234
property string _fieldName: "description"
235235

236236
visible: !!selectedRowField(_fieldName)
237-
Layout.rowSpan: 2
237+
Layout.rowSpan: parents.rows - 8
238238
Layout.columnSpan: 1
239239
Layout.preferredWidth: parent.colWidthLabel
240-
Layout.preferredHeight: isLongTextField(_fieldName) ? 2 * parent.smallRowHeight : parent.smallRowHeight
240+
Layout.preferredHeight: Math.max(1, parent.height - 8 * parent.smallRowHeight)
241241
sourceComponent: settingRowLabel
242242
}
243243

244244
Loader {
245245
property string _fieldName: "description"
246246

247247
visible: !!selectedRowField(_fieldName)
248-
Layout.rowSpan: 2
248+
Layout.rowSpan: parents.rows - 8
249249
Layout.columnSpan: parent.columns - 1
250250
Layout.preferredWidth: parent.colWidthField
251-
Layout.preferredHeight: isLongTextField(_fieldName) ? 2 * parent.smallRowHeight : parent.smallRowHeight
252-
sourceComponent: settingRowText
253-
}
254-
255-
Loader {
256-
property string _title: "Notes"
257-
property string _fieldName: "notes"
258-
259-
visible: !!selectedRowField(_fieldName)
260-
Layout.columnSpan: 1
261-
Layout.rowSpan: parent.rows - 7
262-
Layout.preferredHeight: Math.max(1, parent.height - 7 * parent.smallRowHeight)
263-
Layout.preferredWidth: parent.colWidthLabel
264-
sourceComponent: settingRowLabel
265-
}
266-
267-
Loader {
268-
id: notes
269-
270-
property string _fieldName: "notes"
271-
272-
visible: !!selectedRowField(_fieldName)
273-
Layout.columnSpan: parent.columns - 1
274-
Layout.rowSpan: parent.rows - 8
275251
Layout.preferredHeight: Math.max(1, parent.height - 8 * parent.smallRowHeight)
276-
Layout.preferredWidth: parent.colWidthField
277252
sourceComponent: settingRowText
278253
}
279-
280-
Loader {
281-
property string _fieldName: "notes"
282-
283-
visible: !notes.visible
284-
Layout.columnSpan: parent.columns
285-
Layout.rowSpan: parent.rows - 8
286-
Layout.fillHeight: true
287-
Layout.fillWidth: true
288-
sourceComponent: emptyRow
289-
}
290254
}
291255

292256
ScrollBar.vertical: ScrollBar {
@@ -326,7 +290,16 @@ Rectangle {
326290
anchors.fill: parent
327291

328292
TextEdit {
329-
text: selectedRowField(_fieldName)
293+
text: {
294+
if (_fieldName == "description") {
295+
let desc = selectedRowField("description");
296+
let notes = selectedRowField("notes");
297+
if (notes)
298+
return desc + "\n\nNotes:\n" + notes;
299+
return desc;
300+
}
301+
return selectedRowField(_fieldName);
302+
}
330303
anchors.fill: parent
331304
wrapMode: Text.WordWrap
332305
readOnly: true

0 commit comments

Comments
 (0)