diff --git a/gemini/qml/components/DocumentTile.qml b/gemini/qml/components/DocumentTile.qml index ca3703d4246..640a40a8544 100644 --- a/gemini/qml/components/DocumentTile.qml +++ b/gemini/qml/components/DocumentTile.qml @@ -1,77 +1,83 @@ /* This file is part of the KDE project * Copyright (C) 2019 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 QtQuick.Controls 2.2 as QtControls +import QtQuick 2.11 +import QtQuick.Controls 2.11 as QtControls +import org.kde.kirigami 2.7 as Kirigami import org.calligra 1.0 Item { id: component; signal clicked(); property string filePath; property string imageUrl: "image://recentimage/" + component.filePath; property string title; - Rectangle { - x: documentImage.x - Constants.DefaultMargin + (documentImage.width - documentImage.paintedWidth) / 2; - y: documentImage.y - Constants.DefaultMargin + (documentImage.height - documentImage.paintedHeight) / 2; - width: documentImage.paintedWidth + Constants.DefaultMargin * 2; - height: documentImage.paintedHeight + Constants.DefaultMargin * 2; - border { - color: "silver"; - width: 1; - } - } - Image { - id: documentImage; - source: component.imageUrl; + width: GridView.view.cellWidth; height: GridView.view.cellHeight + Item { anchors { - top: parent.top; - left: parent.left; - right: parent.right; - margins: Constants.DefaultMargin / 2; + fill: parent; + margins: Kirigami.Units.largeSpacing * 2 + } + Rectangle { + x: documentImage.x - Kirigami.Units.smallSpacing + (documentImage.width - documentImage.paintedWidth) / 2; + y: documentImage.y - Kirigami.Units.smallSpacing + (documentImage.height - documentImage.paintedHeight) / 2; + width: documentImage.paintedWidth + Kirigami.Units.smallSpacing * 2; + height: documentImage.paintedHeight + Kirigami.Units.smallSpacing * 2; + border { + color: "silver"; + width: 1; + } } - height: parent.width; - fillMode: Image.PreserveAspectFit; - smooth: true; - asynchronous: true; - QtControls.BusyIndicator { - anchors.centerIn: parent - width: docList.cellWidth / 3 - height: width - running: parent.status === Image.Loading + Image { + id: documentImage; + source: component.imageUrl; + anchors { + top: parent.top; + left: parent.left; + right: parent.right; + margins: Kirigami.Units.largeSpacing; + } + height: parent.width; + fillMode: Image.PreserveAspectFit; + smooth: true; + asynchronous: true; + QtControls.BusyIndicator { + anchors.centerIn: parent + width: docList.cellWidth / 3 + height: width + running: parent.status === Image.Loading + } } } QtControls.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; + height: font.pixelSize + Kirigami.Units.largeSpacing * 2; horizontalAlignment: Text.AlignHCenter; verticalAlignment: Text.AlignVCenter; text: component.title; } MouseArea { anchors.fill: parent; onClicked: component.clicked(); } } diff --git a/gemini/qml/welcomepages/WelcomePageFilebrowser.qml b/gemini/qml/welcomepages/WelcomePageFilebrowser.qml index 4ae4ca70b7f..e80074f12a2 100644 --- a/gemini/qml/welcomepages/WelcomePageFilebrowser.qml +++ b/gemini/qml/welcomepages/WelcomePageFilebrowser.qml @@ -1,75 +1,72 @@ /* 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 QtQuick.Controls 2.2 as QtControls import org.kde.kirigami 2.7 as Kirigami import org.calligra 1.0 import "../components" Kirigami.ScrollablePage { id: base; objectName: "WelcomePageFilebrowser"; title: "Open From Your Library"; property string categoryUIName: (docList.model === textDocumentsModel) ? "text documents" : "presentations" actions { main: Kirigami.Action { text: "Open Other..."; icon.name: "document-open"; onTriggered: mainWindow.openFile(); } contextualActions: [ Kirigami.Action { text: "Text Documents"; onTriggered: { if(!checked) { docList.model = textDocumentsModel; } } checked: docList.model === textDocumentsModel; }, Kirigami.Action { text: "Presentations"; onTriggered: { if(!checked) { docList.model = presentationDocumentsModel; } } checked: docList.model === presentationDocumentsModel; } ] } GridView { id: docList; - contentWidth: width; - cellWidth: width / 4 - Kirigami.Units.largeSpacing; - cellHeight: cellWidth + Settings.theme.font("templateLabel").pixelSize + Kirigami.Units.largeSpacing * 4; + cellWidth: width / 4; + cellHeight: cellWidth + Settings.theme.font("templateLabel").pixelSize; model: textDocumentsModel; delegate: documentTile; QtControls.Label { anchors.fill: parent; text: "No %1\n\nPlease drop some into your Documents folder\n(%2)".arg(base.categoryUIName).arg(docList.model.documentsFolder); horizontalAlignment: Text.AlignHCenter; verticalAlignment: Text.AlignVCenter; visible: docList.count === 0; } } Component { id: documentTile; DocumentTile { - width: docList.cellWidth; - height: docList.cellHeight title: model.fileName != "" ? model.fileName : "" filePath: model.filePath onClicked: openFile(model.filePath); } } } diff --git a/gemini/qml/welcomepages/cloud/git/RepositoryContent.qml b/gemini/qml/welcomepages/cloud/git/RepositoryContent.qml index 2c072a3c697..c5f5a8531f8 100644 --- a/gemini/qml/welcomepages/cloud/git/RepositoryContent.qml +++ b/gemini/qml/welcomepages/cloud/git/RepositoryContent.qml @@ -1,216 +1,235 @@ /* 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 QtQuick.Controls 2.2 as QtControls import org.kde.kirigami 2.1 as Kirigami 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; + property string progressMessage; onPullCompleted: { logModel.refreshLog(); updatedLabel.opacity = 1; if(DocumentManager.doc()) { DocumentManager.doc().clearStatusBarMessage(); } + progressMessage = ""; } onTransferProgress: { if(DocumentManager.doc()) { DocumentManager.doc().sigProgress(progress); } + progressMessage = "Transfer progress: %1%".arg(progress); console.log("Transfer progress: " + progress); } onOperationBegun: { console.log(message); if(DocumentManager.doc()) { DocumentManager.doc().statusBarMessage(message); } + progressMessage = 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; QtControls.Button { id: pullButton; anchors { top: parent.top; horizontalCenter: parent.horizontalCenter; margins: Settings.theme.adjustedPixel(8); } text: "Pull from upstream"; onClicked: { enabled = false; - pullInProgress.opacity = 1; + pullInProgress.running = true; gitController.pull(); } - QtControls.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; - } - } } QtControls.Label { id: updatedLabel; opacity: 0; Behavior on opacity { SequentialAnimation { - ScriptAction { script: pullInProgress.opacity = 0; } + ScriptAction { script: pullInProgress.running = false; } 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!"; 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: QtControls.Label { width: logListView.width; height: Constants.GridHeight / 2; text: "Recent Changes"; verticalAlignment: Text.AlignVCenter; horizontalAlignment: Text.AlignHCenter; } delegate: Column { width: logListView.width; height: childrenRect.height; QtControls.Label { id: messageText; width: parent.width; height: paintedHeight; text: model.shortMessage; wrapMode: Text.Wrap; } QtControls.Label { id: timeText; width: parent.width; height: paintedHeight; opacity: 0.7; text: "on " + model.time; } QtControls.Label { id: nameText; width: parent.width; height: paintedHeight; opacity: 0.7 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"; } } } } ScrollDecorator { flickableItem: logListView; anchors.fill: logListView; } } GridView { id: docList; clip: true; - contentWidth: width; anchors { margins: Constants.DefaultMargin; top: parent.top; topMargin: Constants.DefaultMargin * 2; 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; + cellWidth: width / 3; + cellHeight: cellWidth + Settings.theme.font("templateLabel").pixelSize; model: gitController.documents; delegate: documentTile; ScrollDecorator { flickableItem: docList; } } QtControls.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; visible: docList.count === 0; } Component { id: documentTile; DocumentTile { - width: docList.cellWidth; - height: docList.cellHeight; filePath: model.filePath; title: model.fileName != "" ? model.fileName : ""; onClicked: openFile(model.filePath, gitController.commitAndPushCurrentFileAction()); } } + Item { + anchors.fill: parent; + opacity: pullInProgress.running ? 1 : 0; + Behavior on opacity { PropertyAnimation { duration: Constants.AnimationDuration; } } + Rectangle { + anchors.fill: parent; + opacity: 0.7; + color: Kirigami.Theme.backgroundColor; + } + MouseArea { + enabled: pullInProgress.running; + anchors.fill: parent; + onClicked: {} + } + QtControls.BusyIndicator { + id: pullInProgress; + running: false; + height: Kirigami.Units.iconSizes.huge; + width: height; + anchors.centerIn: parent; + QtControls.Label { + anchors { + top: parent.bottom; + left: parent.left; + right: parent.right; + margins: Kirigami.Units.largeSpacing; + } + horizontalAlignment: Text.AlignHCenter; + text: gitController.progressMessage; + } + } + } }