matrixion/qml/dialogs/JoinRoomDialog.qml

75 lines
1.6 KiB
QML
Raw Normal View History

2021-09-25 04:32:06 +03:00
// SPDX-FileCopyrightText: 2021 Nheko Contributors
// SPDX-FileCopyrightText: 2022 Nheko Contributors
2021-09-25 04:32:06 +03:00
//
// SPDX-License-Identifier: GPL-3.0-or-later
import ".."
import QtQuick 2.12
import QtQuick.Controls 2.5
import QtQuick.Layouts 1.3
import im.nheko 1.0
ApplicationWindow {
id: joinRoomRoot
title: qsTr("Join room")
modality: Qt.WindowModal
flags: Qt.Dialog | Qt.WindowCloseButtonHint | Qt.WindowTitleHint
2022-04-11 05:18:16 +03:00
palette: timelineRoot.palette
color: timelineRoot.palette.window
2021-09-25 04:32:06 +03:00
width: 350
height: fontMetrics.lineSpacing * 7
2021-10-06 02:53:39 +03:00
Shortcut {
sequence: StandardKey.Cancel
onActivated: dbb.rejected()
}
2021-09-25 04:32:06 +03:00
ColumnLayout {
spacing: Nheko.paddingMedium
anchors.margins: Nheko.paddingMedium
anchors.fill: parent
Label {
id: promptLabel
text: qsTr("Room ID or alias")
2022-04-11 05:18:16 +03:00
color: timelineRoot.palette.text
2021-09-25 04:32:06 +03:00
}
MatrixTextField {
id: input
2021-10-06 02:55:53 +03:00
focus: true
2021-09-25 04:32:06 +03:00
Layout.fillWidth: true
2021-10-10 00:29:05 +03:00
onAccepted: {
if (input.text.match("#.+?:.{3,}"))
dbb.accepted();
2021-10-10 00:29:05 +03:00
}
2021-09-25 04:32:06 +03:00
}
}
footer: DialogButtonBox {
2021-10-06 02:53:39 +03:00
id: dbb
standardButtons: DialogButtonBox.Cancel
2021-09-25 04:32:06 +03:00
onAccepted: {
Nheko.joinRoom(input.text);
joinRoomRoot.close();
}
onRejected: {
joinRoomRoot.close();
}
Button {
text: "Join"
enabled: input.text.match("#.+?:.{3,}")
DialogButtonBox.buttonRole: DialogButtonBox.AcceptRole
}
}
}