mirror of
https://github.com/Nheko-Reborn/nheko.git
synced 2024-10-30 17:40:47 +03:00
Merge pull request #965 from maltee1/mobile_room_settings
Mobile room settings
This commit is contained in:
commit
d0623131e5
1 changed files with 298 additions and 230 deletions
|
@ -17,8 +17,10 @@ ApplicationWindow {
|
|||
|
||||
property var roomSettings
|
||||
|
||||
minimumWidth: 450
|
||||
minimumHeight: 680
|
||||
minimumWidth: 340
|
||||
minimumHeight: 450
|
||||
width: 450
|
||||
height: 680
|
||||
palette: Nheko.colors
|
||||
color: Nheko.colors.window
|
||||
modality: Qt.NonModal
|
||||
|
@ -29,15 +31,25 @@ ApplicationWindow {
|
|||
sequence: StandardKey.Cancel
|
||||
onActivated: roomSettingsDialog.close()
|
||||
}
|
||||
|
||||
ScrollHelper {
|
||||
flickable: flickable
|
||||
anchors.fill: flickable
|
||||
}
|
||||
Flickable {
|
||||
id: flickable
|
||||
boundsBehavior: Flickable.StopAtBounds
|
||||
anchors.fill: parent
|
||||
clip: true
|
||||
flickableDirection: Flickable.VerticalFlick
|
||||
contentWidth: roomSettingsDialog.width
|
||||
contentHeight: contentLayout1.height
|
||||
ColumnLayout {
|
||||
id: contentLayout1
|
||||
|
||||
anchors.fill: parent
|
||||
anchors.margins: Nheko.paddingMedium
|
||||
width: parent.width
|
||||
spacing: Nheko.paddingMedium
|
||||
|
||||
Avatar {
|
||||
Layout.topMargin: Nheko.paddingMedium
|
||||
url: roomSettings.roomAvatarUrl.replace("mxc://", "image://MxcImage/")
|
||||
roomid: roomSettings.roomId
|
||||
displayName: roomSettings.roomName
|
||||
|
@ -65,6 +77,8 @@ ApplicationWindow {
|
|||
visible: opacity > 0
|
||||
opacity: 0
|
||||
Layout.alignment: Qt.AlignHCenter
|
||||
wrapMode: Text.Wrap // somehow still doesn't wrap
|
||||
Layout.fillWidth: true
|
||||
}
|
||||
|
||||
SequentialAnimation {
|
||||
|
@ -93,20 +107,21 @@ ApplicationWindow {
|
|||
hideErrorAnimation.restart();
|
||||
}
|
||||
}
|
||||
|
||||
ColumnLayout {
|
||||
Layout.alignment: Qt.AlignHCenter
|
||||
|
||||
MatrixText {
|
||||
Label {
|
||||
text: roomSettings.roomName
|
||||
Layout.alignment: Qt.AlignHCenter
|
||||
font.pixelSize: fontMetrics.font.pixelSize * 2
|
||||
Layout.fillWidth: true
|
||||
horizontalAlignment: TextEdit.AlignHCenter
|
||||
color: Nheko.colors.text
|
||||
wrapMode: Text.Wrap
|
||||
textFormat: Text.RichText
|
||||
}
|
||||
|
||||
MatrixText {
|
||||
Label {
|
||||
text: qsTr("%n member(s)", "", roomSettings.memberCount)
|
||||
Layout.alignment: Qt.AlignHCenter
|
||||
color: Nheko.colors.text
|
||||
|
||||
TapHandler {
|
||||
onSingleTapped: TimelineManager.openRoomMembers(Rooms.getRoomById(roomSettings.roomId))
|
||||
|
@ -119,8 +134,6 @@ ApplicationWindow {
|
|||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
ImageButton {
|
||||
Layout.alignment: Qt.AlignHCenter
|
||||
image: ":/icons/icons/ui/edit.svg"
|
||||
|
@ -128,20 +141,24 @@ ApplicationWindow {
|
|||
onClicked: roomSettings.openEditModal()
|
||||
}
|
||||
|
||||
ScrollView {
|
||||
Layout.fillHeight: true
|
||||
TextArea {
|
||||
id: roomTopic
|
||||
property bool cut: implicitHeight > 100
|
||||
property bool showMore
|
||||
clip: true
|
||||
Layout.maximumHeight: showMore? Number.POSITIVE_INFINITY : 100
|
||||
Layout.preferredHeight: implicitHeight
|
||||
Layout.alignment: Qt.AlignHCenter
|
||||
Layout.fillWidth: true
|
||||
Layout.leftMargin: Nheko.paddingLarge
|
||||
Layout.rightMargin: Nheko.paddingLarge
|
||||
|
||||
TextArea {
|
||||
text: TimelineManager.escapeEmoji(roomSettings.roomTopic)
|
||||
wrapMode: TextEdit.WordWrap
|
||||
textFormat: TextEdit.RichText
|
||||
readOnly: true
|
||||
background: null
|
||||
selectByMouse: true
|
||||
selectByMouse: !Settings.mobileMode
|
||||
color: Nheko.colors.text
|
||||
horizontalAlignment: TextEdit.AlignHCenter
|
||||
onLinkActivated: Nheko.openLink(link)
|
||||
|
@ -152,25 +169,34 @@ ApplicationWindow {
|
|||
}
|
||||
|
||||
}
|
||||
|
||||
Item {
|
||||
Layout.alignment: Qt.AlignHCenter
|
||||
id: showMorePlaceholder
|
||||
Layout.preferredHeight: showMoreButton.height
|
||||
Layout.preferredWidth: showMoreButton.width
|
||||
visible: roomTopic.cut
|
||||
}
|
||||
|
||||
GridLayout {
|
||||
columns: 2
|
||||
rowSpacing: Nheko.paddingMedium
|
||||
Layout.margins: Nheko.paddingMedium
|
||||
Layout.fillWidth: true
|
||||
|
||||
MatrixText {
|
||||
Label {
|
||||
text: qsTr("SETTINGS")
|
||||
font.bold: true
|
||||
color: Nheko.colors.text
|
||||
}
|
||||
|
||||
Item {
|
||||
Layout.fillWidth: true
|
||||
}
|
||||
|
||||
MatrixText {
|
||||
Label {
|
||||
text: qsTr("Notifications")
|
||||
Layout.fillWidth: true
|
||||
color: Nheko.colors.text
|
||||
}
|
||||
|
||||
ComboBox {
|
||||
|
@ -180,11 +206,13 @@ ApplicationWindow {
|
|||
roomSettings.changeNotifications(index);
|
||||
}
|
||||
Layout.fillWidth: true
|
||||
WheelHandler{} // suppress scrolling changing values
|
||||
}
|
||||
|
||||
MatrixText {
|
||||
Label {
|
||||
text: qsTr("Room access")
|
||||
Layout.fillWidth: true
|
||||
color: Nheko.colors.text
|
||||
}
|
||||
|
||||
ComboBox {
|
||||
|
@ -204,10 +232,12 @@ ApplicationWindow {
|
|||
roomSettings.changeAccessRules(index);
|
||||
}
|
||||
Layout.fillWidth: true
|
||||
WheelHandler{} // suppress scrolling changing values
|
||||
}
|
||||
|
||||
MatrixText {
|
||||
Label {
|
||||
text: qsTr("Encryption")
|
||||
color: Nheko.colors.text
|
||||
}
|
||||
|
||||
ToggleButton {
|
||||
|
@ -243,8 +273,9 @@ ApplicationWindow {
|
|||
buttons: Platform.MessageDialog.Ok | Platform.MessageDialog.Cancel
|
||||
}
|
||||
|
||||
MatrixText {
|
||||
Label {
|
||||
text: qsTr("Sticker & Emote Settings")
|
||||
color: Nheko.colors.text
|
||||
}
|
||||
|
||||
Button {
|
||||
|
@ -254,8 +285,9 @@ ApplicationWindow {
|
|||
Layout.alignment: Qt.AlignRight
|
||||
}
|
||||
|
||||
MatrixText {
|
||||
Label {
|
||||
text: qsTr("Hidden events")
|
||||
color: Nheko.colors.text
|
||||
}
|
||||
|
||||
HiddenEventsDialog {
|
||||
|
@ -281,42 +313,78 @@ ApplicationWindow {
|
|||
Layout.fillWidth: true
|
||||
}
|
||||
|
||||
MatrixText {
|
||||
Label {
|
||||
text: qsTr("INFO")
|
||||
font.bold: true
|
||||
color: Nheko.colors.text
|
||||
}
|
||||
|
||||
Item {
|
||||
Layout.fillWidth: true
|
||||
}
|
||||
|
||||
MatrixText {
|
||||
Label {
|
||||
text: qsTr("Internal ID")
|
||||
color: Nheko.colors.text
|
||||
}
|
||||
|
||||
MatrixText {
|
||||
AbstractButton { // AbstractButton does not allow setting text color
|
||||
Layout.alignment: Qt.AlignRight
|
||||
Layout.fillWidth: true
|
||||
Layout.preferredHeight: idLabel.height
|
||||
Label { // TextEdit does not trigger onClicked
|
||||
id: idLabel
|
||||
text: roomSettings.roomId
|
||||
font.pixelSize: Math.floor(fontMetrics.font.pixelSize * 0.8)
|
||||
Layout.alignment: Qt.AlignRight
|
||||
color: Nheko.colors.text
|
||||
width: parent.width
|
||||
horizontalAlignment: Text.AlignRight
|
||||
wrapMode: Text.WrapAnywhere
|
||||
ToolTip.text: qsTr("Copied to clipboard")
|
||||
ToolTip.visible: toolTipTimer.running
|
||||
}
|
||||
TextEdit{ // label does not allow selection
|
||||
id: textEdit
|
||||
visible: false
|
||||
text: roomSettings.roomId
|
||||
}
|
||||
onClicked: {
|
||||
textEdit.selectAll()
|
||||
textEdit.copy()
|
||||
toolTipTimer.start()
|
||||
}
|
||||
Timer {
|
||||
id: toolTipTimer
|
||||
}
|
||||
}
|
||||
|
||||
MatrixText {
|
||||
Label {
|
||||
text: qsTr("Room Version")
|
||||
color: Nheko.colors.text
|
||||
}
|
||||
|
||||
MatrixText {
|
||||
Label {
|
||||
text: roomSettings.roomVersion
|
||||
font.pixelSize: fontMetrics.font.pixelSize
|
||||
Layout.alignment: Qt.AlignRight
|
||||
color: Nheko.colors.text
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
DialogButtonBox {
|
||||
Layout.fillWidth: true
|
||||
}
|
||||
}
|
||||
Button {
|
||||
id: showMoreButton
|
||||
anchors.horizontalCenter: flickable.horizontalCenter
|
||||
y: Math.min(showMorePlaceholder.y+contentLayout1.y-flickable.contentY,flickable.height-height)
|
||||
visible: roomTopic.cut
|
||||
text: roomTopic.showMore? "show less" : "show more"
|
||||
onClicked: {roomTopic.showMore = !roomTopic.showMore
|
||||
console.log(flickable.visibleArea)
|
||||
}
|
||||
}
|
||||
footer: DialogButtonBox {
|
||||
standardButtons: DialogButtonBox.Ok
|
||||
onAccepted: close()
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue