From 504d29accac51c537d5dcd42b129deb6f7463457 Mon Sep 17 00:00:00 2001 From: Matias Linares Date: Fri, 20 Sep 2024 20:46:28 -0300 Subject: Initial commit --- kodereviewer/qml/AddRepositoryPage.qml | 97 ++++++++++++++++++++++++++++++++++ 1 file changed, 97 insertions(+) create mode 100644 kodereviewer/qml/AddRepositoryPage.qml (limited to 'kodereviewer/qml/AddRepositoryPage.qml') diff --git a/kodereviewer/qml/AddRepositoryPage.qml b/kodereviewer/qml/AddRepositoryPage.qml new file mode 100644 index 0000000..2bd26fe --- /dev/null +++ b/kodereviewer/qml/AddRepositoryPage.qml @@ -0,0 +1,97 @@ +import QtCore +import QtQuick 6.7 +import QtQuick.Controls 6 as QQC2 +import QtQuick.Layouts 6.7 + +import org.kde.kirigami as Kirigami +import org.kde.kirigamiaddons.formcard as FormCard + +FormCard.FormCardPage { + id: root + title: "Add a new repository" + + signal accepted(string url, string name, string owner, string displayName) + + FormCard.FormHeader { + title: "Github information" + } + + FormCard.FormCard { + FormCard.FormTextFieldDelegate { + id: urlField + label: "URL" + onTextChanged: root.fillDataFromUrl(text) + } + + FormCard.FormDelegateSeparator {} + + FormCard.FormTextFieldDelegate { + id: nameField + label: "Name" + } + + FormCard.FormDelegateSeparator {} + + FormCard.FormTextFieldDelegate { + id: ownerField + label: "Owner" + } + + FormCard.FormDelegateSeparator {} + } + + FormCard.FormHeader { + title: "General information" + } + + FormCard.FormCard { + FormCard.FormTextFieldDelegate { + id: displayNameField + label: "Display name" + } + } + + + FormCard.FormHeader { + title: "Git" + } + + FormCard.FormCard { + FormCard.FormCheckDelegate { + id: cloneCheck + text: "Clone repository" + checked: false + } + + FormCard.FormDelegateSeparator {} + + FormCard.FormTextFieldDelegate { + id: cloneDirectory + label: "Clone directory" + enabled: cloneCheck.checked + } + } + + + footer: QQC2.ToolBar { + contentItem: QQC2.DialogButtonBox { + standardButtons: QQC2.Dialog.Ok | QQC2.Dialog.Cancel + onAccepted: root.accepted( + urlField.text, + nameField.text, + ownerField.text, + displayNameField.text + ) + onRejected: applicationWindow().pageStack.pop() + } + } + + function fillDataFromUrl(text) { + const s = text.split("/") + if (s.length > 2) { + nameField.text = s[s.length -1] + ownerField.text = s[s.length - 2] + displayNameField.text = s[s.length -1] + } + } +} -- cgit v1.2.3-70-g09d2