Fix notification issue.

This commit is contained in:
Black Hat
2018-09-10 08:06:32 +08:00
parent f5b24f32b8
commit 13a8d6b889
10 changed files with 47 additions and 83 deletions

View File

@@ -4,6 +4,8 @@ import QtQuick.Controls.Material 2.2
import QtQuick.Layouts 1.3
import Matrique 0.1
import "qrc:/js/util.js" as Util
Drawer {
property var room
@@ -94,6 +96,10 @@ Drawer {
boundsBehavior: Flickable.DragOverBounds
model: UserListModel {
room: roomDrawer.room
}
delegate: ItemDelegate {
width: parent.width
height: 48
@@ -107,6 +113,7 @@ Drawer {
Layout.preferredWidth: height
Layout.fillHeight: true
defaultColor: Util.stringToColor(name)
image: avatar
hint: name
}
@@ -119,12 +126,6 @@ Drawer {
}
}
model: UserListModel {
id: userListModel
room: roomDrawer.room
}
ScrollBar.vertical: ScrollBar {}
}

View File

@@ -3,6 +3,8 @@ import QtQuick.Controls 2.2
import QtQuick.Layouts 1.3
import QtQuick.Controls.Material 2.2
import "qrc:/js/util.js" as Util
ItemDelegate {
property var page
readonly property bool selected: stackView.currentItem === page
@@ -18,14 +20,5 @@ ItemDelegate {
}
}
onClicked: {
if(page && stackView.currentItem !== page) {
if(stackView.depth === 1) {
stackView.replace(page)
} else {
stackView.clear()
stackView.push(page)
}
}
}
onClicked: Util.pushToStack(stackView, page)
}

View File

@@ -9,6 +9,7 @@ import SortFilterProxyModel 0.2
import Matrique.Settings 0.1
import "../component"
import "qrc:/js/util.js" as Util
Item {
property alias listModel: roomListProxyModel.sourceModel
@@ -142,14 +143,6 @@ Item {
spacing: 12
// ImageStatus {
// Layout.preferredWidth: height
// Layout.fillHeight: true
// source: avatar ? "image://mxc/" + avatar : ""
// displayText: name
// }
ImageItem {
id: imageItem
@@ -157,7 +150,7 @@ Item {
Layout.fillHeight: true
hint: name || "No Name"
defaultColor: stringToColor(name || "No Name")
defaultColor: Util.stringToColor(name || "No Name")
image: avatar
}
@@ -224,17 +217,4 @@ Item {
}
}
}
function stringToColor(str) {
var hash = 0;
for (var i = 0; i < str.length; i++) {
hash = str.charCodeAt(i) + ((hash << 5) - hash);
}
var colour = '#';
for (var j = 0; j < 3; j++) {
var value = (hash >> (j * 8)) & 0xFF;
colour += ('00' + value.toString(16)).substr(-2);
}
return colour;
}
}

View File

@@ -290,7 +290,7 @@ ApplicationWindow {
id: stackView
// initialItem: roomPage
initialItem: roomPage
}
}