Allow the toolbar color to be the same as the theme background and small fixes

This commit is contained in:
Stefano Moretti
2023-05-27 11:07:43 +02:00
parent 051e97c636
commit 287d439eec
8 changed files with 64 additions and 17 deletions

View File

@ -23,5 +23,5 @@ ApplicationWindow {
Material.primary: Style.primaryColor
Material.accent: Style.accentColor
Material.theme: Style.isDarkTheme ? Material.Dark : Material.Light
Material.theme: Style.theme
}

View File

@ -1,6 +1,7 @@
import QtQuick
import QtQuick.Layouts
import QtQuick.Controls
import QtQuick.Controls.Material
ToolBar {
id: root
@ -10,6 +11,8 @@ ToolBar {
property alias title: titleLabel.text
Material.background: Style.toolBarBackground
RowLayout {
focus: false
spacing: 0
@ -17,7 +20,7 @@ ToolBar {
ToolButton {
icon.source: root.leftButton?.icon.source ?? ""
icon.color: Style.textOnPrimary
icon.color: Style.toolBarForeground
focusPolicy: Qt.NoFocus
opacity: Style.opacityTitle
enabled: root.leftButton && root.leftButton.enabled
@ -26,14 +29,14 @@ ToolBar {
LabelTitle {
id: titleLabel
elide: Label.ElideRight
color: Style.textOnPrimary
color: Style.toolBarForeground
Layout.fillWidth: true
}
Repeater {
model: root.rightButtons.length
delegate: ToolButton {
icon.source: root.rightButtons[index].icon.source
icon.color: Style.textOnPrimary
icon.color: Style.toolBarForeground
focusPolicy: Qt.NoFocus
opacity: Style.opacityTitle
enabled: root.rightButtons[index].enabled

View File

@ -5,6 +5,8 @@ import QtQuick.Controls.Material
QtObject {
property bool isDarkTheme: false
property int theme: Material.System
property bool toolBarPrimary: true
property color primaryColor: Material.color(Material.BlueGrey)
property color accentColor: Material.color(Material.Orange)
@ -23,6 +25,8 @@ QtObject {
property color popupTextColor: isDarkTheme ? "#FFFFFF" : "#424242"
property color toastColor: isDarkTheme ? "Darkgrey" : "#323232"
property real toastOpacity: isDarkTheme ? 0.9 : 0.75
property color toolBarForeground: toolBarPrimary ? textOnPrimary : (isDarkTheme ? "#FFFFFF" : "#000000")
property color toolBarBackground: toolBarPrimary ? primaryColor : (isDarkTheme ? "#1C1B1F" : "#FFFBFE")
// font sizes - defaults from Google Material Design Guide
property int fontSizeDisplay4: 112

View File

@ -72,6 +72,11 @@ Item {
toMiddleTime = Math.abs(minAngle - handToAnimation.to) / 180 * 400
fromMiddleTime = Math.abs(hourAngle - handFromAnimation.from) / 180 * 400
}
var animTime = toMiddleTime + fromMiddleTime
if (animTime > 0 && animTime < 200) {
toMiddleTime = toMiddleTime / animTime * 200
fromMiddleTime = fromMiddleTime / animTime * 200
}
handToAnimation.duration = circleToAnimation.duration = toMiddleTime
handFromAnimation.duration = circleFromAnimation.duration = fromMiddleTime
@ -191,7 +196,7 @@ Item {
height: width
radius: width / 2
anchors.centerIn: parent
visible: root.pickMinutes && root.minutes % 5
visible: root.pickMinutes && !animation.running && root.minutes % 5
color: root.labelDotColor
}