Code cleanup.

This commit is contained in:
Black Hat
2018-12-15 22:29:51 +08:00
parent 076c501605
commit df045a786f
12 changed files with 129 additions and 145 deletions

View File

@@ -5,7 +5,6 @@ import QtQuick.Layouts 1.3
import QtQuick.Controls.Material 2.4
import Spectral.Component 2.0
import Spectral.Menu 2.0
import Spectral.Effect 2.0
import Spectral 0.1
@@ -489,11 +488,8 @@ Rectangle {
stepSize: 25
snapMode: Slider.SnapAlways
ToolTip {
Material.foreground: "white"
visible: parent.pressed
text: parent.value
}
ToolTip.visible: pressed
ToolTip.text: value
onMoved: controller.setDpi(value)
}
@@ -804,10 +800,7 @@ Rectangle {
RippleEffect {
anchors.fill: parent
onSecondaryClicked: {
roomContextMenu.model = model
roomContextMenu.popup()
}
onSecondaryClicked: roomContextMenu.popup()
onPrimaryClicked: {
if (category === RoomType.Invited) {
inviteDialog.currentRoom = currentRoom
@@ -823,6 +816,36 @@ Rectangle {
}
}
}
Menu {
id: roomContextMenu
MenuItem {
text: "Favourite"
checkable: true
checked: category === RoomType.Favorite
onTriggered: category === RoomType.Favorite ? currentRoom.removeTag("m.favourite") : currentRoom.addTag("m.favourite", 1.0)
}
MenuItem {
text: "Deprioritize"
checkable: true
checked: category === RoomType.Deprioritized
onTriggered: category === RoomType.Deprioritized ? currentRoom.removeTag("m.lowpriority") : currentRoom.addTag("m.lowpriority", 1.0)
}
MenuSeparator {}
MenuItem {
text: "Mark as Read"
onTriggered: currentRoom.markAllMessagesAsRead()
}
MenuItem {
text: "Leave Room"
onTriggered: currentRoom.forget()
}
}
}
section.property: "display"
@@ -837,10 +860,6 @@ Rectangle {
elide: Text.ElideRight
verticalAlignment: Text.AlignVCenter
}
RoomContextMenu {
id: roomContextMenu
}
}
}

View File

@@ -7,7 +7,6 @@ import Qt.labs.qmlmodels 1.0
import Spectral.Component 2.0
import Spectral.Component.Emoji 2.0
import Spectral.Component.Timeline 2.0
import Spectral.Menu 2.0
import Spectral.Effect 2.0
import Spectral 0.1
@@ -266,10 +265,6 @@ Item {
onClicked: messageListView.positionViewAtBeginning()
}
MessageContextMenu {
id: messageContextMenu
}
Popup {
property string sourceText

View File

@@ -251,13 +251,8 @@ Control {
onTriggered: currentRoom.sendTypingNotification(true)
}
ToolTip {
visible: currentRoom
&& currentRoom.hasUsersTyping
text: currentRoom ? currentRoom.usersTyping : ""
Material.foreground: "white"
}
ToolTip.visible: currentRoom && currentRoom.hasUsersTyping
ToolTip.text: currentRoom ? currentRoom.usersTyping : ""
Keys.onReturnPressed: {
if (event.modifiers & Qt.ShiftModifier) {