This commit is contained in:
2026-03-31 20:13:15 +08:00
parent 48044e957d
commit 08c513b995
1155 changed files with 79920 additions and 0 deletions

View File

@ -0,0 +1,73 @@
/*
SPDX-FileCopyrightText: 2024 Evgeny Kazantsev <exequtic@gmail.com>
SPDX-License-Identifier: MIT
*/
import QtQuick
import QtQuick.Layouts
import QtQuick.Controls
import org.kde.plasma.components
import org.kde.kirigami as Kirigami
import "../../tools/tools.js" as JS
import "../components"
ScrollView {
id: view
ScrollBar.vertical.policy: (sts.count === 0 || sts.busy || sts.err) ? ScrollBar.AlwaysOff : ScrollBar.AsNeeded
ListView {
model: modelList
delegate: GridLayout {
visible: sts.pending
property var heightItem: Math.round(Kirigami.Theme.defaultFont.pointSize * 1.5)
property var column: view.width / 2
height: heightItem + cfg.spacing
Rectangle {
id: icon
property bool isHovering: false
Layout.alignment: Qt.AlignHCenter | Qt.AlignVCenter
height: heightItem
width: height
color: "transparent"
Kirigami.Icon {
anchors.centerIn: parent
height: heightItem
width: height
source: !icon.isHovering ? model.IC : "edit-download"
}
Loader {
width: parent.width - (Kirigami.Units.largeSpacing * 4)
anchors.fill: parent
active: model.ID || model.CN
sourceComponent: MouseArea {
id: hoverIcon
anchors.fill: parent
hoverEnabled: true
cursorShape: Qt.PointingHandCursor
onEntered: icon.isHovering = true
onExited: icon.isHovering = false
onClicked: JS.upgradePackage(model.NM, model.ID, model.CN)
}
}
}
Label {
Layout.minimumWidth: column
Layout.maximumWidth: column
text: model.IM ? "<font color='" + Kirigami.Theme.negativeTextColor + "'><b>" + model.NM + "</b></font>" : model.NM
elide: Text.ElideRight
}
Label {
Layout.minimumWidth: column
Layout.maximumWidth: column
text: model.RE + " → " + model.VN
elide: Text.ElideRight
}
}
Placeholder {
anchors.fill: parent
}
}
}

View File

@ -0,0 +1,136 @@
/*
SPDX-FileCopyrightText: 2024 Evgeny Kazantsev <exequtic@gmail.com>
SPDX-License-Identifier: MIT
*/
import QtQuick
import QtQuick.Layouts
import QtQuick.Controls
import org.kde.ksvg
import org.kde.plasma.extras
import org.kde.plasma.components
import org.kde.kirigami as Kirigami
import "../../tools/tools.js" as JS
import "../components"
ScrollView {
ScrollBar.vertical.policy: (sts.count === 0 || sts.busy || sts.err) ? ScrollBar.AlwaysOff : ScrollBar.AsNeeded
contentItem: ListView {
model: modelList
boundsBehavior: Flickable.StopAtBounds
highlight: Highlight { visible: sts.idle }
highlightMoveDuration: Kirigami.Units.shortDuration
highlightResizeDuration: Kirigami.Units.shortDuration
height: parent.height
delegate: ExpandableListItem {
visible: sts.pending
property var pkg: []
allowStyledText: true
title: model.IM ? "<font color='" + Kirigami.Theme.negativeTextColor + "'><b>" + model.NM + "</b></font>" : model.NM
subtitle: model.RE + " " + model.VO + " → " + model.VN
icon: model.IC
function getContextualActions() {
var actions = []
if (model.ID || model.CN) {
actions.push(updateButton)
}
return actions
}
Action {
id: updateButton
icon.name: "edit-download"
text: i18n("Upgrade package")
enabled: cfg.terminal
onTriggered: JS.upgradePackage(model.NM, model.ID, model.CN)
}
contextualActions: getContextualActions()
customExpandedViewContent: Component {
ColumnLayout {
spacing: 0
SvgItem {
Layout.fillWidth: true
imagePath: "widgets/line"
elementId: "horizontal-line"
visible: contextualActions.length === 0
}
Item {
Layout.preferredHeight: Kirigami.Units.smallSpacing * 2
}
MouseArea {
Layout.fillWidth: true
Layout.preferredHeight: details.implicitHeight
// acceptedButtons: Qt.RightButton
activeFocusOnTab: repeater.count > 0
GridLayout {
id: details
width: parent.width
columns: 2
rowSpacing: Kirigami.Units.smallSpacing / 4
columnSpacing: 40
Repeater {
id: repeater
model: pkg.length
Label {
property bool header: !(index % 2)
Layout.fillWidth: true
Layout.alignment: Qt.AlignTop
horizontalAlignment: Text.AlignLeft
font: Kirigami.Theme.smallFont
opacity: header ? 0.6 : 1
text: header ? "<b>" + pkg[index] + ":</b>" : pkg[index].indexOf("://") !== -1 ? "<a href=\"" + pkg[index] + "\">" + pkg[index] + "</a>" : pkg[index]
textFormat: header ? Text.StyledText : pkg[index].indexOf("://") !== -1 ? Text.StyledText : Text.PlainText
wrapMode: header ? Text.NoWrap : Text.WordWrap
onLinkActivated: Qt.openUrlExternally(link)
}
}
}
}
Item {
Layout.preferredHeight: Kirigami.Units.smallSpacing * 2
}
Component.onCompleted: {
const details = []
model.TP && details.push(i18n("Package type"), model.TP)
model.DE && details.push(i18n("Description"), model.DE)
model.AU && details.push(i18n("Author"), model.AU)
model.LN && details.push("URL", model.LN)
model.ID && details.push(i18n("App ID"), model.ID)
model.BR && details.push(i18n("Branch"), model.BR)
model.CM && details.push(i18n("Commit"), model.CM)
model.RT && details.push(i18n("Runtime"), model.RT)
model.GR && details.push(i18n("Groups"), model.GR)
model.PR && details.push(i18n("Provides"), model.PR)
model.DP && details.push(i18n("Depends on"), model.DP)
model.RQ && details.push(i18n("Required by"), model.RQ)
model.CF && details.push(i18n("Conflicts with"), model.CF)
model.RP && details.push(i18n("Replaces"), model.RP)
model.IS && details.push(i18n("Installed size"), model.IS)
model.DS && details.push(i18n("Download size"), model.DS)
model.DT && details.push(i18n("Install date"), model.DT)
model.RN && details.push(i18n("Install reason"), model.RN)
pkg = details
}
}
}
}
Placeholder {
anchors.fill: parent
}
}
}

View File

@ -0,0 +1,126 @@
/*
SPDX-FileCopyrightText: 2024 Evgeny Kazantsev <exequtic@gmail.com>
SPDX-License-Identifier: MIT
*/
import QtQuick
import QtQuick.Layouts
import QtQuick.Controls as Controls
import org.kde.plasma.components
import org.kde.kirigami as Kirigami
import "../../tools/tools.js" as JS
ScrollView {
ScrollBar.horizontal.policy: ScrollBar.AlwaysOff
ListView {
model: activeNewsModel
spacing: Kirigami.Units.largeSpacing * 2
topMargin: spacing
rightMargin: spacing
leftMargin: spacing
bottomMargin: spacing
// add: Transition { NumberAnimation { properties: "x"; from: 100; duration: Kirigami.Units.longDuration } } NEWS SPACING PATCH
removeDisplaced: Transition { NumberAnimation { properties: "x,y"; duration: Kirigami.Units.longDuration } }
remove: Transition { ParallelAnimation {
NumberAnimation { property: "opacity"; to: 0; duration: Kirigami.Units.longDuration }
NumberAnimation { properties: "x"; to: 100; duration: Kirigami.Units.longDuration }}}
delegate: Kirigami.AbstractCard {
contentItem: Item {
implicitWidth: delegateLayout.implicitWidth
implicitHeight: delegateLayout.implicitHeight
GridLayout {
id: delegateLayout
anchors {
left: parent.left
top: parent.top
right: parent.right
}
rowSpacing: Kirigami.Units.largeSpacing
columnSpacing: Kirigami.Units.largeSpacing
columns: width > Kirigami.Units.gridUnit * 20 ? 4 : 2
Kirigami.Icon {
Layout.fillHeight: true
Layout.maximumHeight: Kirigami.Units.iconSizes.huge
Layout.preferredWidth: height
source: model.title.includes("Arch") ? "apdatifier-plasmoid" :
model.title.includes("Plasma") ? "note-symbolic" :
model.title.includes("Apps") ? "applications-all-symbolic" :
model.title.includes("Community") ? "start-here-kde-plasma-symbolic"
: "news-subscribe"
}
RowLayout {
ColumnLayout {
Controls.Label {
Layout.fillWidth: true
wrapMode: Text.WordWrap
text: model.title
font.bold: true
}
Controls.Label {
Layout.fillWidth: true
wrapMode: Text.WordWrap
text: model.date
opacity: 0.6
}
Kirigami.Separator {
Layout.fillWidth: true
}
Controls.Label {
Layout.fillWidth: true
wrapMode: Text.WordWrap
text: model.article
}
}
ColumnLayout {
Controls.Button {
ToolTip { id: tip; text: i18n("Read article") }
icon.name: "internet-web-browser-symbolic"
onClicked: {
tip.hide()
Qt.openUrlExternally(model.link)
}
}
Controls.Button {
ToolTip { text: i18n("Remove") }
icon.name: "delete"
onClicked: JS.removeNewsItem(index)
}
}
}
}
}
}
Loader {
width: parent.width
active: sts.busy && (sts.statusIco === "status_news" || sts.statusIco === "news-subscribe")
sourceComponent: ProgressBar {
from: 0
to: 100
indeterminate: true
}
}
Loader {
anchors.centerIn: parent
active: activeNewsModel.count === 0
sourceComponent: Kirigami.PlaceholderMessage {
icon.name: "news-subscribe"
text: i18n("No unread news")
helpfulAction: Kirigami.Action {
enabled: newsModel.count > 0
icon.name: "backup"
text: i18n("Restore list")
onTriggered: JS.restoreNewsList()
}
}
}
}
}