2021-09-25 04:32:06 +03:00
|
|
|
// SPDX-FileCopyrightText: 2021 Nheko Contributors
|
2022-01-01 06:57:53 +03:00
|
|
|
// SPDX-FileCopyrightText: 2022 Nheko Contributors
|
2023-01-02 06:25:33 +03:00
|
|
|
// SPDX-FileCopyrightText: 2023 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
|
|
|
|
palette: Nheko.colors
|
|
|
|
color: Nheko.colors.window
|
|
|
|
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")
|
|
|
|
color: Nheko.colors.text
|
|
|
|
}
|
|
|
|
|
|
|
|
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-11-04 01:01:36 +03:00
|
|
|
|
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
|
|
|
|
|
2022-03-11 14:53:23 +03:00
|
|
|
standardButtons: DialogButtonBox.Cancel
|
2021-09-25 04:32:06 +03:00
|
|
|
onAccepted: {
|
|
|
|
Nheko.joinRoom(input.text);
|
|
|
|
joinRoomRoot.close();
|
|
|
|
}
|
|
|
|
onRejected: {
|
|
|
|
joinRoomRoot.close();
|
|
|
|
}
|
|
|
|
|
|
|
|
Button {
|
2022-08-05 22:44:40 +03:00
|
|
|
text: qsTr("Join")
|
2021-09-25 04:32:06 +03:00
|
|
|
enabled: input.text.match("#.+?:.{3,}")
|
|
|
|
DialogButtonBox.buttonRole: DialogButtonBox.AcceptRole
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|