mirror of
https://github.com/redis/RedisDesktopManager.git
synced 2026-10-28 19:17:36 +08:00
@@ -157,6 +157,8 @@ void DatabaseItem::setMetadata(const QString &key, QVariant value)
|
||||
if (key == "filter") {
|
||||
if (!m_filter.isEmpty() && isResetValue)
|
||||
return resetFilter();
|
||||
else if (isResetValue)
|
||||
return;
|
||||
|
||||
QRegExp pattern(value.toString(), Qt::CaseSensitive, QRegExp::PatternSyntax::WildcardUnix);
|
||||
return filterKeys(pattern);
|
||||
|
||||
@@ -78,13 +78,13 @@ TreeView {
|
||||
}
|
||||
|
||||
Loader {
|
||||
id: menuLoader
|
||||
anchors {right: itemRoot.right; top: itemRoot.top; bottom: itemRoot.bottom; }
|
||||
anchors.rightMargin: 20
|
||||
height: parent.height
|
||||
visible: styleData.selected
|
||||
asynchronous: true
|
||||
|
||||
|
||||
source: {
|
||||
if (!styleData.selected
|
||||
|| !connectionsManager
|
||||
@@ -122,6 +122,13 @@ TreeView {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
focus: true
|
||||
Keys.forwardTo: menuLoader.item ? [menuLoader.item] : []
|
||||
|
||||
Component.onCompleted: {
|
||||
forceActiveFocus()
|
||||
}
|
||||
}
|
||||
|
||||
onClicked: {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import QtQuick 2.3
|
||||
import QtQuick 2.5
|
||||
import QtQuick.Layouts 1.1
|
||||
import QtQuick.Controls 1.4
|
||||
import "."
|
||||
@@ -6,6 +6,43 @@ import "."
|
||||
RowLayout {
|
||||
id: root
|
||||
|
||||
property var shortcuts: {
|
||||
'add': Qt.platform.os == "osx"? "Meta+N" : "Ctrl+N",
|
||||
'reload': Qt.platform.os == "osx"? "Meta+R" : "Ctrl+R",
|
||||
'filter': Qt.platform.os == "osx"? "Meta+F" : "Ctrl+F",
|
||||
'live': Qt.platform.os == "osx"? "Meta+L" : "Ctrl+L",
|
||||
}
|
||||
|
||||
function sc(t, a) {
|
||||
return t + " (" + root.shortcuts[a] + ")"
|
||||
}
|
||||
|
||||
Shortcut {
|
||||
sequence: root.shortcuts['add']
|
||||
onActivated: {
|
||||
dbMenu.sendEvent('add_key')
|
||||
}
|
||||
}
|
||||
|
||||
Shortcut {
|
||||
sequence: root.shortcuts['reload']
|
||||
onActivated: {
|
||||
dbMenu.sendEvent('reload')
|
||||
}
|
||||
}
|
||||
|
||||
Shortcut {
|
||||
sequence: root.shortcuts['filter']
|
||||
onActivated: root.state = "filter"
|
||||
}
|
||||
|
||||
Shortcut {
|
||||
sequence: root.shortcuts['live']
|
||||
onActivated: {
|
||||
liveButton.processClick()
|
||||
}
|
||||
}
|
||||
|
||||
state: "menu"
|
||||
|
||||
states: [
|
||||
@@ -40,7 +77,7 @@ RowLayout {
|
||||
}
|
||||
|
||||
ToolButton {
|
||||
tooltip: qsTr("Open Keys Filter")
|
||||
tooltip: sc(qsTr("Open Keys Filter"), 'filter')
|
||||
iconSource: "qrc:/images/filter.png"
|
||||
|
||||
Layout.preferredWidth: 25
|
||||
@@ -50,7 +87,7 @@ RowLayout {
|
||||
}
|
||||
|
||||
ToolButton {
|
||||
tooltip: qsTr("Reload Keys in Database")
|
||||
tooltip: sc(qsTr("Reload Keys in Database"), 'reload')
|
||||
iconSource: "qrc:/images/refresh.png"
|
||||
|
||||
Layout.preferredWidth: 25
|
||||
@@ -60,7 +97,7 @@ RowLayout {
|
||||
}
|
||||
|
||||
ToolButton {
|
||||
tooltip: qsTr("Add New Key")
|
||||
tooltip: sc(qsTr("Add New Key"), 'add')
|
||||
iconSource: "qrc:/images/add.png"
|
||||
|
||||
Layout.preferredWidth: 25
|
||||
@@ -70,14 +107,18 @@ RowLayout {
|
||||
}
|
||||
|
||||
ToolButton {
|
||||
id: liveButton
|
||||
|
||||
property bool liveUpdateEnabled: false
|
||||
tooltip: liveUpdateEnabled? qsTr("Disable Live Update") : qsTr("Enable Live Update")
|
||||
tooltip: liveUpdateEnabled? qsTr("Disable Live Update") : sc(qsTr("Enable Live Update"), 'live')
|
||||
iconSource: liveUpdateEnabled? "qrc:/images/live_update_disable.png" : "qrc:/images/live_update.png"
|
||||
|
||||
Layout.preferredWidth: 25
|
||||
Layout.preferredHeight: 25
|
||||
|
||||
onClicked: {
|
||||
onClicked: processClick()
|
||||
|
||||
function processClick() {
|
||||
if (liveUpdateEnabled) {
|
||||
connectionsManager.setMetadata(styleData.index, "live_update", false)
|
||||
} else {
|
||||
@@ -125,6 +166,7 @@ RowLayout {
|
||||
ToolButton {
|
||||
id: filterHelp
|
||||
iconSource: "qrc:/images/help.png"
|
||||
onClicked: Qt.openUrlExternally("https://github.com/uglide/RedisDesktopManager/wiki/Features#Filter")
|
||||
}
|
||||
|
||||
ToolButton {
|
||||
|
||||
@@ -1,16 +1,70 @@
|
||||
import QtQuick 2.3
|
||||
import QtQuick 2.5
|
||||
import QtQuick.Layouts 1.1
|
||||
import QtQuick.Controls 1.4
|
||||
import "."
|
||||
|
||||
RowLayout {
|
||||
id: root
|
||||
|
||||
property var shortcuts: {
|
||||
'console': Qt.platform.os == "osx"? "Meta+T" : "Ctrl+T",
|
||||
'reload': Qt.platform.os == "osx"? "Meta+R" : "Ctrl+R",
|
||||
'unload': Qt.platform.os == "osx"? "Meta+U" : "Ctrl+U",
|
||||
'edit': Qt.platform.os == "osx"? "Meta+E" : "Ctrl+E",
|
||||
'delete': Qt.platform.os == "osx"? "Meta+Del" : "Ctrl+Del",
|
||||
}
|
||||
|
||||
function sc(t, a) {
|
||||
return t + " (" + root.shortcuts[a] + ")"
|
||||
}
|
||||
|
||||
InlineMenu {
|
||||
id: serverMenu
|
||||
model: [
|
||||
{'icon': "qrc:/images/console.png", 'event': 'console', "help": qsTr("Open Console")},
|
||||
{'icon': "qrc:/images/refresh.png", 'event': 'reload', "help": qsTr("Reload Server")},
|
||||
{'icon': "qrc:/images/offline.png", 'event': 'unload', "help": qsTr("Unload All Data")},
|
||||
{'icon': "qrc:/images/editdb.png", 'event': 'edit', "help": qsTr("Edit Connection Settings")},
|
||||
{'icon': "qrc:/images/delete.png", 'event': 'delete', "help": qsTr("Delete Connection")},
|
||||
{'icon': "qrc:/images/console.png", 'event': 'console', "help": sc(qsTr("Open Console"), 'console')},
|
||||
{'icon': "qrc:/images/refresh.png", 'event': 'reload', "help": sc(qsTr("Reload Server"), 'reload')},
|
||||
{'icon': "qrc:/images/offline.png", 'event': 'unload', "help": sc(qsTr("Unload All Data"), 'unload')},
|
||||
{'icon': "qrc:/images/editdb.png", 'event': 'edit', "help": sc(qsTr("Edit Connection Settings"), 'edit')},
|
||||
{'icon': "qrc:/images/delete.png", 'event': 'delete', "help": sc(qsTr("Delete Connection"), 'delete')},
|
||||
]
|
||||
}
|
||||
|
||||
Keys.onPressed: {
|
||||
console.log("Works!")
|
||||
}
|
||||
|
||||
Shortcut {
|
||||
sequence: root.shortcuts['console']
|
||||
onActivated: {
|
||||
serverMenu.sendEvent('console')
|
||||
}
|
||||
}
|
||||
|
||||
Shortcut {
|
||||
sequence: root.shortcuts['reload']
|
||||
onActivated: {
|
||||
serverMenu.sendEvent('reload')
|
||||
}
|
||||
}
|
||||
|
||||
Shortcut {
|
||||
sequence: root.shortcuts['unload']
|
||||
onActivated: {
|
||||
serverMenu.sendEvent('unload')
|
||||
}
|
||||
}
|
||||
|
||||
Shortcut {
|
||||
sequence: root.shortcuts['edit']
|
||||
onActivated: {
|
||||
serverMenu.sendEvent('edit')
|
||||
}
|
||||
}
|
||||
|
||||
Shortcut {
|
||||
sequence: root.shortcuts['delete']
|
||||
onActivated: {
|
||||
serverMenu.sendEvent('delete')
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user