Rebrand files names Spectral -> NeoChat

This commit is contained in:
Carl Schwan
2020-11-08 23:17:30 +01:00
parent c2c49c69fe
commit 122a7cdd2f
71 changed files with 787 additions and 273 deletions

View File

@@ -0,0 +1,20 @@
import QtQuick 2.12
import QtQuick.Controls 2.12 as Controls
import QtQuick.Layouts 1.12
import Qt.labs.qmlmodels 1.0
import org.kde.kirigami 2.12 as Kirigami
import SortFilterProxyModel 0.2
import NeoChat.Component 2.0
import NeoChat.Component.Timeline 2.0
import org.kde.neochat 0.1
Kirigami.GlobalDrawer {
id: root
modal: true
collapsible: true
collapsed: Kirigami.Settings.isMobile
}

View File

@@ -0,0 +1,222 @@
import QtQuick 2.12
import QtQuick.Controls 2.12
import QtQuick.Controls.Material 2.12
import QtQuick.Layouts 1.12
import org.kde.kirigami 2.13 as Kirigami
import NeoChat.Component 2.0
import NeoChat.Dialog 2.0
import NeoChat.Effect 2.0
import NeoChat.Setting 0.1
import org.kde.neochat 0.1
Kirigami.OverlayDrawer {
property var room
id: roomDrawer
enabled: true
edge: Qt.application.layoutDirection == Qt.RightToLeft ? Qt.LeftEdge : Qt.RightEdge
padding: 0
contentItem: ColumnLayout {
implicitWidth: Kirigami.Units.gridUnit * 15 // TODO FIXME
Component {
id: fullScreenImage
FullScreenImage {}
}
RowLayout {
Layout.fillWidth: true
spacing: 16
Kirigami.Avatar {
Layout.preferredWidth: 72
Layout.preferredHeight: 72
name: room ? room.displayName : "No name"
source: room ? "image://mxc/" + room.avatarMediaId : null
}
ColumnLayout {
Layout.fillWidth: true
Label {
Layout.fillWidth: true
font.pixelSize: 18
font.bold: true
wrapMode: Label.Wrap
text: room ? room.displayName : "No Name"
color: MPalette.foreground
}
Label {
Layout.fillWidth: true
wrapMode: Label.Wrap
text: room ? room.totalMemberCount + " Members" : "No Member Count"
color: MPalette.lighter
}
}
}
Kirigami.Separator {
Layout.fillWidth: true
}
Control {
Layout.fillWidth: true
contentItem: Kirigami.FormLayout {
Label {
Kirigami.FormData.label: "Main Alias"
text: room && room.canonicalAlias ? room.canonicalAlias : "No Canonical Alias"
}
Label {
Kirigami.FormData.label: "Topic"
text: room && room.topic ? room.topic : "No Topic"
wrapMode: Text.WordWrap
}
}
background: AutoMouseArea {
onPrimaryClicked: roomSettingDialog.createObject(ApplicationWindow.overlay, {"room": room}).open()
}
}
Kirigami.Separator {
Layout.fillWidth: true
}
RowLayout {
Layout.fillWidth: true
spacing: 8
Kirigami.Icon {
Layout.preferredWidth: Kirigami.Units.gridUnit * 2
Layout.preferredHeight: Kirigami.Units.gridUnit * 2
source: "user-others"
}
Label {
Layout.fillWidth: true
wrapMode: Label.Wrap
text: room ? room.totalMemberCount + " Members" : "No Member Count"
}
ToolButton {
Layout.preferredWidth: Kirigami.Units.gridUnit
Layout.preferredHeight: Kirigami.Units.gridUnit
icon.name: "list-user-add"
onClicked: inviteUserDialog.createObject(ApplicationWindow.overlay, {"room": room}).open()
}
}
AutoListView {
Layout.fillWidth: true
Layout.fillHeight: true
id: userListView
clip: true
boundsBehavior: Flickable.DragOverBounds
model: UserListModel {
room: roomDrawer.room
}
delegate: Item {
width: userListView.width
height: 48
RowLayout {
anchors.fill: parent
anchors.margins: 8
spacing: 12
Kirigami.Avatar {
Layout.preferredWidth: height
Layout.fillHeight: true
source: "image://mxc/" + avatar
name: name
}
Label {
Layout.fillWidth: true
text: name
color: MPalette.foreground
textFormat: Text.PlainText
elide: Text.ElideRight
wrapMode: Text.NoWrap
}
Label {
visible: perm != UserType.Member
text: {
if (perm == UserType.Owner) {
return "Owner"
}
if (perm == UserType.Admin) {
return "Admin"
}
if (perm == UserType.Moderator) {
return "Mod"
}
if (perm == UserType.Muted) {
return "Muted"
}
return ""
}
color: perm == UserType.Muted ? MPalette.lighter : MPalette.accent
font.pixelSize: 12
textFormat: Text.PlainText
wrapMode: Text.NoWrap
}
}
RippleEffect {
anchors.fill: parent
onPrimaryClicked: userDetailDialog.createObject(ApplicationWindow.overlay, {"room": room, "user": user}).open()
}
}
ScrollBar.vertical: ScrollBar {}
}
}
onRoomChanged: {
if (room == null) {
close()
}
}
Component {
id: roomSettingDialog
RoomSettingsDialog {}
}
Component {
id: userDetailDialog
UserDetailDialog {}
}
Component {
id: inviteUserDialog
InviteUserDialog {}
}
}

View File

@@ -0,0 +1,55 @@
import QtQuick 2.12
import QtQuick.Controls 2.12
import QtQuick.Layouts 1.12
import QtQuick.Controls.Material 2.12
import org.kde.neochat 0.1
import NeoChat.Effect 2.0
import NeoChat.Component 2.0
import NeoChat.Setting 0.1
Control {
signal clicked()
id: header
background: Rectangle {
color: MPalette.background
layer.enabled: true
layer.effect: ElevationEffect {
elevation: 2
}
}
RowLayout {
anchors.fill: parent
anchors.leftMargin: 18
Layout.alignment: Qt.AlignVCenter
spacing: 12
Label {
Layout.fillWidth: true
text: currentRoom ? currentRoom.displayName : ""
color: MPalette.foreground
font.pixelSize: 18
elide: Text.ElideRight
wrapMode: Text.NoWrap
}
ToolButton {
Layout.preferredWidth: height
Layout.fillHeight: true
contentItem: MaterialIcon {
icon: "\ue5d4"
color: MPalette.lighter
}
onClicked: header.clicked()
}
}
}

View File

@@ -0,0 +1,108 @@
import QtQuick 2.12
import QtQuick.Controls 2.12 as QQC2
import QtQuick.Layouts 1.12
import org.kde.kirigami 2.13 as Kirigami
import org.kde.kitemmodels 1.0
import NeoChat.Component 2.0
import org.kde.neochat 0.1
Kirigami.ScrollablePage {
id: page
property var roomListModel
property var enteredRoom
property var searchText: ""
onSearchTextChanged: sortedFilteredRoomListModel.invalidateFilter()
signal enterRoom(var room)
signal leaveRoom(var room)
title: "Rooms"
titleDelegate: Kirigami.SearchField {
Layout.topMargin: Kirigami.Units.smallSpacing
Layout.bottomMargin: Kirigami.Units.smallSpacing
Layout.fillHeight: true
Layout.fillWidth: true
onTextChanged: page.searchText = text
}
ListView {
id: messageListView
model: KSortFilterProxyModel {
id: sortedFilteredRoomListModel
sourceModel: roomListModel
sortRole: "name"
sortOrder: Qt.AscendingOrder
filterRowCallback: function(row, parent) {
return (roomListModel.data(roomListModel.index(row, 0), RoomListModel.JoinStateRole) !== "upgraded") && roomListModel.data(roomListModel.index(row, 0), RoomListModel.NameRole).toLowerCase().includes(page.searchText.toLowerCase())
}
}
section.property: "categoryName"
section.delegate: Kirigami.ListSectionHeader {
label: section
}
delegate: Kirigami.AbstractListItem {
topPadding: Kirigami.Units.largeSpacing
bottomPadding: Kirigami.Units.largeSpacing
contentItem: RowLayout {
spacing: Kirigami.Units.largeSpacing
Kirigami.Avatar {
Layout.preferredWidth: height
Layout.fillHeight: true
source: avatar ? "image://mxc/" + avatar : ""
name: model.name || "No Name"
}
ColumnLayout {
Layout.fillWidth: true
Layout.fillHeight: true
Layout.alignment: Qt.AlignHCenter
spacing: Kirigami.Units.smallSpacing
QQC2.Label {
Layout.fillWidth: true
Layout.fillHeight: true
text: name ?? ""
font.pixelSize: 15
font.bold: unreadCount >= 0
elide: Text.ElideRight
wrapMode: Text.NoWrap
}
QQC2.Label {
Layout.fillWidth: true
Layout.fillHeight: true
Layout.alignment: Qt.AlignHCenter
text: (lastEvent == "" ? topic : lastEvent).replace(/(\r\n\t|\n|\r\t)/gm," ")
font.pixelSize: 12
elide: Text.ElideRight
wrapMode: Text.NoWrap
}
}
}
onClicked: {
if (enteredRoom) {
leaveRoom(enteredRoom)
}
enteredRoom = currentRoom
enterRoom(enteredRoom)
}
}
}
}

View File

@@ -0,0 +1,5 @@
module NeoChat.Panel
RoomPanel 2.0 RoomPanel.qml
RoomListPanel 2.0 RoomListPanel.qml
RoomDrawer 2.0 RoomDrawer.qml
NeoChatSidebar 2.0 NeoChatSidebar.qml