mirror of
https://github.com/zoriya/noctalia-shell.git
synced 2026-08-15 18:43:59 +00:00
Switched to qmlformat.
This commit is contained in:
+70
-42
@@ -25,151 +25,179 @@ Rectangle {
|
||||
id: tokensList
|
||||
Layout.fillWidth: true
|
||||
Layout.fillHeight: true
|
||||
model: [// Common format combinations
|
||||
model: [
|
||||
// Common format combinations
|
||||
{
|
||||
"category": "Common",
|
||||
"token": "h:mm AP",
|
||||
"description": I18n.tr("widgets.datetime-tokens.common.12hour-time-minutes"),
|
||||
"example": "2:30 PM"
|
||||
}, {
|
||||
},
|
||||
{
|
||||
"category": "Common",
|
||||
"token": "HH:mm",
|
||||
"description": I18n.tr("widgets.datetime-tokens.common.24hour-time-minutes"),
|
||||
"example": "14:30"
|
||||
}, {
|
||||
},
|
||||
{
|
||||
"category": "Common",
|
||||
"token": "HH:mm:ss",
|
||||
"description": I18n.tr("widgets.datetime-tokens.common.24hour-time-seconds"),
|
||||
"example": "14:30:45"
|
||||
}, {
|
||||
},
|
||||
{
|
||||
"category": "Common",
|
||||
"token": "ddd MMM d",
|
||||
"description": I18n.tr("widgets.datetime-tokens.common.weekday-month-day"),
|
||||
"example": "Mon Dec 25"
|
||||
}, {
|
||||
},
|
||||
{
|
||||
"category": "Common",
|
||||
"token": "yyyy-MM-dd",
|
||||
"description": I18n.tr("widgets.datetime-tokens.common.iso-date"),
|
||||
"example": "2023-12-25"
|
||||
}, {
|
||||
},
|
||||
{
|
||||
"category": "Common",
|
||||
"token": "MM/dd/yyyy",
|
||||
"description": I18n.tr("widgets.datetime-tokens.common.us-date"),
|
||||
"example": "12/25/2023"
|
||||
}, {
|
||||
},
|
||||
{
|
||||
"category": "Common",
|
||||
"token": "dd.MM.yyyy",
|
||||
"description": I18n.tr("widgets.datetime-tokens.common.european-date"),
|
||||
"example": "25.12.2023"
|
||||
}, {
|
||||
},
|
||||
{
|
||||
"category": "Common",
|
||||
"token": "ddd, MMM dd",
|
||||
"description": I18n.tr("widgets.datetime-tokens.common.weekday-date"),
|
||||
"example": "Fri, Dec 12"
|
||||
}, // Hour tokens
|
||||
} // Hour tokens
|
||||
,
|
||||
{
|
||||
"category": "Hour",
|
||||
"token": "H",
|
||||
"description": I18n.tr("widgets.datetime-tokens.hour.no-leading-zero"),
|
||||
"example": "14"
|
||||
}, {
|
||||
},
|
||||
{
|
||||
"category": "Hour",
|
||||
"token": "HH",
|
||||
"description": I18n.tr("widgets.datetime-tokens.hour.leading-zero"),
|
||||
"example": "14"
|
||||
}, // Minute tokens
|
||||
} // Minute tokens
|
||||
,
|
||||
{
|
||||
"category": "Minute",
|
||||
"token": "m",
|
||||
"description": I18n.tr("widgets.datetime-tokens.minute.no-leading-zero"),
|
||||
"example": "30"
|
||||
}, {
|
||||
},
|
||||
{
|
||||
"category": "Minute",
|
||||
"token": "mm",
|
||||
"description": I18n.tr("widgets.datetime-tokens.minute.leading-zero"),
|
||||
"example": "30"
|
||||
}, // Second tokens
|
||||
} // Second tokens
|
||||
,
|
||||
{
|
||||
"category": "Second",
|
||||
"token": "s",
|
||||
"description": I18n.tr("widgets.datetime-tokens.second.no-leading-zero"),
|
||||
"example": "45"
|
||||
}, {
|
||||
},
|
||||
{
|
||||
"category": "Second",
|
||||
"token": "ss",
|
||||
"description": I18n.tr("widgets.datetime-tokens.second.leading-zero"),
|
||||
"example": "45"
|
||||
}, // AM/PM tokens
|
||||
} // AM/PM tokens
|
||||
,
|
||||
{
|
||||
"category": "AM/PM",
|
||||
"token": "AP",
|
||||
"description": I18n.tr("widgets.datetime-tokens.ampm.uppercase"),
|
||||
"example": "PM"
|
||||
}, {
|
||||
},
|
||||
{
|
||||
"category": "AM/PM",
|
||||
"token": "ap",
|
||||
"description": I18n.tr("widgets.datetime-tokens.ampm.lowercase"),
|
||||
"example": "pm"
|
||||
}, // Timezone tokens
|
||||
} // Timezone tokens
|
||||
,
|
||||
{
|
||||
"category": "Timezone",
|
||||
"token": "t",
|
||||
"description": I18n.tr("widgets.datetime-tokens.timezone.abbreviation"),
|
||||
"example": "UTC"
|
||||
}, // Year tokens
|
||||
} // Year tokens
|
||||
,
|
||||
{
|
||||
"category": "Year",
|
||||
"token": "yy",
|
||||
"description": I18n.tr("widgets.datetime-tokens.year.two-digit"),
|
||||
"example": "23"
|
||||
}, {
|
||||
},
|
||||
{
|
||||
"category": "Year",
|
||||
"token": "yyyy",
|
||||
"description": I18n.tr("widgets.datetime-tokens.year.four-digit"),
|
||||
"example": "2023"
|
||||
}, // Month tokens
|
||||
} // Month tokens
|
||||
,
|
||||
{
|
||||
"category": "Month",
|
||||
"token": "M",
|
||||
"description": I18n.tr("widgets.datetime-tokens.month.number-no-zero"),
|
||||
"example": "12"
|
||||
}, {
|
||||
},
|
||||
{
|
||||
"category": "Month",
|
||||
"token": "MM",
|
||||
"description": I18n.tr("widgets.datetime-tokens.month.number-leading-zero"),
|
||||
"example": "12"
|
||||
}, {
|
||||
},
|
||||
{
|
||||
"category": "Month",
|
||||
"token": "MMM",
|
||||
"description": I18n.tr("widgets.datetime-tokens.month.abbreviated"),
|
||||
"example": "Dec"
|
||||
}, {
|
||||
},
|
||||
{
|
||||
"category": "Month",
|
||||
"token": "MMMM",
|
||||
"description": I18n.tr("widgets.datetime-tokens.month.full"),
|
||||
"example": "December"
|
||||
}, // Day tokens
|
||||
} // Day tokens
|
||||
,
|
||||
{
|
||||
"category": "Day",
|
||||
"token": "d",
|
||||
"description": I18n.tr("widgets.datetime-tokens.day.no-leading-zero"),
|
||||
"example": "25"
|
||||
}, {
|
||||
},
|
||||
{
|
||||
"category": "Day",
|
||||
"token": "dd",
|
||||
"description": I18n.tr("widgets.datetime-tokens.day.leading-zero"),
|
||||
"example": "25"
|
||||
}, {
|
||||
},
|
||||
{
|
||||
"category": "Day",
|
||||
"token": "ddd",
|
||||
"description": I18n.tr("widgets.datetime-tokens.day.abbreviated"),
|
||||
"example": "Mon"
|
||||
}, {
|
||||
},
|
||||
{
|
||||
"category": "Day",
|
||||
"token": "dddd",
|
||||
"description": I18n.tr("widgets.datetime-tokens.day.full"),
|
||||
"example": "Monday"
|
||||
}]
|
||||
}
|
||||
]
|
||||
|
||||
delegate: Rectangle {
|
||||
id: tokenDelegate
|
||||
@@ -178,9 +206,9 @@ Rectangle {
|
||||
radius: Style.radiusS
|
||||
color: {
|
||||
if (tokenMouseArea.containsMouse) {
|
||||
return Qt.alpha(Color.mPrimary, 0.1)
|
||||
return Qt.alpha(Color.mPrimary, 0.1);
|
||||
}
|
||||
return index % 2 === 0 ? Color.mSurfaceVariant : Qt.alpha(Color.mSurfaceVariant, 0.6)
|
||||
return index % 2 === 0 ? Color.mSurfaceVariant : Qt.alpha(Color.mSurfaceVariant, 0.6);
|
||||
}
|
||||
|
||||
// Mouse area for the entire delegate
|
||||
@@ -191,8 +219,8 @@ Rectangle {
|
||||
cursorShape: Qt.PointingHandCursor
|
||||
|
||||
onClicked: {
|
||||
root.tokenClicked(modelData.token)
|
||||
clickAnimation.start()
|
||||
root.tokenClicked(modelData.token);
|
||||
clickAnimation.start();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -331,25 +359,25 @@ Rectangle {
|
||||
function getCategoryColor(category) {
|
||||
switch (category) {
|
||||
case "Year":
|
||||
return [Color.mPrimary, Color.mOnPrimary]
|
||||
return [Color.mPrimary, Color.mOnPrimary];
|
||||
case "Month":
|
||||
return [Color.mSecondary, Color.mOnSecondary]
|
||||
return [Color.mSecondary, Color.mOnSecondary];
|
||||
case "Day":
|
||||
return [Color.mTertiary, Color.mOnTertiary]
|
||||
return [Color.mTertiary, Color.mOnTertiary];
|
||||
case "Hour":
|
||||
return [Color.mPrimary, Color.mOnPrimary]
|
||||
return [Color.mPrimary, Color.mOnPrimary];
|
||||
case "Minute":
|
||||
return [Color.mSecondary, Color.mOnSecondary]
|
||||
return [Color.mSecondary, Color.mOnSecondary];
|
||||
case "Second":
|
||||
return [Color.mTertiary, Color.mOnTertiary]
|
||||
return [Color.mTertiary, Color.mOnTertiary];
|
||||
case "AM/PM":
|
||||
return [Color.mError, Color.mOnError]
|
||||
return [Color.mError, Color.mOnError];
|
||||
case "Timezone":
|
||||
return [Color.mOnSurface, Color.mSurface]
|
||||
return [Color.mOnSurface, Color.mSurface];
|
||||
case "Common":
|
||||
return [Color.mError, Color.mOnError]
|
||||
return [Color.mError, Color.mOnError];
|
||||
default:
|
||||
return [Color.mOnSurfaceVariant, Color.mSurfaceVariant]
|
||||
return [Color.mOnSurfaceVariant, Color.mSurfaceVariant];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user