Compare commits

..

No commits in common. "11d0e4a8380c382d44349579bbc5f839edc78ea0" and "75f780753f9cf0ad4cc0ab42bfb86a730f722e2a" have entirely different histories.

6 changed files with 245 additions and 146 deletions

34
components/StyledMenu.qml Normal file
View file

@ -0,0 +1,34 @@
import qs.config
import qs.services
import QtQuick
import QtQuick.Controls
Menu {
id: root
palette.window: Theme.palette.base100
palette.base: Theme.palette.base100
focus: true
closePolicy: Popup.CloseOnEscape | Popup.CloseOnPressOutsideParent
popupType: Popup.Window
function toggle() {
visible ? close() : open();
}
enter: Transition {
NumberAnimation {
property: "opacity"
from: 0.0
to: 1.0
}
}
exit: Transition {
NumberAnimation {
property: "opacity"
from: 1.0
to: 0.0
}
}
}

View file

@ -0,0 +1,9 @@
import qs.config
import QtQuick
import QtQuick.Controls
MenuItem {
palette.text: Theme.palette.basecontent
palette.highlight: Theme.palette.primary
palette.highlightedText: Theme.palette.primarycontent
}

View file

@ -0,0 +1,9 @@
import qs.config
import QtQuick
import QtQuick.Controls
MenuSeparator {
palette.text: Theme.palette.basecontent
palette.highlight: Theme.palette.primary
palette.highlightedText: Theme.palette.primarycontent
}

View file

@ -6,10 +6,9 @@ import Quickshell.Hyprland
PopupWindow { PopupWindow {
id: root id: root
implicitWidth: contentItem.children.reduce((prev, child) => Math.max(prev, child.width), 0) implicitWidth: background.implicitWidth
implicitHeight: contentItem.children.reduce((prev, child) => prev + child.height, 0) implicitHeight: background.implicitHeight
color: "transparent" color: "transparent"
contentItem.focus: visible
function open() { function open() {
visible = true; visible = true;
@ -19,19 +18,19 @@ PopupWindow {
visible = false; visible = false;
} }
// WlrLayershell.layer: WlrLayer.Top
// WlrLayershell.keyboardFocus: root.visible ? WlrKeyboardFocus.OnDemand : WlrKeyboardFocus.None
HyprlandFocusGrab { HyprlandFocusGrab {
active: root.visible id: grab
windows: [root] windows: [root]
onCleared: { onCleared: {
root.close(); root.close();
} }
} }
Rectangle { Rectangle {
id: background id: background
anchors.fill: parent anchors.centerIn: root
implicitWidth: root.contentItem.children.reduce((prev, child) => Math.max(prev, child.width), 0)
implicitHeight: root.contentItem.children.reduce((prev, child) => prev + child.height, 0)
color: Theme.palette.base200 color: Theme.palette.base200
radius: 8 radius: 8
} }

View file

@ -78,11 +78,7 @@ Variants {
Launcher {} Launcher {}
Pomodoro {} Pomodoro {}
PowerMenu {} PowerMenu {}
Storybook { Storybook {}
anchor.window: topWindow
anchor.rect.x: topWindow.width / 2 - width / 2
anchor.rect.y: topWindow.height / 4
}
Drawers {} Drawers {}
} }
} }

View file

@ -4,173 +4,225 @@ import qs.components
import qs.config import qs.config
import qs.constants import qs.constants
import qs.services import qs.services
import Quickshell.Hyprland
import Quickshell.Wayland
import QtQuick import QtQuick
import QtQuick.Controls import QtQuick.Controls
import QtQuick.Layouts import QtQuick.Layouts
StyledPopupWindow { StyledWindow {
id: root id: root
name: "storybook"
visible: Visibility.storybook visible: Visibility.storybook
implicitWidth: rect.width
implicitHeight: rect.height
GridLayout { WlrLayershell.layer: WlrLayer.Top
id: grid WlrLayershell.keyboardFocus: root.visible ? WlrKeyboardFocus.OnDemand : WlrKeyboardFocus.None
flow: GridLayout.TopToBottom HyprlandFocusGrab {
columns: 2 active: Visibility.storybook
rows: 10 windows: [root]
onCleared: {
StyledText { Visibility.storybook = false;
Layout.columnSpan: grid.columns
Layout.alignment: Qt.AlignHCenter
text: "Components"
font.pixelSize: 24
font.bold: true
font.underline: true
bottomPadding: 24
} }
}
StyledWrapperRectangle {
id: rect
margin: 48
GridLayout {
id: grid
flow: GridLayout.TopToBottom
columns: 2
rows: 10
ColumnLayout {
StyledText { StyledText {
text: "Icon Button" Layout.columnSpan: grid.columns
font.pixelSize: 18 Layout.alignment: Qt.AlignHCenter
} text: "Components"
StyledIconButton { font.pixelSize: 24
text: Icons.square font.bold: true
} font.underline: true
} bottomPadding: 24
ColumnLayout {
StyledText {
text: "Switch"
font.pixelSize: 18
} }
StyledSwitch { ColumnLayout {
text: "Enable" StyledText {
} text: "Icon Button"
} font.pixelSize: 18
}
ColumnLayout { StyledIconButton {
StyledText { text: Icons.square
text: "ToolTip"
font.pixelSize: 18
}
Button {
id: toolTipButton
text: "Hello world!"
StyledToolTip {
visible: toolTipButton.hovered
text: qsTr("Save the active project")
} }
} }
}
ColumnLayout { ColumnLayout {
StyledText { StyledText {
text: "Slider" text: "Switch"
font.pixelSize: 18 font.pixelSize: 18
} }
StyledSlider {
id: slider
from: 0
to: 100
value: 50
}
}
ColumnLayout { StyledSwitch {
StyledText { text: "Enable"
text: "ProgressBar" }
font.pixelSize: 18
} }
StyledProgressBar {
id: progressBar
indeterminate: true
implicitHeight: 10
from: 0
to: 100
value: 50
}
}
ColumnLayout { ColumnLayout {
StyledText { StyledText {
text: "ListView" text: "ToolTip"
font.pixelSize: 18 font.pixelSize: 18
} }
StyledWrapperRectangle { Button {
border.color: Theme.palette.base100 id: toolTipButton
border.width: 2 text: "Hello world!"
StyledListView { StyledToolTip {
implicitWidth: 200 visible: toolTipButton.hovered
implicitHeight: 100 text: qsTr("Save the active project")
model: 10
delegate: StyledText {
text: "Hello world!"
} }
} }
} }
}
ColumnLayout { ColumnLayout {
StyledText { StyledText {
text: "Mpris Player Selector" text: "Slider"
font.pixelSize: 18 font.pixelSize: 18
}
StyledSlider {
id: slider
from: 0
to: 100
value: 50
}
} }
MprisPlayerSelector {}
}
ColumnLayout { ColumnLayout {
StyledText { StyledText {
text: "Mpris Controller" text: "ProgressBar"
font.pixelSize: 18 font.pixelSize: 18
}
StyledProgressBar {
id: progressBar
indeterminate: true
implicitHeight: 10
from: 0
to: 100
value: 50
}
} }
MprisController {
player: Mpris.active ?? null
}
}
ColumnLayout { ColumnLayout {
StyledText { StyledText {
text: "Drawer" text: "ListView"
font.pixelSize: 18 font.pixelSize: 18
} }
RowLayout { StyledWrapperRectangle {
Button { border.color: Theme.palette.base100
text: "Top" border.width: 2
onClicked: { StyledListView {
drawer.x = root.width / 2 - drawer.width / 2; implicitWidth: 200
drawer.y = 0; implicitHeight: 100
drawer.edge = Qt.TopEdge; model: 10
drawer.open(); delegate: StyledText {
text: "Hello world!"
}
} }
} }
Button { }
text: "Left"
onClicked: { ColumnLayout {
drawer.y = root.height / 2 - drawer.height / 2; StyledText {
drawer.x = 0; text: "Mpris Player Selector"
drawer.edge = Qt.LeftEdge; font.pixelSize: 18
drawer.open(); }
} MprisPlayerSelector {}
}
ColumnLayout {
StyledText {
text: "Mpris Controller"
font.pixelSize: 18
}
MprisController {
player: Mpris.active ?? null
}
}
ColumnLayout {
StyledText {
text: "Popup"
font.pixelSize: 18
} }
Button { Button {
text: "Right" id: fileButton
onClicked: { text: "File"
drawer.y = root.height / 2 - drawer.height / 2; onPressed: menu.visible ? menu.close() : menu.open()
drawer.x = 0;
drawer.edge = Qt.RightEdge; StyledPopup {
drawer.open(); id: menu
anchor.item: fileButton
Column {
StyledButton {
text: "New..."
}
StyledButton {
text: "Open..."
}
StyledText {
text: "Close"
}
}
} }
} }
Button { }
text: "Bottom"
onClicked: { ColumnLayout {
drawer.x = root.width / 2 - drawer.width / 2; StyledText {
drawer.y = 0; text: "Drawer"
drawer.edge = Qt.BottomEdge; font.pixelSize: 18
drawer.open(); }
RowLayout {
Button {
text: "Top"
onClicked: {
drawer.x = root.width / 2 - drawer.width / 2;
drawer.y = 0;
drawer.edge = Qt.TopEdge;
drawer.open();
}
}
Button {
text: "Left"
onClicked: {
drawer.y = root.height / 2 - drawer.height / 2;
drawer.x = 0;
drawer.edge = Qt.LeftEdge;
drawer.open();
}
}
Button {
text: "Right"
onClicked: {
drawer.y = root.height / 2 - drawer.height / 2;
drawer.x = 0;
drawer.edge = Qt.RightEdge;
drawer.open();
}
}
Button {
text: "Bottom"
onClicked: {
drawer.x = root.width / 2 - drawer.width / 2;
drawer.y = 0;
drawer.edge = Qt.BottomEdge;
drawer.open();
}
} }
} }
} }