feat: make right bar side dependant on devices
This commit is contained in:
1 parent
c7fb3f9c02
commit
832d2544da
13 files changed
+630
-17
No files matched your search
@@ -0,0 +1,48 @@
|
||||
import QtQuick
|
||||
import "."
|
||||
|
||||
Rectangle {
|
||||
id: button
|
||||
|
||||
// "primary" | "secondary" | "accent" | "destructive"
|
||||
property string variant: "primary"
|
||||
property string text: ""
|
||||
signal clicked()
|
||||
|
||||
readonly property bool filled: variant === "primary" || variant === "accent"
|
||||
readonly property color tint: variant === "accent" ? Theme.colors.accent
|
||||
: variant === "destructive" ? Theme.colors.alert
|
||||
: Theme.colors.primary
|
||||
|
||||
implicitWidth: label.implicitWidth + Theme.geometry.padding * 2
|
||||
implicitHeight: label.implicitHeight + Theme.geometry.padding
|
||||
|
||||
radius: Theme.geometry.radius
|
||||
color: filled
|
||||
? (mouseArea.pressed ? Qt.darker(tint, 1.1) : tint)
|
||||
: (mouseArea.containsMouse ? Qt.alpha(tint, 0.22) : Qt.alpha(tint, 0.15))
|
||||
border.width: filled ? 0 : 1
|
||||
border.color: Qt.alpha(tint, 0.3)
|
||||
|
||||
Behavior on color { ColorAnimation { duration: Theme.animation.durationFast } }
|
||||
Behavior on scale { SpringAnimation { spring: 4; damping: 0.3 } }
|
||||
scale: mouseArea.pressed ? 0.97 : 1.0
|
||||
|
||||
Text {
|
||||
id: label
|
||||
anchors.centerIn: parent
|
||||
text: button.text
|
||||
font.family: Theme.font.family
|
||||
font.pixelSize: 13
|
||||
font.bold: true
|
||||
color: button.filled ? Theme.colors.background : button.tint
|
||||
}
|
||||
|
||||
MouseArea {
|
||||
id: mouseArea
|
||||
anchors.fill: parent
|
||||
hoverEnabled: true
|
||||
cursorShape: Qt.PointingHandCursor
|
||||
onClicked: button.clicked()
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,87 @@
|
||||
import QtQuick
|
||||
import "."
|
||||
|
||||
// Reusable right-click menu. `model` is a plain JS array of
|
||||
// { label, icon, destructive, separator, action } entries.
|
||||
Rectangle {
|
||||
id: menu
|
||||
|
||||
property var model: []
|
||||
|
||||
visible: false
|
||||
z: 1000
|
||||
width: 180
|
||||
radius: 10
|
||||
color: Theme.colors.background
|
||||
border.color: Theme.colors.border
|
||||
border.width: 1
|
||||
height: column.implicitHeight + Theme.geometry.spacing
|
||||
|
||||
function openAt(px, py) {
|
||||
x = px;
|
||||
y = py;
|
||||
visible = true;
|
||||
}
|
||||
|
||||
function close() {
|
||||
visible = false;
|
||||
}
|
||||
|
||||
// Absorb clicks inside the menu so they don't fall through to the backdrop.
|
||||
MouseArea {
|
||||
anchors.fill: parent
|
||||
}
|
||||
|
||||
Column {
|
||||
id: column
|
||||
anchors.fill: parent
|
||||
anchors.margins: Theme.geometry.spacing / 2
|
||||
|
||||
Repeater {
|
||||
model: menu.model
|
||||
|
||||
delegate: Rectangle {
|
||||
width: column.width
|
||||
height: modelData.separator ? 1 : 28
|
||||
radius: modelData.separator ? 0 : 6
|
||||
color: modelData.separator
|
||||
? Theme.colors.border
|
||||
: (itemMouse.containsMouse ? Theme.colors.surfaceHover : "transparent")
|
||||
|
||||
Row {
|
||||
visible: !modelData.separator
|
||||
anchors.left: parent.left
|
||||
anchors.leftMargin: Theme.geometry.spacing
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
spacing: Theme.geometry.spacing
|
||||
|
||||
Text {
|
||||
text: modelData.icon || ""
|
||||
width: 14
|
||||
font.pixelSize: 12
|
||||
color: modelData.destructive ? Theme.colors.alert : Theme.colors.text
|
||||
}
|
||||
|
||||
Text {
|
||||
text: modelData.label || ""
|
||||
font.family: Theme.font.family
|
||||
font.pixelSize: 12
|
||||
color: modelData.destructive ? Theme.colors.alert : Theme.colors.text
|
||||
}
|
||||
}
|
||||
|
||||
MouseArea {
|
||||
id: itemMouse
|
||||
anchors.fill: parent
|
||||
enabled: !modelData.separator
|
||||
hoverEnabled: true
|
||||
cursorShape: Qt.PointingHandCursor
|
||||
onClicked: {
|
||||
menu.close();
|
||||
if (modelData.action) modelData.action();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -5,14 +5,17 @@ QtObject {
|
||||
id: theme
|
||||
|
||||
property QtObject colors: QtObject {
|
||||
property color background: "#4011111b" // Translucent dark for blur
|
||||
property color surface: "#80181825"
|
||||
property color surfaceHover: "#a0313244"
|
||||
property color background: "#e611111b" // Opaque dark for better readability
|
||||
property color surface: "#e6181825"
|
||||
property color surfaceHover: "#f2313244"
|
||||
property color overlay: "#6011111b" // Translucent dark for full screen dim
|
||||
|
||||
property color primary: "#89b4fa"
|
||||
property color secondary: "#b4befe"
|
||||
property color accent: "#cba6f7"
|
||||
property color alert: "#f38ba8"
|
||||
property color success: "#a6e3a1"
|
||||
property color warning: "#f9e2af"
|
||||
|
||||
property color text: "#cdd6f4"
|
||||
property color textMuted: "#a6adc8"
|
||||
|
||||
@@ -1 +1,3 @@
|
||||
singleton Theme 1.0 Theme.qml
|
||||
Button 1.0 Button.qml
|
||||
ContextMenu 1.0 ContextMenu.qml
|
||||
Reference in new issue
Block a user