forked from Shinonome/dots-hyprland
new folder for services, fancy calendar month button
This commit is contained in:
@@ -1,5 +1,6 @@
|
|||||||
import "root:/modules/common"
|
import "root:/modules/common"
|
||||||
import "root:/modules/common/widgets"
|
import "root:/modules/common/widgets"
|
||||||
|
import "root:/services"
|
||||||
import QtQuick
|
import QtQuick
|
||||||
import QtQuick.Controls
|
import QtQuick.Controls
|
||||||
import QtQuick.Layouts
|
import QtQuick.Layouts
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
import "root:/modules/common"
|
import "root:/modules/common"
|
||||||
import "root:/modules/common/widgets"
|
import "root:/modules/common/widgets"
|
||||||
|
import "root:/services"
|
||||||
import QtQuick
|
import QtQuick
|
||||||
import QtQuick.Layouts
|
import QtQuick.Layouts
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
import "root:/modules/common"
|
import "root:/modules/common"
|
||||||
import "root:/modules/common/widgets"
|
import "root:/modules/common/widgets"
|
||||||
|
import "root:/services"
|
||||||
import QtQuick
|
import QtQuick
|
||||||
import QtQuick.Layouts
|
import QtQuick.Layouts
|
||||||
import Quickshell
|
import Quickshell
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
import "root:/modules/common"
|
import "root:/modules/common"
|
||||||
import "root:/modules/common/widgets"
|
import "root:/modules/common/widgets"
|
||||||
|
import "root:/services"
|
||||||
import QtQuick
|
import QtQuick
|
||||||
import QtQuick.Layouts
|
import QtQuick.Layouts
|
||||||
import Quickshell
|
import Quickshell
|
||||||
|
|||||||
@@ -164,6 +164,7 @@ Singleton {
|
|||||||
property QtObject elementDecel: QtObject {
|
property QtObject elementDecel: QtObject {
|
||||||
property int duration: 180
|
property int duration: 180
|
||||||
property int type: Easing.OutCirc
|
property int type: Easing.OutCirc
|
||||||
|
property int velocity: 650
|
||||||
}
|
}
|
||||||
property QtObject menuDecel: QtObject {
|
property QtObject menuDecel: QtObject {
|
||||||
property int duration: 350
|
property int duration: 350
|
||||||
|
|||||||
@@ -6,16 +6,25 @@ import QtQuick.Layouts
|
|||||||
|
|
||||||
ToolTip {
|
ToolTip {
|
||||||
property string content
|
property string content
|
||||||
parent: parent
|
property bool extraVisibleCondition: true
|
||||||
visible: parent.hovered
|
|
||||||
padding: 7
|
padding: 7
|
||||||
|
|
||||||
|
visible: (extraVisibleCondition && parent.hovered)
|
||||||
|
|
||||||
background: Rectangle {
|
background: Rectangle {
|
||||||
color: Appearance.colors.colTooltip
|
color: Appearance.colors.colTooltip
|
||||||
radius: Appearance.rounding.small
|
radius: Appearance.rounding.small
|
||||||
width: tooltipText.width + 2 * padding
|
width: tooltipTextObject.width + 2 * padding
|
||||||
|
Behavior on opacity {
|
||||||
|
OpacityAnimator {
|
||||||
|
duration: Appearance.animation.elementDecel.duration
|
||||||
|
easing.type: Appearance.animation.elementDecel.type
|
||||||
|
}
|
||||||
|
}
|
||||||
|
opacity: visible ? 1 : 0
|
||||||
}
|
}
|
||||||
StyledText {
|
StyledText {
|
||||||
id: tooltipText
|
id: tooltipTextObject
|
||||||
text: content
|
text: content
|
||||||
color: Appearance.colors.colOnTooltip
|
color: Appearance.colors.colOnTooltip
|
||||||
wrapMode: Text.WordWrap
|
wrapMode: Text.WordWrap
|
||||||
|
|||||||
@@ -13,13 +13,13 @@ Rectangle {
|
|||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
radius: Appearance.rounding.normal
|
radius: Appearance.rounding.normal
|
||||||
color: Appearance.colors.colLayer1
|
color: Appearance.colors.colLayer1
|
||||||
implicitHeight: 343 // TODO NO HARD CODE
|
// implicitHeight: 343 // TODO NO HARD CODE
|
||||||
|
height: calendarWidgetRow.height
|
||||||
|
|
||||||
RowLayout {
|
RowLayout {
|
||||||
id: calendarRow
|
id: calendarWidgetRow
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
// width: parent.width - 10 * 2
|
height: tabStack.height
|
||||||
height: parent.height - 10 * 2
|
|
||||||
spacing: 10
|
spacing: 10
|
||||||
property int selectedTab: 0
|
property int selectedTab: 0
|
||||||
|
|
||||||
@@ -36,11 +36,11 @@ Rectangle {
|
|||||||
{"name": "To Do", "icon": "done_outline"}
|
{"name": "To Do", "icon": "done_outline"}
|
||||||
]
|
]
|
||||||
NavRailButton {
|
NavRailButton {
|
||||||
toggled: calendarRow.selectedTab == index
|
toggled: calendarWidgetRow.selectedTab == index
|
||||||
buttonText: modelData.name
|
buttonText: modelData.name
|
||||||
buttonIcon: modelData.icon
|
buttonIcon: modelData.icon
|
||||||
onClicked: {
|
onClicked: {
|
||||||
calendarRow.selectedTab = index
|
calendarWidgetRow.selectedTab = index
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -50,7 +50,7 @@ Rectangle {
|
|||||||
StackLayout {
|
StackLayout {
|
||||||
id: tabStack
|
id: tabStack
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
// Layout.fillHeight: true
|
height: 358 // ???? wtf
|
||||||
Layout.alignment: Qt.AlignVCenter
|
Layout.alignment: Qt.AlignVCenter
|
||||||
property int realIndex: 0
|
property int realIndex: 0
|
||||||
property int animationDuration: Appearance.animation.elementDecel.duration * 1.5
|
property int animationDuration: Appearance.animation.elementDecel.duration * 1.5
|
||||||
@@ -65,6 +65,7 @@ Rectangle {
|
|||||||
height: calendarColumn.height
|
height: calendarColumn.height
|
||||||
property int monthShift: 0
|
property int monthShift: 0
|
||||||
property var viewingDate: CalendarLayout.getDateInXMonthsTime(monthShift)
|
property var viewingDate: CalendarLayout.getDateInXMonthsTime(monthShift)
|
||||||
|
property var calendarLayout: CalendarLayout.getCalendarLayout(viewingDate, monthShift === 0)
|
||||||
|
|
||||||
MouseArea {
|
MouseArea {
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
@@ -84,18 +85,13 @@ Rectangle {
|
|||||||
// Calendar header
|
// Calendar header
|
||||||
RowLayout {
|
RowLayout {
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
Layout.fillHeight: false
|
|
||||||
spacing: 5
|
spacing: 5
|
||||||
CalendarHeaderButton {
|
CalendarHeaderButton {
|
||||||
|
buttonText: `${monthShift != 0 ? "• " : ""}${viewingDate.toLocaleDateString(Qt.locale(), "MMMM yyyy")}`
|
||||||
|
tooltipText: (monthShift === 0) ? "" : "Jump to current month"
|
||||||
onClicked: {
|
onClicked: {
|
||||||
monthShift = 0;
|
monthShift = 0;
|
||||||
}
|
}
|
||||||
content: StyledText {
|
|
||||||
text: `${monthShift != 0 ? "• " : ""}${viewingDate.toLocaleDateString(Qt.locale(), "MMMM yyyy")}`
|
|
||||||
horizontalAlignment: Text.AlignHCenter
|
|
||||||
font.pixelSize: Appearance.font.pixelSize.larger
|
|
||||||
color: Appearance.colors.colOnLayer1
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
Item {
|
Item {
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
@@ -106,9 +102,9 @@ Rectangle {
|
|||||||
onClicked: {
|
onClicked: {
|
||||||
monthShift--;
|
monthShift--;
|
||||||
}
|
}
|
||||||
content: MaterialSymbol {
|
contentItem: MaterialSymbol {
|
||||||
text: "chevron_left"
|
text: "chevron_left"
|
||||||
font.pixelSize: Appearance.font.pixelSize.large
|
font.pixelSize: Appearance.font.pixelSize.larger
|
||||||
horizontalAlignment: Text.AlignHCenter
|
horizontalAlignment: Text.AlignHCenter
|
||||||
color: Appearance.colors.colOnLayer1
|
color: Appearance.colors.colOnLayer1
|
||||||
}
|
}
|
||||||
@@ -118,9 +114,9 @@ Rectangle {
|
|||||||
onClicked: {
|
onClicked: {
|
||||||
monthShift++;
|
monthShift++;
|
||||||
}
|
}
|
||||||
content: MaterialSymbol {
|
contentItem: MaterialSymbol {
|
||||||
text: "chevron_right"
|
text: "chevron_right"
|
||||||
font.pixelSize: Appearance.font.pixelSize.large
|
font.pixelSize: Appearance.font.pixelSize.larger
|
||||||
horizontalAlignment: Text.AlignHCenter
|
horizontalAlignment: Text.AlignHCenter
|
||||||
color: Appearance.colors.colOnLayer1
|
color: Appearance.colors.colOnLayer1
|
||||||
}
|
}
|
||||||
@@ -147,16 +143,17 @@ Rectangle {
|
|||||||
// Real week rows
|
// Real week rows
|
||||||
Repeater {
|
Repeater {
|
||||||
id: calendarRows
|
id: calendarRows
|
||||||
model: CalendarLayout.getCalendarLayout(viewingDate, monthShift === 0)
|
// model: calendarLayout
|
||||||
|
model: 6
|
||||||
delegate: RowLayout {
|
delegate: RowLayout {
|
||||||
Layout.alignment: Qt.AlignHCenter
|
Layout.alignment: Qt.AlignHCenter
|
||||||
Layout.fillHeight: false
|
Layout.fillHeight: false
|
||||||
spacing: 5
|
spacing: 5
|
||||||
Repeater {
|
Repeater {
|
||||||
model: modelData
|
model: Array(7).fill(modelData)
|
||||||
delegate: CalendarDayButton {
|
delegate: CalendarDayButton {
|
||||||
day: modelData.day
|
day: calendarLayout[modelData][index].day
|
||||||
isToday: modelData.today
|
isToday: calendarLayout[modelData][index].today
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -186,10 +183,10 @@ Rectangle {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Connections {
|
Connections {
|
||||||
target: calendarRow
|
target: calendarWidgetRow
|
||||||
function onSelectedTabChanged() {
|
function onSelectedTabChanged() {
|
||||||
delayedStackSwitch.start()
|
delayedStackSwitch.start()
|
||||||
tabStack.realIndex = calendarRow.selectedTab
|
tabStack.realIndex = calendarWidgetRow.selectedTab
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Timer {
|
Timer {
|
||||||
@@ -197,7 +194,7 @@ Rectangle {
|
|||||||
interval: tabStack.animationDuration / 2
|
interval: tabStack.animationDuration / 2
|
||||||
repeat: false
|
repeat: false
|
||||||
onTriggered: {
|
onTriggered: {
|
||||||
tabStack.currentIndex = calendarRow.selectedTab
|
tabStack.currentIndex = calendarWidgetRow.selectedTab
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
import "root:/modules/common"
|
import "root:/modules/common"
|
||||||
import "root:/modules/common/widgets"
|
import "root:/modules/common/widgets"
|
||||||
|
import "root:/services"
|
||||||
import "./quickToggles/"
|
import "./quickToggles/"
|
||||||
import QtQuick
|
import QtQuick
|
||||||
import QtQuick.Controls
|
import QtQuick.Controls
|
||||||
@@ -129,8 +130,8 @@ Scope {
|
|||||||
anchors.margins: 5
|
anchors.margins: 5
|
||||||
spacing: 5
|
spacing: 5
|
||||||
|
|
||||||
Network {}
|
NetworkToggle {}
|
||||||
Bluetooth {}
|
BluetoothToggle {}
|
||||||
NightLight {}
|
NightLight {}
|
||||||
GameMode {}
|
GameMode {}
|
||||||
IdleInhibitor {}
|
IdleInhibitor {}
|
||||||
|
|||||||
@@ -6,12 +6,19 @@ import QtQuick.Layouts
|
|||||||
|
|
||||||
Button {
|
Button {
|
||||||
id: button
|
id: button
|
||||||
required default property Item content
|
property string buttonText: ""
|
||||||
|
property string tooltipText: ""
|
||||||
property bool forceCircle: false
|
property bool forceCircle: false
|
||||||
|
|
||||||
implicitHeight: 30
|
implicitHeight: 30
|
||||||
implicitWidth: forceCircle ? implicitHeight : (contentItem.implicitWidth + 10 * 2)
|
implicitWidth: forceCircle ? implicitHeight : (contentItem.implicitWidth + 10 * 2)
|
||||||
|
|
||||||
|
Behavior on implicitWidth {
|
||||||
|
SmoothedAnimation {
|
||||||
|
velocity: Appearance.animation.elementDecel.velocity
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
background: Rectangle {
|
background: Rectangle {
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
radius: Appearance.rounding.full
|
radius: Appearance.rounding.full
|
||||||
@@ -26,6 +33,15 @@ Button {
|
|||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
contentItem: content
|
contentItem: StyledText {
|
||||||
|
text: buttonText
|
||||||
|
horizontalAlignment: Text.AlignHCenter
|
||||||
|
font.pixelSize: Appearance.font.pixelSize.larger
|
||||||
|
color: Appearance.colors.colOnLayer1
|
||||||
|
}
|
||||||
|
|
||||||
|
StyledToolTip {
|
||||||
|
content: tooltipText
|
||||||
|
extraVisibleCondition: tooltipText.length > 0
|
||||||
|
}
|
||||||
}
|
}
|
||||||
+1
@@ -1,4 +1,5 @@
|
|||||||
import "../"
|
import "../"
|
||||||
|
import "root:/services"
|
||||||
import "root:/modules/common"
|
import "root:/modules/common"
|
||||||
import "root:/modules/common/widgets"
|
import "root:/modules/common/widgets"
|
||||||
import QtQuick
|
import QtQuick
|
||||||
+1
@@ -1,5 +1,6 @@
|
|||||||
import "root:/modules/common"
|
import "root:/modules/common"
|
||||||
import "root:/modules/common/widgets"
|
import "root:/modules/common/widgets"
|
||||||
|
import "root:/services"
|
||||||
import "../"
|
import "../"
|
||||||
import Quickshell.Io
|
import Quickshell.Io
|
||||||
import Quickshell
|
import Quickshell
|
||||||
Reference in New Issue
Block a user