Skip to content

Commit 9a73eb4

Browse files
committed
Add full screen mode for value editor and treeview toggle
1 parent 05fa28f commit 9a73eb4

File tree

10 files changed

+162
-40
lines changed

10 files changed

+162
-40
lines changed

src/qml/AppToolBar.qml

Lines changed: 35 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import QtQuick 2.0
22
import QtQuick.Layouts 1.1
3-
import QtQuick.Controls 2.13
3+
import QtQuick.Controls 2.15
44
import QtQuick.Controls.Styles 1.1
55
import QtQuick.Dialogs 1.2
66
import QtQml.Models 2.2
@@ -24,7 +24,7 @@ ToolBar {
2424
BetterButton {
2525
Layout.fillWidth: true
2626
Layout.minimumWidth: 190
27-
iconSource: "qrc:/images/add.svg"
27+
iconSource: "qrc:/images/plus.svg"
2828
text: qsTranslate("RESP","Connect to Redis Server")
2929
objectName: "rdm_connect_to_redis_server_btn"
3030

@@ -34,14 +34,13 @@ ToolBar {
3434
}
3535
}
3636

37-
BetterButton {
38-
Layout.fillWidth: true
39-
iconSource: "qrc:/images/import.svg"
40-
text: width < 100 ? "" : qsTranslate("RESP","Import")
41-
tooltip: qsTranslate("RESP","Import Connections")
42-
objectName: "rdm_import_connections_btn"
4337

44-
onClicked: importConnectionsDialog.open()
38+
ImageButton {
39+
id: connectionsMenuBtn
40+
Layout.preferredWidth: 30
41+
iconSource: "qrc:/images/list.svg"
42+
43+
onClicked: menu.open()
4544

4645
FileDialog {
4746
id: importConnectionsDialog
@@ -50,16 +49,6 @@ ToolBar {
5049
selectExisting: true
5150
onAccepted: connectionsManager.importConnections(qmlUtils.getPathFromUrl(fileUrl))
5251
}
53-
}
54-
55-
BetterButton {
56-
Layout.fillWidth: true
57-
iconSource: "qrc:/images/export.svg"
58-
text: width < 100 ? "" : qsTranslate("RESP","Export")
59-
tooltip: qsTranslate("RESP","Export Connections")
60-
objectName: "rdm_export_connections_btn"
61-
62-
onClicked: exportConnectionsDialog.open()
6352

6453
FileDialog {
6554
id: exportConnectionsDialog
@@ -68,6 +57,33 @@ ToolBar {
6857
selectExisting: false
6958
onAccepted: connectionsManager.saveConnectionsConfigToFile(qmlUtils.getPathFromUrl(fileUrl))
7059
}
60+
61+
Menu {
62+
id: menu
63+
64+
MenuItem {
65+
objectName: "rdm_import_connections_btn"
66+
text: qsTranslate("RDM","Import Connections")
67+
onTriggered: importConnectionsDialog.open()
68+
}
69+
MenuItem {
70+
objectName: "rdm_export_connections_btn"
71+
text: qsTranslate("RDM","Export Connections")
72+
onTriggered: exportConnectionsDialog.open()
73+
}
74+
}
75+
}
76+
77+
ImageButton {
78+
id: toggleTreeViewBtn
79+
Layout.preferredWidth: 30
80+
iconSource: "qrc:/images/square-half.svg"
81+
imgWidth: 15
82+
imgHeight: 15
83+
84+
onClicked: {
85+
connectionsTreeWrapper.visible = !connectionsTreeWrapper.visible
86+
}
7187
}
7288
}
7389

src/qml/app.qml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -278,6 +278,7 @@ ApplicationWindow {
278278
header: AppToolBar {}
279279

280280
Rectangle {
281+
id: appWrapper
281282
anchors.fill: parent
282283
color: sysPalette.base
283284
border.color: sysPalette.mid
@@ -290,6 +291,7 @@ ApplicationWindow {
290291
orientation: Qt.Horizontal
291292

292293
ColumnLayout {
294+
id: connectionsTreeWrapper
293295
SplitView.fillHeight: true
294296
SplitView.minimumWidth: 404
295297
SplitView.minimumHeight: 500

src/qml/value-editor/ValueTabs.qml

Lines changed: 85 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -339,30 +339,92 @@ Repeater {
339339
}
340340

341341
// Value editor
342-
ColumnLayout {
342+
Item {
343343
id: editorWrapper
344+
344345
SplitView.fillWidth: true
345346
SplitView.fillHeight: !isMultiRow
346347
Layout.topMargin: 20
347348
SplitView.minimumHeight: 220
348-
spacing: 10
349349

350-
Loader {
351-
id: valueEditor
352-
objectName: "rdm_value_editor_loader"
350+
BetterDialog {
351+
id: fullScreenEditorDialog
352+
title: tabName
353+
354+
width: approot.width * 0.9
355+
height: approot.height * 0.9
356+
footer: null
353357

354-
Layout.topMargin: 5
355-
Layout.fillWidth: true
356-
Layout.fillHeight: true
357-
Layout.minimumHeight: 180
358+
Rectangle {
359+
id: fullscreenEditorParent
358360

359-
Component.onCompleted: {
360-
keyTab.valueEditor = valueEditor
361+
anchors.fill: parent
362+
implicitHeight: 500
363+
implicitWidth: 800
361364
}
362365

363-
property int currentRow: -1
366+
onClosed: {
367+
editor.state = "default"
368+
}
369+
}
370+
371+
Rectangle {
372+
id: editor
373+
anchors.fill: parent
374+
375+
color: sysPalette.base
376+
377+
state: "default"
378+
379+
states: [
380+
State {
381+
name: "full_screen"
382+
ParentChange { target: editor; parent: fullscreenEditorParent;}
383+
PropertyChanges {
384+
target: fullScreenEditorDialog
385+
visible: true
386+
}
387+
PropertyChanges {
388+
target: fullScreenModeBtn
389+
visible: false
390+
}
391+
},
392+
State {
393+
name: "default"
394+
ParentChange { target: editor; parent: editorWrapper; }
395+
PropertyChanges {
396+
target: fullScreenEditorDialog
397+
visible: false
398+
}
399+
PropertyChanges {
400+
target: fullScreenModeBtn
401+
visible: true
402+
}
403+
}
404+
]
405+
406+
ColumnLayout {
407+
id: editorLayout
408+
anchors.fill: parent
409+
anchors.margins: 5
410+
spacing: 10
411+
412+
Loader {
413+
id: valueEditor
414+
objectName: "rdm_value_editor_loader"
415+
416+
Layout.topMargin: 5
417+
Layout.fillWidth: true
418+
Layout.fillHeight: true
419+
Layout.minimumHeight: 180
420+
421+
Component.onCompleted: {
422+
keyTab.valueEditor = valueEditor
423+
}
364424

365-
source: keyTab.keyModel? Editor.getEditorByTypeString(keyType) : ""
425+
property int currentRow: -1
426+
427+
source: keyTab.keyModel? Editor.getEditorByTypeString(keyType) : ""
366428

367429
function loadRowValue(row) {
368430
console.log("loading row value", row)
@@ -377,19 +439,21 @@ Repeater {
377439
}
378440
}
379441

380-
function clear() {
381-
if (valueEditor.item) {
382-
currentRow = -1
442+
function clear() {
443+
if (valueEditor.item) {
444+
currentRow = -1
445+
446+
if (valueEditor.item.keyType !== undefined) {
447+
valueEditor.item.keyType = keyType
448+
}
383449

384-
if (valueEditor.item.keyType !== undefined) {
385-
valueEditor.item.keyType = keyType
450+
valueEditor.item.reset()
451+
}
386452
}
387453

388-
valueEditor.item.reset()
454+
onLoaded: clear()
389455
}
390456
}
391-
392-
onLoaded: clear()
393457
}
394458
}
395459
// Value editor end

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

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -579,6 +579,26 @@ Item
579579
}
580580
}
581581

582+
ImageButton {
583+
id: fullScreenModeBtn
584+
585+
iconSource: editor.state === "default"?
586+
PlatformUtils.getThemeIcon("maximize.svg")
587+
: PlatformUtils.getThemeIcon("minimize.svg")
588+
implicitWidth: imgBtnWidth
589+
implicitHeight: imgBtnHeight
590+
imgWidth: imgBtnWidth * 0.8
591+
imgHeight: imgBtnHeight * 0.8
592+
593+
tooltip: (editor.state === "default"? "" : qsTranslate("RDM","Exit "))
594+
+ qsTranslate("RDM","Full Screen Mode")
595+
596+
onClicked: {
597+
editor.state = editor.state === "default"? "full_screen" : "default"
598+
editor.forceActiveFocus()
599+
}
600+
}
601+
582602
BetterButton {
583603
id: saveBtn
584604
objectName: "rdm_value_editor_save_btn"

src/resources/images.qrc

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,5 +54,10 @@
5454
<file alias="aws_logo_white.svg">images/aws_logo_white.svg</file>
5555
<file alias="azure_logo.svg">images/azure_logo.svg</file>
5656
<file alias="heroku_logo.svg">images/heroku_logo.svg</file>
57+
<file alias="fullscreen.svg">images/fullscreen.svg</file>
58+
<file alias="fullscreen_white.svg">images/fullscreen_white.svg</file>
59+
<file alias="square-half.svg">images/square-half.svg</file>
60+
<file alias="list.svg">images/list.svg</file>
61+
<file alias="plus.svg">images/plus.svg</file>
5762
</qresource>
5863
</RCC>
Lines changed: 3 additions & 0 deletions
Loading
Lines changed: 3 additions & 0 deletions
Loading

src/resources/images/list.svg

Lines changed: 3 additions & 0 deletions
Loading

src/resources/images/plus.svg

Lines changed: 3 additions & 0 deletions
Loading
Lines changed: 3 additions & 0 deletions
Loading

0 commit comments

Comments
 (0)