1
0
Fork 0
mirror of https://git.jami.net/savoirfairelinux/jami-client-qt.git synced 2025-07-13 12:05:22 +02:00

shortcuts: re-add shortcuts and shortcuts view

Gitlab: #2
Change-Id: Ic04fe6f2dfd01c561799d1707601b48058a9c89c
This commit is contained in:
Sébastien Blin 2020-08-13 13:05:17 -04:00 committed by Adrien Béraud
parent d4c5f42253
commit 214d9add58
14 changed files with 905 additions and 20 deletions

View file

@ -5,6 +5,8 @@
<file>src/settingsview/components/LeftPanelView.qml</file> <file>src/settingsview/components/LeftPanelView.qml</file>
<file>src/settingsview/components/AvSettingPage.qml</file> <file>src/settingsview/components/AvSettingPage.qml</file>
<file>src/settingsview/components/GeneralSettingsPage.qml</file> <file>src/settingsview/components/GeneralSettingsPage.qml</file>
<file>src/settingsview/components/KeyBoardShortcutTable.qml</file>
<file>src/settingsview/components/KeyBoardShortcutKey.qml</file>
<file>src/settingsview/components/PluginSettingsPage.qml</file> <file>src/settingsview/components/PluginSettingsPage.qml</file>
<file>src/settingsview/components/PluginListSettingsView.qml</file> <file>src/settingsview/components/PluginListSettingsView.qml</file>
<file>src/settingsview/components/PluginListPreferencesView.qml</file> <file>src/settingsview/components/PluginListPreferencesView.qml</file>

View file

@ -708,4 +708,95 @@ Window {
mainViewWindow.hide() mainViewWindow.hide()
mainViewWindow.closeApp() mainViewWindow.closeApp()
} }
Shortcut {
sequence: "Ctrl+M"
context: Qt.ApplicationShortcut
onActivated: {
if (!inSettingsView) {
toggleSettingsView()
}
leftPanelSettingsView.btnMediaSettings.clicked()
}
}
Shortcut {
sequence: "Ctrl+G"
context: Qt.ApplicationShortcut
onActivated: {
if (!inSettingsView) {
toggleSettingsView()
}
leftPanelSettingsView.btnGeneralSettings.clicked()
}
}
Shortcut {
sequence: "Ctrl+I"
context: Qt.ApplicationShortcut
onActivated: {
if (!inSettingsView) {
toggleSettingsView()
}
leftPanelSettingsView.btnAccountSettings.clicked()
}
}
Shortcut {
sequence: "Ctrl+P"
context: Qt.ApplicationShortcut
onActivated: {
if (!inSettingsView) {
toggleSettingsView()
}
leftPanelSettingsView.btnPluginSettings.clicked()
}
}
Shortcut {
sequence: "F10"
context: Qt.ApplicationShortcut
onActivated: {
shortcutsTable.open()
}
}
Shortcut {
sequence: "F11"
context: Qt.ApplicationShortcut
onActivated: {
if (mainViewWindow.visibility !== 5) // 5 = FullScreen
mainViewWindow.visibility = "FullScreen"
else
mainViewWindow.visibility = "Windowed"
}
}
Shortcut {
sequence: "Ctrl+D"
context: Qt.ApplicationShortcut
onActivated: CallAdapter.hangUpThisCall()
}
Shortcut {
sequence: "Ctrl+Shift+A"
context: Qt.ApplicationShortcut
onActivated: {
ClientWrapper.utilsAdaptor.makePermanentCurrentConv()
communicationPageMessageWebView.setSendContactRequestButtonVisible(false)
}
}
Shortcut {
sequence: "Ctrl+Shift+N"
context: Qt.ApplicationShortcut
onActivated: mainViewWindowSidePanel.needToAddNewAccount()
}
KeyBoardShortcutTable {
id: shortcutsTable
x: Math.round((mainViewWindow.width - width) / 2)
y: Math.round((mainViewWindow.height - height) / 2)
}
} }

View file

@ -271,6 +271,14 @@ ComboBox {
popup: AccountComboBoxPopup { popup: AccountComboBoxPopup {
id: comboBoxPopup id: comboBoxPopup
Shortcut {
sequence: "Ctrl+J"
context: Qt.ApplicationShortcut
onActivated: comboBoxPopup.visible ?
comboBoxPopup.close() :
comboBoxPopup.open()
}
onAccountNeedToChange: { onAccountNeedToChange: {
accountComboBox.accountChanged(index) accountComboBox.accountChanged(index)
} }
@ -279,4 +287,10 @@ ComboBox {
accountComboBox.newAccountButtonClicked() accountComboBox.newAccountButtonClicked()
} }
} }
Shortcut {
sequence: "Ctrl+,"
context: Qt.ApplicationShortcut
onActivated: settingBtnClicked()
}
} }

View file

@ -31,12 +31,6 @@ Rectangle {
anchors.fill: parent anchors.fill: parent
Shortcut {
sequence: "Ctrl+D"
context: Qt.ApplicationShortcut
onActivated: CallAdapter.hangUpThisCall()
}
/* /*
* When selected conversation is changed, * When selected conversation is changed,
* these values will also be changed. * these values will also be changed.

View file

@ -110,4 +110,10 @@ Rectangle {
contactSearchBar.text) contactSearchBar.text)
} }
} }
Shortcut {
sequence: "Ctrl+F"
context: Qt.ApplicationShortcut
onActivated: contactSearchBar.forceActiveFocus()
}
} }

View file

@ -97,4 +97,74 @@ ListView {
} }
ScrollIndicator.vertical: ScrollIndicator {} ScrollIndicator.vertical: ScrollIndicator {}
Shortcut {
sequence: "Ctrl+Shift+X"
context: Qt.ApplicationShortcut
enabled: conversationSmartListView.visible
onActivated: {
CallAdapter.placeCall()
}
}
Shortcut {
sequence: "Ctrl+Shift+C"
context: Qt.ApplicationShortcut
enabled: conversationSmartListView.visible
onActivated: {
CallAdapter.placeAudioOnlyCall()
}
}
Shortcut {
sequence: "Ctrl+Shift+L"
context: Qt.ApplicationShortcut
enabled: conversationSmartListView.visible
onActivated: {
ClientWrapper.utilsAdaptor.clearConversationHistory(ClientWrapper.utilsAdaptor.getCurrAccId(),
ClientWrapper.utilsAdaptor.getCurrConvId())
}
}
Shortcut {
sequence: "Ctrl+Shift+B"
context: Qt.ApplicationShortcut
enabled: conversationSmartListView.visible
onActivated: {
ClientWrapper.utilsAdaptor.removeConversation(ClientWrapper.utilsAdaptor.getCurrAccId(),
ClientWrapper.utilsAdaptor.getCurrConvId(), true)
conversationSmartListView.needToBackToWelcomePage()
}
}
Shortcut {
sequence: "Ctrl+Shift+Delete"
context: Qt.ApplicationShortcut
enabled: conversationSmartListView.visible
onActivated: {
ClientWrapper.utilsAdaptor.removeConversation(ClientWrapper.utilsAdaptor.getCurrAccId(),
ClientWrapper.utilsAdaptor.getCurrConvId(), false)
}
}
Shortcut {
sequence: "Ctrl+Down"
context: Qt.ApplicationShortcut
enabled: conversationSmartListView.visible
onActivated: {
if (currentIndex + 1 >= count) return
conversationSmartListView.currentIndex += 1
}
}
Shortcut {
sequence: "Ctrl+Up"
context: Qt.ApplicationShortcut
enabled: conversationSmartListView.visible
onActivated: {
if (currentIndex <= 0) return
conversationSmartListView.currentIndex -= 1
}
}
} }

View file

@ -57,6 +57,8 @@ ItemDelegate {
return InCall ? Qt.lighter(JamiTheme.selectionBlue, return InCall ? Qt.lighter(JamiTheme.selectionBlue,
1.8) : JamiTheme.releaseColor 1.8) : JamiTheme.releaseColor
}) })
conversationSmartListView.needToSelectItems(UID)
conversationSmartListView.needToGrabFocus()
} }
} }
@ -200,8 +202,6 @@ ItemDelegate {
smartListContextMenu.openMenu() smartListContextMenu.openMenu()
} else if (mouse.button === Qt.LeftButton) { } else if (mouse.button === Qt.LeftButton) {
conversationSmartListView.currentIndex = index conversationSmartListView.currentIndex = index
conversationSmartListView.needToSelectItems(UID)
conversationSmartListView.needToGrabFocus()
} }
} }
onEntered: { onEntered: {

View file

@ -339,4 +339,24 @@ Window {
} }
color: "transparent" color: "transparent"
Shortcut {
sequence: "Ctrl+Y"
context: Qt.ApplicationShortcut
onActivated: {
incomingCallPage.close()
CallAdapter.acceptACall(responsibleAccountId,
responsibleConvUid)
}
}
Shortcut {
sequence: "Ctrl+Shift+D"
context: Qt.ApplicationShortcut
onActivated: {
incomingCallPage.close()
CallAdapter.refuseACall(responsibleAccountId,
responsibleConvUid)
}
}
} }

View file

@ -76,6 +76,16 @@ TabBar {
height: tabBar.height height: tabBar.height
color: JamiTheme.backgroundColor color: JamiTheme.backgroundColor
function showConversations() {
ConversationsAdapter.setConversationFilter("")
contactSearchBar.setPlaceholderString(
JamiTheme.contactSearchBarPlaceHolderConversationText)
pageOne.down = true
pageTwo.down = false
setCurrentUidSmartListModelIndex()
forceReselectConversationSmartListCurrentIndex()
}
Image { Image {
id: imgRectOne id: imgRectOne
anchors.horizontalCenter: buttonRectOne.horizontalCenter anchors.horizontalCenter: buttonRectOne.horizontalCenter
@ -127,13 +137,7 @@ TabBar {
anchors.fill: parent anchors.fill: parent
hoverEnabled: true hoverEnabled: true
onPressed: { onPressed: {
ConversationsAdapter.setConversationFilter("") buttonRectOne.showConversations()
contactSearchBar.setPlaceholderString(
JamiTheme.contactSearchBarPlaceHolderConversationText)
pageOne.down = true
pageTwo.down = false
setCurrentUidSmartListModelIndex()
forceReselectConversationSmartListCurrentIndex()
} }
onReleased: { onReleased: {
buttonRectOne.color = JamiTheme.backgroundColor buttonRectOne.color = JamiTheme.backgroundColor
@ -145,6 +149,15 @@ TabBar {
buttonRectOne.color = JamiTheme.backgroundColor buttonRectOne.color = JamiTheme.backgroundColor
} }
} }
Shortcut {
sequence: "Ctrl+L"
context: Qt.ApplicationShortcut
enabled: buttonRectOne.visible
onActivated: {
buttonRectOne.showConversations()
}
}
} }
} }
@ -184,6 +197,14 @@ TabBar {
height: tabBar.height height: tabBar.height
color: JamiTheme.backgroundColor color: JamiTheme.backgroundColor
function showRequests() {
ConversationsAdapter.setConversationFilter("PENDING")
contactSearchBar.setPlaceholderString(
JamiTheme.contactSearchBarPlaceHolderInivitionText)
pageTwo.down = true
pageOne.down = false
}
Image { Image {
id: imgRectTwo id: imgRectTwo
anchors.horizontalCenter: buttonRectTwo.horizontalCenter anchors.horizontalCenter: buttonRectTwo.horizontalCenter
@ -237,11 +258,7 @@ TabBar {
anchors.fill: parent anchors.fill: parent
hoverEnabled: true hoverEnabled: true
onPressed: { onPressed: {
ConversationsAdapter.setConversationFilter("PENDING") buttonRectTwo.showRequests()
contactSearchBar.setPlaceholderString(
JamiTheme.contactSearchBarPlaceHolderInivitionText)
pageTwo.down = true
pageOne.down = false
} }
onReleased: { onReleased: {
buttonRectTwo.color = JamiTheme.backgroundColor buttonRectTwo.color = JamiTheme.backgroundColor
@ -253,6 +270,15 @@ TabBar {
buttonRectTwo.color = JamiTheme.backgroundColor buttonRectTwo.color = JamiTheme.backgroundColor
} }
} }
Shortcut {
sequence: "Ctrl+R"
context: Qt.ApplicationShortcut
enabled: buttonRectTwo.visible
onActivated: {
buttonRectTwo.showRequests()
}
}
} }
} }
} }

View file

@ -188,6 +188,8 @@ Rectangle {
return pageIdAvSettingPage return pageIdAvSettingPage
case SettingsView.Plugin: case SettingsView.Plugin:
return pageIdPluginSettingsPage return pageIdPluginSettingsPage
case SettingsView.Plugin:
return pageIdPluginSettingsPage
} }
} }

View file

@ -0,0 +1,27 @@
import QtQuick 2.9
import QtQuick.Controls 2.2
Item {
property alias text: shortcutText.text
Rectangle{
id: keyRect
width: t_metrics.tightBoundingRect.width + 10
height: t_metrics.tightBoundingRect.height + 10
color: "#525252"
radius: 5
anchors.centerIn: parent
Text {
id : shortcutText
anchors.centerIn: parent
anchors.leftMargin: 10
font.family: "Arial"
font.pointSize: 12
color: "white"
}
TextMetrics {
id: t_metrics
font: shortcutText.font
text: shortcutText.text
}
}
}

View file

@ -0,0 +1,619 @@
/*
* Copyright (C) 2019-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 <http://www.gnu.org/licenses/>.
*/
import QtQuick 2.9
import QtQuick.Controls 2.2
import QtQuick.Controls 1.4
import QtQuick.Controls.Styles 1.4
import QtQuick.Layouts 1.3
Dialog {
id: root
modal: true
width: rectangle.width + 24
height: rectangle.height + 24
Rectangle {
id: rectangle
property int minWidth: 1200
property int minHeight: 500
implicitWidth: minWidth
implicitHeight: minHeight
color: "white"
radius: 30
Rectangle {
width: 500
height: t_metrics_title.tightBoundingRect.height + 15
color: "#e0e0e0"
radius: 8
anchors.top: parent.top
anchors.topMargin: 10
anchors.horizontalCenter: parent.horizontalCenter
Text {
id : titleText
anchors.centerIn: parent
anchors.leftMargin: 10
font.family: "Arial"
font.pointSize: 12
font.bold: true
text: "Shortcuts"
color: "black"
}
TextMetrics {
id: t_metrics_title
font: titleText.font
text: titleText.text
}
}
ListModel {
id: keyboardGeneralShortcutsModel
ListElement {
Shortcut: "Ctrl+J"
Description: qsTr("Open account list")
KeyLength: 2
}
ListElement {
Shortcut: "Ctrl+L"
Description: qsTr("Focus conversations list")
KeyLength: 2
}
ListElement {
Shortcut: "Ctrl+R"
Description: qsTr("Focus requests list")
KeyLength: 2
}
ListElement {
Shortcut: "Ctrl+↑"
Description: qsTr("Focus the previous conversation")
KeyLength: 2
}
ListElement {
Shortcut: "Ctrl+↓"
Description: qsTr("Focus the next conversation")
KeyLength: 2
}
ListElement {
Shortcut: "Ctrl+F"
Description: qsTr("Focus search bar")
KeyLength: 2
}
ListElement {
Shortcut: "F11"
Description: qsTr("Toggle fullscreen")
KeyLength: 1
}
}
ListModel {
id: keyboardConversationShortcutsModel
ListElement {
Shortcut: "Shift+Ctrl+C"
Description: qsTr("Start an audio call")
KeyLength: 3
}
ListElement {
Shortcut: "Shift+Ctrl+X"
Description: qsTr("Start an video call")
KeyLength: 3
}
ListElement {
Shortcut: "Shift+Ctrl+L"
Description: qsTr("Clear history")
KeyLength: 3
}
ListElement {
Shortcut: "Shift+Ctrl+B"
Description: qsTr("Block contact")
KeyLength: 3
}
ListElement {
Shortcut: "Shift+Ctrl+A"
Description: qsTr("Accept contact request")
KeyLength: 3
}
}
ListModel {
id: keyboardSettingsShortcutsModel
ListElement {
Shortcut: "Ctrl+M"
Description: qsTr("Toggle media settings")
KeyLength: 2
}
ListElement {
Shortcut: "Ctrl+G"
Description: qsTr("Toggle general settings")
KeyLength: 2
}
ListElement {
Shortcut: "Ctrl+I"
Description: qsTr("Toggle account settings")
KeyLength: 2
}
ListElement {
Shortcut: "Ctrl+Shift+N"
Description: qsTr("Open account creation's wizard")
KeyLength: 3
}
ListElement {
Shortcut: "F10"
Description: qsTr("Open this window")
KeyLength: 1
}
}
ListModel {
id: keyboardCallsShortcutsModel
ListElement {
Shortcut: "Ctrl+Y"
Description: qsTr("Answer an incoming call")
KeyLength: 2
}
ListElement {
Shortcut: "Ctrl+D"
Description: qsTr("Hangup current call")
KeyLength: 2
}
ListElement {
Shortcut: "Ctrl+Shift+D"
Description: qsTr("Decline the call request")
KeyLength: 2
}
}
Component {
id: shortcutDelegateWithThreeKeys
Rectangle {
id: cellRectWithThreeKeys
implicitWidth: minWidth /2
implicitHeight: 50
anchors.left: parent.left
anchors.leftMargin: 50
color: "white"
border.color: "white"
Rectangle {
id: containerRectWithThreeKeys
implicitWidth: parent.width - 10
implicitHeight: 50
anchors.horizontalCenter: parent.horizontalCenter
anchors.verticalCenter: parent.verticalCenter
Component.onCompleted: {
var componentKeyOne = Qt.createComponent("KeyBoardShortcutKey.qml")
if (componentKeyOne.status === Component.Ready) {
var objectKeyOne = componentKeyOne.createObject(containerRectWithThreeKeys)
objectKeyOne.anchors.verticalCenter = containerRectWithThreeKeys.verticalCenter
objectKeyOne.anchors.left = containerRectWithThreeKeys.left
objectKeyOne.text = Qt.binding(function() { return modelData.Shortcut.split("+")[0] })
}
if (modelData.Shortcut.split("+").length === 1)
return
var componentPlusSign = Qt.createQmlObject('import QtQuick 2.0;' +
'Text {anchors.verticalCenter: containerRectWithThreeKeys.verticalCenter;' +
'anchors.verticalCenterOffset: -2;' +
'anchors.left: containerRectWithThreeKeys.left;' +
'anchors.leftMargin: 30;' +
'color: "#525252";' +
'font.bold: true;' +
'font.pointSize : 12;' +
'text: "+"}',
containerRectWithThreeKeys)
var componentKeyTwo = Qt.createComponent("KeyBoardShortcutKey.qml")
if (componentKeyTwo.status === Component.Ready) {
var objectKeyTwo = componentKeyTwo.createObject(containerRectWithThreeKeys)
objectKeyTwo.anchors.verticalCenter = containerRectWithThreeKeys.verticalCenter
objectKeyTwo.anchors.left = containerRectWithThreeKeys.left
objectKeyTwo.anchors.leftMargin = componentPlusSign.anchors.leftMargin + 42
objectKeyTwo.text = Qt.binding(function() { return modelData.Shortcut.split("+")[1] })
}
if (modelData.Shortcut.split("+").length === 2)
return
var componentPlusSignTwo = Qt.createQmlObject('import QtQuick 2.0;' +
'Text {anchors.verticalCenter: containerRectWithThreeKeys.verticalCenter;' +
'anchors.verticalCenterOffset: -2;' +
'anchors.left: containerRectWithThreeKeys.left;' +
'anchors.leftMargin: 97;' +
'color: "#525252";' +
'font.bold: true;' +
'font.pointSize : 12;' +
'text: "+"}',
containerRectWithThreeKeys)
var componentKeyThree = Qt.createComponent("KeyBoardShortcutKey.qml")
if (componentKeyThree.status === Component.Ready) {
var objectKeyThree = componentKeyThree.createObject(containerRectWithThreeKeys)
objectKeyThree.anchors.verticalCenter = containerRectWithThreeKeys.verticalCenter
objectKeyThree.anchors.left = containerRectWithThreeKeys.left
objectKeyThree.anchors.leftMargin = componentPlusSignTwo.anchors.leftMargin + 35
objectKeyThree.text = Qt.binding(function() { return modelData.Shortcut.split("+")[2] })
}
}
}
}
}
Component {
id: descriptionDelegate
Rectangle {
implicitWidth: minWidth /2
implicitHeight: 50
color: "white"
border.color: "white"
Text {
id : descriptionText
anchors.verticalCenter: parent.verticalCenter
anchors.left: parent.left
anchors.leftMargin: 10
font.family: "Arial"
font.pointSize: 10
text: styleData.value
}
}
}
Column {
spacing: 2
id: columnAll
anchors.rightMargin: 20
anchors.leftMargin: 20
anchors.bottomMargin: 20
anchors.topMargin: 50
width: minWidth
height: minHeight - 100
anchors.fill: parent
StackLayout {
// pages
implicitWidth: parent.width
implicitHeight: parent.height - tabBar.height
currentIndex: tabBar.currentIndex
Item {
id: tabOne
Rectangle {
implicitWidth: parent.width / 2
implicitHeight: parent.height
anchors.left: parent.left
TableView {
id: generalTableView
anchors.fill: parent
horizontalScrollBarPolicy: Qt.ScrollBarAlwaysOff
TableViewColumn {
role: "Description"
width: generalTableView.width / 2
delegate: descriptionDelegate
}
TableViewColumn {
role: "Shortcut"
width: generalTableView.width / 2
delegate: Component{
Loader {
property variant modelData: model
sourceComponent: shortcutDelegateWithThreeKeys
}
}
}
model: keyboardGeneralShortcutsModel
rowDelegate: Rectangle {
height: 50
color: "white"
}
style: TableViewStyle {
alternateBackgroundColor: "white"
frame: Rectangle {
border{
color: "transparent" // color of the border
}
}
headerDelegate: Rectangle {
// Only first column's header is shown
height: [t_metrics_general.tightBoundingRect.height + 10, 0][styleData.column % 2]
width: [parent.width, 0][styleData.column % 2]
color: "white"
radius: 10
anchors.top: parent.top
anchors.topMargin: 5
Text {
id : generalShortcutText
anchors.verticalCenter: parent.verticalCenter
anchors.left: parent.left
anchors.leftMargin: 10
font.family: "Arial"
font.pointSize: 12
text: styleData.column % 2 ? "" : "General"
color: "black"
}
TextMetrics {
id: t_metrics_general
font: generalShortcutText.font
text: generalShortcutText.text
}
}
}
}
}
Rectangle {
implicitWidth: parent.width / 2
implicitHeight: parent.height
anchors.right: parent.right
TableView {
id: conversationsTableView
anchors.fill: parent
horizontalScrollBarPolicy: Qt.ScrollBarAlwaysOff
TableViewColumn {
role: "Description"
width: conversationsTableView.width / 2
delegate: descriptionDelegate
}
TableViewColumn {
role: "Shortcut"
width: conversationsTableView.width / 2
delegate: Component{
Loader {
property variant modelData: model
sourceComponent: shortcutDelegateWithThreeKeys
}
}
}
model: keyboardConversationShortcutsModel
rowDelegate: Rectangle {
height: 50
color: "white"
}
style: TableViewStyle {
alternateBackgroundColor: "white"
frame: Rectangle {
border{
color: "transparent" // color of the border
}
}
headerDelegate: Rectangle {
// Only first column's header is shown
height: [t_metrics_conversations.tightBoundingRect.height + 10, 0][styleData.column % 2]
width: [parent.width, 0][styleData.column % 2]
color: "white"
radius: 10
anchors.top: parent.top
anchors.topMargin: 5
Text {
id : conversationsShortcutText
anchors.verticalCenter: parent.verticalCenter
anchors.left: parent.left
anchors.leftMargin: 10
font.family: "Arial"
font.pointSize: 12
text: styleData.column % 2 ? "" : "Conversations"
color: "black"
}
TextMetrics {
id: t_metrics_conversations
font: conversationsShortcutText.font
text: conversationsShortcutText.text
}
}
}
}
}
}
Item {
id: tabTwo
Rectangle {
implicitWidth: parent.width / 2
implicitHeight: parent.height
anchors.left: parent.left
TableView {
id: callsTableView
anchors.fill: parent
horizontalScrollBarPolicy: Qt.ScrollBarAlwaysOff
TableViewColumn {
role: "Description"
width: callsTableView.width / 2
delegate: descriptionDelegate
}
TableViewColumn {
role: "Shortcut"
width: callsTableView.width / 2
delegate: Component{
Loader {
property variant modelData: model
sourceComponent: shortcutDelegateWithThreeKeys
}
}
}
model: keyboardCallsShortcutsModel
rowDelegate: Rectangle {
height: 50
color: "white"
}
style: TableViewStyle {
alternateBackgroundColor: "white"
frame: Rectangle {
border{
color: "transparent" // color of the border
}
}
headerDelegate: Rectangle {
// Only first column's header is shown
height: [t_metrics_calls.tightBoundingRect.height + 10, 0][styleData.column % 2]
width: [parent.width, 0][styleData.column % 2]
color: "white"
radius: 10
anchors.top: parent.top
anchors.topMargin: 5
Text {
id : callsShortcutText
anchors.verticalCenter: parent.verticalCenter
anchors.left: parent.left
anchors.leftMargin: 10
font.family: "Arial"
font.pointSize: 12
text: styleData.column % 2 ? "" : "Calls"
color: "black"
}
// make sure that calls and settings header are parallel
TextMetrics {
id: t_metrics_calls
font: callsShortcutText.font
text: "Settings"
}
}
}
}
}
Rectangle {
implicitWidth: parent.width / 2
implicitHeight: parent.height
anchors.right: parent.right
TableView {
id: settingsTableView
anchors.fill: parent
horizontalScrollBarPolicy: Qt.ScrollBarAlwaysOff
TableViewColumn {
role: "Description"
width: settingsTableView.width / 2
delegate: descriptionDelegate
}
TableViewColumn {
role: "Shortcut"
width: settingsTableView.width / 2
delegate: Component{
Loader {
property variant modelData: model
sourceComponent: shortcutDelegateWithThreeKeys
}
}
}
model: keyboardSettingsShortcutsModel
rowDelegate: Rectangle {
height: 50
color: "white"
}
style: TableViewStyle {
alternateBackgroundColor: "white"
frame: Rectangle {
border{
color: "transparent" // color of the border
}
}
headerDelegate: Rectangle {
// Only first column's header is shown
height: [t_metrics_settings.tightBoundingRect.height + 10, 0][styleData.column % 2]
width: [parent.width, 0][styleData.column % 2]
color: "white"
radius: 10
anchors.top: parent.top
anchors.topMargin: 5
Text {
id : settingsShortcutText
anchors.verticalCenter: parent.verticalCenter
anchors.left: parent.left
anchors.leftMargin: 10
font.family: "Arial"
font.pointSize: 12
text: styleData.column % 2 ? "" : "Settings"
color: "black"
}
TextMetrics {
id: t_metrics_settings
font: settingsShortcutText.font
text: settingsShortcutText.text
}
}
}
}
}
}
}
}
TabBar {
id: tabBar
anchors.horizontalCenter: parent.horizontalCenter
anchors.bottom: parent.bottom
anchors.bottomMargin: 15
width: 240
currentIndex: 0
TabButton {
id: pageOne
width: tabBar.width / 2
text: qsTr("1")
down: true
// customize tab button
contentItem: Text {
text: pageOne.text
font: pageOne.font
opacity: enabled ? 1.0 : 0.3
horizontalAlignment: Text.AlignHCenter
verticalAlignment: Text.AlignVCenter
elide: Text.ElideRight
}
// customize tab button
background: Rectangle {
id: buttonRectOne
implicitWidth: tabBar.width / 2
implicitHeight: tabBar.height
radius: 10
color: pageOne.down ? "#e0e0e0" :"#fdfdfd"
MouseArea {
anchors.fill: parent
hoverEnabled: true
onPressed: { buttonRectOne.color = "#c0c0c0"; tabBar.currentIndex = 0; pageOne.down = true; pageTwo.down = false;}
onReleased: { buttonRectOne.color = "#e0e0e0"; }
onEntered: { buttonRectOne.color = "#c7c7c7"; }
onExited: { buttonRectOne.color = Qt.binding(function() { return pageOne.down ? "#e0e0e0" :"#fdfdfd" }); }
}
}
}
TabButton {
id: pageTwo
text: qsTr("2")
width: tabBar.width / 2
contentItem: Text {
text: pageTwo.text
font: pageTwo.font
opacity: enabled ? 1.0 : 0.3
horizontalAlignment: Text.AlignHCenter
verticalAlignment: Text.AlignVCenter
elide: Text.ElideRight
}
background: Rectangle {
id: buttonRectTwo
implicitWidth: tabBar.width / 2
implicitHeight: tabBar.height
radius: 10
color: pageTwo.down ? "#e0e0e0" :"#fdfdfd"
MouseArea {
anchors.fill: parent
hoverEnabled: true
onPressed: { buttonRectTwo.color = "#c0c0c0"; tabBar.currentIndex = 1; pageTwo.down = true; pageOne.down = false;}
onReleased: { buttonRectTwo.color = "#e0e0e0"; }
onEntered: { buttonRectTwo.color = "#c7c7c7"; }
onExited: { buttonRectTwo.color = Qt.binding(function() { return pageTwo.down ? "#e0e0e0" :"#fdfdfd" }); }
}
}
}
}
}
}

View file

@ -988,6 +988,18 @@ UtilsAdapter::getCurrAccId()
return LRCInstance::getCurrAccId(); return LRCInstance::getCurrAccId();
} }
const QString
UtilsAdapter::getCurrConvId()
{
return LRCInstance::getCurrentConvUid();
}
void
UtilsAdapter::makePermanentCurrentConv()
{
LRCInstance::getCurrentConversationModel()->makePermanent(LRCInstance::getCurrentConvUid());
}
const QStringList const QStringList
UtilsAdapter::getCurrAccList() UtilsAdapter::getCurrAccList()
{ {

View file

@ -497,6 +497,8 @@ public:
Q_INVOKABLE const QString getBestId(const QString &accountId, const QString &uid); Q_INVOKABLE const QString getBestId(const QString &accountId, const QString &uid);
Q_INVOKABLE const QString getCurrAccId(); Q_INVOKABLE const QString getCurrAccId();
Q_INVOKABLE const QString getCurrConvId();
Q_INVOKABLE void makePermanentCurrentConv();
Q_INVOKABLE const QStringList getCurrAccList(); Q_INVOKABLE const QStringList getCurrAccList();
Q_INVOKABLE int getAccountListSize(); Q_INVOKABLE int getAccountListSize();
Q_INVOKABLE void setCurrentCall(const QString &accountId, const QString &convUid); Q_INVOKABLE void setCurrentCall(const QString &accountId, const QString &convUid);