Fix alias and more compact account detail dialog.
This commit is contained in:
@@ -20,55 +20,26 @@ Dialog {
|
|||||||
|
|
||||||
spacing: 0
|
spacing: 0
|
||||||
|
|
||||||
Repeater {
|
ListView {
|
||||||
|
width: parent.width
|
||||||
|
height: 48
|
||||||
|
|
||||||
|
clip: true
|
||||||
|
|
||||||
|
orientation: ListView.Horizontal
|
||||||
|
|
||||||
|
spacing: 16
|
||||||
|
|
||||||
model: AccountListModel{
|
model: AccountListModel{
|
||||||
controller: spectralController
|
controller: spectralController
|
||||||
}
|
}
|
||||||
|
|
||||||
delegate: Item {
|
delegate: Avatar {
|
||||||
width: detailColumn.width
|
width: 48
|
||||||
height: 72
|
height: 48
|
||||||
|
|
||||||
RowLayout {
|
source: user.avatarMediaId
|
||||||
anchors.fill: parent
|
hint: user.displayName || "No Name"
|
||||||
anchors.margins: 12
|
|
||||||
|
|
||||||
spacing: 12
|
|
||||||
|
|
||||||
Avatar {
|
|
||||||
Layout.preferredWidth: height
|
|
||||||
Layout.fillHeight: true
|
|
||||||
|
|
||||||
source: user.avatarMediaId
|
|
||||||
hint: user.displayName || "No Name"
|
|
||||||
}
|
|
||||||
|
|
||||||
ColumnLayout {
|
|
||||||
Layout.fillWidth: true
|
|
||||||
Layout.alignment: Qt.AlignHCenter
|
|
||||||
|
|
||||||
Label {
|
|
||||||
Layout.fillWidth: true
|
|
||||||
|
|
||||||
text: user.displayName || "No Name"
|
|
||||||
color: MPalette.foreground
|
|
||||||
font.pixelSize: 16
|
|
||||||
font.bold: true
|
|
||||||
elide: Text.ElideRight
|
|
||||||
wrapMode: Text.NoWrap
|
|
||||||
}
|
|
||||||
|
|
||||||
Label {
|
|
||||||
Layout.fillWidth: true
|
|
||||||
|
|
||||||
text: connection === spectralController.connection ? "Active" : "Online"
|
|
||||||
color: MPalette.lighter
|
|
||||||
font.pixelSize: 13
|
|
||||||
elide: Text.ElideRight
|
|
||||||
wrapMode: Text.NoWrap
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Menu {
|
Menu {
|
||||||
id: contextMenu
|
id: contextMenu
|
||||||
@@ -83,6 +54,8 @@ Dialog {
|
|||||||
RippleEffect {
|
RippleEffect {
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
|
|
||||||
|
circular: true
|
||||||
|
|
||||||
onPrimaryClicked: spectralController.connection = connection
|
onPrimaryClicked: spectralController.connection = connection
|
||||||
onSecondaryClicked: contextMenu.popup()
|
onSecondaryClicked: contextMenu.popup()
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -176,6 +176,23 @@ Dialog {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Button {
|
||||||
|
Layout.alignment: Qt.AlignRight
|
||||||
|
|
||||||
|
text: "Save"
|
||||||
|
highlighted: true
|
||||||
|
|
||||||
|
onClicked: {
|
||||||
|
if (room.name != roomNameField.text) {
|
||||||
|
room.setName(roomNameField.text)
|
||||||
|
}
|
||||||
|
|
||||||
|
if (room.topic != roomTopicField.text) {
|
||||||
|
room.setTopic(roomTopicField.text)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
MenuSeparator {
|
MenuSeparator {
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
}
|
}
|
||||||
@@ -202,6 +219,11 @@ Dialog {
|
|||||||
model: room.remoteAliases
|
model: room.remoteAliases
|
||||||
|
|
||||||
currentIndex: room.remoteAliases.indexOf(room.canonicalAlias)
|
currentIndex: room.remoteAliases.indexOf(room.canonicalAlias)
|
||||||
|
onCurrentIndexChanged: {
|
||||||
|
if (room.canonicalAlias != room.remoteAliases[currentIndex]) {
|
||||||
|
room.setCanonicalAlias(room.remoteAliases[currentIndex])
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -225,13 +247,30 @@ Dialog {
|
|||||||
Repeater {
|
Repeater {
|
||||||
model: room.localAliases
|
model: room.localAliases
|
||||||
|
|
||||||
delegate: Label {
|
delegate: RowLayout {
|
||||||
Layout.fillWidth: true
|
Layout.maximumWidth: parent.width
|
||||||
|
|
||||||
text: modelData
|
Label {
|
||||||
|
text: modelData
|
||||||
|
|
||||||
font.pixelSize: 12
|
font.pixelSize: 12
|
||||||
color: MPalette.lighter
|
color: MPalette.lighter
|
||||||
|
}
|
||||||
|
|
||||||
|
MaterialIcon {
|
||||||
|
icon: "\ue5cd"
|
||||||
|
|
||||||
|
color: MPalette.lighter
|
||||||
|
font.pixelSize: 12
|
||||||
|
|
||||||
|
RippleEffect {
|
||||||
|
anchors.fill: parent
|
||||||
|
|
||||||
|
circular: true
|
||||||
|
|
||||||
|
onClicked: room.removeLocalAlias(modelData)
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -273,14 +312,6 @@ Dialog {
|
|||||||
onClicked: room.clearBackground()
|
onClicked: room.clearBackground()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Button {
|
|
||||||
Layout.alignment: Qt.AlignRight
|
|
||||||
|
|
||||||
text: "Save"
|
|
||||||
|
|
||||||
onClicked: saveSettings()
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Component {
|
Component {
|
||||||
@@ -290,19 +321,5 @@ Dialog {
|
|||||||
}
|
}
|
||||||
|
|
||||||
onClosed: destroy()
|
onClosed: destroy()
|
||||||
|
|
||||||
function saveSettings() {
|
|
||||||
if (room.name != roomNameField.text) {
|
|
||||||
room.setName(roomNameField.text)
|
|
||||||
}
|
|
||||||
|
|
||||||
if (room.topic != roomTopicField.text) {
|
|
||||||
room.setTopic(roomTopicField.text)
|
|
||||||
}
|
|
||||||
|
|
||||||
if (room.canonicalAlias != room.remoteAliases[canonicalAliasComboBox.currentIndex]) {
|
|
||||||
room.setCanonicalAlias(room.remoteAliases[canonicalAliasComboBox.currentIndex])
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Submodule include/libQuotient updated: fe82533860...d15ba3d775
@@ -68,8 +68,12 @@ void Controller::loginWithCredentials(QString serverAddr,
|
|||||||
QSysInfo::productVersion() + " " +
|
QSysInfo::productVersion() + " " +
|
||||||
QSysInfo::currentCpuArchitecture();
|
QSysInfo::currentCpuArchitecture();
|
||||||
|
|
||||||
|
QUrl serverUrl(serverAddr);
|
||||||
|
|
||||||
Connection* conn = new Connection(this);
|
Connection* conn = new Connection(this);
|
||||||
conn->setHomeserver(QUrl(serverAddr));
|
if (serverUrl.isValid()) {
|
||||||
|
conn->setHomeserver(serverUrl);
|
||||||
|
}
|
||||||
conn->connectToServer(user, pass, deviceName, "");
|
conn->connectToServer(user, pass, deviceName, "");
|
||||||
connect(conn, &Connection::connected, [=] {
|
connect(conn, &Connection::connected, [=] {
|
||||||
AccountSettings account(conn->userId());
|
AccountSettings account(conn->userId());
|
||||||
|
|||||||
@@ -316,3 +316,23 @@ void SpectralRoom::changeAvatar(QUrl localFile) {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void SpectralRoom::addLocalAlias(const QString& alias) {
|
||||||
|
auto aliases = localAliases();
|
||||||
|
if (aliases.contains(alias))
|
||||||
|
return;
|
||||||
|
|
||||||
|
aliases.append(alias);
|
||||||
|
|
||||||
|
setLocalAliases(aliases);
|
||||||
|
}
|
||||||
|
|
||||||
|
void SpectralRoom::removeLocalAlias(const QString& alias) {
|
||||||
|
auto aliases = localAliases();
|
||||||
|
if (!aliases.contains(alias))
|
||||||
|
return;
|
||||||
|
|
||||||
|
aliases.removeAll(alias);
|
||||||
|
|
||||||
|
setLocalAliases(aliases);
|
||||||
|
}
|
||||||
|
|||||||
@@ -306,6 +306,8 @@ class SpectralRoom : public Room {
|
|||||||
QString replyContent,
|
QString replyContent,
|
||||||
QString sendContent);
|
QString sendContent);
|
||||||
void changeAvatar(QUrl localFile);
|
void changeAvatar(QUrl localFile);
|
||||||
|
void addLocalAlias(const QString& alias);
|
||||||
|
void removeLocalAlias(const QString& alias);
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // SpectralRoom_H
|
#endif // SpectralRoom_H
|
||||||
|
|||||||
Reference in New Issue
Block a user