Use Base components without namespace prefix

This commit is contained in:
miruka
2019-04-28 15:18:36 -04:00
parent 89fcfbea82
commit d0089df051
25 changed files with 123 additions and 128 deletions

View File

@@ -1,9 +1,9 @@
import QtQuick 2.7
import QtQuick.Controls 2.2
import QtQuick.Layouts 1.4
import "../../Base" as Base
import "../../Base"
Base.HGlassRectangle {
HGlassRectangle {
id: banner
Layout.fillWidth: true
Layout.preferredHeight: 32
@@ -14,16 +14,16 @@ Base.HGlassRectangle {
property alias buttonModel: bannerRepeater.model
property var buttonCallbacks: []
Base.HRowLayout {
HRowLayout {
id: bannerRow
anchors.fill: parent
Base.HAvatar {
HAvatar {
id: bannerAvatar
dimension: banner.Layout.preferredHeight
}
Base.HLabel {
HLabel {
id: bannerLabel
textFormat: Text.StyledText
maximumLineCount: 1
@@ -43,7 +43,7 @@ Base.HGlassRectangle {
Item { Layout.fillWidth: true }
Base.HRowLayout {
HRowLayout {
id: bannerButtons
function getButtonsWidth() {
@@ -68,7 +68,7 @@ Base.HGlassRectangle {
id: bannerRepeater
model: []
Base.HButton {
HButton {
id: button
text: modelData.text
iconName: modelData.iconName

View File

@@ -1,12 +1,12 @@
import QtQuick 2.7
import QtQuick.Controls 2.2
import QtQuick.Layouts 1.4
import "../../Base" as Base
import "../../Base"
Banner {
property var inviter: null
color: Base.HStyle.chat.inviteBanner.background
color: HStyle.chat.inviteBanner.background
avatarName: inviter ? inviter.displayname : ""
//avatarSource: inviter ? inviter.avatar_url : ""

View File

@@ -1,13 +1,13 @@
import QtQuick 2.7
import QtQuick.Controls 2.2
import QtQuick.Layouts 1.4
import "../../Base" as Base
import "../../Base"
import "../utils.js" as ChatJS
Banner {
property var leftEvent: null
color: Base.HStyle.chat.leftBanner.background
color: HStyle.chat.leftBanner.background
avatarName: ChatJS.getLeftBannerAvatarName(leftEvent, chatPage.userId)
labelText: ChatJS.getLeftBannerText(leftEvent)

View File

@@ -1,11 +1,11 @@
import QtQuick 2.7
import QtQuick.Controls 2.2
import QtQuick.Layouts 1.4
import "../Base" as Base
import "../Base"
import "Banners"
import "RoomEventList"
Base.HColumnLayout {
HColumnLayout {
property string userId: ""
property string roomId: ""

View File

@@ -1,9 +1,9 @@
import QtQuick 2.7
import "../../Base" as Base
import "../../Base"
Base.HNoticeLabel {
HNoticeLabel {
text: dateTime.toLocaleDateString()
color: Base.HStyle.chat.daybreak.foreground
backgroundColor: Base.HStyle.chat.daybreak.background
radius: Base.HStyle.chat.daybreak.radius
color: HStyle.chat.daybreak.foreground
backgroundColor: HStyle.chat.daybreak.background
radius: HStyle.chat.daybreak.radius
}

View File

@@ -1,41 +1,41 @@
import QtQuick 2.7
import QtQuick.Controls 2.0
import QtQuick.Layouts 1.4
import "../../Base" as Base
import "../../Base"
import "../utils.js" as ChatJS
Base.HRowLayout {
HRowLayout {
id: eventContent
spacing: standardSpacing / 2
layoutDirection: isOwn ? Qt.RightToLeft : Qt.LeftToRight
Base.HAvatar {
HAvatar {
id: avatar
name: displayName
hidden: combine
dimension: 28
}
Base.HLabel {
HLabel {
id: contentLabel
text: "<font color='" +
Qt.hsla(Backend.hueFromString(displayName.value || dict.sender),
Base.HStyle.chat.event.saturation,
Base.HStyle.chat.event.lightness,
HStyle.chat.event.saturation,
HStyle.chat.event.lightness,
1) +
"'>" +
(displayName.value || dict.sender) + " " +
ChatJS.getEventText(type, dict) +
"&nbsp;&nbsp;" +
"<font size=" + Base.HStyle.fontSize.small + "px " +
"color=" + Base.HStyle.chat.event.date + ">" +
"<font size=" + HStyle.fontSize.small + "px " +
"color=" + HStyle.chat.event.date + ">" +
Qt.formatDateTime(dateTime, "hh:mm:ss") +
"</font> " +
"</font>"
textFormat: Text.RichText
background: Rectangle {color: Base.HStyle.chat.event.background}
background: Rectangle {color: HStyle.chat.event.background}
wrapMode: Text.Wrap
leftPadding: horizontalPadding

View File

@@ -1,26 +1,26 @@
import QtQuick 2.7
import QtQuick.Controls 2.0
import QtQuick.Layouts 1.4
import "../../Base" as Base
import "../../Base"
Row {
id: row
spacing: standardSpacing
layoutDirection: isOwn ? Qt.RightToLeft : Qt.LeftToRight
Base.HAvatar { id: avatar; hidden: combine; name: displayName }
HAvatar { id: avatar; hidden: combine; name: displayName }
Base.HColumnLayout {
HColumnLayout {
spacing: 0
Base.HLabel {
HLabel {
visible: ! combine
id: nameLabel
text: displayName.value || dict.sender
background: Rectangle {color: Base.HStyle.chat.message.background}
background: Rectangle {color: HStyle.chat.message.background}
color: Qt.hsla(Backend.hueFromString(text),
Base.HStyle.displayName.saturation,
Base.HStyle.displayName.lightness,
HStyle.displayName.saturation,
HStyle.displayName.lightness,
1)
elide: Text.ElideRight
maximumLineCount: 1
@@ -32,21 +32,21 @@ Row {
topPadding: verticalPadding
}
Base.HRichLabel {
HRichLabel {
id: contentLabel
text: (dict.formatted_body ?
Backend.htmlFilter.filter(dict.formatted_body) :
dict.body) +
"&nbsp;&nbsp;<font size=" + Base.HStyle.fontSize.small +
"px color=" + Base.HStyle.chat.message.date + ">" +
"&nbsp;&nbsp;<font size=" + HStyle.fontSize.small +
"px color=" + HStyle.chat.message.date + ">" +
Qt.formatDateTime(dateTime, "hh:mm:ss") +
"</font>" +
(isLocalEcho ?
"&nbsp;<font size=" + Base.HStyle.fontSize.small +
"&nbsp;<font size=" + HStyle.fontSize.small +
"px>⏳</font>" : "")
textFormat: Text.RichText
background: Rectangle {color: Base.HStyle.chat.message.background}
color: Base.HStyle.chat.message.body
background: Rectangle {color: HStyle.chat.message.background}
color: HStyle.chat.message.body
wrapMode: Text.Wrap
leftPadding: horizontalPadding

View File

@@ -1,7 +1,7 @@
import QtQuick 2.7
import QtQuick.Controls 2.0
import QtQuick.Layouts 1.4
import "../../Base" as Base
import "../../Base"
import "../utils.js" as ChatJS
Column {

View File

@@ -1,13 +1,13 @@
import QtQuick 2.7
import QtQuick.Controls 2.2
import QtQuick.Layouts 1.4
import "../../Base" as Base
import "../../Base"
Base.HGlassRectangle {
HGlassRectangle {
property bool canLoadPastEvents: true
property int space: 8
color: Base.HStyle.chat.roomEventList.background
color: HStyle.chat.roomEventList.background
Layout.fillWidth: true
Layout.fillHeight: true
@@ -40,7 +40,7 @@ Base.HGlassRectangle {
}
}
Base.HNoticeLabel {
HNoticeLabel {
text: qsTr("Nothing to show here yet...")
visible: roomEventListView.model.count < 1

View File

@@ -1,43 +1,43 @@
import QtQuick 2.7
import QtQuick.Controls 2.2
import QtQuick.Layouts 1.4
import "../Base" as Base
import "../Base"
Base.HGlassRectangle {
HGlassRectangle {
property string displayName: ""
property string topic: ""
id: roomHeader
color: Base.HStyle.chat.roomHeader.background
color: HStyle.chat.roomHeader.background
Layout.fillWidth: true
Layout.preferredHeight: 32
Base.HRowLayout {
HRowLayout {
id: row
spacing: 8
anchors.fill: parent
Base.HAvatar {
HAvatar {
id: avatar
name: displayName
dimension: roomHeader.height
Layout.alignment: Qt.AlignTop
}
Base.HLabel {
HLabel {
id: roomName
text: displayName
font.pixelSize: Base.HStyle.fontSize.big
font.pixelSize: HStyle.fontSize.big
elide: Text.ElideRight
maximumLineCount: 1
Layout.maximumWidth: row.width - row.totalSpacing - avatar.width
}
Base.HLabel {
HLabel {
id: roomTopic
text: topic
font.pixelSize: Base.HStyle.fontSize.small
font.pixelSize: HStyle.fontSize.small
elide: Text.ElideRight
maximumLineCount: 1
Layout.maximumWidth:

View File

@@ -1,9 +1,9 @@
import QtQuick 2.7
import QtQuick.Controls 2.2
import QtQuick.Layouts 1.4
import "../Base" as Base
import "../Base"
Base.HGlassRectangle {
HGlassRectangle {
function setFocus() { textArea.forceActiveFocus() }
id: root
@@ -12,18 +12,18 @@ Base.HGlassRectangle {
Layout.preferredHeight: textArea.implicitHeight
// parent.height / 2 causes binding loop?
Layout.maximumHeight: pageStack.height / 2
color: Base.HStyle.chat.sendBox.background
color: HStyle.chat.sendBox.background
Base.HRowLayout {
HRowLayout {
anchors.fill: parent
Base.HAvatar {
HAvatar {
id: avatar
name: Backend.getUserDisplayName(chatPage.userId)
dimension: root.Layout.minimumHeight
}
Base.HScrollableTextArea {
HScrollableTextArea {
Layout.fillHeight: true
Layout.fillWidth: true

View File

@@ -1,19 +1,19 @@
import QtQuick 2.7
import QtQuick.Controls 2.2
import QtQuick.Layouts 1.4
import "../Base" as Base
import "../Base"
import "utils.js" as ChatJS
Base.HGlassRectangle {
HGlassRectangle {
property var typingUsers: chatPage.roomInfo.typingUsers
color: Base.HStyle.chat.typingUsers.background
color: HStyle.chat.typingUsers.background
Layout.fillWidth: true
Layout.minimumHeight: usersLabel.text ? usersLabel.implicitHeight : 0
Layout.maximumHeight: Layout.minimumHeight
Base.HLabel {
HLabel {
id: usersLabel
anchors.fill: parent