mirror of
https://github.com/Nheko-Reborn/nheko.git
synced 2024-11-22 11:00:48 +03:00
Fix miscalculation of padding in timeline
This commit is contained in:
parent
264a85b9e4
commit
8351cc4180
4 changed files with 48 additions and 39 deletions
|
@ -15,7 +15,7 @@ ScrollView {
|
||||||
ListView {
|
ListView {
|
||||||
id: chat
|
id: chat
|
||||||
|
|
||||||
property int delegateMaxWidth: ((Settings.timelineMaxWidth > 100 && Settings.timelineMaxWidth < parent.availableWidth) ? Settings.timelineMaxWidth : parent.availableWidth) - parent.padding
|
property int delegateMaxWidth: ((Settings.timelineMaxWidth > 100 && Settings.timelineMaxWidth < parent.availableWidth) ? Settings.timelineMaxWidth : parent.availableWidth) - parent.padding * 2
|
||||||
|
|
||||||
model: TimelineManager.timeline
|
model: TimelineManager.timeline
|
||||||
boundsBehavior: Flickable.StopAtBounds
|
boundsBehavior: Flickable.StopAtBounds
|
||||||
|
|
|
@ -1,16 +1,16 @@
|
||||||
import QtQuick 2.9
|
import QtQuick 2.9
|
||||||
import QtQuick.Controls 2.3
|
import QtQuick.Controls 2.3
|
||||||
|
import QtQuick.Dialogs 1.2
|
||||||
import QtQuick.Layouts 1.2
|
import QtQuick.Layouts 1.2
|
||||||
import QtQuick.Window 2.3
|
import QtQuick.Window 2.3
|
||||||
import QtQuick.Dialogs 1.2
|
|
||||||
import im.nheko 1.0
|
import im.nheko 1.0
|
||||||
|
|
||||||
ApplicationWindow {
|
ApplicationWindow {
|
||||||
id: roomSettingsDialog
|
id: roomSettingsDialog
|
||||||
|
|
||||||
property var roomSettings
|
property var roomSettings
|
||||||
|
|
||||||
x: MainWindow.x + (MainWindow.width / 2) - (width / 2)
|
x: MainWindow.x + (MainWindow.width / 2) - (width / 2)
|
||||||
y: MainWindow.y + (MainWindow.height / 2) - (height / 2)
|
y: MainWindow.y + (MainWindow.height / 2) - (height / 2)
|
||||||
minimumWidth: 420
|
minimumWidth: 420
|
||||||
minimumHeight: 650
|
minimumHeight: 650
|
||||||
|
@ -36,9 +36,9 @@ ApplicationWindow {
|
||||||
width: 130
|
width: 130
|
||||||
Layout.alignment: Qt.AlignHCenter
|
Layout.alignment: Qt.AlignHCenter
|
||||||
onClicked: {
|
onClicked: {
|
||||||
if(roomSettings.canChangeAvatar) {
|
if (roomSettings.canChangeAvatar)
|
||||||
roomSettings.updateAvatar();
|
roomSettings.updateAvatar();
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -50,6 +50,7 @@ ApplicationWindow {
|
||||||
|
|
||||||
Text {
|
Text {
|
||||||
id: errorText
|
id: errorText
|
||||||
|
|
||||||
text: "Error Text"
|
text: "Error Text"
|
||||||
color: "red"
|
color: "red"
|
||||||
visible: opacity > 0
|
visible: opacity > 0
|
||||||
|
@ -59,24 +60,28 @@ ApplicationWindow {
|
||||||
|
|
||||||
SequentialAnimation {
|
SequentialAnimation {
|
||||||
id: hideErrorAnimation
|
id: hideErrorAnimation
|
||||||
|
|
||||||
running: false
|
running: false
|
||||||
|
|
||||||
PauseAnimation {
|
PauseAnimation {
|
||||||
duration: 4000
|
duration: 4000
|
||||||
}
|
}
|
||||||
|
|
||||||
NumberAnimation {
|
NumberAnimation {
|
||||||
target: errorText
|
target: errorText
|
||||||
property: 'opacity'
|
property: 'opacity'
|
||||||
to: 0
|
to: 0
|
||||||
duration: 1000
|
duration: 1000
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Connections{
|
Connections {
|
||||||
target: roomSettings
|
target: roomSettings
|
||||||
onDisplayError: {
|
onDisplayError: {
|
||||||
errorText.text = errorMessage
|
errorText.text = errorMessage;
|
||||||
errorText.opacity = 1
|
errorText.opacity = 1;
|
||||||
hideErrorAnimation.restart()
|
hideErrorAnimation.restart();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -93,6 +98,7 @@ ApplicationWindow {
|
||||||
text: "%1 member(s)".arg(roomSettings.memberCount)
|
text: "%1 member(s)".arg(roomSettings.memberCount)
|
||||||
Layout.alignment: Qt.AlignHCenter
|
Layout.alignment: Qt.AlignHCenter
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
ImageButton {
|
ImageButton {
|
||||||
|
@ -117,6 +123,7 @@ ApplicationWindow {
|
||||||
color: colors.text
|
color: colors.text
|
||||||
horizontalAlignment: TextEdit.AlignHCenter
|
horizontalAlignment: TextEdit.AlignHCenter
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
GridLayout {
|
GridLayout {
|
||||||
|
@ -138,10 +145,10 @@ ApplicationWindow {
|
||||||
}
|
}
|
||||||
|
|
||||||
ComboBox {
|
ComboBox {
|
||||||
model: [ "Muted", "Mentions only", "All messages" ]
|
model: ["Muted", "Mentions only", "All messages"]
|
||||||
currentIndex: roomSettings.notifications
|
currentIndex: roomSettings.notifications
|
||||||
onActivated: {
|
onActivated: {
|
||||||
roomSettings.changeNotifications(index)
|
roomSettings.changeNotifications(index);
|
||||||
}
|
}
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
}
|
}
|
||||||
|
@ -153,10 +160,10 @@ ApplicationWindow {
|
||||||
|
|
||||||
ComboBox {
|
ComboBox {
|
||||||
enabled: roomSettings.canChangeJoinRules
|
enabled: roomSettings.canChangeJoinRules
|
||||||
model: [ "Anyone and guests", "Anyone", "Invited users" ]
|
model: ["Anyone and guests", "Anyone", "Invited users"]
|
||||||
currentIndex: roomSettings.accessJoinRules
|
currentIndex: roomSettings.accessJoinRules
|
||||||
onActivated: {
|
onActivated: {
|
||||||
roomSettings.changeAccessRules(index)
|
roomSettings.changeAccessRules(index);
|
||||||
}
|
}
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
}
|
}
|
||||||
|
@ -170,11 +177,10 @@ ApplicationWindow {
|
||||||
|
|
||||||
checked: roomSettings.isEncryptionEnabled
|
checked: roomSettings.isEncryptionEnabled
|
||||||
onClicked: {
|
onClicked: {
|
||||||
if(roomSettings.isEncryptionEnabled) {
|
if (roomSettings.isEncryptionEnabled) {
|
||||||
checked=true;
|
checked = true;
|
||||||
return;
|
return ;
|
||||||
}
|
}
|
||||||
|
|
||||||
confirmEncryptionDialog.open();
|
confirmEncryptionDialog.open();
|
||||||
}
|
}
|
||||||
Layout.alignment: Qt.AlignRight
|
Layout.alignment: Qt.AlignRight
|
||||||
|
@ -182,24 +188,21 @@ ApplicationWindow {
|
||||||
|
|
||||||
MessageDialog {
|
MessageDialog {
|
||||||
id: confirmEncryptionDialog
|
id: confirmEncryptionDialog
|
||||||
|
|
||||||
title: qsTr("End-to-End Encryption")
|
title: qsTr("End-to-End Encryption")
|
||||||
text: qsTr("Encryption is currently experimental and things might break unexpectedly. <br>
|
text: qsTr("Encryption is currently experimental and things might break unexpectedly. <br>
|
||||||
Please take note that it can't be disabled afterwards.")
|
Please take note that it can't be disabled afterwards.")
|
||||||
modality: Qt.WindowModal
|
modality: Qt.WindowModal
|
||||||
icon: StandardIcon.Question
|
icon: StandardIcon.Question
|
||||||
|
|
||||||
onAccepted: {
|
onAccepted: {
|
||||||
if(roomSettings.isEncryptionEnabled) {
|
if (roomSettings.isEncryptionEnabled)
|
||||||
return;
|
return ;
|
||||||
}
|
|
||||||
|
|
||||||
roomSettings.enableEncryption();
|
roomSettings.enableEncryption();
|
||||||
}
|
}
|
||||||
|
|
||||||
onRejected: {
|
onRejected: {
|
||||||
encryptionToggle.checked = false
|
encryptionToggle.checked = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
standardButtons: Dialog.Ok | Dialog.Cancel
|
standardButtons: Dialog.Ok | Dialog.Cancel
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -210,14 +213,12 @@ ApplicationWindow {
|
||||||
|
|
||||||
ToggleButton {
|
ToggleButton {
|
||||||
visible: roomSettings.isEncryptionEnabled
|
visible: roomSettings.isEncryptionEnabled
|
||||||
ToolTip.text: qsTr("Whether or not the client should respond automatically with the session keys
|
ToolTip.text: qsTr("Whether or not the client should respond automatically with the session keys
|
||||||
upon request. Use with caution, this is a temporary measure to test the
|
upon request. Use with caution, this is a temporary measure to test the
|
||||||
E2E implementation until device verification is completed.")
|
E2E implementation until device verification is completed.")
|
||||||
|
|
||||||
checked: roomSettings.respondsToKeyRequests
|
checked: roomSettings.respondsToKeyRequests
|
||||||
|
|
||||||
onClicked: {
|
onClicked: {
|
||||||
roomSettings.changeKeyRequestsPreference(checked)
|
roomSettings.changeKeyRequestsPreference(checked);
|
||||||
}
|
}
|
||||||
Layout.alignment: Qt.AlignRight
|
Layout.alignment: Qt.AlignRight
|
||||||
}
|
}
|
||||||
|
@ -260,6 +261,7 @@ ApplicationWindow {
|
||||||
font.pixelSize: 14
|
font.pixelSize: 14
|
||||||
Layout.alignment: Qt.AlignRight
|
Layout.alignment: Qt.AlignRight
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Button {
|
Button {
|
||||||
|
@ -267,5 +269,7 @@ ApplicationWindow {
|
||||||
text: "Ok"
|
text: "Ok"
|
||||||
onClicked: close()
|
onClicked: close()
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
}
|
||||||
|
|
|
@ -5,32 +5,36 @@ import im.nheko 1.0
|
||||||
|
|
||||||
Switch {
|
Switch {
|
||||||
id: toggleButton
|
id: toggleButton
|
||||||
|
|
||||||
implicitWidth: indicatorItem.width
|
implicitWidth: indicatorItem.width
|
||||||
|
|
||||||
indicator: Item {
|
indicator: Item {
|
||||||
id: indicatorItem
|
id: indicatorItem
|
||||||
|
|
||||||
implicitWidth: 48
|
implicitWidth: 48
|
||||||
implicitHeight: 24
|
implicitHeight: 24
|
||||||
y: parent.height / 2 - height / 2
|
y: parent.height / 2 - height / 2
|
||||||
|
|
||||||
Rectangle {
|
Rectangle {
|
||||||
height: 3 * parent.height/4
|
height: 3 * parent.height / 4
|
||||||
radius: height/2
|
radius: height / 2
|
||||||
width: parent.width - height
|
width: parent.width - height
|
||||||
x: radius
|
x: radius
|
||||||
y: parent.height / 2 - height / 2
|
y: parent.height / 2 - height / 2
|
||||||
color: toggleButton.checked ? "skyblue" : "grey"
|
color: toggleButton.checked ? "skyblue" : "grey"
|
||||||
border.color: "#cccccc"
|
border.color: "#cccccc"
|
||||||
}
|
}
|
||||||
|
|
||||||
Rectangle {
|
Rectangle {
|
||||||
x: toggleButton.checked ? parent.width - width : 0
|
x: toggleButton.checked ? parent.width - width : 0
|
||||||
y: parent.height / 2 - height / 2
|
y: parent.height / 2 - height / 2
|
||||||
width: parent.height
|
width: parent.height
|
||||||
height: width
|
height: width
|
||||||
radius: width/2
|
radius: width / 2
|
||||||
color: toggleButton.down ? "whitesmoke" : "whitesmoke"
|
color: toggleButton.down ? "whitesmoke" : "whitesmoke"
|
||||||
border.color: "#ebebeb"
|
border.color: "#ebebeb"
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
}
|
||||||
|
|
|
@ -118,6 +118,7 @@ ApplicationWindow {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
MatrixText {
|
MatrixText {
|
||||||
|
|
Loading…
Reference in a new issue