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