Allow creating spaces

createSpaces
Loren Burkholder 3 years ago
parent 07be49ba22
commit d3c6bcd43c
  1. 2
      resources/qml/RoomList.qml
  2. 22
      resources/qml/dialogs/CreateRoom.qml
  3. 7
      src/ui/NhekoGlobalObject.cpp
  4. 2
      src/ui/NhekoGlobalObject.h

@ -661,7 +661,7 @@ Page {
} }
Platform.MenuItem { Platform.MenuItem {
text: qsTr("Create a new room") text: qsTr("Create a new room or space")
onTriggered: { onTriggered: {
var createRoom = createRoomComponent.createObject(timelineRoot); var createRoom = createRoomComponent.createObject(timelineRoot);
createRoom.show(); createRoom.show();

@ -85,7 +85,7 @@ ApplicationWindow {
id: privateHover id: privateHover
} }
ToolTip.visible: privateHover.hovered ToolTip.visible: privateHover.hovered
ToolTip.text: qsTr("Public rooms can be joined by anyone, private rooms need explicit invites.") ToolTip.text: qsTr("Public rooms can be joined by anyone; private rooms need explicit invites.")
ToolTip.delay: Nheko.tooltipDelay ToolTip.delay: Nheko.tooltipDelay
} }
ToggleButton { ToggleButton {
@ -94,6 +94,24 @@ ApplicationWindow {
id: isPublic id: isPublic
checked: false checked: false
} }
Label {
Layout.preferredWidth: implicitWidth
Layout.alignment: Qt.AlignLeft
text: qsTr("Space")
color: Nheko.colors.text
HoverHandler {
id: spaceHover
}
ToolTip.visible: spaceHover.hovered
ToolTip.text: qsTr("Make this a space for organizing other rooms and spaces.")
ToolTip.delay: Nheko.tooltipDelay
}
ToggleButton {
Layout.alignment: Qt.AlignRight
Layout.preferredWidth: implicitWidth
id: isSpace
checked: false
}
Label { Label {
Layout.preferredWidth: implicitWidth Layout.preferredWidth: implicitWidth
Layout.alignment: Qt.AlignLeft Layout.alignment: Qt.AlignLeft
@ -150,7 +168,7 @@ ApplicationWindow {
else { else {
preset = isTrusted.checked ? 2 : 0; preset = isTrusted.checked ? 2 : 0;
} }
Nheko.createRoom(newRoomName.text, newRoomTopic.text, newRoomAlias.text, isEncrypted.checked, preset) Nheko.createRoom(newRoomName.text, newRoomTopic.text, newRoomAlias.text, isEncrypted.checked, isSpace.checked, preset)
createRoomRoot.close(); createRoomRoot.close();
} }
} }

@ -128,7 +128,7 @@ Nheko::logout() const
} }
void void
Nheko::createRoom(QString name, QString topic, QString aliasLocalpart, bool isEncrypted, int preset) Nheko::createRoom(QString name, QString topic, QString aliasLocalpart, bool isEncrypted, bool isSpace, int preset)
{ {
mtx::requests::CreateRoom req; mtx::requests::CreateRoom req;
@ -155,5 +155,10 @@ Nheko::createRoom(QString name, QString topic, QString aliasLocalpart, bool isEn
req.initial_state.emplace_back(std::move(enc)); req.initial_state.emplace_back(std::move(enc));
} }
if (isSpace) {
req.creation_content = mtx::events::state::Create{};
req.creation_content->type = "m.space";
}
emit ChatPage::instance()->createRoom(req); emit ChatPage::instance()->createRoom(req);
} }

@ -53,7 +53,7 @@ public:
Q_INVOKABLE void showUserSettingsPage() const; Q_INVOKABLE void showUserSettingsPage() const;
Q_INVOKABLE void logout() const; Q_INVOKABLE void logout() const;
Q_INVOKABLE void Q_INVOKABLE void
createRoom(QString name, QString topic, QString aliasLocalpart, bool isEncrypted, int preset); createRoom(QString name, QString topic, QString aliasLocalpart, bool isEncrypted, bool isSpace, int preset);
public slots: public slots:
void updateUserProfile(); void updateUserProfile();

Loading…
Cancel
Save