diff --git a/gemini/qml/components/DocumentTile.qml b/gemini/qml/components/DocumentTile.qml new file mode 100644 index 00000000000..ca3703d4246 --- /dev/null +++ b/gemini/qml/components/DocumentTile.qml @@ -0,0 +1,77 @@ +/* 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 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; + anchors { + top: parent.top; + left: parent.left; + right: parent.right; + margins: Constants.DefaultMargin / 2; + } + 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; + 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 626ce880add..2d189a78190 100644 --- a/gemini/qml/welcomepages/WelcomePageFilebrowser.qml +++ b/gemini/qml/welcomepages/WelcomePageFilebrowser.qml @@ -1,160 +1,121 @@ /* 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.calligra 1.0 import "../components" Page { id: base; objectName: "WelcomePageFilebrowser"; property string categoryUIName: (docList.model === textDocumentsModel) ? "text documents" : "presentations" GridView { id: docList; contentWidth: width; anchors { margins: Constants.DefaultMargin; top: docTypeSelectorRow.bottom; left: parent.left; right: parent.right; bottom: parent.bottom; bottomMargin: 0; } cellWidth: width / 4 - Constants.DefaultMargin; cellHeight: cellWidth + Settings.theme.font("templateLabel").pixelSize + Constants.DefaultMargin * 4; model: textDocumentsModel; delegate: documentTile; ScrollDecorator { flickableItem: docList; } } Rectangle { anchors.fill: docTypeSelectorRow; } Label { id: docTypeSelectorRow; anchors { top: parent.top; left: parent.left; right: parent.right; } height: Constants.GridHeight * 1.5; verticalAlignment: Text.AlignVCenter; horizontalAlignment: Text.AlignHCenter; font: Settings.theme.font("pageHeader"); text: "Open From Your Library"; color: "#22282f"; CohereButton { anchors { left: parent.left; leftMargin: 20; verticalCenter: parent.verticalCenter; } text: "Open Other..."; textColor: "#5b6573"; textSize: Settings.theme.adjustedPixel(18); color: "#D2D4D5"; onClicked: mainWindow.openFile(); } Row { anchors { right: parent.right; rightMargin: 20; verticalCenter: parent.verticalCenter; } height: parent.height - Constants.DefaultMargin * 2; spacing: 4; CohereButton { anchors.verticalCenter: parent.verticalCenter; text: "Text Documents"; textColor: "#5b6573"; textSize: Settings.theme.adjustedPixel(18); checkedColor: "#D2D4D5"; onClicked: { if(!checked) { docList.model = textDocumentsModel; } } checked: docList.model === textDocumentsModel; } CohereButton { anchors.verticalCenter: parent.verticalCenter; text: "Presentations"; textColor: "#5b6573"; textSize: Settings.theme.adjustedPixel(18); checkedColor: "#D2D4D5"; onClicked: { if(!checked) { docList.model = presentationDocumentsModel; } } checked: docList.model === presentationDocumentsModel; } } } 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; - Item { + DocumentTile { width: docList.cellWidth; height: docList.cellHeight - 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: "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; - } - 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; - horizontalAlignment: Text.AlignHCenter; - verticalAlignment: Text.AlignVCenter; - text: model.fileName ? model.fileName : ""; - } - MouseArea { - anchors.fill: parent; - onClicked: { - baseLoadingDialog.visible = true; - openFile(model.filePath); - } + title: model.fileName != "" ? model.fileName : "" + filePath: model.filePath + onClicked: { + baseLoadingDialog.visible = true; + openFile(model.filePath); } } } } diff --git a/gemini/qml/welcomepages/WelcomePageRecent.qml b/gemini/qml/welcomepages/WelcomePageRecent.qml index 2f719d89f97..66c65204bb2 100644 --- a/gemini/qml/welcomepages/WelcomePageRecent.qml +++ b/gemini/qml/welcomepages/WelcomePageRecent.qml @@ -1,107 +1,67 @@ /* 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 "../components" Page { id: base; objectName: "WelcomePageRecent"; GridView { id: docList; contentWidth: width; anchors { margins: Constants.DefaultMargin; top: parent.top; topMargin: Constants.DefaultMargin * 3; left: parent.left; right: parent.right; bottom: parent.bottom; bottomMargin: 0; } cellWidth: width / 4 - Constants.DefaultMargin; cellHeight: cellWidth + Settings.theme.font("templateLabel").pixelSize + Constants.DefaultMargin * 4; model: RecentFilesModel { recentFileManager: RecentFileManager; } delegate: documentTile; ScrollDecorator { flickableItem: docList; } } Label { anchors.fill: parent; text: "There are no recent documents to list.\n\nTo see anything here, open some documents and they\nwill show up here in the order in which they were opened."; horizontalAlignment: Text.AlignHCenter; verticalAlignment: Text.AlignVCenter; font: Settings.theme.font("templateLabel"); color: "#5b6573"; visible: docList.count === 0; } Component { id: documentTile; - Item { + DocumentTile { width: docList.cellWidth; - height: docList.cellHeight - 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: model.image; - 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.text ? model.text : ""; - font: Settings.theme.font("templateLabel"); - color: "#5b6573"; - } - MouseArea { - anchors.fill: parent; - onClicked: { - baseLoadingDialog.visible = true; - openFile(model.url); - } + height: docList.cellHeight; + filePath: model.url; + imageUrl: model.image; + title: model.text != "" ? model.text : ""; + onClicked: { + baseLoadingDialog.visible = true; + openFile(model.url); } } } } diff --git a/gemini/qml/welcomepages/cloud/git/RepositoryContent.qml b/gemini/qml/welcomepages/cloud/git/RepositoryContent.qml index bd6dd32e238..840345b050f 100644 --- a/gemini/qml/welcomepages/cloud/git/RepositoryContent.qml +++ b/gemini/qml/welcomepages/cloud/git/RepositoryContent.qml @@ -1,259 +1,220 @@ /* 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; 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; 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; 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; } 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; 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; - Item { + DocumentTile { width: docList.cellWidth; - height: docList.cellHeight - 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: "image://recentimage/" + model.filePath; - anchors { - top: parent.top; - left: parent.left; - right: parent.right; - margins: Constants.DefaultMargin; - } - height: parent.width; - fillMode: Image.PreserveAspectFit; - smooth: true; - asynchronous: true; - } - 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; - horizontalAlignment: Text.AlignHCenter; - verticalAlignment: Text.AlignVCenter; - text: model.fileName ? model.fileName : ""; - } - MouseArea { - anchors.fill: parent; - onClicked: { - baseLoadingDialog.visible = true; - openFile(model.filePath, gitController.commitAndPushCurrentFileAction()); - } + height: docList.cellHeight; + filePath: model.filePath; + title: model.fileName != "" ? model.filename : ""; + onClicked: { + baseLoadingDialog.visible = true; + openFile(model.filePath, gitController.commitAndPushCurrentFileAction()); } } } }