2023-02-21 23:48:49 +01:00
|
|
|
// SPDX-FileCopyrightText: Nheko Contributors
|
2021-09-25 03:32:06 +02: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
|
|
|
|
palette: Nheko.colors
|
|
|
|
color: Nheko.colors.window
|
|
|
|
width: 350
|
|
|
|
height: fontMetrics.lineSpacing * 7
|
|
|
|
|
2021-10-06 01:53:39 +02:00
|
|
|
Shortcut {
|
|
|
|
sequence: StandardKey.Cancel
|
|
|
|
onActivated: dbb.rejected()
|
|
|
|
}
|
|
|
|
|
2021-09-25 03:32:06 +02:00
|
|
|
ColumnLayout {
|
|
|
|
spacing: Nheko.paddingMedium
|
|
|
|
anchors.margins: Nheko.paddingMedium
|
|
|
|
anchors.fill: parent
|
|
|
|
|
|
|
|
Label {
|
|
|
|
id: promptLabel
|
|
|
|
|
|
|
|
text: qsTr("Room ID or alias")
|
|
|
|
color: Nheko.colors.text
|
|
|
|
}
|
|
|
|
|
|
|
|
MatrixTextField {
|
|
|
|
id: input
|
|
|
|
|
2021-10-06 01:55:53 +02:00
|
|
|
focus: true
|
2021-09-25 03:32:06 +02:00
|
|
|
Layout.fillWidth: true
|
2021-10-09 23:29:05 +02:00
|
|
|
onAccepted: {
|
|
|
|
if (input.text.match("#.+?:.{3,}"))
|
|
|
|
dbb.accepted();
|
2021-11-03 23:01:36 +01:00
|
|
|
|
2021-10-09 23:29:05 +02:00
|
|
|
}
|
2021-09-25 03:32:06 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
footer: DialogButtonBox {
|
2021-10-06 01:53:39 +02:00
|
|
|
id: dbb
|
|
|
|
|
2022-03-11 12:53:23 +01:00
|
|
|
standardButtons: DialogButtonBox.Cancel
|
2021-09-25 03:32:06 +02:00
|
|
|
onAccepted: {
|
|
|
|
Nheko.joinRoom(input.text);
|
|
|
|
joinRoomRoot.close();
|
|
|
|
}
|
|
|
|
onRejected: {
|
|
|
|
joinRoomRoot.close();
|
|
|
|
}
|
|
|
|
|
|
|
|
Button {
|
2022-08-05 21:44:40 +02:00
|
|
|
text: qsTr("Join")
|
2021-09-25 03:32:06 +02:00
|
|
|
enabled: input.text.match("#.+?:.{3,}")
|
|
|
|
DialogButtonBox.buttonRole: DialogButtonBox.AcceptRole
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|