Commit da18924f authored by Ming Rui Zhang's avatar Ming Rui Zhang Committed by Sébastien Blin
Browse files

misc: add KeyboardShortcutTable back

Change-Id: Iee0e9c955b426de4a7d757a3bc892287761265ca
parent 1b259f9a
......@@ -173,5 +173,9 @@
<file>src/commoncomponents/JamiFlickable.qml</file>
<file>src/AccountMigrationView.qml</file>
<file>src/settingsview/js/logviewwindowcreation.js</file>
<file>src/mainview/js/keyboardshortcuttablecreation.js</file>
<file>src/mainview/components/KeyboardShortcutTable.qml</file>
<file>src/mainview/components/KeyboardShortcutKeyDelegate.qml</file>
<file>src/mainview/components/KeyboardShortcutTabButton.qml</file>
</qresource>
</RCC>
......@@ -418,6 +418,13 @@ Item {
// Recording Settings
property string tipRecordFolder: qsTr("Select a record directory")
// KeyboardShortCutTable
property string keyboardShortcutTableWindowTitle: qsTr("Keyboard Shortcut Table")
property string generalKeyboardShortcuts: qsTr("General")
property string conversationKeyboardShortcuts: qsTr("Conversation")
property string callKeyboardShortcuts: qsTr("Call")
property string settingsKeyboardShortcuts: qsTr("Settings")
// View Logs
property string logsViewTitle: qsTr("Debug")
property string logsViewShowStats: qsTr("Show Stats")
......
......@@ -346,6 +346,11 @@ Item {
// JamiScrollBar
property int scrollBarHandleSize: 6
//KeyboardShortcutTable
property int titleRectMargin: 25
property int keyboardShortcutTabBarSize: 24
property int keyboardShortcutDelegateSize: 50
// Main application spec
property real mainViewMinWidth: 332
property real mainViewMinHeight: 500
......
......@@ -31,6 +31,8 @@ import "../wizardview"
import "../settingsview"
import "../settingsview/components"
import "js/keyboardshortcuttablecreation.js" as KeyboardShortcutTableCreation
Rectangle {
id: mainView
......@@ -514,6 +516,15 @@ Rectangle {
}
}
Shortcut {
sequence: "F10"
context: Qt.ApplicationShortcut
onActivated: {
KeyboardShortcutTableCreation.createKeyboardShortcutTableWindowObject()
KeyboardShortcutTableCreation.showKeyboardShortcutTableWindow()
}
}
Shortcut {
sequence: "F11"
context: Qt.ApplicationShortcut
......
/*
* Copyright (C) 2020 by Savoir-faire Linux
* Author: Mingrui Zhang <mingrui.zhang@savoirfairelinux.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
import QtQuick
import QtQuick.Layouts
import net.jami.Constants 1.1
RowLayout {
id: root
Rectangle {
id: descriptionTextRect
Layout.alignment: Qt.AlignVCenter | Qt.AlignLeft
Layout.preferredHeight: descriptionText.contentHeight + 10
Layout.preferredWidth: descriptionText.contentWidth + 10
Layout.leftMargin: 10
color: JamiTheme.transparentColor
Text {
id: descriptionText
anchors.centerIn: parent
text: description
font.pointSize: JamiTheme.textFontSize
font.weight: Font.Bold
color: JamiTheme.textColor
}
}
Rectangle {
id: shortcutTextRect
Layout.alignment: Qt.AlignVCenter | Qt.AlignRight
Layout.preferredHeight: shortcutText.contentHeight + 10
Layout.preferredWidth: shortcutText.contentWidth + 10
Layout.rightMargin: 10
color: JamiTheme.backgroundColor
radius: JamiTheme.primaryRadius
Text {
id: shortcutText
anchors.centerIn: parent
text: shortcut
font.pointSize: JamiTheme.textFontSize + 3
font.weight: Font.DemiBold
color: JamiTheme.textColor
}
}
}
/*
* Copyright (C) 2020 by Savoir-faire Linux
* Author: Mingrui Zhang <mingrui.zhang@savoirfairelinux.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
import QtQuick
import QtQuick.Controls
import net.jami.Constants 1.1
TabButton {
id: root
property int currentIndex
contentItem: Text {
text: root.text
font.pointSize: JamiTheme.textFontSize
color: JamiTheme.textColor
horizontalAlignment: Text.AlignHCenter
verticalAlignment: Text.AlignVCenter
elide: Text.ElideRight
}
background: Rectangle {
color: root.hovered ? JamiTheme.hoveredButtonColor :
(root.down || root.currentIndex === index) ?
JamiTheme.pressedButtonColor :
JamiTheme.normalButtonColor
radius: JamiTheme.primaryRadius
}
}
/*
* Copyright (C) 2020 by Savoir-faire Linux
* Author: Mingrui Zhang <mingrui.zhang@savoirfairelinux.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
import QtQuick
import QtQuick.Window
import QtQuick.Controls
import QtQuick.Layouts
import net.jami.Adapters 1.1
import net.jami.Constants 1.1
import "../../commoncomponents"
Window {
id: root
title: JamiStrings.keyboardShortcutTableWindowTitle
width: 500
height: 480
ListModel {
id: keyboardGeneralShortcutsModel
ListElement {
shortcut: "Ctrl + J"
description: qsTr("Open account list")
}
ListElement {
shortcut: "Ctrl + L"
description: qsTr("Focus conversations list")
}
ListElement {
shortcut: "Ctrl + R"
description: qsTr("Requests list")
}
ListElement {
shortcut: "Ctrl + ↑"
description: qsTr("Previous conversation")
}
ListElement {
shortcut: "Ctrl + ↓"
description: qsTr("Next conversation")
}
ListElement {
shortcut: "Ctrl + F"
description: qsTr("Search bar")
}
ListElement {
shortcut: "F11"
description: qsTr("Full screen")
}
}
ListModel {
id: keyboardConversationShortcutsModel
ListElement {
shortcut: "Ctrl + Shift + C"
description: qsTr("Start an audio call")
}
ListElement {
shortcut: "Ctrl + Shift + X"
description: qsTr("Start a video call")
}
ListElement {
shortcut: "Ctrl + Shift + L"
description: qsTr("Clear history")
}
ListElement {
shortcut: "Ctrl + Shift + B"
description: qsTr("Block contact")
}
ListElement {
shortcut: "Ctrl + Shift + Delete"
description: qsTr("Remove conversation")
}
ListElement {
shortcut: "Shift + Ctrl + A"
description: qsTr("Accept contact request")
}
}
ListModel {
id: keyboardSettingsShortcutsModel
ListElement {
shortcut: "Ctrl + M"
description: qsTr("Media settings")
}
ListElement {
shortcut: "Ctrl + G"
description: qsTr("General settings")
}
ListElement {
shortcut: "Ctrl + I"
description: qsTr("Account settings")
}
ListElement {
shortcut: "Ctrl + P"
description: qsTr("Plugin settings")
}
ListElement {
shortcut: "Ctrl + Shift + N"
description: qsTr("Open account creation wizard")
}
ListElement {
shortcut: "F10"
description: qsTr("Open keyboard shortcut table")
}
}
ListModel {
id: keyboardCallsShortcutsModel
ListElement {
shortcut: "Ctrl + Y"
description: qsTr("Answer an incoming call")
}
ListElement {
shortcut: "Ctrl + D"
description: qsTr("End call")
}
ListElement {
shortcut: "Ctrl + Shift + D"
description: qsTr("Decline the call request")
}
}
Rectangle {
id: windowRect
anchors.fill: parent
color: JamiTheme.secondaryBackgroundColor
Rectangle {
id: titleRect
anchors.top: parent.top
anchors.horizontalCenter: parent.horizontalCenter
anchors.topMargin: JamiTheme.titleRectMargin
height: titleName.contentHeight + JamiTheme.titleRectMargin
width: titleName.contentWidth + JamiTheme.titleRectMargin
color: JamiTheme.backgroundColor
radius: JamiTheme.primaryRadius
Text {
id: titleName
anchors.centerIn: parent
font.pointSize: JamiTheme.titleFontSize
text: {
switch (selectionBar.currentIndex) {
case 0:
return JamiStrings.generalKeyboardShortcuts
case 1:
return JamiStrings.conversationKeyboardShortcuts
case 2:
return JamiStrings.callKeyboardShortcuts
case 3:
return JamiStrings.settingsKeyboardShortcuts
}
}
color: JamiTheme.textColor
}
}
JamiListView {
id: keyboardShortCutList
anchors.top: titleRect.bottom
anchors.topMargin: 10
anchors.horizontalCenter: parent.horizontalCenter
width: parent.width
height: parent.height - titleRect.height - JamiTheme.titleRectMargin -
keyboardShortCutList.anchors.topMargin - selectionBar.height -
selectionBar.anchors.bottomMargin
model: {
switch (selectionBar.currentIndex) {
case 0:
return keyboardGeneralShortcutsModel
case 1:
return keyboardConversationShortcutsModel
case 2:
return keyboardCallsShortcutsModel
case 3:
return keyboardSettingsShortcutsModel
}
}
delegate: KeyboardShortcutKeyDelegate {
width: keyboardShortCutList.width
height: Math.max(JamiTheme.keyboardShortcutDelegateSize,
implicitHeight)
}
}
TabBar {
id: selectionBar
anchors.bottom: parent.bottom
anchors.bottomMargin: 10
anchors.horizontalCenter: parent.horizontalCenter
width: 96
height: JamiTheme.keyboardShortcutTabBarSize
contentHeight: JamiTheme.keyboardShortcutTabBarSize
Repeater {
model: ["1", "2", "3", "4"]
KeyboardShortcutTabButton {
currentIndex: selectionBar.currentIndex
text: modelData
}
}
}
}
}
/*
* Copyright (C) 2020 by Savoir-faire Linux
* Author: Mingrui Zhang <mingrui.zhang@savoirfairelinux.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
// Global select screen window component, object variable for creation.
var keyboardShortcutTableWindowComponent
var keyboardShortcutTableWindowObject
function createKeyboardShortcutTableWindowObject() {
if (keyboardShortcutTableWindowObject)
return
keyboardShortcutTableWindowComponent = Qt.createComponent(
"../components/KeyboardShortcutTable.qml")
if (keyboardShortcutTableWindowComponent.status === Component.Ready)
finishCreation()
else if (keyboardShortcutTableWindowComponent.status === Component.Error)
console.log("Error loading component:",
keyboardShortcutTableWindowComponent.errorString())
}
function finishCreation() {
keyboardShortcutTableWindowObject = keyboardShortcutTableWindowComponent.createObject()
if (keyboardShortcutTableWindowObject === null) {
// Error Handling.
console.log("Error creating select screen object")
}
// Signal connection.
keyboardShortcutTableWindowObject.onClosing.connect(destroyKeyboardShortcutTableWindow)
}
function showKeyboardShortcutTableWindow() {
keyboardShortcutTableWindowObject.show()
var screen = keyboardShortcutTableWindowObject.screen
keyboardShortcutTableWindowObject.x = screen.virtualX +
(screen.width - keyboardShortcutTableWindowObject.width) / 2
keyboardShortcutTableWindowObject.y = screen.virtualY +
(screen.height - keyboardShortcutTableWindowObject.height) / 2
}
// Destroy and reset selectScreenWindowObject when window is closed.
function destroyKeyboardShortcutTableWindow() {
if(!keyboardShortcutTableWindowObject)
return
keyboardShortcutTableWindowObject.destroy()
keyboardShortcutTableWindowObject = false
}
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment