add crypto
This commit is contained in:
parent
90cbe489f6
commit
af6a3bce3e
120 changed files with 24616 additions and 462 deletions
|
|
@ -0,0 +1,125 @@
|
|||
// Calendar.qml
|
||||
import QtQuick
|
||||
import QtQuick.Layouts
|
||||
import QtQuick.Controls
|
||||
import "root:/Data" as Data
|
||||
|
||||
// Calendar widget with navigation
|
||||
Rectangle {
|
||||
id: calendarRoot
|
||||
property var shell
|
||||
|
||||
radius: 20
|
||||
color: Qt.lighter(Data.ThemeManager.bgColor, 1.2)
|
||||
|
||||
readonly property date currentDate: new Date()
|
||||
property int month: currentDate.getMonth()
|
||||
property int year: currentDate.getFullYear()
|
||||
readonly property int currentDay: currentDate.getDate()
|
||||
|
||||
ColumnLayout {
|
||||
anchors.fill: parent
|
||||
anchors.margins: 12
|
||||
spacing: 12
|
||||
|
||||
// Month/Year header
|
||||
RowLayout {
|
||||
Layout.fillWidth: true
|
||||
spacing: 8
|
||||
|
||||
// Reusable navigation button
|
||||
component NavButton: AbstractButton {
|
||||
property alias buttonText: buttonLabel.text
|
||||
implicitWidth: 30
|
||||
implicitHeight: 30
|
||||
|
||||
background: Rectangle {
|
||||
radius: 15
|
||||
color: parent.down ? Qt.darker(Data.ThemeManager.accentColor, 1.2) :
|
||||
parent.hovered ? Qt.lighter(Data.ThemeManager.highlightBg, 1.1) : Data.ThemeManager.highlightBg
|
||||
}
|
||||
|
||||
Text {
|
||||
id: buttonLabel
|
||||
anchors.centerIn: parent
|
||||
color: Data.ThemeManager.fgColor
|
||||
font.pixelSize: 16
|
||||
font.bold: true
|
||||
}
|
||||
}
|
||||
|
||||
// Current month and year display
|
||||
Text {
|
||||
text: Qt.locale("en_US").monthName(calendarRoot.month) + " " + calendarRoot.year
|
||||
color: Data.ThemeManager.accentColor
|
||||
font.bold: true
|
||||
Layout.fillWidth: true
|
||||
horizontalAlignment: Text.AlignHCenter
|
||||
verticalAlignment: Text.AlignVCenter
|
||||
font.pixelSize: 18
|
||||
}
|
||||
}
|
||||
|
||||
// Weekday headers (Monday-Sunday)
|
||||
Grid {
|
||||
columns: 7
|
||||
rowSpacing: 4
|
||||
columnSpacing: 0
|
||||
Layout.leftMargin: 2
|
||||
Layout.fillWidth: true
|
||||
|
||||
Repeater {
|
||||
model: ["M", "T", "W", "T", "F", "S", "S"]
|
||||
delegate: Text {
|
||||
text: modelData
|
||||
color: Data.ThemeManager.fgColor
|
||||
font.bold: true
|
||||
horizontalAlignment: Text.AlignHCenter
|
||||
verticalAlignment: Text.AlignVCenter
|
||||
width: parent.width / 7
|
||||
font.pixelSize: 14
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Calendar grid
|
||||
MonthGrid {
|
||||
id: monthGrid
|
||||
month: calendarRoot.month
|
||||
year: calendarRoot.year
|
||||
Layout.fillWidth: true
|
||||
Layout.fillHeight: true
|
||||
spacing: 4
|
||||
leftPadding: 0
|
||||
rightPadding: 0
|
||||
locale: Qt.locale("en_US")
|
||||
implicitHeight: 400
|
||||
|
||||
delegate: Rectangle {
|
||||
width: 30
|
||||
height: 30
|
||||
radius: 15
|
||||
|
||||
readonly property bool isCurrentMonth: model.month === calendarRoot.month
|
||||
readonly property bool isToday: model.day === calendarRoot.currentDay &&
|
||||
model.month === calendarRoot.currentDate.getMonth() &&
|
||||
calendarRoot.year === calendarRoot.currentDate.getFullYear() &&
|
||||
isCurrentMonth
|
||||
|
||||
// Dynamic styling: today = accent color, current month = normal, other months = dimmed
|
||||
color: isToday ? Data.ThemeManager.accentColor :
|
||||
isCurrentMonth ? Data.ThemeManager.bgColor : Qt.darker(Data.ThemeManager.bgColor, 1.4)
|
||||
|
||||
Text {
|
||||
text: model.day
|
||||
anchors.centerIn: parent
|
||||
color: isToday ? Data.ThemeManager.bgColor :
|
||||
isCurrentMonth ? Data.ThemeManager.fgColor : Qt.darker(Data.ThemeManager.fgColor, 1.5)
|
||||
font.bold: isToday
|
||||
font.pixelSize: 14
|
||||
font.family: "Roboto"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,121 @@
|
|||
import QtQuick
|
||||
import QtQuick.Controls
|
||||
import "root:/Data" as Data
|
||||
|
||||
// Calendar popup with animations
|
||||
Popup {
|
||||
id: calendarPopup
|
||||
property bool hovered: false
|
||||
property bool clickMode: false // Persistent mode - stays open until clicked again
|
||||
property var shell
|
||||
property int targetX: 0
|
||||
readonly property int targetY: Screen.height - height
|
||||
|
||||
width: 280
|
||||
height: 280
|
||||
modal: false
|
||||
focus: true
|
||||
closePolicy: Popup.CloseOnEscape | Popup.CloseOnPressOutside
|
||||
padding: 15
|
||||
|
||||
// Animation state properties
|
||||
property bool _visible: false
|
||||
property real animX: targetX - 20
|
||||
property real animOpacity: 0
|
||||
|
||||
x: animX
|
||||
y: targetY
|
||||
opacity: animOpacity
|
||||
visible: _visible
|
||||
|
||||
// Smooth slide-in animation
|
||||
Behavior on animX {
|
||||
NumberAnimation { duration: 200; easing.type: Easing.InOutQuad }
|
||||
}
|
||||
Behavior on animOpacity {
|
||||
NumberAnimation { duration: 200; easing.type: Easing.InOutQuad }
|
||||
}
|
||||
|
||||
// Hover mode: show/hide based on mouse state
|
||||
onHoveredChanged: {
|
||||
if (!clickMode) {
|
||||
if (hovered) {
|
||||
_visible = true
|
||||
animX = targetX
|
||||
animOpacity = 1
|
||||
} else {
|
||||
animX = targetX - 20
|
||||
animOpacity = 0
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Click mode: persistent visibility toggle
|
||||
onClickModeChanged: {
|
||||
if (clickMode) {
|
||||
_visible = true
|
||||
animX = targetX
|
||||
animOpacity = 1
|
||||
} else {
|
||||
animX = targetX - 20
|
||||
animOpacity = 0
|
||||
}
|
||||
}
|
||||
|
||||
// Hide when animation completes
|
||||
onAnimOpacityChanged: {
|
||||
if (animOpacity === 0 && !hovered && !clickMode) {
|
||||
_visible = false
|
||||
}
|
||||
}
|
||||
|
||||
function setHovered(state) {
|
||||
hovered = state
|
||||
}
|
||||
|
||||
function setClickMode(state) {
|
||||
clickMode = state
|
||||
}
|
||||
|
||||
// Hover detection
|
||||
MouseArea {
|
||||
id: hoverArea
|
||||
anchors.fill: parent
|
||||
hoverEnabled: true
|
||||
propagateComposedEvents: true
|
||||
anchors.margins: 10 // Larger area to reduce flicker
|
||||
|
||||
onEntered: {
|
||||
if (!clickMode) {
|
||||
setHovered(true)
|
||||
}
|
||||
}
|
||||
onExited: {
|
||||
if (!clickMode) {
|
||||
// Delayed exit check to prevent hover flicker
|
||||
Qt.callLater(() => {
|
||||
if (!hoverArea.containsMouse) {
|
||||
setHovered(false)
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Lazy-loaded calendar content
|
||||
Loader {
|
||||
anchors.fill: parent
|
||||
active: calendarPopup._visible
|
||||
source: active ? "Calendar.qml" : ""
|
||||
onLoaded: {
|
||||
if (item) {
|
||||
item.shell = calendarPopup.shell
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
background: Rectangle {
|
||||
color: Data.ThemeManager.bgColor
|
||||
topRightRadius: 20
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue