Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Input method height #1011

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions resources/qml/TimelineView.qml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,15 @@ Item {
property var room: null
property var roomPreview: null
property bool showBackButton: false
property int fullHeight

Component.onCompleted: {
fullHeight = height
}
onHeightChanged: {
if(!Qt.inputMethod.visible)
fullHeight = height
}
Comment on lines +28 to +34
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Won't this break on phone rotations? :D

Copy link
Contributor Author

@maltee1 maltee1 Mar 23, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

are you saying that when rotating the phone with the keyboard up, fullHeight won't change? Or fullHeight will change when it shouldn't?

Disregarding the fact that Nheko is more or less unusable in landscape mode (at 200% scaling, with On-screen keyboard), the former is not an issue, because the keyboard is stowed on rotation. The latter does happen, but I think that's actually desirable.

There's also the Screen QML Type which provides a property desktopAvailableHeight and height. At least the latter will be persistent and could be used. But that would require us to somehow determine what kind of platform we're on, I imagine people on Desktop want their images to resize according to the window size (what about multiple screens?). Another settings toggle should be the last option if nothing else is deemed satisfactory :D


Label {
visible: !room && !TimelineManager.isInitialSync && (!roomPreview || !roomPreview.roomid)
Expand Down
2 changes: 1 addition & 1 deletion resources/qml/delegates/ImageMessage.qml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ Item {

property int tempWidth: originalWidth < 1? 400: originalWidth

implicitWidth: Math.round(tempWidth*Math.min((timelineView.height/divisor)/(tempWidth*proportionalHeight), 1))
implicitWidth: Math.round(tempWidth*Math.min((timelineView.fullHeight/divisor)/(tempWidth*proportionalHeight), 1))
width: Math.min(parent.width,implicitWidth)
height: width*proportionalHeight

Expand Down
2 changes: 1 addition & 1 deletion resources/qml/delegates/PlayableMediaMessage.qml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ Item {
required property string filesize
property double divisor: isReply ? 4 : 2
property int tempWidth: originalWidth < 1? 400: originalWidth
implicitWidth: type == MtxEvent.VideoMessage ? Math.round(tempWidth*Math.min((timelineView.height/divisor)/(tempWidth*proportionalHeight), 1)) : 500
implicitWidth: type == MtxEvent.VideoMessage ? Math.round(tempWidth*Math.min((timelineView.fullHeight/divisor)/(tempWidth*proportionalHeight), 1)) : 500
width: Math.min(parent.width, implicitWidth)
height: (type == MtxEvent.VideoMessage ? width*proportionalHeight : 80) + fileInfoLabel.height
implicitHeight: height
Expand Down
2 changes: 1 addition & 1 deletion resources/qml/delegates/TextMessage.qml
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ MatrixText {
</style>
" + formatted.replace(/<pre>/g, "<pre style='white-space: pre-wrap; background-color: " + Nheko.colors.alternateBase + "'>").replace(/<del>/g, "<s>").replace(/<\/del>/g, "</s>").replace(/<strike>/g, "<s>").replace(/<\/strike>/g, "</s>")
width: parent.width
height: isReply ? Math.round(Math.min(timelineView.height / 8, implicitHeight)) : implicitHeight
height: isReply ? Math.round(Math.min(timelineView.fullHeight / 8, implicitHeight)) : implicitHeight
clip: isReply
selectByMouse: !Settings.mobileMode && !isReply
font.pointSize: (Settings.enlargeEmojiOnlyMessages && isOnlyEmoji > 0 && isOnlyEmoji < 4) ? Settings.fontSize * 3 : Settings.fontSize
Expand Down
3 changes: 1 addition & 2 deletions src/UserSettingsPage.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1131,8 +1131,7 @@ UserSettingsModel::data(const QModelIndex &index, int role) const
"Allow using markdown in messages.\nWhen disabled, all messages are sent as a plain "
"text.");
case Bubbles:
return tr(
"Messages get a bubble background. This also triggers some layout changes (WIP).");
return tr("Messages get a bubble background. This also triggers some layout changes.");
case SmallAvatars:
return tr("Avatars are resized to fit above the message.");
case AnimateImagesOnHover:
Expand Down