Fix Qml control colors

This commit is contained in:
trilene 2020-12-30 15:03:07 -05:00 committed by Nicolas Werner
parent 4123e6aff1
commit 2984d71971
8 changed files with 155 additions and 111 deletions

View file

@ -1,9 +1,9 @@
import "./voip"
import QtQuick 2.9
import QtQuick.Controls 2.3
import QtQuick.Layouts 1.2
import QtQuick.Window 2.2
import im.nheko 1.0
import "./voip"
Rectangle {
color: colors.window
@ -26,6 +26,7 @@ Rectangle {
ImageButton {
visible: CallManager.callsSupported
opacity: CallManager.haveCallInvite ? 0.3 : 1.0
Layout.alignment: Qt.AlignBottom
hoverEnabled: true
width: 22
@ -46,7 +47,7 @@ Rectangle {
}
else {
var dialog = placeCallDialog.createObject(timelineRoot);
dialog.show();
dialog.open();
}
}
}

View file

@ -1,8 +1,8 @@
import "../"
import QtQuick 2.9
import QtQuick.Controls 2.3
import QtQuick.Layouts 1.2
import im.nheko 1.0
import "../"
Rectangle {
@ -38,7 +38,7 @@ Rectangle {
Layout.leftMargin: 8
font.pointSize: fontMetrics.font.pointSize * 1.1
text: CallManager.callParty
color: colors.windowText
color: "#000000"
}
Image {
@ -52,7 +52,7 @@ Rectangle {
id: callStateLabel
font.pointSize: fontMetrics.font.pointSize * 1.1
color: colors.windowText
color: "#000000"
}
Item {
@ -163,11 +163,9 @@ Rectangle {
onClicked: CallManager.toggleCameraView()
}
Item {
implicitWidth: 8
}
ImageButton {
Layout.leftMargin: 8
Layout.rightMargin: 16
width: 24
height: 24
buttonTextColor: "#000000"
@ -177,11 +175,5 @@ Rectangle {
ToolTip.text: CallManager.isMicMuted ? qsTr("Unmute Mic") : qsTr("Mute Mic")
onClicked: CallManager.toggleMicMute()
}
Item {
implicitWidth: 16
}
}
}

View file

@ -1,32 +1,45 @@
import QtQuick 2.3
import QtQuick 2.9
import QtQuick.Controls 2.3
import QtQuick.Dialogs 1.3
import QtQuick.Layouts 1.2
import im.nheko 1.0
import "../"
ApplicationWindow {
Popup {
flags: Qt.Dialog
modality: Qt.ApplicationModal
palette: colors
width: columnLayout.implicitWidth
height: columnLayout.implicitHeight
modal: true
anchors.centerIn: parent
background: Rectangle {
color: colors.window
border.color: colors.windowText
}
// palette: colors
// colorize controls correctly
palette.base: colors.base
palette.brightText: colors.brightText
palette.button: colors.button
palette.buttonText: colors.buttonText
palette.dark: colors.dark
palette.highlight: colors.highlight
palette.highlightedText: colors.highlightedText
palette.light: colors.light
palette.mid: colors.mid
palette.text: colors.text
palette.window: colors.window
palette.windowText: colors.windowText
ColumnLayout {
id: columnLayout
spacing: 16
ColumnLayout {
spacing: 8
RowLayout {
Layout.topMargin: 8
Layout.leftMargin: 8
Layout.rightMargin: 8
RowLayout {
Image {
Layout.preferredWidth: 22
Layout.preferredHeight: 22
@ -42,9 +55,7 @@ ApplicationWindow {
RowLayout {
visible: CallManager.cameras.length > 0
Layout.leftMargin: 8
Layout.rightMargin: 8
visible: CallManager.isVideo && CallManager.cameras.length > 0
Image {
Layout.preferredWidth: 22
@ -60,32 +71,22 @@ ApplicationWindow {
}
}
RowLayout {
DialogButtonBox {
Layout.rightMargin: 8
Layout.bottomMargin: 8
Layout.leftMargin: 128
standardButtons: DialogButtonBox.Ok | DialogButtonBox.Cancel
Item {
implicitWidth: 128
}
Button {
text: qsTr("Ok")
onClicked: {
onAccepted: {
Settings.microphone = micCombo.currentText
if (cameraCombo.visible) {
Settings.camera = cameraCombo.currentText
}
close();
}
}
Button {
text: qsTr("Cancel")
onClicked: {
onRejected: {
close();
}
}
}
}
}

View file

@ -1,9 +1,8 @@
import "../"
import QtQuick 2.9
import QtQuick.Controls 2.3
import QtQuick.Dialogs 1.3
import QtQuick.Layouts 1.2
import im.nheko 1.0
import "../"
Rectangle {
@ -11,15 +10,15 @@ Rectangle {
color: "#2ECC71"
implicitHeight: visible ? rowLayout.height + 8 : 0
MessageDialog {
id: warningDialog
icon: StandardIcon.Warning
Component {
id: devicesDialog
CallDevices {
}
}
Component {
id: devicesDialog
CallDevices {
id: deviceError
DeviceError {
}
}
@ -42,7 +41,7 @@ Rectangle {
Layout.leftMargin: 8
font.pointSize: fontMetrics.font.pointSize * 1.1
text: CallManager.callParty
color: colors.windowText
color: "#000000"
}
Image {
@ -55,7 +54,7 @@ Rectangle {
Label {
font.pointSize: fontMetrics.font.pointSize * 1.1
text: CallManager.isVideo ? qsTr("Video Call") : qsTr("Voice Call")
color: colors.windowText
color: "#000000"
}
Item {
@ -63,8 +62,9 @@ Rectangle {
}
ImageButton {
width: 24
height: 24
Layout.rightMargin: 16
width: 20
height: 20
buttonTextColor: "#000000"
image: ":/icons/icons/ui/settings.png"
hoverEnabled: true
@ -72,53 +72,56 @@ Rectangle {
ToolTip.text: qsTr("Devices")
onClicked: {
var dialog = devicesDialog.createObject(timelineRoot);
dialog.show();
dialog.open();
}
}
Item {
implicitWidth: 8
}
Button {
Layout.rightMargin: 4
icon.source: CallManager.isVideo ? "qrc:/icons/icons/ui/video-call.png" : "qrc:/icons/icons/ui/place-call.png"
palette: colors
text: qsTr("Accept")
palette.button: colors.button
palette.buttonText: colors.buttonText
onClicked: {
if (CallManager.mics.length == 0) {
warningDialog.text = qsTr("No microphone found.");
warningDialog.open();
var dialog = deviceError.createObject(timelineRoot, {
"errorString": qsTr("No microphone found."),
"iconSource": "qrc:/icons/icons/ui/place-call.png"
});
dialog.open();
return;
}
else if (!CallManager.mics.includes(Settings.microphone)) {
warningDialog.text = qsTr("Unknown microphone: ") + Settings.microphone;
warningDialog.open();
var dialog = deviceError.createObject(timelineRoot, {
"errorString": qsTr("Unknown microphone: ") + Settings.microphone,
"iconSource": "qrc:/icons/icons/ui/place-call.png"
});
dialog.open();
return;
}
if (CallManager.isVideo && CallManager.cameras.length > 0 && !CallManager.cameras.includes(Settings.camera)) {
warningDialog.text = qsTr("Unknown camera: ") + Settings.camera;
warningDialog.open();
var dialog = deviceError.createObject(timelineRoot, {
"errorString": qsTr("Unknown camera: ") + Settings.camera,
"iconSource": "qrc:/icons/icons/ui/video-call.png"
});
dialog.open();
return;
}
CallManager.acceptInvite();
}
}
Item {
implicitWidth: 4
}
Button {
Layout.rightMargin: 16
icon.source: "qrc:/icons/icons/ui/end-call.png"
palette: colors
text: qsTr("Decline")
palette.button: colors.button
palette.buttonText: colors.buttonText
onClicked: {
CallManager.hangUp();
}
}
Item {
implicitWidth: 16
}
}
}

View file

@ -0,0 +1,31 @@
import QtQuick 2.9
import QtQuick.Controls 2.3
import QtQuick.Layouts 1.2
import im.nheko 1.0
Popup {
property string errorString
property var iconSource
modal: true
anchors.centerIn: parent
background: Rectangle {
color: colors.window
border.color: colors.windowText
}
RowLayout {
Image {
Layout.preferredWidth: 16
Layout.preferredHeight: 16
source: iconSource
}
Label {
text: errorString
color: colors.windowText
}
}
}

View file

@ -1,23 +1,39 @@
import QtQuick 2.3
import "../"
import QtQuick 2.9
import QtQuick.Controls 2.3
import QtQuick.Dialogs 1.3
import QtQuick.Layouts 1.2
import im.nheko 1.0
import "../"
ApplicationWindow {
Popup {
flags: Qt.Dialog
modality: Qt.ApplicationModal
palette: colors
width: columnLayout.implicitWidth
height: columnLayout.implicitHeight
MessageDialog {
id: warningDialog
icon: StandardIcon.Warning
modal: true
anchors.centerIn: parent
background: Rectangle {
color: colors.window
border.color: colors.windowText
}
Component {
id: deviceError
DeviceError {
}
}
// palette: colors
// colorize controls correctly
palette.base: colors.base
palette.brightText: colors.brightText
palette.button: colors.button
palette.buttonText: colors.buttonText
palette.dark: colors.dark
palette.highlight: colors.highlight
palette.highlightedText: colors.highlightedText
palette.light: colors.light
palette.mid: colors.mid
palette.text: colors.text
palette.window: colors.window
palette.windowText: colors.windowText
ColumnLayout {
id: columnLayout
@ -25,11 +41,10 @@ ApplicationWindow {
RowLayout {
Layout.topMargin: 16
Layout.topMargin: 8
Layout.leftMargin: 8
Label {
font.pointSize: fontMetrics.font.pointSize * 1.1
text: qsTr("Place a call to ") + TimelineManager.timeline.roomName + "?"
color: colors.windowText
}
@ -47,24 +62,24 @@ ApplicationWindow {
function validateMic() {
if (CallManager.mics.length == 0) {
warningDialog.text = qsTr("No microphone found.");
warningDialog.open();
var dialog = deviceError.createObject(timelineRoot, {
"errorString": qsTr("No microphone found."),
"iconSource": "qrc:/icons/icons/ui/place-call.png"
});
dialog.open();
return false;
}
return true;
}
Avatar {
Layout.rightMargin: cameraCombo.visible ? 16 : 64
width: avatarSize
height: avatarSize
url: TimelineManager.timeline.roomAvatarUrl.replace("mxc://", "image://MxcImage/")
displayName: TimelineManager.timeline.roomName
}
Item {
implicitWidth: cameraCombo.visible ? 16 : 64
}
Button {
text: qsTr("Voice")
icon.source: "qrc:/icons/icons/ui/place-call.png"
@ -106,7 +121,7 @@ ApplicationWindow {
Layout.leftMargin: 8
Layout.rightMargin: 8
Layout.bottomMargin: cameraCombo.visible ? 0 : 16
Layout.bottomMargin: cameraCombo.visible ? 0 : 8
Image {
Layout.preferredWidth: 22
@ -126,7 +141,7 @@ ApplicationWindow {
visible: CallManager.cameras.length > 0
Layout.leftMargin: 8
Layout.rightMargin: 8
Layout.bottomMargin: 16
Layout.bottomMargin: 8
Image {
Layout.preferredWidth: 22

View file

@ -160,6 +160,7 @@
<file>qml/voip/ActiveCallBar.qml</file>
<file>qml/voip/CallDevices.qml</file>
<file>qml/voip/CallInviteBar.qml</file>
<file>qml/voip/DeviceError.qml</file>
<file>qml/voip/PlaceCall.qml</file>
<file>qml/voip/VideoCall.qml</file>
</qresource>

View file

@ -464,7 +464,7 @@ UserSettings::applyTheme()
stylefile.setFileName(":/styles/styles/nheko.qss");
QPalette lightActive(
/*windowText*/ QColor("#333"),
/*button*/ QColor("#333"),
/*button*/ QColor("white"),
/*light*/ QColor(0xef, 0xef, 0xef),
/*dark*/ QColor(110, 110, 110),
/*mid*/ QColor(220, 220, 220),
@ -477,7 +477,7 @@ UserSettings::applyTheme()
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("#495057"));
lightActive.setColor(QPalette::ButtonText, QColor("#333"));
QApplication::setPalette(lightActive);
} else if (this->theme() == "dark") {
stylefile.setFileName(":/styles/styles/nheko-dark.qss");