Skip to content

Commit 34e4592

Browse files
mrnomuglide
authored andcommitted
Fix shortcuts, update editor toolbar layout
1 parent 5eb53d0 commit 34e4592

File tree

7 files changed

+145
-112
lines changed

7 files changed

+145
-112
lines changed

src/qml/common/SaveToFileButton.qml

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,17 @@ import QtQuick.Layouts 1.1
66
ImageButton {
77
id: root
88
iconSource: "qrc:/images/document.svg"
9-
tooltip: qsTranslate("RDM","Save to File")
9+
tooltip: qsTranslate("RDM","Save to File") + " (" + shortcutText + ")"
1010

1111
property string fileUrl
1212
property string folderUrl
1313
property string path
14+
property string shortcutText: ""
1415

1516

16-
onClicked: {
17+
onClicked: saveToFile()
18+
19+
function saveToFile() {
1720
saveValueToFileDialog.open()
1821
}
1922

src/qml/value-editor/editors/MultilineEditor.qml

Lines changed: 70 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -358,53 +358,65 @@ Item
358358
Layout.preferredWidth: isMultiRow ? 200 : 208
359359
Layout.maximumWidth: isMultiRow ? 200 : 208
360360

361-
visible: showToolBar
361+
visible: showToolBar
362362

363-
Item {
363+
RowLayout {
364364
Layout.fillWidth: true
365-
}
365+
Layout.preferredWidth: 98
366+
367+
ImageButton {
368+
iconSource: "qrc:/images/add.svg"
369+
implicitWidth: imgBtnWidth
370+
implicitHeight: imgBtnHeight
371+
imgWidth: imgBtnWidth
372+
imgHeight: imgBtnHeight
366373

367-
ImageButton {
368-
iconSource: "qrc:/images/add.svg"
369-
implicitWidth: imgBtnWidth
370-
implicitHeight: imgBtnHeight
371-
imgWidth: imgBtnWidth
372-
imgHeight: imgBtnHeight
374+
Layout.alignment: Qt.AlignHCenter
373375

374-
tooltip: qsTranslate("RDM","Add Element to HLL");
375-
visible: keyType === "hyperloglog"
376+
tooltip: qsTranslate("RDM","Add Element to HLL");
377+
visible: keyType === "hyperloglog"
376378

377-
onClicked: {
378-
addRowDialog.open()
379+
onClicked: {
380+
addRowDialog.open()
381+
}
379382
}
380-
}
381383

382-
ImageButton {
383-
iconSource: "qrc:/images/copy.svg"
384-
implicitWidth: imgBtnWidth
385-
implicitHeight: imgBtnHeight
386-
imgWidth: imgBtnWidth
387-
imgHeight: imgBtnHeight
384+
ImageButton {
385+
id: copyValueToClipboardBtn
386+
iconSource: "qrc:/images/copy.svg"
387+
implicitWidth: imgBtnWidth
388+
implicitHeight: imgBtnHeight
389+
imgWidth: imgBtnWidth
390+
imgHeight: imgBtnHeight
391+
392+
Layout.alignment: Qt.AlignHCenter
388393

389-
tooltip: qsTranslate("RDM","Copy to Clipboard")
390-
enabled: root.value !== ""
394+
tooltip: qsTranslate("RDM","Copy to Clipboard")
395+
enabled: root.value !== ""
391396

392-
onClicked: {
393-
if (textView.model) {
394-
qmlUtils.copyToClipboard(textView.model.getText())
397+
onClicked: copyValue()
398+
399+
function copyValue() {
400+
console.log(textView.model)
401+
if (textView.model) {
402+
qmlUtils.copyToClipboard(textView.model.getText())
403+
}
395404
}
396405
}
397-
}
398406

399-
SaveToFileButton {
400-
objectName: "rdm_save_value_to_file_btn"
407+
SaveToFileButton {
408+
id: saveAsBtn
409+
objectName: "rdm_save_value_to_file_btn"
401410

402-
implicitWidth: imgBtnWidth
403-
implicitHeight: imgBtnHeight
404-
imgWidth: imgBtnWidth
405-
imgHeight: imgBtnHeight
411+
Layout.alignment: Qt.AlignHCenter
406412

407-
enabled: root.value !== ""
413+
implicitWidth: imgBtnWidth
414+
implicitHeight: imgBtnHeight
415+
imgWidth: imgBtnWidth
416+
imgHeight: imgBtnHeight
417+
418+
enabled: root.value !== ""
419+
}
408420
}
409421

410422
BetterButton {
@@ -415,11 +427,11 @@ Item
415427
implicitWidth: isMultiRow ? 100 : 105
416428

417429
text: qsTranslate("RDM","Save")
418-
tooltip: qsTranslate("RDM","Save Changes") + " (" + saveBtn.saveShortcut + ")"
430+
tooltip: qsTranslate("RDM","Save Changes") + " (" + shortcutText + ")"
419431
enabled: root.value !== "" && valueEditor.item.isEdited() && keyType != "stream"
420432
visible: showSaveBtn
421433

422-
property string saveShortcut: PlatformUtils.isOSX()? "Meta+S" : "Ctrl+S"
434+
property string shortcutText: ""
423435

424436
onClicked: saveChanges()
425437

@@ -450,11 +462,6 @@ Item
450462
text: ""
451463
visible: false
452464
}
453-
454-
Shortcut {
455-
sequence: StandardKey.Save
456-
onActivated: saveBtn.saveChanges()
457-
}
458465
}
459466

460467
Item {
@@ -515,6 +522,29 @@ Item
515522
root.isEdited = true
516523
textView.model && textView.model.setTextChunk(index, textAreaPart.text)
517524
}
525+
526+
Keys.forwardTo: [saveShortcut, saveAsShortcut]
527+
528+
}
529+
530+
Shortcut {
531+
id: saveShortcut
532+
sequence: StandardKey.Save
533+
onActivated: saveBtn.saveChanges()
534+
535+
Component.onCompleted: {
536+
saveBtn.shortcutText = saveShortcut.nativeText
537+
}
538+
}
539+
540+
Shortcut {
541+
id: saveAsShortcut
542+
sequence: StandardKey.SaveAs
543+
onActivated: saveAsBtn.saveToFile()
544+
545+
Component.onCompleted: {
546+
saveAsBtn.shortcutText = saveAsShortcut.nativeText
547+
}
518548
}
519549
}
520550
}

src/resources/translations/rdm.ts

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -417,7 +417,7 @@
417417
</message>
418418
<message>
419419
<location filename="../../qml/value-editor/ValueTabs.qml" line="575"/>
420-
<location filename="../../qml/value-editor/editors/MultilineEditor.qml" line="374"/>
420+
<location filename="../../qml/value-editor/editors/MultilineEditor.qml" line="376"/>
421421
<source>Add Element to HLL</source>
422422
<translation type="unfinished"></translation>
423423
</message>
@@ -453,17 +453,17 @@
453453
<translation type="unfinished"></translation>
454454
</message>
455455
<message>
456-
<location filename="../../qml/value-editor/editors/MultilineEditor.qml" line="428"/>
456+
<location filename="../../qml/value-editor/editors/MultilineEditor.qml" line="440"/>
457457
<source>Nothing to save</source>
458458
<translation type="unfinished"></translation>
459459
</message>
460460
<message>
461-
<location filename="../../qml/value-editor/editors/MultilineEditor.qml" line="442"/>
461+
<location filename="../../qml/value-editor/editors/MultilineEditor.qml" line="454"/>
462462
<source>Value was updated!</source>
463463
<translation type="unfinished"></translation>
464464
</message>
465465
<message>
466-
<location filename="../../qml/value-editor/editors/MultilineEditor.qml" line="449"/>
466+
<location filename="../../qml/value-editor/editors/MultilineEditor.qml" line="461"/>
467467
<source>Save value</source>
468468
<translation type="unfinished"></translation>
469469
</message>
@@ -855,8 +855,8 @@
855855
<location filename="../../qml/ConnectionSettignsDialog.qml" line="555"/>
856856
<location filename="../../qml/GlobalSettings.qml" line="217"/>
857857
<location filename="../../qml/QuickStartDialog.qml" line="61"/>
858-
<location filename="../../qml/common/SaveToFileButton.qml" line="105"/>
859-
<location filename="../../qml/value-editor/editors/MultilineEditor.qml" line="538"/>
858+
<location filename="../../qml/common/SaveToFileButton.qml" line="108"/>
859+
<location filename="../../qml/value-editor/editors/MultilineEditor.qml" line="568"/>
860860
<source>OK</source>
861861
<translation type="unfinished"></translation>
862862
</message>
@@ -1303,7 +1303,7 @@
13031303
<message>
13041304
<location filename="../../qml/common/BetterDialog.qml" line="25"/>
13051305
<location filename="../../qml/value-editor/AddKeyDialog.qml" line="68"/>
1306-
<location filename="../../qml/value-editor/editors/MultilineEditor.qml" line="417"/>
1306+
<location filename="../../qml/value-editor/editors/MultilineEditor.qml" line="429"/>
13071307
<source>Save</source>
13081308
<translation type="unfinished"></translation>
13091309
</message>
@@ -1344,22 +1344,22 @@
13441344
<translation type="unfinished"></translation>
13451345
</message>
13461346
<message>
1347-
<location filename="../../qml/value-editor/editors/MultilineEditor.qml" line="389"/>
1347+
<location filename="../../qml/value-editor/editors/MultilineEditor.qml" line="394"/>
13481348
<source>Copy to Clipboard</source>
13491349
<translation type="unfinished"></translation>
13501350
</message>
13511351
<message>
1352-
<location filename="../../qml/value-editor/editors/MultilineEditor.qml" line="418"/>
1352+
<location filename="../../qml/value-editor/editors/MultilineEditor.qml" line="430"/>
13531353
<source>Save Changes</source>
13541354
<translation type="unfinished"></translation>
13551355
</message>
13561356
<message>
1357-
<location filename="../../qml/value-editor/editors/MultilineEditor.qml" line="534"/>
1357+
<location filename="../../qml/value-editor/editors/MultilineEditor.qml" line="564"/>
13581358
<source>Binary value is too large to display</source>
13591359
<translation type="unfinished"></translation>
13601360
</message>
13611361
<message>
1362-
<location filename="../../qml/value-editor/editors/MultilineEditor.qml" line="546"/>
1362+
<location filename="../../qml/value-editor/editors/MultilineEditor.qml" line="576"/>
13631363
<source>Save value to file: </source>
13641364
<translation type="unfinished"></translation>
13651365
</message>
@@ -1460,17 +1460,17 @@
14601460
<translation type="unfinished"></translation>
14611461
</message>
14621462
<message>
1463-
<location filename="../../qml/common/SaveToFileButton.qml" line="22"/>
1463+
<location filename="../../qml/common/SaveToFileButton.qml" line="25"/>
14641464
<source>Save Value</source>
14651465
<translation type="unfinished"></translation>
14661466
</message>
14671467
<message>
1468-
<location filename="../../qml/common/SaveToFileButton.qml" line="41"/>
1468+
<location filename="../../qml/common/SaveToFileButton.qml" line="44"/>
14691469
<source>Save value to file</source>
14701470
<translation type="unfinished"></translation>
14711471
</message>
14721472
<message>
1473-
<location filename="../../qml/common/SaveToFileButton.qml" line="62"/>
1473+
<location filename="../../qml/common/SaveToFileButton.qml" line="65"/>
14741474
<source>Value was saved to file:</source>
14751475
<translation type="unfinished"></translation>
14761476
</message>

src/resources/translations/rdm_es_ES.ts

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -463,7 +463,7 @@
463463
</message>
464464
<message>
465465
<location filename="../../qml/value-editor/ValueTabs.qml" line="575"/>
466-
<location filename="../../qml/value-editor/editors/MultilineEditor.qml" line="374"/>
466+
<location filename="../../qml/value-editor/editors/MultilineEditor.qml" line="376"/>
467467
<source>Add Element to HLL</source>
468468
<translation>Añadir Elemento a HLL</translation>
469469
</message>
@@ -503,17 +503,17 @@
503503
<translation type="vanished">Buscar en Todos los valores</translation>
504504
</message>
505505
<message>
506-
<location filename="../../qml/value-editor/editors/MultilineEditor.qml" line="428"/>
506+
<location filename="../../qml/value-editor/editors/MultilineEditor.qml" line="440"/>
507507
<source>Nothing to save</source>
508508
<translation>Nada que gurdar</translation>
509509
</message>
510510
<message>
511-
<location filename="../../qml/value-editor/editors/MultilineEditor.qml" line="442"/>
511+
<location filename="../../qml/value-editor/editors/MultilineEditor.qml" line="454"/>
512512
<source>Value was updated!</source>
513513
<translation>¡Valor actualizado!</translation>
514514
</message>
515515
<message>
516-
<location filename="../../qml/value-editor/editors/MultilineEditor.qml" line="449"/>
516+
<location filename="../../qml/value-editor/editors/MultilineEditor.qml" line="461"/>
517517
<source>Save value</source>
518518
<translation>Guardar valor</translation>
519519
</message>
@@ -963,8 +963,8 @@
963963
<location filename="../../qml/ConnectionSettignsDialog.qml" line="555"/>
964964
<location filename="../../qml/GlobalSettings.qml" line="217"/>
965965
<location filename="../../qml/QuickStartDialog.qml" line="61"/>
966-
<location filename="../../qml/common/SaveToFileButton.qml" line="105"/>
967-
<location filename="../../qml/value-editor/editors/MultilineEditor.qml" line="538"/>
966+
<location filename="../../qml/common/SaveToFileButton.qml" line="108"/>
967+
<location filename="../../qml/value-editor/editors/MultilineEditor.qml" line="568"/>
968968
<source>OK</source>
969969
<translation>OK</translation>
970970
</message>
@@ -1503,7 +1503,7 @@
15031503
<message>
15041504
<location filename="../../qml/common/BetterDialog.qml" line="25"/>
15051505
<location filename="../../qml/value-editor/AddKeyDialog.qml" line="68"/>
1506-
<location filename="../../qml/value-editor/editors/MultilineEditor.qml" line="417"/>
1506+
<location filename="../../qml/value-editor/editors/MultilineEditor.qml" line="429"/>
15071507
<source>Save</source>
15081508
<translation>Guardar</translation>
15091509
</message>
@@ -1548,22 +1548,22 @@
15481548
<translation> [Comprimido: </translation>
15491549
</message>
15501550
<message>
1551-
<location filename="../../qml/value-editor/editors/MultilineEditor.qml" line="389"/>
1551+
<location filename="../../qml/value-editor/editors/MultilineEditor.qml" line="394"/>
15521552
<source>Copy to Clipboard</source>
15531553
<translation>Copiar al Portapapeles</translation>
15541554
</message>
15551555
<message>
1556-
<location filename="../../qml/value-editor/editors/MultilineEditor.qml" line="418"/>
1556+
<location filename="../../qml/value-editor/editors/MultilineEditor.qml" line="430"/>
15571557
<source>Save Changes</source>
15581558
<translation type="unfinished"></translation>
15591559
</message>
15601560
<message>
1561-
<location filename="../../qml/value-editor/editors/MultilineEditor.qml" line="534"/>
1561+
<location filename="../../qml/value-editor/editors/MultilineEditor.qml" line="564"/>
15621562
<source>Binary value is too large to display</source>
15631563
<translation type="unfinished"></translation>
15641564
</message>
15651565
<message>
1566-
<location filename="../../qml/value-editor/editors/MultilineEditor.qml" line="546"/>
1566+
<location filename="../../qml/value-editor/editors/MultilineEditor.qml" line="576"/>
15671567
<source>Save value to file: </source>
15681568
<translation type="unfinished"></translation>
15691569
</message>
@@ -1672,17 +1672,17 @@
16721672
<translation type="unfinished"></translation>
16731673
</message>
16741674
<message>
1675-
<location filename="../../qml/common/SaveToFileButton.qml" line="22"/>
1675+
<location filename="../../qml/common/SaveToFileButton.qml" line="25"/>
16761676
<source>Save Value</source>
16771677
<translation type="unfinished"></translation>
16781678
</message>
16791679
<message>
1680-
<location filename="../../qml/common/SaveToFileButton.qml" line="41"/>
1680+
<location filename="../../qml/common/SaveToFileButton.qml" line="44"/>
16811681
<source>Save value to file</source>
16821682
<translation type="unfinished"></translation>
16831683
</message>
16841684
<message>
1685-
<location filename="../../qml/common/SaveToFileButton.qml" line="62"/>
1685+
<location filename="../../qml/common/SaveToFileButton.qml" line="65"/>
16861686
<source>Value was saved to file:</source>
16871687
<translation type="unfinished"></translation>
16881688
</message>

0 commit comments

Comments
 (0)