diff --git a/src/gui/Base/HColumnPage.qml b/src/gui/Base/HColumnPage.qml new file mode 100644 index 00000000..d9b041f2 --- /dev/null +++ b/src/gui/Base/HColumnPage.qml @@ -0,0 +1,16 @@ +// SPDX-License-Identifier: LGPL-3.0-or-later + +import QtQuick 2.12 + +HPage { + focusTarget: column + + + default property alias columnData: column.data + + + HColumnLayout { + id: column + anchors.fill: parent + } +} diff --git a/src/gui/Base/HFlickableColumnPage.qml b/src/gui/Base/HFlickableColumnPage.qml new file mode 100644 index 00000000..5fbd9fd9 --- /dev/null +++ b/src/gui/Base/HFlickableColumnPage.qml @@ -0,0 +1,26 @@ +// SPDX-License-Identifier: LGPL-3.0-or-later + +import QtQuick 2.12 + +HPage { + focusTarget: column + + + property alias flickable: flickable + default property alias columnData: column.data + + + HFlickable { + id: flickable + anchors.fill: parent + clip: true + contentWidth: parent.width + contentHeight: column.childrenRect.height + + HColumnLayout { + id: column + width: flickable.width + height: flickable.height + } + } +} diff --git a/src/gui/Base/HPage.qml b/src/gui/Base/HPage.qml index 27f081a0..d07712fd 100644 --- a/src/gui/Base/HPage.qml +++ b/src/gui/Base/HPage.qml @@ -2,74 +2,22 @@ import QtQuick 2.12 import QtQuick.Controls 2.12 -import QtQuick.Layouts 1.12 -import "../MainPane" Page { - id: innerPage + leftPadding: currentSpacing < theme.spacing ? 0 : currentSpacing + rightPadding: leftPadding + background: null + Component.onCompleted: + if (becomeKeyboardFlickableTarget) shortcuts.flickTarget = focusTarget - default property alias columnData: contentColumn.data - - property alias flickable: innerFlickable - property alias headerLabel: innerHeaderLabel - property var hideHeaderUnderHeight: null property int currentSpacing: Math.min(theme.spacing * width / 400, theme.spacing) + property Item focusTarget: this property bool becomeKeyboardFlickableTarget: true - background: null - - header: Rectangle { - implicitWidth: parent ? parent.width : 0 - color: theme.controls.header.background - - height: innerHeaderLabel.text && ( - ! hideHeaderUnderHeight || - window.height >= - hideHeaderUnderHeight + - theme.baseElementsHeight + - currentSpacing * 2 - ) ? theme.baseElementsHeight : 0 - - Behavior on height { HNumberAnimation {} } - visible: height > 0 - - HLabel { - id: innerHeaderLabel - anchors.fill: parent - textFormat: Text.StyledText - font.pixelSize: theme.fontSize.big - elide: Text.ElideRight - horizontalAlignment: Text.AlignHCenter - verticalAlignment: Text.AlignVCenter - - leftPadding: currentSpacing - rightPadding: leftPadding - } - } - - leftPadding: currentSpacing < theme.spacing ? 0 : currentSpacing - rightPadding: leftPadding Behavior on leftPadding { HNumberAnimation {} } - - HFlickable { - id: innerFlickable - anchors.fill: parent - clip: true - contentWidth: parent.width - contentHeight: contentColumn.childrenRect.height - - Component.onCompleted: - if (becomeKeyboardFlickableTarget) shortcuts.flickTarget = this - - HColumnLayout { - id: contentColumn - width: innerFlickable.width - height: innerFlickable.height - } - } } diff --git a/src/gui/Pages/AccountSettings/AccountSettings.qml b/src/gui/Pages/AccountSettings/AccountSettings.qml index acae66e7..e0a0a2a3 100644 --- a/src/gui/Pages/AccountSettings/AccountSettings.qml +++ b/src/gui/Pages/AccountSettings/AccountSettings.qml @@ -6,12 +6,8 @@ import QtQuick.Layouts 1.12 import "../.." import "../../Base" -HPage { +HFlickableColumnPage { id: accountSettings - hideHeaderUnderHeight: avatarPreferredSize - headerLabel.text: qsTr("Account settings for %1").arg( - utils.coloredNameHtml(headerName, userId) - ) property int avatarPreferredSize: 256 * theme.uiScale @@ -38,9 +34,8 @@ HPage { Behavior on color { HColorAnimation {} } Layout.alignment: Qt.AlignCenter - Layout.topMargin: header.visible || index > 0 ? theme.spacing : 0 - Layout.bottomMargin: - header.visible || index < repeater.count - 1? theme.spacing : 0 + Layout.topMargin: index > 0 ? theme.spacing : 0 + Layout.bottomMargin: index < repeater.count - 1 ? theme.spacing : 0 Layout.maximumWidth: Math.min(parent.width, 640) Layout.preferredWidth: diff --git a/src/gui/Pages/AddAccount/AddAccount.qml b/src/gui/Pages/AddAccount/AddAccount.qml index 0297dc37..10b91cfc 100644 --- a/src/gui/Pages/AddAccount/AddAccount.qml +++ b/src/gui/Pages/AddAccount/AddAccount.qml @@ -4,7 +4,7 @@ import QtQuick 2.12 import QtQuick.Layouts 1.12 import "../../Base" -HPage { +HFlickableColumnPage { HTabContainer { tabModel: [ qsTr("Sign in"), qsTr("Register"), qsTr("Reset"), diff --git a/src/gui/Pages/AddChat/AddChat.qml b/src/gui/Pages/AddChat/AddChat.qml index 84cccb80..c3264ea4 100644 --- a/src/gui/Pages/AddChat/AddChat.qml +++ b/src/gui/Pages/AddChat/AddChat.qml @@ -5,7 +5,7 @@ import QtQuick.Layouts 1.12 import "../.." import "../../Base" -HPage { +HFlickableColumnPage { id: addChatPage diff --git a/src/gui/Pages/Chat/ChatPage.qml b/src/gui/Pages/Chat/ChatPage.qml index f9f01014..985971da 100644 --- a/src/gui/Pages/Chat/ChatPage.qml +++ b/src/gui/Pages/Chat/ChatPage.qml @@ -7,7 +7,7 @@ import "Banners" import "Timeline" import "FileTransfer" -HPage { +HColumnPage { id: chatPage leftPadding: 0 rightPadding: 0