From 05a0cd98e0e1618e15879817dc125c2b87c5adf6 Mon Sep 17 00:00:00 2001 From: "andrey.daragan" <daragan.andrey@demlabs.net> Date: Fri, 7 Feb 2020 06:26:18 +0000 Subject: [PATCH] Revert "Merge branch 'bugs-3089' into 'develop'" This reverts merge request !110 --- .../desktop/Console/DapConsoleRightPanel.qml | 17 ++++-------- .../Console/DapConsoleRightPanelForm.ui.qml | 2 +- .../desktop/Console/DapConsoleScreen.qml | 12 +++------ .../Console/DapConsoleScreenForm.ui.qml | 27 ++++++------------- 4 files changed, 18 insertions(+), 40 deletions(-) diff --git a/CellFrameDashboardGUI/screen/desktop/Console/DapConsoleRightPanel.qml b/CellFrameDashboardGUI/screen/desktop/Console/DapConsoleRightPanel.qml index 993d7af..45975e5 100644 --- a/CellFrameDashboardGUI/screen/desktop/Console/DapConsoleRightPanel.qml +++ b/CellFrameDashboardGUI/screen/desktop/Console/DapConsoleRightPanel.qml @@ -7,8 +7,6 @@ DapConsoleRightPanelForm property string commandQuery ///@detalis historyQuery Text of command from the command history. property string historyQuery - ///@detalis historyQueryIndex Index of command from the command history. - property string historyQueryIndex ///@detalis historySize Num of history command at right panel. property int historySize: 10 @@ -25,6 +23,7 @@ DapConsoleRightPanelForm //Returns true if item 'someElement' is already exist at list 'someModel'. function findElement(someModel, someElement) { + console.log("someElement.query", someElement.query) for(var i = 0; i < someModel.count; ++i) if(someModel.get(i).query === someElement.query) { @@ -37,28 +36,22 @@ DapConsoleRightPanelForm onCommandQueryChanged: { + console.log("commandQuery", commandQuery) //Adding only new element if(!findElement(modelHistoryConsole, {query: commandQuery})) { if(commandQuery !== "") + { modelHistoryConsole.insert(0, {query: commandQuery}); + } } else modelHistoryConsole.insert(0, {query: commandQuery}); //History is limited by historySize and realized as FIFO if(historySize < modelHistoryConsole.count) - modelHistoryConsole.remove(modelHistoryConsole.count-1); - } - - //Handler for the doubleClick on right history panel - onHistoryQueryIndexChanged: - { - if(historyQueryIndex > -1) { - historyQuery = modelHistoryConsole.get(historyQueryIndex).query; - historyQueryIndex = -1; - historyQuery = "" + modelHistoryConsole.remove(modelHistoryConsole.count-1); } } } diff --git a/CellFrameDashboardGUI/screen/desktop/Console/DapConsoleRightPanelForm.ui.qml b/CellFrameDashboardGUI/screen/desktop/Console/DapConsoleRightPanelForm.ui.qml index 734e06a..cf57d06 100644 --- a/CellFrameDashboardGUI/screen/desktop/Console/DapConsoleRightPanelForm.ui.qml +++ b/CellFrameDashboardGUI/screen/desktop/Console/DapConsoleRightPanelForm.ui.qml @@ -65,7 +65,7 @@ DapAbstractRightPanel { id: historyQueryMouseArea anchors.fill: textCommand - onDoubleClicked: historyQueryIndex = index + onDoubleClicked: historyQuery = textCommand.text } } //It allows to see last element of list by default diff --git a/CellFrameDashboardGUI/screen/desktop/Console/DapConsoleScreen.qml b/CellFrameDashboardGUI/screen/desktop/Console/DapConsoleScreen.qml index 1668bff..c62d0bc 100644 --- a/CellFrameDashboardGUI/screen/desktop/Console/DapConsoleScreen.qml +++ b/CellFrameDashboardGUI/screen/desktop/Console/DapConsoleScreen.qml @@ -19,8 +19,6 @@ DapConsoleScreenForm { //The start point for using history consoleHistoryIndex = modelConsoleCommand.count - //Set focus to console input - consoleInput.forceActiveFocus() } QtObject @@ -77,21 +75,19 @@ DapConsoleScreenForm if(sendedCommand != "") { sendCommand = sendedCommand; - consoleHistoryIndex = modelConsoleCommand.count + 1; + consoleHistoryIndex = modelConsoleCommand.count; runCommand(sendCommand) sendedCommand = ""; currentCommand = sendedCommand; } - } //Send command fron right history panel onHistoryCommandChanged: { sendCommand = historyCommand; - runCommand(sendCommand); - consoleHistoryIndex = modelConsoleCommand.count + 1; - consoleInput.forceActiveFocus(); + runCommand(sendCommand) + consoleHistoryIndex = modelConsoleCommand.count; } //Using KeyUp and KeyDown to serf on console history @@ -101,6 +97,7 @@ DapConsoleScreenForm { if(consoleHistoryIndex >= modelConsoleCommand.count) { + consoleHistoryIndex = modelConsoleCommand.count; currentCommand = ""; return; } @@ -110,5 +107,4 @@ DapConsoleScreenForm currentCommand = modelConsoleCommand.get(consoleHistoryIndex).query; return; } - } diff --git a/CellFrameDashboardGUI/screen/desktop/Console/DapConsoleScreenForm.ui.qml b/CellFrameDashboardGUI/screen/desktop/Console/DapConsoleScreenForm.ui.qml index 8a11636..f2bf41a 100644 --- a/CellFrameDashboardGUI/screen/desktop/Console/DapConsoleScreenForm.ui.qml +++ b/CellFrameDashboardGUI/screen/desktop/Console/DapConsoleScreenForm.ui.qml @@ -16,8 +16,6 @@ DapAbstractScreen property alias currentCommand: consoleCmd.text ///@detalis consoleHistoryIndex Index for using KeyUp and KeyDown to the navigation in console history. property int consoleHistoryIndex - ///@detalis consoleInput Reference to console input area - property alias consoleInput: consoleCmd Rectangle { @@ -28,22 +26,20 @@ DapAbstractScreen anchors.rightMargin: 20 * pt anchors.bottomMargin: 20 * pt + ListView { id: listViewConsoleCommand anchors.top: parent.top anchors.left: parent.left anchors.right: parent.right - height: (contentHeight < consoleRectangle.height - inputCommand.height) ? - contentHeight : - consoleRectangle.height - inputCommand.height + height: (contentHeight < consoleRectangle.height - inputCommand.height) ? contentHeight : consoleRectangle.height - inputCommand.height clip: true model: modelConsoleCommand delegate: delegateConsoleCommand currentIndex: count - 1 highlightFollowsCurrentItem: true highlightRangeMode: ListView.ApplyRange - DapScrollViewHandling { id: scrollHandler @@ -79,20 +75,13 @@ DapAbstractScreen selectByMouse: true focus: true font: themeConsole.inputCommandFont - Keys.onReturnPressed: text.length > 0 ? - sendedCommand = text : - sendedCommand = "" - Keys.onEnterPressed: text.length > 0 ? - sendedCommand = text : - sendedCommand = "" - Keys.onUpPressed: (consoleHistoryIndex > 0) ? - consoleHistoryIndex -= 1 : - null - Keys.onDownPressed: (consoleHistoryIndex < modelConsoleCommand.count) ? - consoleHistoryIndex += 1 : - null - } + Keys.onReturnPressed: text.length > 0 ? sendedCommand = text : sendedCommand = "" + Keys.onEnterPressed: text.length > 0 ? sendedCommand = text : sendedCommand = "" + Keys.onUpPressed: consoleHistoryIndex -= 1 + Keys.onDownPressed: consoleHistoryIndex += 1 + } } + } DapScrollView -- GitLab