diff --git a/gemini/qml/welcomepages/cloud/git/CreateCheckout.qml b/gemini/qml/welcomepages/cloud/git/CreateCheckout.qml index 77ba69026a9..df9fafecd7f 100644 --- a/gemini/qml/welcomepages/cloud/git/CreateCheckout.qml +++ b/gemini/qml/welcomepages/cloud/git/CreateCheckout.qml @@ -1,258 +1,215 @@ /* This file is part of the KDE project * Copyright (C) 2014 Dan Leinir Turthra Jensen * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ import QtQuick 2.0 import org.calligra 1.0 import Calligra.Gemini.Git 1.0 +import QtQuick.Controls 1.4 as QtControls +import org.kde.kirigami 1.0 as Kirigami import "../../../components" Item { id: base; property string userForRemote; property string privateKeyFile; property string publicKeyFile; property bool needsPrivateKeyPassphrase; Component { id: accountComp; QtObject { property string localrepo: checkoutDir.text; property string userForRemote: base.userForRemote; property string privateKeyFile: base.privateKeyFile; property string publicKeyFile: base.publicKeyFile; property bool needsPrivateKeyPassphrase: base.needsPrivateKeyPassphrase; } } - Text { - id: pageTitle; - anchors { - top: parent.top; - left: parent.left; - right: parent.right + Column { + width: parent.width; + height: childrenRect.height; + Kirigami.Heading { + text: "Add Git Account" + width: parent.width; } - height: font.pixelHeight + Settings.theme.adjustedPixel(16); - font: Settings.theme.font("pageHeader"); - verticalAlignment: Text.AlignVCenter; - horizontalAlignment: Text.AlignHCenter; - text: "Add Git Account"; - Rectangle { - anchors { - left: parent.left; - right: parent.right; - bottom: parent.bottom; - } - height: 1; - color: "black"; - opacity: 0.1; - } - } - Item { - id: pageContent; - anchors { - top: pageTitle.bottom; - left: parent.left; - right: parent.right; - bottom: parent.bottom; - } - Column { - anchors { - top: parent.top; - left: parent.left; - right: parent.right; - bottom: parent.verticalCenter; - } - Text { - id: typeChooser; - anchors.right: parent.right; - width: parent.width - (height / 2); - height: existingCheckoutSelector.height + Settings.theme.adjustedPixel(16); - verticalAlignment: Text.AlignVCenter - font: Settings.theme.font("application"); - text: "Type of repository:"; - CohereButton { - id: existingCheckoutSelector; - anchors { - right: newCheckoutSelector.left; - verticalCenter: parent.verticalCenter; - } - text: "Existing Clone"; - textColor: "#5b6573"; - textSize: Settings.theme.adjustedPixel(18); - checkedColor: "#D2D4D5"; - checked: true; - onClicked: { - if(!checked) { - checked = true; - newCheckoutSelector.checked = false; - } - } + Text { + id: typeChooser; + anchors.right: parent.right; + width: parent.width - (height / 2); + height: existingCheckoutSelector.height + Settings.theme.adjustedPixel(16); + verticalAlignment: Text.AlignVCenter + font: Settings.theme.font("application"); + text: "Type of repository:"; + CohereButton { + id: existingCheckoutSelector; + anchors { + right: newCheckoutSelector.left; + verticalCenter: parent.verticalCenter; } - CohereButton { - id: newCheckoutSelector; - anchors{ - right: parent.right; - verticalCenter: parent.verticalCenter; + text: "Existing Clone"; + textColor: "#5b6573"; + textSize: Settings.theme.adjustedPixel(18); + checkedColor: "#D2D4D5"; + checked: true; + onClicked: { + if(!checked) { + checked = true; + newCheckoutSelector.checked = false; } - text: "New Clone"; - textColor: "#5b6573"; - textSize: Settings.theme.adjustedPixel(18); - checkedColor: "#D2D4D5"; - onClicked: { - if(!checked) { - checked = true; - existingCheckoutSelector.checked = false; - } + } + } + CohereButton { + id: newCheckoutSelector; + anchors{ + right: parent.right; + verticalCenter: parent.verticalCenter; + } + text: "New Clone"; + textColor: "#5b6573"; + textSize: Settings.theme.adjustedPixel(18); + checkedColor: "#D2D4D5"; + onClicked: { + if(!checked) { + checked = true; + existingCheckoutSelector.checked = false; } } } - TextField { - id: checkoutName; - width: parent.width; - placeholder: "Short name for this account"; + } + QtControls.TextField { + id: checkoutName; + width: parent.width; + placeholderText: "Short name for this account"; + } + Item { + width: parent.width; + height: checkoutDir.height; + QtControls.TextField { + id: checkoutDir; + anchors { + left: parent.left; + right: checkoutBrowse.left; + } + placeholderText: "Local clone location"; } - Item { - width: parent.width; - height: checkoutDir.height; - TextField { - id: checkoutDir; - anchors { - left: parent.left; - right: checkoutBrowse.left; - } - placeholder: "Local clone location"; + QtControls.Button { + id: checkoutBrowse; + anchors { + top: checkoutDir.top; + right: parent.right; + bottom: checkoutDir.bottom; } - CohereButton { - id: checkoutBrowse; - anchors { - verticalCenter: checkoutDir.verticalCenter; - right: parent.right; - } - text: "Browse..."; - textColor: "#5b6573"; - textSize: Settings.theme.adjustedPixel(18); - color: "#D2D4D5"; - onClicked: { - var newDir = GitCheckoutCreator.getDir(); - if(newDir !== "") { - checkoutDir.text = newDir; - } + text: "Browse..."; + onClicked: { + var newDir = GitCheckoutCreator.getDir(); + if(newDir !== "") { + checkoutDir.text = newDir; } } } - TextField { - id: newCheckoutServer; - width: parent.width; - height: newCheckoutSelector.checked ? Constants.GridHeight : 0; - Behavior on height { PropertyAnimation { duration: Constants.AnimationDuration; } } - opacity: height === 0 ? 0 : 1; - Behavior on opacity { PropertyAnimation { duration: Constants.AnimationDuration; } } - placeholder: "Clone URL (https or git)"; - } + } + QtControls.TextField { + id: newCheckoutServer; + width: parent.width; + height: newCheckoutSelector.checked ? Constants.GridHeight : 0; + Behavior on height { PropertyAnimation { duration: Constants.AnimationDuration; } } + opacity: height === 0 ? 0 : 1; + Behavior on opacity { PropertyAnimation { duration: Constants.AnimationDuration; } } + placeholderText: "Clone URL (https or git)"; + } + CohereButton { + anchors.right: parent.right; + onClicked: dlgStack.push(userCredentials); + text: "Set User Credentials"; + textColor: "#5b6573"; + textSize: Settings.theme.adjustedPixel(18); + color: "#D2D4D5"; + } + Kirigami.Label { + id: errorLabel; + width: parent.width; + height: cloneAdd.height + Settings.theme.adjustedPixel(16); + verticalAlignment: Text.AlignVCenter + color: "red"; CohereButton { - anchors.right: parent.right; - onClicked: dlgStack.push(userCredentials); - text: "Set User Credentials"; + id: cloneAdd; + anchors { + verticalCenter: parent.verticalCenter; + right: parent.right; + } + text: "Add Now"; textColor: "#5b6573"; textSize: Settings.theme.adjustedPixel(18); color: "#D2D4D5"; - } - Text { - id: errorLabel; - width: parent.width; - height: cloneAdd.height + Settings.theme.adjustedPixel(16); - verticalAlignment: Text.AlignVCenter - color: "red"; - font: Settings.theme.font("application"); - CohereButton { - id: cloneAdd; - anchors { - verticalCenter: parent.verticalCenter; - right: parent.right; + onClicked: { + if(checkoutName.text.length < 1) { + errorLabel.text = "You need to enter a name for the account." + return; } - text: "Add Now"; - textColor: "#5b6573"; - textSize: Settings.theme.adjustedPixel(18); - color: "#D2D4D5"; - onClicked: { - if(checkoutName.text.length < 1) { - errorLabel.text = "You need to enter a name for the account." - return; - } - if(checkoutDir.text.length < 1) { - errorLabel.text = "You must select a location." - return; - } - if(base.userForRemote.length < 1 || base.privateKeyFile.length < 1 || base.publicKeyFile.length < 1) { - errorLabel.text = "You need to enter your credentials."; + if(checkoutDir.text.length < 1) { + errorLabel.text = "You must select a location." + return; + } + if(base.userForRemote.length < 1 || base.privateKeyFile.length < 1 || base.publicKeyFile.length < 1) { + errorLabel.text = "You need to enter your credentials."; + return; + } + var createAccount = true; + if(newCheckoutSelector.checked) { + if(newCheckoutServer.text.length < 1) { + errorLabel.text = "You have to enter a remote server location for the clone."; return; } - var createAccount = true; - if(newCheckoutSelector.checked) { - if(newCheckoutServer.text.length < 1) { - errorLabel.text = "You have to enter a remote server location for the clone."; - return; - } - var repoDir = GitCheckoutCreator.createClone(checkoutName.text, newCheckoutServer.text, checkoutDir.text, accountComp.createObject(cloudAccounts)); - if(repoDir.length > 0) { - checkoutDir.text = repoDir; - } - else { - createAccount = false; - } + var repoDir = GitCheckoutCreator.createClone(checkoutName.text, newCheckoutServer.text, checkoutDir.text, accountComp.createObject(cloudAccounts)); + if(repoDir.length > 0) { + checkoutDir.text = repoDir; } else { - if(!GitCheckoutCreator.isGitDir(checkoutDir.text)) { - errorLabel.text = "You must select a location which is actually a git repository." - return; - } + createAccount = false; } - if(createAccount) { - cloudAccounts.addAccount(checkoutName.text, "Git", "accountsPageGit", accountComp.createObject(cloudAccounts)); - dlgStack.replace(addEmpty); + } + else { + if(!GitCheckoutCreator.isGitDir(checkoutDir.text)) { + errorLabel.text = "You must select a location which is actually a git repository." + return; } } + if(createAccount) { + cloudAccounts.addAccount(checkoutName.text, "Git", "accountsPageGit", accountComp.createObject(cloudAccounts)); + dlgStack.replace(addEmpty); + } } } } - Rectangle { - anchors { - left: parent.left; - right: parent.right; - bottom: parent.bottom; - } - height: 1; - color: "black"; - opacity: 0.1; - } } Component { id: userCredentials; GetUserCredentials { onAccepted: { base.userForRemote = userForRemote; base.privateKeyFile = privateKeyFile; base.publicKeyFile = publicKeyFile; base.needsPrivateKeyPassphrase = needsPrivateKeyPassphrase; dlgStack.pop(); } onCancelled: { dlgStack.pop(); } } } } diff --git a/gemini/qml/welcomepages/cloud/git/RepositoryContent.qml b/gemini/qml/welcomepages/cloud/git/RepositoryContent.qml index d9a1e264588..e680f5fbc9c 100644 --- a/gemini/qml/welcomepages/cloud/git/RepositoryContent.qml +++ b/gemini/qml/welcomepages/cloud/git/RepositoryContent.qml @@ -1,258 +1,259 @@ /* This file is part of the KDE project * Copyright (C) 2014 Dan Leinir Turthra Jensen * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ import QtQuick 2.0 import org.calligra 1.0 import Calligra.Gemini.Git 1.0 import "../../../components" Item { property alias localrepo: gitController.cloneDir; property alias privateKeyFile: gitController.privateKeyFile; property alias needsPrivateKeyPassphrase: gitController.needsPrivateKeyPassphrase; property alias publicKeyFile: gitController.publicKeyFile; property alias userForRemote: gitController.userForRemote; GitController { id: gitController; currentFile: Settings.currentFile; onPullCompleted: { logModel.refreshLog(); updatedLabel.opacity = 1; if(DocumentManager.doc()) { DocumentManager.doc().clearStatusBarMessage(); } } onTransferProgress: { if(DocumentManager.doc()) { DocumentManager.doc().sigProgress(progress); } + console.log("Transfer progress: " + progress); } onOperationBegun: { console.log(message); if(DocumentManager.doc()) { DocumentManager.doc().statusBarMessage(message); } } onPushCompleted: { if(DocumentManager.doc()) { DocumentManager.doc().clearStatusBarMessage(); } } } GitLogModel { id: logModel; repoDir: gitController.cloneDir; } Item { id: logSidebar; anchors { margins: Constants.DefaultMargin; top: parent.top; right: parent.right; bottom: parent.bottom; bottomMargin: 0; } width: (parent.width / 4) - Constants.DefaultMargin; CohereButton { id: pullButton; anchors { top: parent.top; horizontalCenter: parent.horizontalCenter; margins: Settings.theme.adjustedPixel(8); } textColor: "#5b6573"; textSize: Settings.theme.adjustedPixel(18); color: "#D2D4D5"; text: "Pull from upstream"; onClicked: { enabled = false; pullInProgress.opacity = 1; gitController.pull(); } BusyIndicator { id: pullInProgress; opacity: 0; running: true; height: parent.height; width: height; anchors.centerIn: parent; Behavior on opacity { PropertyAnimation { duration: Constants.AnimationDuration; } } anchors { top: pullButton.bottom; left: parent.left; right: parent.right; } } } Label { id: updatedLabel; opacity: 0; Behavior on opacity { SequentialAnimation { ScriptAction { script: pullInProgress.opacity = 0; } PropertyAnimation { duration: Constants.AnimationDuration; } ScriptAction { script: hideUpdate.start(); } } } height: opacity * Constants.GridHeight / 2; anchors { top: pullButton.bottom; left: parent.left; right: parent.right; } text: "Update Completed!"; font: Settings.theme.font("templateLabel"); color: "#5b6573"; verticalAlignment: Text.AlignVCenter; horizontalAlignment: Text.AlignHCenter; Timer { id: hideUpdate; running: false; repeat: false; interval: 1000; onTriggered: { updatedLabel.opacity = 0; pullButton.enabled = true; } } } ListView { id: logListView; model: logModel; clip: true; anchors { margins: Constants.DefaultMargin; top: updatedLabel.bottom; left: parent.left; right: parent.right; bottom: parent.bottom; } header: Label { width: logListView.width; height: Constants.GridHeight / 2; text: "Recent Changes"; font: Settings.theme.font("templateLabel"); color: "#5b6573"; verticalAlignment: Text.AlignVCenter; horizontalAlignment: Text.AlignHCenter; } delegate: Column { width: logListView.width; height: childrenRect.height; Text { id: messageText; width: parent.width; height: paintedHeight; font: Settings.theme.font("templateLabel"); color: "#5b6573"; text: model.shortMessage; wrapMode: Text.Wrap; } Text { id: timeText; width: parent.width; height: paintedHeight; font: Settings.theme.font("applicationLight"); color: "#5b6573"; text: "on " + model.time; } Text { id: nameText; width: parent.width; height: paintedHeight; font: Settings.theme.font("applicationLight"); color: "#5b6573"; text: "by " + model.authorName; } Item { width: parent.width; height: nameText.height; Rectangle { width: parent.width - (Constants.DefaultMargin * 2); height: 1; anchors.centerIn: parent; opacity: 0.3; color: "black"; } } } } } GridView { id: docList; clip: true; contentWidth: width; anchors { margins: Constants.DefaultMargin; top: parent.top; left: parent.left; right: logSidebar.left; bottom: parent.bottom; bottomMargin: 0; } cellWidth: width / 3 - Constants.DefaultMargin; cellHeight: cellWidth + Settings.theme.font("templateLabel").pixelSize + Constants.DefaultMargin * 4; model: gitController.documents; delegate: documentTile; ScrollDecorator { flickableItem: docList; } } Label { anchors.fill: parent; text: "No Documents\n\nPlease add some documents to your reporitory.\n(%1)".arg(docList.model.documentsFolder); horizontalAlignment: Text.AlignHCenter; verticalAlignment: Text.AlignVCenter; font: Settings.theme.font("templateLabel"); color: "#5b6573"; visible: docList.count === 0; } Component { id: documentTile; Item { width: docList.cellWidth; height: docList.cellHeight Image { source: "image://recentimage/" + model.filePath; anchors { top: parent.top; left: parent.left; right: parent.right; margins: Constants.DefaultMargin / 2; } height: parent.width; fillMode: Image.PreserveAspectFit; smooth: true; asynchronous: true; } Label { id: lblName; anchors { left: parent.left; right: parent.right; bottom: parent.bottom; margins: Constants.DefaultMargin; bottomMargin: Constants.DefaultMargin * 2; } height: font.pixelSize + Constants.DefaultMargin * 2; horizontalAlignment: Text.AlignHCenter; verticalAlignment: Text.AlignVCenter; text: model.fileName ? model.fileName : ""; font: Settings.theme.font("templateLabel"); color: "#5b6573"; } MouseArea { anchors.fill: parent; onClicked: { baseLoadingDialog.visible = true; openFile(model.filePath, gitController.commitAndPushCurrentFileAction()); } } } } }