Rename side pane stuff to main pane

This commit is contained in:
miruka 2019-12-10 15:17:41 -04:00
parent 3a3e0e9dbb
commit 888df282a8
13 changed files with 63 additions and 63 deletions

View File

@ -146,7 +146,7 @@ class Backend:
return (settings, ui_state, history, theme)
async def get_flat_sidepane_data(self) -> List[Dict[str, Any]]:
async def get_flat_mainpane_data(self) -> List[Dict[str, Any]]:
data = []
for account in sorted(self.models[Account].values()):

View File

@ -137,7 +137,7 @@ class UISettings(JSONConfigFile):
"previousTab": ["Alt+Shift+Left", "Alt+Shift+H"],
"nextTab": ["Alt+Shift+Right", "Alt+Shift+L"],
"focusSidePane": ["Alt+S"],
"focusMainPane": ["Alt+S"],
"clearRoomFilter": ["Alt+Shift+S"],
"accountSettings": ["Alt+A"],
"addNewChat": ["Alt+N"],

View File

@ -1,7 +1,7 @@
import QtQuick 2.12
import QtQuick.Controls 2.12
import QtQuick.Layouts 1.12
import "../SidePane"
import "../MainPane"
Page {
id: innerPage

View File

@ -8,27 +8,27 @@ HTileDelegate {
spacing: 0
topPadding: model.index > 0 ? theme.spacing / 2 : 0
bottomPadding: topPadding
backgroundColor: theme.sidePane.account.background
backgroundColor: theme.mainPane.account.background
opacity: collapsed && ! forceExpand ?
theme.sidePane.account.collapsedOpacity : 1
theme.mainPane.account.collapsedOpacity : 1
shouldBeCurrent:
window.uiState.page === "Pages/AccountSettings/AccountSettings.qml" &&
window.uiState.pageProperties.userId === model.data.user_id
setCurrentTimer.running:
! sidePaneList.activateLimiter.running && ! sidePane.hasFocus
! mainPaneList.activateLimiter.running && ! mainPane.hasFocus
Behavior on opacity { HOpacityAnimator {} }
property bool disconnecting: false
readonly property bool forceExpand: Boolean(sidePaneList.filter)
readonly property bool forceExpand: Boolean(mainPaneList.filter)
// Hide harmless error when a filter matches nothing
readonly property bool collapsed: try {
return sidePaneList.collapseAccounts[model.data.user_id] || false
return mainPaneList.collapseAccounts[model.data.user_id] || false
} catch (err) {}
@ -51,7 +51,7 @@ HTileDelegate {
mxc: model.data.avatar_url
}
title.color: theme.sidePane.account.name
title.color: theme.mainPane.account.name
title.text: model.data.display_name || model.data.user_id
title.font.pixelSize: theme.fontSize.big
title.leftPadding: theme.spacing

View File

@ -4,10 +4,10 @@ import "../Base"
import "../utils.js" as Utils
HListView {
id: sidePaneList
id: mainPaneList
readonly property var originSource: window.sidePaneModelSource
readonly property var originSource: window.mainPaneModelSource
readonly property var collapseAccounts: window.uiState.collapseAccounts
readonly property string filter: toolBar.roomFilter
readonly property alias activateLimiter: activateLimiter
@ -21,10 +21,10 @@ HListView {
let show = []
// Hide a harmless error when activating a RoomDelegate
try { window.sidePaneModelSource } catch (err) { return }
try { window.mainPaneModelSource } catch (err) { return }
for (let i = 0; i < window.sidePaneModelSource.length; i++) {
let item = window.sidePaneModelSource[i]
for (let i = 0; i < window.mainPaneModelSource.length; i++) {
let item = window.mainPaneModelSource[i]
if (item.type === "Account" ||
(filter ?
@ -119,11 +119,11 @@ HListView {
}
delegate: Loader {
width: sidePaneList.width
width: mainPaneList.width
Component.onCompleted: setSource(
model.type === "Account" ?
"AccountDelegate.qml" : "RoomDelegate.qml",
{view: sidePaneList}
{view: mainPaneList}
)
}

View File

@ -4,14 +4,14 @@ import "../Base"
import "../utils.js" as Utils
HDrawer {
id: sidePane
id: mainPane
objectName: "mainPane"
color: theme.sidePane.background
color: theme.mainPane.background
minimumSize: theme.controls.avatar.size + theme.spacing * 2
property bool hasFocus: toolBar.filterField.activeFocus
property alias sidePaneList: sidePaneList
property alias mainPaneList: mainPaneList
property alias toolBar: toolBar
@ -21,7 +21,7 @@ HDrawer {
return
}
sidePane.open()
mainPane.open()
toolBar.filterField.forceActiveFocus()
}
@ -29,7 +29,7 @@ HDrawer {
Behavior on opacity { HOpacityAnimator {} }
Binding {
target: sidePane
target: mainPane
property: "visible"
value: false
when: ! mainUI.accountsPresent
@ -38,17 +38,17 @@ HDrawer {
HColumnLayout {
anchors.fill: parent
SidePaneList {
id: sidePaneList
AccountRoomList {
id: mainPaneList
clip: true
Layout.fillWidth: true
Layout.fillHeight: true
}
SidePaneToolBar {
MainPaneToolBar {
id: toolBar
sidePaneList: sidePaneList
mainPaneList: mainPaneList
Layout.fillWidth: true
Layout.fillHeight: false

View File

@ -5,7 +5,7 @@ import "../Base"
HRowLayout {
id: toolBar
property SidePaneList sidePaneList
property AccountRoomList mainPaneList
readonly property alias addAccountButton: addAccountButton
readonly property alias filterField: filterField
property alias roomFilter: filterField.text
@ -14,7 +14,7 @@ HRowLayout {
id: addAccountButton
icon.name: "add-account"
toolTip.text: qsTr("Add another account")
backgroundColor: theme.sidePane.settingsButton.background
backgroundColor: theme.mainPane.settingsButton.background
onClicked: pageLoader.showPage("AddAccount/AddAccount")
Layout.fillHeight: true
@ -23,32 +23,32 @@ HRowLayout {
HTextField {
id: filterField
placeholderText: qsTr("Filter rooms")
backgroundColor: theme.sidePane.filterRooms.background
backgroundColor: theme.mainPane.filterRooms.background
bordered: false
Component.onCompleted: filterField.text = uiState.sidePaneFilter
onTextChanged: {
if (window.uiState.sidePaneFilter === text) return
window.uiState.sidePaneFilter = text
if (window.uiState.mainPaneFilter === text) return
window.uiState.mainPaneFilter = text
window.uiStateChanged()
}
Layout.fillWidth: true
Layout.fillHeight: true
Keys.onUpPressed: sidePaneList.previous(false) // do not activate
Keys.onDownPressed: sidePaneList.next(false)
Keys.onUpPressed: mainPaneList.previous(false) // do not activate
Keys.onDownPressed: mainPaneList.next(false)
Keys.onEnterPressed: Keys.onReturnPressed(event)
Keys.onReturnPressed: {
if (event.modifiers & Qt.ShiftModifier) {
sidePaneList.toggleCollapseAccount()
mainPaneList.toggleCollapseAccount()
return
}
if (window.settings.clearRoomFilterOnEnter) text = ""
sidePaneList.activate()
mainPaneList.activate()
}
Keys.onEscapePressed: {

View File

@ -6,8 +6,8 @@ import "../utils.js" as Utils
HTileDelegate {
id: roomDelegate
spacing: theme.spacing
backgroundColor: theme.sidePane.room.background
opacity: model.data.left ? theme.sidePane.room.leftRoomOpacity : 1
backgroundColor: theme.mainPane.room.background
opacity: model.data.left ? theme.mainPane.room.leftRoomOpacity : 1
shouldBeCurrent:
window.uiState.page === "Chat/Chat.qml" &&
@ -15,7 +15,7 @@ HTileDelegate {
window.uiState.pageProperties.roomId === model.data.room_id
setCurrentTimer.running:
! sidePaneList.activateLimiter.running && ! sidePane.hasFocus
! mainPaneList.activateLimiter.running && ! mainPane.hasFocus
Behavior on opacity { HOpacityAnimator {} }
@ -33,7 +33,7 @@ HTileDelegate {
mxc: model.data.avatar_url
}
title.color: theme.sidePane.room.name
title.color: theme.mainPane.room.name
title.text: model.data.display_name || qsTr("Empty room")
additionalInfo.children: HIcon {
@ -46,7 +46,7 @@ HTileDelegate {
Behavior on Layout.maximumWidth { HNumberAnimation {} }
}
rightInfo.color: theme.sidePane.room.lastEventDate
rightInfo.color: theme.mainPane.room.lastEventDate
rightInfo.text: {
! lastEvent || ! lastEvent.date ?
"" :
@ -60,7 +60,7 @@ HTileDelegate {
lastEvent.date.getFullYear()
}
subtitle.color: theme.sidePane.room.subtitle
subtitle.color: theme.mainPane.room.subtitle
subtitle.font.italic:
Boolean(lastEvent && lastEvent.event_type === "RoomMessageEmote")
subtitle.textFormat: Text.StyledText
@ -83,7 +83,7 @@ HTileDelegate {
return text.replace(
/< *span +class=['"]?quote['"]? *>(.+?)<\/ *span *>/g,
`<font color="${theme.sidePane.room.subtitleQuote}">$1</font>`,
`<font color="${theme.mainPane.room.subtitleQuote}">$1</font>`,
)
}

View File

@ -125,58 +125,58 @@ Item {
}
// SidePane
// MainPane
HShortcut {
enabled: mainUI.accountsPresent
sequences: settings.keys.focusSidePane
onActivated: mainUI.sidePane.toggleFocus()
sequences: settings.keys.focusMainPane
onActivated: mainUI.mainPane.toggleFocus()
context: Qt.ApplicationShortcut
}
HShortcut {
enabled: mainUI.accountsPresent
sequences: settings.keys.clearRoomFilter
onActivated: mainUI.sidePane.toolBar.roomFilter = ""
onActivated: mainUI.mainPane.toolBar.roomFilter = ""
}
HShortcut {
enabled: mainUI.accountsPresent
sequences: settings.keys.addNewAccount
onActivated: mainUI.sidePane.toolBar.addAccountButton.clicked()
onActivated: mainUI.mainPane.toolBar.addAccountButton.clicked()
}
HShortcut {
enabled: mainUI.accountsPresent
sequences: settings.keys.addNewChat
onActivated: mainUI.sidePane.sidePaneList.addNewChat()
onActivated: mainUI.mainPane.mainPaneList.addNewChat()
}
HShortcut {
enabled: mainUI.accountsPresent
sequences: settings.keys.accountSettings
onActivated: mainUI.sidePane.sidePaneList.accountSettings()
onActivated: mainUI.mainPane.mainPaneList.accountSettings()
}
HShortcut {
enabled: mainUI.accountsPresent
sequences: settings.keys.toggleCollapseAccount
onActivated: mainUI.sidePane.sidePaneList.toggleCollapseAccount()
onActivated: mainUI.mainPane.mainPaneList.toggleCollapseAccount()
}
HShortcut {
enabled: mainUI.accountsPresent
sequences: settings.keys.goToPreviousRoom
onActivated: mainUI.sidePane.sidePaneList.previous()
onActivated: mainUI.mainPane.mainPaneList.previous()
}
HShortcut {
enabled: mainUI.accountsPresent
sequences: settings.keys.goToNextRoom
onActivated: mainUI.sidePane.sidePaneList.next()
onActivated: mainUI.mainPane.mainPaneList.next()
}

View File

@ -4,7 +4,7 @@ import QtQuick.Layouts 1.12
import QtQuick.Window 2.7
import QtGraphicalEffects 1.12
import "Base"
import "SidePane"
import "MainPane"
import "utils.js" as Utils
Item {
@ -13,7 +13,7 @@ Item {
Component.onCompleted: window.mainUI = mainUI
readonly property alias shortcuts: shortcuts
readonly property alias sidePane: sidePane
readonly property alias mainPane: mainPane
readonly property alias pageLoader: pageLoader
readonly property alias pressAnimation: pressAnimation
readonly property alias fullScreenPopup: fullScreenPopup
@ -54,18 +54,18 @@ Item {
}
SidePane {
id: sidePane
MainPane {
id: mainPane
}
HLoader {
id: pageLoader
anchors.fill: parent
anchors.leftMargin: sidePane.visibleSize
visible: ! sidePane.hidden || anchors.leftMargin < width
anchors.leftMargin: mainPane.visibleSize
visible: ! mainPane.hidden || anchors.leftMargin < width
clip: appearAnimation.running
onLoaded: { takeFocus(); appearAnimation.start() }
// onSourceChanged: if (sidePane.collapse) sidePane.close()
// onSourceChanged: if (mainPane.collapse) mainPane.close()
property bool isWide: width > theme.contentIsWideAbove
@ -130,7 +130,7 @@ Item {
function takeFocus() {
pageLoader.item.forceActiveFocus()
if (sidePane.collapse) sidePane.close()
if (mainPane.collapse) mainPane.close()
}

View File

@ -26,7 +26,7 @@ ApplicationWindow {
// NOTE: For JS object variables, the corresponding method to notify
// key/value changes must be called manually, e.g. settingsChanged().
property var modelSources: ({})
property var sidePaneModelSource: []
property var mainPaneModelSource: []
property var mainUI: null

View File

@ -33,8 +33,8 @@ function onCoroutineDone(uuid, result, error, traceback) {
function onModelUpdated(syncId, data, serializedSyncId) {
if (serializedSyncId === ["Account"] || serializedSyncId[0] === "Room") {
py.callCoro("get_flat_sidepane_data", [], data => {
window.sidePaneModelSource = data
py.callCoro("get_flat_mainpane_data", [], data => {
window.mainPaneModelSource = data
})
}

View File

@ -260,7 +260,7 @@ ui:
sidePane:
mainPane:
int autoCollapseBelowWidth: 128 * uiScale
int collapsedWidth: controls.avatar.size