mirror of
https://github.com/Nheko-Reborn/nheko.git
synced 2024-11-22 03:00:46 +03:00
Merge pull request #1394 from Nheko-Reborn/uiTweaks
Some small UI changes
This commit is contained in:
commit
94c34a6e58
17 changed files with 64 additions and 115 deletions
|
@ -14,6 +14,8 @@ Image {
|
||||||
property int trust: Crypto.Unverified
|
property int trust: Crypto.Unverified
|
||||||
property string unencryptedIcon: ":/icons/icons/ui/shield-filled-cross.svg"
|
property string unencryptedIcon: ":/icons/icons/ui/shield-filled-cross.svg"
|
||||||
property color unencryptedColor: Nheko.theme.error
|
property color unencryptedColor: Nheko.theme.error
|
||||||
|
property color unencryptedHoverColor: unencryptedColor
|
||||||
|
property bool hovered: ma.hovered
|
||||||
|
|
||||||
property string sourceUrl: {
|
property string sourceUrl: {
|
||||||
if (!encrypted)
|
if (!encrypted)
|
||||||
|
@ -46,10 +48,10 @@ Image {
|
||||||
return sourceUrl + Nheko.theme.error;
|
return sourceUrl + Nheko.theme.error;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
return sourceUrl + unencryptedColor;
|
return sourceUrl + (stateImg.hovered ? unencryptedHoverColor : unencryptedColor);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
ToolTip.visible: ma.hovered
|
ToolTip.visible: stateImg.hovered
|
||||||
ToolTip.text: {
|
ToolTip.text: {
|
||||||
if (!encrypted)
|
if (!encrypted)
|
||||||
return qsTr("This message is not encrypted!");
|
return qsTr("This message is not encrypted!");
|
||||||
|
|
|
@ -4,6 +4,7 @@
|
||||||
|
|
||||||
import "./emoji"
|
import "./emoji"
|
||||||
import "./voip"
|
import "./voip"
|
||||||
|
import "./ui"
|
||||||
import QtQuick 2.12
|
import QtQuick 2.12
|
||||||
import QtQuick.Controls 2.3
|
import QtQuick.Controls 2.3
|
||||||
import QtQuick.Layouts 1.2
|
import QtQuick.Layouts 1.2
|
||||||
|
@ -90,8 +91,9 @@ Rectangle {
|
||||||
color: Nheko.colors.window
|
color: Nheko.colors.window
|
||||||
visible: room && room.input.uploading
|
visible: room && room.input.uploading
|
||||||
|
|
||||||
NhekoBusyIndicator {
|
Spinner {
|
||||||
anchors.fill: parent
|
anchors.centerIn: parent
|
||||||
|
height: parent.height / 2
|
||||||
running: parent.visible
|
running: parent.visible
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -206,7 +206,7 @@ Item {
|
||||||
Shortcut {
|
Shortcut {
|
||||||
sequence: StandardKey.MoveToPreviousPage
|
sequence: StandardKey.MoveToPreviousPage
|
||||||
onActivated: {
|
onActivated: {
|
||||||
chat.contentY = chat.contentY - chat.height / 2;
|
chat.contentY = chat.contentY - chat.height * 0.9;
|
||||||
chat.returnToBounds();
|
chat.returnToBounds();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -214,7 +214,7 @@ Item {
|
||||||
Shortcut {
|
Shortcut {
|
||||||
sequence: StandardKey.MoveToNextPage
|
sequence: StandardKey.MoveToNextPage
|
||||||
onActivated: {
|
onActivated: {
|
||||||
chat.contentY = chat.contentY + chat.height / 2;
|
chat.contentY = chat.contentY + chat.height * 0.9;
|
||||||
chat.returnToBounds();
|
chat.returnToBounds();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,69 +0,0 @@
|
||||||
// SPDX-FileCopyrightText: Nheko Contributors
|
|
||||||
//
|
|
||||||
// SPDX-License-Identifier: GPL-3.0-or-later
|
|
||||||
|
|
||||||
import QtQuick 2.9
|
|
||||||
import QtQuick.Controls 2.3
|
|
||||||
import QtQuick.Layouts 1.2
|
|
||||||
import im.nheko 1.0
|
|
||||||
|
|
||||||
BusyIndicator {
|
|
||||||
id: control
|
|
||||||
|
|
||||||
contentItem: Item {
|
|
||||||
implicitWidth: 64
|
|
||||||
implicitHeight: 64
|
|
||||||
|
|
||||||
Item {
|
|
||||||
id: item
|
|
||||||
|
|
||||||
height: Math.min(parent.height, parent.width)
|
|
||||||
width: height
|
|
||||||
opacity: control.running ? 1 : 0
|
|
||||||
|
|
||||||
RotationAnimator {
|
|
||||||
target: item
|
|
||||||
running: control.visible && control.running
|
|
||||||
from: 0
|
|
||||||
to: 360
|
|
||||||
loops: Animation.Infinite
|
|
||||||
duration: 2000
|
|
||||||
}
|
|
||||||
|
|
||||||
Repeater {
|
|
||||||
id: repeater
|
|
||||||
|
|
||||||
model: 6
|
|
||||||
|
|
||||||
Rectangle {
|
|
||||||
implicitWidth: radius * 2
|
|
||||||
implicitHeight: radius * 2
|
|
||||||
radius: item.height / 8
|
|
||||||
color: Nheko.colors.text
|
|
||||||
opacity: (index + 2) / (repeater.count + 2)
|
|
||||||
transform: [
|
|
||||||
Translate {
|
|
||||||
y: item.height / 2
|
|
||||||
},
|
|
||||||
Rotation {
|
|
||||||
angle: index / repeater.count * 360
|
|
||||||
origin.x: item.height / 2
|
|
||||||
origin.y: item.height / 2
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
Behavior on opacity {
|
|
||||||
OpacityAnimator {
|
|
||||||
duration: 250
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
|
@ -268,8 +268,6 @@ Pane {
|
||||||
var component = Qt.createComponent("qrc:/qml/dialogs/InviteDialog.qml")
|
var component = Qt.createComponent("qrc:/qml/dialogs/InviteDialog.qml")
|
||||||
if (component.status == Component.Ready) {
|
if (component.status == Component.Ready) {
|
||||||
var dialog = component.createObject(timelineRoot, {
|
var dialog = component.createObject(timelineRoot, {
|
||||||
"roomId": Rooms.currentRoom.roomId,
|
|
||||||
"plainRoomName": Rooms.currentRoom.plainRoomName,
|
|
||||||
"invitees": invitees
|
"invitees": invitees
|
||||||
});
|
});
|
||||||
dialog.show();
|
dialog.show();
|
||||||
|
|
|
@ -279,6 +279,13 @@ Item {
|
||||||
onClicked: Rooms.declineInvite(roomPreview.roomid)
|
onClicked: Rooms.declineInvite(roomPreview.roomid)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
FlatButton {
|
||||||
|
visible: !!room
|
||||||
|
Layout.alignment: Qt.AlignHCenter
|
||||||
|
text: qsTr("leave")
|
||||||
|
onClicked: TimelineManager.openLeaveRoomDialog(room.roomId)
|
||||||
|
}
|
||||||
|
|
||||||
ScrollView {
|
ScrollView {
|
||||||
id: reasonField
|
id: reasonField
|
||||||
property bool showReason: false
|
property bool showReason: false
|
||||||
|
|
|
@ -25,7 +25,7 @@ Switch {
|
||||||
width: parent.width - height
|
width: parent.width - height
|
||||||
x: radius
|
x: radius
|
||||||
y: parent.height / 2 - height / 2
|
y: parent.height / 2 - height / 2
|
||||||
color: toggleButton.checked ? "skyblue" : "grey"
|
color: toggleButton.checked ? Nheko.colors.highlight : "grey"
|
||||||
border.color: "#cccccc"
|
border.color: "#cccccc"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -242,9 +242,8 @@ Pane {
|
||||||
enabled: false
|
enabled: false
|
||||||
unencryptedIcon: ":/icons/icons/ui/people.svg"
|
unencryptedIcon: ":/icons/icons/ui/people.svg"
|
||||||
unencryptedColor: Nheko.colors.buttonText
|
unencryptedColor: Nheko.colors.buttonText
|
||||||
}
|
unencryptedHoverColor: Nheko.colors.highlight
|
||||||
|
hovered: parent.hovered
|
||||||
background: null
|
|
||||||
|
|
||||||
ToolTip.delay: Nheko.tooltipDelay
|
ToolTip.delay: Nheko.tooltipDelay
|
||||||
ToolTip.text: {
|
ToolTip.text: {
|
||||||
|
@ -260,8 +259,9 @@ Pane {
|
||||||
return qsTr("This room contains unverified devices!");
|
return qsTr("This room contains unverified devices!");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
ToolTip.visible: hovered
|
}
|
||||||
|
|
||||||
|
background: null
|
||||||
onClicked: TimelineManager.openRoomMembers(room)
|
onClicked: TimelineManager.openRoomMembers(room)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -12,8 +12,6 @@ import im.nheko 1.0
|
||||||
ApplicationWindow {
|
ApplicationWindow {
|
||||||
id: inviteDialogRoot
|
id: inviteDialogRoot
|
||||||
|
|
||||||
property string roomId
|
|
||||||
property string plainRoomName
|
|
||||||
property InviteesModel invitees
|
property InviteesModel invitees
|
||||||
property var friendsCompleter
|
property var friendsCompleter
|
||||||
property var profile
|
property var profile
|
||||||
|
@ -39,7 +37,7 @@ ApplicationWindow {
|
||||||
close();
|
close();
|
||||||
}
|
}
|
||||||
|
|
||||||
title: qsTr("Invite users to %1").arg(plainRoomName)
|
title: qsTr("Invite users to %1").arg(invitees.room.plainRoomName)
|
||||||
height: 380
|
height: 380
|
||||||
width: 340
|
width: 340
|
||||||
palette: Nheko.colors
|
palette: Nheko.colors
|
||||||
|
|
|
@ -78,6 +78,8 @@ ApplicationWindow {
|
||||||
anchors.margins: Nheko.paddingSmall
|
anchors.margins: Nheko.paddingSmall
|
||||||
|
|
||||||
Avatar {
|
Avatar {
|
||||||
|
id: avatar
|
||||||
|
|
||||||
width: Nheko.avatarSize
|
width: Nheko.avatarSize
|
||||||
height: Nheko.avatarSize
|
height: Nheko.avatarSize
|
||||||
userid: model.mxid
|
userid: model.mxid
|
||||||
|
@ -88,27 +90,28 @@ ApplicationWindow {
|
||||||
|
|
||||||
ColumnLayout {
|
ColumnLayout {
|
||||||
spacing: Nheko.paddingSmall
|
spacing: Nheko.paddingSmall
|
||||||
|
Layout.fillWidth: true
|
||||||
|
|
||||||
Label {
|
ElidedLabel {
|
||||||
text: model.displayName
|
text: model.displayName
|
||||||
color: TimelineManager.userColor(model ? model.mxid : "", Nheko.colors.window)
|
color: TimelineManager.userColor(model ? model.mxid : "", Nheko.colors.window)
|
||||||
font.pointSize: fontMetrics.font.pointSize
|
font.pointSize: fontMetrics.font.pointSize
|
||||||
|
elideWidth: del.width - Nheko.paddingMedium - avatar.width
|
||||||
|
Layout.fillWidth: true
|
||||||
}
|
}
|
||||||
|
|
||||||
Label {
|
ElidedLabel {
|
||||||
text: model.timestamp
|
text: model.timestamp
|
||||||
color: Nheko.colors.buttonText
|
color: Nheko.colors.buttonText
|
||||||
font.pointSize: fontMetrics.font.pointSize * 0.9
|
font.pointSize: fontMetrics.font.pointSize * 0.9
|
||||||
}
|
elideWidth: del.width - Nheko.paddingMedium - avatar.width
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
Item {
|
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
CursorShape {
|
CursorShape {
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
cursorShape: Qt.PointingHandCursor
|
cursorShape: Qt.PointingHandCursor
|
||||||
|
|
|
@ -146,12 +146,14 @@ ApplicationWindow {
|
||||||
|
|
||||||
ColumnLayout {
|
ColumnLayout {
|
||||||
spacing: Nheko.paddingSmall
|
spacing: Nheko.paddingSmall
|
||||||
|
Layout.fillWidth: true
|
||||||
|
|
||||||
ElidedLabel {
|
ElidedLabel {
|
||||||
fullText: model.displayName
|
fullText: model.displayName
|
||||||
color: TimelineManager.userColor(model ? model.mxid : "", del.background.color)
|
color: TimelineManager.userColor(model ? model.mxid : "", del.background.color)
|
||||||
font.pixelSize: fontMetrics.font.pixelSize
|
font.pixelSize: fontMetrics.font.pixelSize
|
||||||
elideWidth: del.width - Nheko.paddingMedium * 2 - avatar.width - encryptInd.width
|
elideWidth: del.width - Nheko.paddingMedium * 2 - avatar.width - encryptInd.width
|
||||||
|
Layout.fillWidth: true
|
||||||
}
|
}
|
||||||
|
|
||||||
ElidedLabel {
|
ElidedLabel {
|
||||||
|
@ -159,14 +161,11 @@ ApplicationWindow {
|
||||||
color: del.hovered ? Nheko.colors.brightText : Nheko.colors.buttonText
|
color: del.hovered ? Nheko.colors.brightText : Nheko.colors.buttonText
|
||||||
font.pixelSize: Math.ceil(fontMetrics.font.pixelSize * 0.9)
|
font.pixelSize: Math.ceil(fontMetrics.font.pixelSize * 0.9)
|
||||||
elideWidth: del.width - Nheko.paddingMedium * 2 - avatar.width - encryptInd.width
|
elideWidth: del.width - Nheko.paddingMedium * 2 - avatar.width - encryptInd.width
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
Item {
|
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
}
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
Image {
|
Image {
|
||||||
property bool isAdmin: room.permissions.changeLevel(MtxEvent.PowerLevels) <= model.powerlevel
|
property bool isAdmin: room.permissions.changeLevel(MtxEvent.PowerLevels) <= model.powerlevel
|
||||||
property bool isModerator: room.permissions.redactLevel() <= model.powerlevel
|
property bool isModerator: room.permissions.redactLevel() <= model.powerlevel
|
||||||
|
|
|
@ -395,6 +395,7 @@ ApplicationWindow {
|
||||||
checked = true;
|
checked = true;
|
||||||
return ;
|
return ;
|
||||||
}
|
}
|
||||||
|
if (checked === true)
|
||||||
confirmEncryptionDialog.open();
|
confirmEncryptionDialog.open();
|
||||||
}
|
}
|
||||||
Layout.alignment: Qt.AlignRight
|
Layout.alignment: Qt.AlignRight
|
||||||
|
|
|
@ -111,7 +111,6 @@
|
||||||
<file>qml/UploadBox.qml</file>
|
<file>qml/UploadBox.qml</file>
|
||||||
<file>qml/MessageInput.qml</file>
|
<file>qml/MessageInput.qml</file>
|
||||||
<file>qml/MessageView.qml</file>
|
<file>qml/MessageView.qml</file>
|
||||||
<file>qml/NhekoBusyIndicator.qml</file>
|
|
||||||
<file>qml/PrivacyScreen.qml</file>
|
<file>qml/PrivacyScreen.qml</file>
|
||||||
<file>qml/Reactions.qml</file>
|
<file>qml/Reactions.qml</file>
|
||||||
<file>qml/ReplyPopup.qml</file>
|
<file>qml/ReplyPopup.qml</file>
|
||||||
|
|
|
@ -9,8 +9,9 @@
|
||||||
#include "MatrixClient.h"
|
#include "MatrixClient.h"
|
||||||
#include "mtx/responses/profile.hpp"
|
#include "mtx/responses/profile.hpp"
|
||||||
|
|
||||||
InviteesModel::InviteesModel(QObject *parent)
|
InviteesModel::InviteesModel(TimelineModel *room, QObject *parent)
|
||||||
: QAbstractListModel{parent}
|
: QAbstractListModel{parent}
|
||||||
|
, room_{room}
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -8,6 +8,8 @@
|
||||||
#include <QAbstractListModel>
|
#include <QAbstractListModel>
|
||||||
#include <QVector>
|
#include <QVector>
|
||||||
|
|
||||||
|
class TimelineModel;
|
||||||
|
|
||||||
class Invitee final : public QObject
|
class Invitee final : public QObject
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
@ -34,6 +36,7 @@ class InviteesModel final : public QAbstractListModel
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
Q_PROPERTY(int count READ rowCount NOTIFY countChanged)
|
Q_PROPERTY(int count READ rowCount NOTIFY countChanged)
|
||||||
|
Q_PROPERTY(TimelineModel *room READ room CONSTANT)
|
||||||
|
|
||||||
public:
|
public:
|
||||||
enum Roles
|
enum Roles
|
||||||
|
@ -43,7 +46,9 @@ public:
|
||||||
AvatarUrl,
|
AvatarUrl,
|
||||||
};
|
};
|
||||||
|
|
||||||
InviteesModel(QObject *parent = nullptr);
|
InviteesModel(TimelineModel *room, QObject *parent = nullptr);
|
||||||
|
|
||||||
|
TimelineModel *room() const { return room_; }
|
||||||
|
|
||||||
Q_INVOKABLE void addUser(QString mxid, QString displayName = "", QString avatarUrl = "");
|
Q_INVOKABLE void addUser(QString mxid, QString displayName = "", QString avatarUrl = "");
|
||||||
Q_INVOKABLE void removeUser(QString mxid);
|
Q_INVOKABLE void removeUser(QString mxid);
|
||||||
|
@ -63,6 +68,7 @@ signals:
|
||||||
|
|
||||||
private:
|
private:
|
||||||
QVector<Invitee *> invitees_;
|
QVector<Invitee *> invitees_;
|
||||||
|
TimelineModel *room_;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // INVITEESMODEL_H
|
#endif // INVITEESMODEL_H
|
||||||
|
|
|
@ -141,7 +141,9 @@ utils::replaceEmoji(const QString &body)
|
||||||
if (!insideTag && utils::codepointIsEmoji(code)) {
|
if (!insideTag && utils::codepointIsEmoji(code)) {
|
||||||
if (!insideFontBlock) {
|
if (!insideFontBlock) {
|
||||||
fmtBody += QStringLiteral("<font face=\"") % UserSettings::instance()->emojiFont() %
|
fmtBody += QStringLiteral("<font face=\"") % UserSettings::instance()->emojiFont() %
|
||||||
QStringLiteral("\">");
|
(UserSettings::instance()->enlargeEmojiOnlyMessages()
|
||||||
|
? QStringLiteral("\" size=\"4\">")
|
||||||
|
: QStringLiteral("\">"));
|
||||||
insideFontBlock = true;
|
insideFontBlock = true;
|
||||||
} else if (code == 0xfe0f) {
|
} else if (code == 0xfe0f) {
|
||||||
// BUG(Nico):
|
// BUG(Nico):
|
||||||
|
|
|
@ -180,7 +180,7 @@ TimelineViewManager::openRoomSettings(QString room_id)
|
||||||
void
|
void
|
||||||
TimelineViewManager::openInviteUsers(QString roomId)
|
TimelineViewManager::openInviteUsers(QString roomId)
|
||||||
{
|
{
|
||||||
InviteesModel *model = new InviteesModel{};
|
InviteesModel *model = new InviteesModel{rooms_->getRoomById(roomId).data()};
|
||||||
connect(model, &InviteesModel::accept, this, [this, model, roomId]() {
|
connect(model, &InviteesModel::accept, this, [this, model, roomId]() {
|
||||||
emit inviteUsers(roomId, model->mxids());
|
emit inviteUsers(roomId, model->mxids());
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in a new issue