From bbe83e74b2c1335a0a726c2f993bb2d8c47ffedc Mon Sep 17 00:00:00 2001 From: Matias Linares Date: Mon, 14 Oct 2024 09:54:47 -0300 Subject: Functioning context drawer --- kodereviewer/qml/PullRequestDescription.qml | 225 +++++++++++++++------------- 1 file changed, 123 insertions(+), 102 deletions(-) (limited to 'kodereviewer/qml/PullRequestDescription.qml') diff --git a/kodereviewer/qml/PullRequestDescription.qml b/kodereviewer/qml/PullRequestDescription.qml index de5a679..075b210 100644 --- a/kodereviewer/qml/PullRequestDescription.qml +++ b/kodereviewer/qml/PullRequestDescription.qml @@ -1,137 +1,158 @@ -pragma ComponentBehavior: Bound -import QtQuick import QtCore +//pragma ComponentBehavior: Bound +import QtQuick import QtQuick.Controls as QQC2 import QtQuick.Layouts - +import org.deprecated.kodereviewer 1.0 import org.kde.kirigami as Kirigami import org.kde.kirigamiaddons.formcard as FormCard -import org.deprecated.kodereviewer 1.0 - -ScrollView { +Kirigami.FormLayout { id: root - property var pullRequest: undefined - anchors.fill: parent + property var pullRequest + implicitWidth: parent.width - Kirigami.FormLayout { - anchors.fill: parent - implicitWidth: parent.width + Kirigami.Heading { + Layout.fillWidth: true + Layout.alignment: Qt.AlignHCenter + leftPadding: Kirigami.Units.largeSpacing + rightPadding: Kirigami.Units.largeSpacing + level: 1 + text: root.pullRequest ? root.pullRequest.title : "" + wrapMode: Text.WordWrap + } - Kirigami.Heading { - Layout.fillWidth: true - Layout.alignment: Qt.AlignHCenter - leftPadding: Kirigami.Units.largeSpacing - rightPadding: Kirigami.Units.largeSpacing - level: 1 - text: root.pullRequest ? root.pullRequest.title : "" - wrapMode: Text.WordWrap - } + Kirigami.Separator { + Kirigami.FormData.isSection: true + } - Kirigami.Separator { - Kirigami.FormData.isSection: true - } + RowLayout { + Layout.fillWidth: true - RowLayout { + ColumnLayout { Layout.fillWidth: true - ColumnLayout { - Layout.fillWidth: true - RowLayout { - QQC2.Label { - text: "Author" - elide: Text.ElideRight - } - QQC2.Label { - text: root.pullRequest ? root.pullRequest.username : "" - elide: Text.ElideLeft - } + + RowLayout { + QQC2.Label { + text: "Author" + elide: Text.ElideRight } - RowLayout { - QQC2.Label { - text: "State: " - elide: Text.ElideRight - } - QQC2.Label { - text: root.pullRequest ? root.pullRequest.state : "" - elide: Text.ElideLeft - } + + QQC2.Label { + text: root.pullRequest ? root.pullRequest.username : "" + elide: Text.ElideLeft } - RowLayout { - QQC2.Label { - text: "Draft?: " - elide: Text.ElideRight - } - QQC2.Label { - text: root.pullRequest ? root.pullRequest.draft ? i18n("Yes") : i18n("No") : "" - elide: Text.ElideLeft - } + + } + + RowLayout { + QQC2.Label { + text: "State: " + elide: Text.ElideRight } - RowLayout { - QQC2.Label { - text: "Last commit: " - elide: Text.ElideRight - } - QQC2.Label { - text: root.pullRequest ? root.pullRequest.last_commit : "" - elide: Text.ElideLeft - } + QQC2.Label { + text: root.pullRequest ? root.pullRequest.state : "" + elide: Text.ElideLeft } + } - ColumnLayout { - Layout.fillWidth: false - Layout.fillHeight: true - Repeater { - model: 0 - delegate: QQC2.Label { - text: "#Faa" - } + RowLayout { + QQC2.Label { + text: "Draft?: " + elide: Text.ElideRight } + + QQC2.Label { + text: root.pullRequest ? root.pullRequest.draft ? i18n("Yes") : i18n("No") : "" + elide: Text.ElideLeft + } + } - } - Loader { - id: labelModelLoader - active: !!root.pullRequest - sourceComponent: LabelModel { - pullRequest: root.pullRequest + RowLayout { + QQC2.Label { + text: "Last commit: " + elide: Text.ElideRight + } + + QQC2.Label { + text: root.pullRequest ? root.pullRequest.last_commit : "" + elide: Text.ElideLeft + } + } + } - RowLayout { + ColumnLayout { + Layout.fillWidth: false + Layout.fillHeight: true + Repeater { - model: labelModelLoader.item - delegate: Rectangle { - required property string name - required property string labelColor - required property string textColor - color: labelColor - width: thelabel.implicitWidth - height: thelabel.implicitHeight - radius: 5 - QQC2.Label { - id: thelabel - padding: Kirigami.Units.smallSpacing - text: name - color: textColor - } + model: 0 + + delegate: QQC2.Label { + text: "#Faa" } + } + } - Kirigami.Separator { - Kirigami.FormData.isSection: true - Kirigami.FormData.label: "Description" + } + + Loader { + id: labelModelLoader + + active: !!root.pullRequest + + sourceComponent: LabelModel { + pullRequest: root.pullRequest } - MarkdownLabel { - Layout.fillWidth: true - Layout.fillHeight: false - leftPadding: Kirigami.Units.largeSpacing - rightPadding: Kirigami.Units.largeSpacing - text: root.pullRequest ? - (root.pullRequest.body != "" ? root.pullRequest.body : "*No description provided.*") : "" + } + + RowLayout { + Repeater { + model: labelModelLoader.item + + delegate: Rectangle { + required property string name + required property string labelColor + required property string textColor + + color: labelColor + width: thelabel.implicitWidth + height: thelabel.implicitHeight + radius: 5 + + QQC2.Label { + id: thelabel + + padding: Kirigami.Units.smallSpacing + text: name + color: textColor + } + + } + } + + } + + Kirigami.Separator { + Kirigami.FormData.isSection: true + Kirigami.FormData.label: "Description" } + + MarkdownLabel { + Layout.fillWidth: true + Layout.fillHeight: false + leftPadding: Kirigami.Units.largeSpacing + rightPadding: Kirigami.Units.largeSpacing + text: root.pullRequest ? (root.pullRequest.body != "" ? root.pullRequest.body : "*No description provided.*") : "" + } + } -- cgit v1.2.3-70-g09d2