Fix banners, adapt to app width

This commit is contained in:
miruka 2019-07-16 08:10:37 -04:00
parent 1abec4cf2c
commit 5cc701113e
6 changed files with 84 additions and 70 deletions

View File

@ -1,17 +1,16 @@
- If avatar is set, name color from average color? - If avatar is set, name color from average color?
- banner button repair
- Wrong avatar for group rooms - Wrong avatar for group rooms
- Reduce messages ListView cacheBuffer height once http thumbnails - Reduce messages ListView cacheBuffer height once http thumbnails
downloading is implemented downloading is implemented
- HTextField focus effect - HTextField focus effect
- Button can get "hoverEnabled: false" to let HoverHandlers work - Button can get "hoverEnabled: false" to let HoverHandlers work
- Handle TimeoutError for all kind of async requests (nio)
- Handle thumbnail response status 400 - Handle thumbnail response status 400
- "Loading..." if going to edit account page while it's loading - "Loading..." if going to edit account page while it's loading
- Improve avatar tooltips position, add stuff to room tooltips (last msg?) - Improve avatar tooltips position, add stuff to room tooltips (last msg?)
- Accept drag and dropping a picture in account settings to set avatar - Accept drag and dropping a picture in account settings to set avatar
- When all the events loaded on beginning in a room are name/avatar changes, - When all the events loaded on beginning in a room are name/avatar changes,
no last event room text is displayed no last event room text is displayed
- `QCoreApplication::setAttribute(Qt::AA_EnableHighDpiScaling)` ?
- Qt 5.12 - Qt 5.12
- See about ECMAScript 6 and 7 features - See about ECMAScript 6 and 7 features
@ -37,8 +36,6 @@
- Don't put own messages to the right past certain width - Don't put own messages to the right past certain width
- Invite to room - Invite to room
- Accounts delegates background
- SidePane delegates hover effect
- Server selection - Server selection
- Register/Forgot? for SignIn dialog - Register/Forgot? for SignIn dialog
- Scaling - Scaling
@ -49,7 +46,6 @@
- Prevent using the SendBox if no permission (power levels) - Prevent using the SendBox if no permission (power levels)
- Spinner when loading past room events, images or clicking buttons - Spinner when loading past room events, images or clicking buttons
- Better theming/styling system - Better theming/styling system
- See about <https://doc.qt.io/qt-5/qtquickcontrols2-configuration.html>
- Settings page - Settings page
- Multiaccount aliases - Multiaccount aliases
- Message/text selection - Message/text selection
@ -71,7 +67,6 @@
- Client improvements - Client improvements
- [debug mode](https://docs.python.org/3/library/asyncio-dev.html) - [debug mode](https://docs.python.org/3/library/asyncio-dev.html)
- Filtering rooms: search more than display names?
- Initial sync filter and lazy load, see weechat-matrix `_handle_login()` - Initial sync filter and lazy load, see weechat-matrix `_handle_login()`
- See also `handle_response()`'s `keys_query` request - See also `handle_response()`'s `keys_query` request
- Direct chats category - Direct chats category
@ -87,6 +82,7 @@
- Room subtitle: show things like "*Image*" instead of blank, etc - Room subtitle: show things like "*Image*" instead of blank, etc
- Missing nio support - Missing nio support
- Handle TimeoutError for all kind of async requests (nio)
- MatrixRoom invited members list - MatrixRoom invited members list
- Invite events are missing their timestamps (needed for sorting) - Invite events are missing their timestamps (needed for sorting)
- Left room events after client reboot - Left room events after client reboot

View File

@ -51,7 +51,11 @@ HRectangle {
HToolTip { HToolTip {
id: avatarToolTip id: avatarToolTip
visible: toolTipImageUrl && hoverHandler.hovered visible: toolTipImageUrl && hoverHandler.hovered
width: 192 + background.border.width * 2 width: Math.min(
mainUI.width / 1.25,
mainUI.height / 1.25,
192 + background.border.width * 2
)
height: width height: width
delay: 1000 delay: 1000

View File

@ -7,19 +7,17 @@ import QtQuick.Layouts 1.12
import QtGraphicalEffects 1.12 import QtGraphicalEffects 1.12
HBaseButton { HBaseButton {
property int contentWidth: 0
property int horizontalMargin: 0 property int horizontalMargin: 0
property int verticalMargin: 0 property int verticalMargin: 0
property int fontSize: theme.fontSize.normal
property string iconName: "" property string iconName: ""
property var iconDimension: null property var iconDimension: null
property var iconTransform: null property var iconTransform: null
property int fontSize: theme.fontSize.normal
property bool loading: false property bool loading: false
property int contentWidth: 0
readonly property alias visibility: button.visible readonly property alias visibility: button.visible
onVisibilityChanged: if (! visibility) { loading = false } onVisibilityChanged: if (! visibility) { loading = false }
@ -46,6 +44,7 @@ HBaseButton {
} }
HLabel { HLabel {
visible: Boolean(text)
text: button.text text: button.text
font.pixelSize: fontSize font.pixelSize: fontSize
horizontalAlignment: Text.AlignHCenter horizontalAlignment: Text.AlignHCenter

View File

@ -7,8 +7,7 @@ import "../../Base"
HRectangle { HRectangle {
id: banner id: banner
Layout.fillWidth: true implicitHeight: childrenRect.height
Layout.preferredHeight: theme.baseElementsHeight
property alias avatar: bannerAvatar property alias avatar: bannerAvatar
property alias icon: bannerIcon property alias icon: bannerIcon
@ -16,12 +15,31 @@ HRectangle {
property alias buttonModel: bannerRepeater.model property alias buttonModel: bannerRepeater.model
property var buttonCallbacks: [] property var buttonCallbacks: []
HGridLayout {
id: bannerGrid
width: parent.width
flow: bannerAvatarWrapper.width +
bannerIcon.width +
bannerLabel.implicitWidth +
bannerButtons.width >
parent.width ?
GridLayout.TopToBottom : GridLayout.LeftToRight
HRowLayout { HRowLayout {
id: bannerRow id: bannerRow
anchors.fill: parent
HRectangle {
id: bannerAvatarWrapper
color: "black"
Layout.preferredWidth: bannerAvatar.width
Layout.minimumHeight: bannerAvatar.height
Layout.preferredHeight: bannerLabel.height
HUserAvatar { HUserAvatar {
id: bannerAvatar id: bannerAvatar
anchors.centerIn: parent
}
} }
HIcon { HIcon {
@ -35,10 +53,7 @@ HRectangle {
HLabel { HLabel {
id: bannerLabel id: bannerLabel
textFormat: Text.StyledText textFormat: Text.StyledText
elide: Text.ElideRight wrapMode: Text.Wrap
visible:
bannerRow.width - bannerAvatar.width - bannerButtons.width > 30
Layout.fillWidth: true Layout.fillWidth: true
Layout.leftMargin: bannerIcon.Layout.leftMargin Layout.leftMargin: bannerIcon.Layout.leftMargin
@ -46,28 +61,12 @@ HRectangle {
} }
HSpacer {} HSpacer {}
}
HRowLayout {
HRowLayout { HRowLayout {
id: bannerButtons id: bannerButtons
function getButtonsWidth() {
var total = 0
for (var i = 0; i < bannerRepeater.count; i++) {
total += bannerRepeater.itemAt(i).implicitWidth
}
return total
}
property bool compact:
bannerRow.width <
bannerAvatar.width +
bannerLabel.implicitWidth +
bannerLabel.Layout.leftMargin +
bannerLabel.Layout.rightMargin +
getButtonsWidth()
Repeater { Repeater {
id: bannerRepeater id: bannerRepeater
model: [] model: []
@ -78,11 +77,19 @@ HRectangle {
iconName: modelData.iconName iconName: modelData.iconName
onClicked: buttonCallbacks[modelData.name](button) onClicked: buttonCallbacks[modelData.name](button)
clip: true Layout.preferredHeight: theme.baseElementsHeight
Layout.maximumWidth: bannerButtons.compact ? height : -1 }
}
}
HRectangle {
id: buttonsRightPadding
color: theme.controls.button.background
visible: bannerGrid.flow == GridLayout.TopToBottom
Layout.fillWidth: true
Layout.fillHeight: true Layout.fillHeight: true
} }
} }
} }
} }
}

View File

@ -55,10 +55,14 @@ HColumnLayout {
InviteBanner { InviteBanner {
visible: category == "Invites" visible: category == "Invites"
inviterId: roomInfo.inviterId inviterId: roomInfo.inviterId
Layout.fillWidth: true
} }
//UnknownDevicesBanner { //UnknownDevicesBanner {
//visible: category == "Rooms" && hasUnknownDevices //visible: category == "Rooms" && hasUnknownDevices
//
//Layout.fillWidth: true
//} //}
SendBox { SendBox {
@ -69,6 +73,8 @@ HColumnLayout {
LeftBanner { LeftBanner {
visible: category == "Left" visible: category == "Left"
userId: chatPage.userId userId: chatPage.userId
Layout.fillWidth: true
} }
} }

View File

@ -90,8 +90,10 @@ Item {
repeat: false repeat: false
onTriggered: pageStack.showRoom( onTriggered: pageStack.showRoom(
"@test_mary:matrix.org", "@test_mary:matrix.org",
"Rooms", // "Rooms",
"!TSXGsbBbdwsdylIOJZ:matrix.org" // "!TSXGsbBbdwsdylIOJZ:matrix.org"
"Invites",
"!xjqvLOGhMVutPXpAqi:matrix.org"
) )
// onTriggered: pageStack.showPage( // onTriggered: pageStack.showPage(
// "EditAccount/EditAccount", // "EditAccount/EditAccount",