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) 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 = [] data = []
for account in sorted(self.models[Account].values()): for account in sorted(self.models[Account].values()):

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -6,8 +6,8 @@ import "../utils.js" as Utils
HTileDelegate { HTileDelegate {
id: roomDelegate id: roomDelegate
spacing: theme.spacing spacing: theme.spacing
backgroundColor: theme.sidePane.room.background backgroundColor: theme.mainPane.room.background
opacity: model.data.left ? theme.sidePane.room.leftRoomOpacity : 1 opacity: model.data.left ? theme.mainPane.room.leftRoomOpacity : 1
shouldBeCurrent: shouldBeCurrent:
window.uiState.page === "Chat/Chat.qml" && window.uiState.page === "Chat/Chat.qml" &&
@ -15,7 +15,7 @@ HTileDelegate {
window.uiState.pageProperties.roomId === model.data.room_id window.uiState.pageProperties.roomId === model.data.room_id
setCurrentTimer.running: setCurrentTimer.running:
! sidePaneList.activateLimiter.running && ! sidePane.hasFocus ! mainPaneList.activateLimiter.running && ! mainPane.hasFocus
Behavior on opacity { HOpacityAnimator {} } Behavior on opacity { HOpacityAnimator {} }
@ -33,7 +33,7 @@ HTileDelegate {
mxc: model.data.avatar_url 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") title.text: model.data.display_name || qsTr("Empty room")
additionalInfo.children: HIcon { additionalInfo.children: HIcon {
@ -46,7 +46,7 @@ HTileDelegate {
Behavior on Layout.maximumWidth { HNumberAnimation {} } Behavior on Layout.maximumWidth { HNumberAnimation {} }
} }
rightInfo.color: theme.sidePane.room.lastEventDate rightInfo.color: theme.mainPane.room.lastEventDate
rightInfo.text: { rightInfo.text: {
! lastEvent || ! lastEvent.date ? ! lastEvent || ! lastEvent.date ?
"" : "" :
@ -60,7 +60,7 @@ HTileDelegate {
lastEvent.date.getFullYear() lastEvent.date.getFullYear()
} }
subtitle.color: theme.sidePane.room.subtitle subtitle.color: theme.mainPane.room.subtitle
subtitle.font.italic: subtitle.font.italic:
Boolean(lastEvent && lastEvent.event_type === "RoomMessageEmote") Boolean(lastEvent && lastEvent.event_type === "RoomMessageEmote")
subtitle.textFormat: Text.StyledText subtitle.textFormat: Text.StyledText
@ -83,7 +83,7 @@ HTileDelegate {
return text.replace( return text.replace(
/< *span +class=['"]?quote['"]? *>(.+?)<\/ *span *>/g, /< *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 { HShortcut {
enabled: mainUI.accountsPresent enabled: mainUI.accountsPresent
sequences: settings.keys.focusSidePane sequences: settings.keys.focusMainPane
onActivated: mainUI.sidePane.toggleFocus() onActivated: mainUI.mainPane.toggleFocus()
context: Qt.ApplicationShortcut context: Qt.ApplicationShortcut
} }
HShortcut { HShortcut {
enabled: mainUI.accountsPresent enabled: mainUI.accountsPresent
sequences: settings.keys.clearRoomFilter sequences: settings.keys.clearRoomFilter
onActivated: mainUI.sidePane.toolBar.roomFilter = "" onActivated: mainUI.mainPane.toolBar.roomFilter = ""
} }
HShortcut { HShortcut {
enabled: mainUI.accountsPresent enabled: mainUI.accountsPresent
sequences: settings.keys.addNewAccount sequences: settings.keys.addNewAccount
onActivated: mainUI.sidePane.toolBar.addAccountButton.clicked() onActivated: mainUI.mainPane.toolBar.addAccountButton.clicked()
} }
HShortcut { HShortcut {
enabled: mainUI.accountsPresent enabled: mainUI.accountsPresent
sequences: settings.keys.addNewChat sequences: settings.keys.addNewChat
onActivated: mainUI.sidePane.sidePaneList.addNewChat() onActivated: mainUI.mainPane.mainPaneList.addNewChat()
} }
HShortcut { HShortcut {
enabled: mainUI.accountsPresent enabled: mainUI.accountsPresent
sequences: settings.keys.accountSettings sequences: settings.keys.accountSettings
onActivated: mainUI.sidePane.sidePaneList.accountSettings() onActivated: mainUI.mainPane.mainPaneList.accountSettings()
} }
HShortcut { HShortcut {
enabled: mainUI.accountsPresent enabled: mainUI.accountsPresent
sequences: settings.keys.toggleCollapseAccount sequences: settings.keys.toggleCollapseAccount
onActivated: mainUI.sidePane.sidePaneList.toggleCollapseAccount() onActivated: mainUI.mainPane.mainPaneList.toggleCollapseAccount()
} }
HShortcut { HShortcut {
enabled: mainUI.accountsPresent enabled: mainUI.accountsPresent
sequences: settings.keys.goToPreviousRoom sequences: settings.keys.goToPreviousRoom
onActivated: mainUI.sidePane.sidePaneList.previous() onActivated: mainUI.mainPane.mainPaneList.previous()
} }
HShortcut { HShortcut {
enabled: mainUI.accountsPresent enabled: mainUI.accountsPresent
sequences: settings.keys.goToNextRoom 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 QtQuick.Window 2.7
import QtGraphicalEffects 1.12 import QtGraphicalEffects 1.12
import "Base" import "Base"
import "SidePane" import "MainPane"
import "utils.js" as Utils import "utils.js" as Utils
Item { Item {
@ -13,7 +13,7 @@ Item {
Component.onCompleted: window.mainUI = mainUI Component.onCompleted: window.mainUI = mainUI
readonly property alias shortcuts: shortcuts readonly property alias shortcuts: shortcuts
readonly property alias sidePane: sidePane readonly property alias mainPane: mainPane
readonly property alias pageLoader: pageLoader readonly property alias pageLoader: pageLoader
readonly property alias pressAnimation: pressAnimation readonly property alias pressAnimation: pressAnimation
readonly property alias fullScreenPopup: fullScreenPopup readonly property alias fullScreenPopup: fullScreenPopup
@ -54,18 +54,18 @@ Item {
} }
SidePane { MainPane {
id: sidePane id: mainPane
} }
HLoader { HLoader {
id: pageLoader id: pageLoader
anchors.fill: parent anchors.fill: parent
anchors.leftMargin: sidePane.visibleSize anchors.leftMargin: mainPane.visibleSize
visible: ! sidePane.hidden || anchors.leftMargin < width visible: ! mainPane.hidden || anchors.leftMargin < width
clip: appearAnimation.running clip: appearAnimation.running
onLoaded: { takeFocus(); appearAnimation.start() } onLoaded: { takeFocus(); appearAnimation.start() }
// onSourceChanged: if (sidePane.collapse) sidePane.close() // onSourceChanged: if (mainPane.collapse) mainPane.close()
property bool isWide: width > theme.contentIsWideAbove property bool isWide: width > theme.contentIsWideAbove
@ -130,7 +130,7 @@ Item {
function takeFocus() { function takeFocus() {
pageLoader.item.forceActiveFocus() 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 // NOTE: For JS object variables, the corresponding method to notify
// key/value changes must be called manually, e.g. settingsChanged(). // key/value changes must be called manually, e.g. settingsChanged().
property var modelSources: ({}) property var modelSources: ({})
property var sidePaneModelSource: [] property var mainPaneModelSource: []
property var mainUI: null property var mainUI: null

View File

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

View File

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