mirror of
https://github.com/Nheko-Reborn/nheko.git
synced 2024-11-25 20:48:52 +03:00
Use palette for qml code for theming
Can't do it for QtWidgets code. We need to fully transition, before we can fully switch over probably.
This commit is contained in:
parent
384ef13c76
commit
d35cc3dda4
10 changed files with 43 additions and 39 deletions
|
@ -1,4 +1,5 @@
|
|||
import QtQuick 2.6
|
||||
import QtQuick.Controls 2.3
|
||||
import QtGraphicalEffects 1.0
|
||||
|
||||
Rectangle {
|
||||
|
@ -10,15 +11,15 @@ Rectangle {
|
|||
property alias url: img.source
|
||||
property string displayName
|
||||
|
||||
Text {
|
||||
Label {
|
||||
anchors.fill: parent
|
||||
text: chat.model.escapeEmoji(String.fromCodePoint(displayName.codePointAt(0)))
|
||||
textFormat: Text.RichText
|
||||
color: colors.text
|
||||
font.pixelSize: avatar.height/2
|
||||
verticalAlignment: Text.AlignVCenter
|
||||
horizontalAlignment: Text.AlignHCenter
|
||||
visible: img.status != Image.Ready
|
||||
color: colors.brightText
|
||||
}
|
||||
|
||||
Image {
|
||||
|
@ -42,5 +43,5 @@ Rectangle {
|
|||
}
|
||||
}
|
||||
}
|
||||
color: colors.base
|
||||
color: colors.dark
|
||||
}
|
||||
|
|
|
@ -54,6 +54,20 @@ MouseArea {
|
|||
}
|
||||
}
|
||||
|
||||
StatusIndicator {
|
||||
state: model.state
|
||||
Layout.alignment: Qt.AlignRight | Qt.AlignTop
|
||||
Layout.preferredHeight: 16
|
||||
width: 16
|
||||
}
|
||||
|
||||
EncryptionIndicator {
|
||||
visible: model.isEncrypted
|
||||
Layout.alignment: Qt.AlignRight | Qt.AlignTop
|
||||
Layout.preferredHeight: 16
|
||||
width: 16
|
||||
}
|
||||
|
||||
ImageButton {
|
||||
visible: timelineSettings.buttons
|
||||
Layout.alignment: Qt.AlignRight | Qt.AlignTop
|
||||
|
@ -87,21 +101,7 @@ MouseArea {
|
|||
|
||||
}
|
||||
|
||||
StatusIndicator {
|
||||
state: model.state
|
||||
Layout.alignment: Qt.AlignRight | Qt.AlignTop
|
||||
Layout.preferredHeight: 16
|
||||
width: 16
|
||||
}
|
||||
|
||||
EncryptionIndicator {
|
||||
visible: model.isEncrypted
|
||||
Layout.alignment: Qt.AlignRight | Qt.AlignTop
|
||||
Layout.preferredHeight: 16
|
||||
width: 16
|
||||
}
|
||||
|
||||
Text {
|
||||
Label {
|
||||
Layout.alignment: Qt.AlignRight | Qt.AlignTop
|
||||
text: model.timestamp.toLocaleTimeString("HH:mm")
|
||||
color: inactiveColors.text
|
||||
|
|
|
@ -9,12 +9,14 @@ import im.nheko 1.0
|
|||
|
||||
import "./delegates"
|
||||
|
||||
Item {
|
||||
Page {
|
||||
property var colors: currentActivePalette
|
||||
property var systemInactive: SystemPalette { colorGroup: SystemPalette.Disabled }
|
||||
property var inactiveColors: currentInactivePalette ? currentInactivePalette : systemInactive
|
||||
property int avatarSize: 40
|
||||
|
||||
palette: colors
|
||||
|
||||
Settings {
|
||||
id: settings
|
||||
category: "user"
|
||||
|
@ -29,7 +31,6 @@ Item {
|
|||
|
||||
Menu {
|
||||
id: messageContextMenu
|
||||
palette: colors
|
||||
modal: true
|
||||
|
||||
function show(eventId_, eventType_, showAt) {
|
||||
|
@ -73,12 +74,11 @@ Item {
|
|||
anchors.fill: parent
|
||||
color: colors.window
|
||||
|
||||
Text {
|
||||
Label {
|
||||
visible: !timelineManager.timeline && !timelineManager.isInitialSync
|
||||
anchors.centerIn: parent
|
||||
text: qsTr("No room open")
|
||||
font.pointSize: 24
|
||||
color: colors.windowText
|
||||
}
|
||||
|
||||
BusyIndicator {
|
||||
|
@ -206,14 +206,14 @@ Item {
|
|||
anchors.horizontalCenter: parent ? parent.horizontalCenter : undefined
|
||||
visible: section.includes(" ")
|
||||
text: chat.model.formatDateSeparator(modelData.timestamp)
|
||||
color: colors.windowText
|
||||
color: colors.brightText
|
||||
|
||||
height: contentHeight * 1.2
|
||||
width: contentWidth * 1.2
|
||||
horizontalAlignment: Text.AlignHCenter
|
||||
background: Rectangle {
|
||||
radius: parent.height / 2
|
||||
color: colors.base
|
||||
color: colors.dark
|
||||
}
|
||||
}
|
||||
Row {
|
||||
|
@ -233,7 +233,7 @@ Item {
|
|||
}
|
||||
}
|
||||
|
||||
Text {
|
||||
Label {
|
||||
id: userName
|
||||
text: chat.model.escapeEmoji(modelData.userName)
|
||||
color: timelineManager.userColor(modelData.userId, colors.window)
|
||||
|
@ -268,7 +268,7 @@ Item {
|
|||
anchors.left: parent.left
|
||||
anchors.right: parent.right
|
||||
|
||||
Text {
|
||||
Label {
|
||||
id: typingDisplay
|
||||
anchors.left: parent.left
|
||||
anchors.right: parent.right
|
||||
|
@ -277,7 +277,6 @@ Item {
|
|||
|
||||
text: chat.model ? chat.model.formatTypingUsers(chat.model.typingUsers, colors.window) : ""
|
||||
textFormat: Text.RichText
|
||||
color: colors.windowText
|
||||
}
|
||||
|
||||
Rectangle {
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
TextMessage {
|
||||
font.italic: true
|
||||
color: inactiveColors.text
|
||||
color: colors.buttonText
|
||||
}
|
||||
|
|
|
@ -2,13 +2,13 @@ import QtQuick 2.5
|
|||
import QtQuick.Controls 2.1
|
||||
|
||||
Label {
|
||||
color: inactiveColors.text
|
||||
color: colors.brightText
|
||||
horizontalAlignment: Text.AlignHCenter
|
||||
|
||||
height: contentHeight * 1.2
|
||||
width: contentWidth * 1.2
|
||||
background: Rectangle {
|
||||
radius: parent.height / 2
|
||||
color: colors.base
|
||||
color: colors.dark
|
||||
}
|
||||
}
|
||||
|
|
|
@ -32,6 +32,7 @@ UserMentionsWidget > * {
|
|||
|
||||
QLineEdit,
|
||||
QListWidget,
|
||||
QToolTip,
|
||||
WelcomePage,
|
||||
LoginPage,
|
||||
RegisterPage,
|
||||
|
|
|
@ -183,6 +183,7 @@ TopSection {
|
|||
|
||||
WelcomePage,
|
||||
LoginPage,
|
||||
QToolTip,
|
||||
RegisterPage {
|
||||
background-color: white;
|
||||
color: #333;
|
||||
|
|
|
@ -70,7 +70,7 @@ FileItem {
|
|||
}
|
||||
|
||||
RaisedButton {
|
||||
qproperty-foregroundColor: palette(buttonText);
|
||||
qproperty-foregroundColor: palette(button-text);
|
||||
}
|
||||
|
||||
TextField {
|
||||
|
@ -95,18 +95,18 @@ UserMentionsWidget {
|
|||
qproperty-titleColor: palette(text);
|
||||
qproperty-subtitleColor: palette(text);
|
||||
|
||||
qproperty-highlightedTitleColor: palette(highlightedtext);
|
||||
qproperty-highlightedSubtitleColor: palette(highlightedtext);
|
||||
qproperty-highlightedTitleColor: palette(highlighted-text);
|
||||
qproperty-highlightedSubtitleColor: palette(highlighted-text);
|
||||
|
||||
qproperty-hoverTitleColor: palette(highlightedtext);
|
||||
qproperty-hoverSubtitleColor: palette(highlightedtext);
|
||||
|
||||
qproperty-btnColor: palette(button);
|
||||
qproperty-btnTextColor: palette(buttonText);
|
||||
qproperty-btnColor: palette(dark);
|
||||
qproperty-btnTextColor: palette(bright-text);
|
||||
|
||||
qproperty-timestampColor: palette(text);
|
||||
qproperty-highlightedTimestampColor: palette(highlightedtext);
|
||||
qproperty-hoverTimestampColor: palette(highlightedtext);
|
||||
qproperty-highlightedTimestampColor: palette(highlighted-text);
|
||||
qproperty-hoverTimestampColor: palette(highlighted-text);
|
||||
|
||||
qproperty-bubbleBgColor: palette(base);
|
||||
qproperty-bubbleFgColor: palette(text);
|
||||
|
|
|
@ -29,7 +29,7 @@ qmlMessageHandler(QtMsgType type, const QMessageLogContext &context, const QStri
|
|||
if (msg.endsWith(
|
||||
"QML Binding: Not restoring previous value because restoreMode has not been set.This "
|
||||
"behavior is deprecated.In Qt < 6.0 the default is Binding.RestoreBinding.In Qt >= "
|
||||
"6.0 the default is Binding.RestoreBindingOrValue."))
|
||||
"6.0 the default is Binding.RestoreBindingOrValue.") || msg.endsWith("Both point size and pixel size set. Using pixel size."))
|
||||
return;
|
||||
|
||||
switch (type) {
|
||||
|
|
|
@ -34,6 +34,7 @@ TimelineViewManager::updateColorPalette()
|
|||
lightActive.setColor(QPalette::ToolTipBase, lightActive.base().color());
|
||||
lightActive.setColor(QPalette::ToolTipText, lightActive.text().color());
|
||||
lightActive.setColor(QPalette::Link, QColor("#0077b5"));
|
||||
lightActive.setColor(QPalette::ButtonText, QColor("gray"));
|
||||
view->rootContext()->setContextProperty("currentActivePalette", lightActive);
|
||||
view->rootContext()->setContextProperty("currentInactivePalette", lightActive);
|
||||
} else if (settings->theme() == "dark") {
|
||||
|
@ -43,13 +44,14 @@ TimelineViewManager::updateColorPalette()
|
|||
/*dark*/ QColor("#2d3139"),
|
||||
/*mid*/ QColor(),
|
||||
/*text*/ QColor("#caccd1"),
|
||||
/*bright_text*/ QColor(),
|
||||
/*bright_text*/ QColor(0xff, 0xff, 0xff),
|
||||
/*base*/ QColor("#2d3139"),
|
||||
/*window*/ QColor("#202228"));
|
||||
darkActive.setColor(QPalette::Highlight, QColor("#e7e7e9"));
|
||||
darkActive.setColor(QPalette::ToolTipBase, darkActive.base().color());
|
||||
darkActive.setColor(QPalette::ToolTipText, darkActive.text().color());
|
||||
darkActive.setColor(QPalette::Link, QColor("#38a3d8"));
|
||||
darkActive.setColor(QPalette::ButtonText, QColor("gray"));
|
||||
view->rootContext()->setContextProperty("currentActivePalette", darkActive);
|
||||
view->rootContext()->setContextProperty("currentInactivePalette", darkActive);
|
||||
} else {
|
||||
|
|
Loading…
Reference in a new issue