mirror of
https://github.com/Nheko-Reborn/nheko.git
synced 2024-11-25 04:28:49 +03:00
Use system colors for now
This commit is contained in:
parent
10eb64de81
commit
bbbd5df75f
5 changed files with 37 additions and 8 deletions
|
@ -1,17 +1,23 @@
|
|||
import QtQuick 2.6
|
||||
import QtQuick.Controls 2.5
|
||||
import QtQuick.Layouts 1.5
|
||||
import QtGraphicalEffects 1.0
|
||||
|
||||
import com.github.nheko 1.0
|
||||
|
||||
Rectangle {
|
||||
anchors.fill: parent
|
||||
|
||||
SystemPalette { id: colors; colorGroup: SystemPalette.Active }
|
||||
SystemPalette { id: inactiveColors; colorGroup: SystemPalette.Disabled }
|
||||
color: colors.window
|
||||
|
||||
Text {
|
||||
visible: !timelineManager.timeline
|
||||
anchors.centerIn: parent
|
||||
text: qsTr("No room open")
|
||||
font.pointSize: 24
|
||||
color: colors.windowText
|
||||
}
|
||||
|
||||
ListView {
|
||||
|
@ -67,16 +73,22 @@ Rectangle {
|
|||
Layout.alignment: Qt.AlignRight | Qt.AlignTop
|
||||
id: replyButton
|
||||
flat: true
|
||||
height: replyButtonImg.contentHeight
|
||||
width: replyButtonImg.contentWidth
|
||||
height: 32
|
||||
width: 32
|
||||
ToolTip.visible: hovered
|
||||
ToolTip.text: qsTr("Reply")
|
||||
|
||||
Image {
|
||||
id: replyButtonImg
|
||||
// Workaround, can't get icon.source working for now...
|
||||
anchors.fill: parent
|
||||
source: "qrc:/icons/icons/ui/mail-reply.png"
|
||||
}
|
||||
ColorOverlay {
|
||||
anchors.fill: replyButtonImg
|
||||
source: replyButtonImg
|
||||
color: colors.buttonText
|
||||
}
|
||||
}
|
||||
Button {
|
||||
Layout.alignment: Qt.AlignRight | Qt.AlignTop
|
||||
|
@ -92,6 +104,11 @@ Rectangle {
|
|||
anchors.fill: parent
|
||||
source: "qrc:/icons/icons/ui/vertical-ellipsis.png"
|
||||
}
|
||||
ColorOverlay {
|
||||
anchors.fill: optionsButtonImg
|
||||
source: optionsButtonImg
|
||||
color: colors.buttonText
|
||||
}
|
||||
|
||||
onClicked: contextMenu.open()
|
||||
|
||||
|
@ -117,6 +134,7 @@ Rectangle {
|
|||
Text {
|
||||
Layout.alignment: Qt.AlignRight | Qt.AlignTop
|
||||
text: model.timestamp.toLocaleTimeString("HH:mm")
|
||||
color: inactiveColors.text
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -134,13 +152,14 @@ Rectangle {
|
|||
anchors.horizontalCenter: parent.horizontalCenter
|
||||
visible: section.includes(" ")
|
||||
text: chat.model.formatDateSeparator(new Date(Number(section.split(" ")[1])))
|
||||
color: colors.windowText
|
||||
|
||||
height: contentHeight * 1.2
|
||||
width: contentWidth * 1.2
|
||||
horizontalAlignment: Text.AlignHCenter
|
||||
background: Rectangle {
|
||||
radius: parent.height / 2
|
||||
color: "black"
|
||||
color: colors.dark
|
||||
}
|
||||
}
|
||||
Row {
|
||||
|
@ -155,7 +174,7 @@ Rectangle {
|
|||
Text {
|
||||
id: userName
|
||||
text: chat.model.displayName(section.split(" ")[0])
|
||||
color: chat.model.userColor(section.split(" ")[0], "#ffffff")
|
||||
color: chat.model.userColor(section.split(" ")[0], colors.window)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
12
resources/qml/delegates/NoticeMessage.qml
Normal file
12
resources/qml/delegates/NoticeMessage.qml
Normal file
|
@ -0,0 +1,12 @@
|
|||
import QtQuick 2.5
|
||||
|
||||
TextEdit {
|
||||
text: eventData.formattedBody
|
||||
textFormat: TextEdit.RichText
|
||||
readOnly: true
|
||||
wrapMode: Text.Wrap
|
||||
width: parent.width
|
||||
selectByMouse: true
|
||||
font.italic: true
|
||||
color: inactiveColors.text
|
||||
}
|
|
@ -7,4 +7,5 @@ TextEdit {
|
|||
wrapMode: Text.Wrap
|
||||
width: parent.width
|
||||
selectByMouse: true
|
||||
color: colors.text
|
||||
}
|
||||
|
|
|
@ -117,5 +117,6 @@
|
|||
<qresource prefix="/">
|
||||
<file>qml/TimelineView.qml</file>
|
||||
<file>qml/delegates/TextMessage.qml</file>
|
||||
<file>qml/delegates/NoticeMessage.qml</file>
|
||||
</qresource>
|
||||
</RCC>
|
||||
|
|
|
@ -43,7 +43,6 @@ resolve(const QString &avatarUrl, int size, QObject *receiver, AvatarCallback ca
|
|||
|
||||
QPixmap pixmap;
|
||||
if (avatar_cache.find(cacheKey, &pixmap)) {
|
||||
nhlog::net()->info("cached pixmap {}", avatarUrl.toStdString());
|
||||
callback(pixmap);
|
||||
return;
|
||||
}
|
||||
|
@ -52,7 +51,6 @@ resolve(const QString &avatarUrl, int size, QObject *receiver, AvatarCallback ca
|
|||
if (!data.isNull()) {
|
||||
pixmap.loadFromData(data);
|
||||
avatar_cache.insert(cacheKey, pixmap);
|
||||
nhlog::net()->info("loaded pixmap from disk cache {}", avatarUrl.toStdString());
|
||||
callback(pixmap);
|
||||
return;
|
||||
}
|
||||
|
@ -86,8 +84,6 @@ resolve(const QString &avatarUrl, int size, QObject *receiver, AvatarCallback ca
|
|||
|
||||
cache::client()->saveImage(opts.mxc_url, res);
|
||||
|
||||
nhlog::net()->info("downloaded pixmap {}", opts.mxc_url);
|
||||
|
||||
emit proxy->avatarDownloaded(QByteArray(res.data(), res.size()));
|
||||
});
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue