1/* 2 SPDX-FileCopyrightText: 2011 Aleix Pol <aleixpol@kde.org> 3 SPDX-FileCopyrightText: 2016 Kevin Funk <kfunk@kde.org> 4 5 SPDX-License-Identifier: GPL-2.0-or-later 6*/ 7 8import QtQuick 2.7 9import QtQuick.Layouts 1.2 10import QtQuick.Controls 2.0 11import QtQuick.Controls 1.4 as QQC1 12 13import org.kdevelop.welcomepage 4.3 14 15StandardPage 16{ 17 id: root 18 19 ColumnLayout { 20 anchors.fill: parent 21 anchors.margins: 20 22 23 spacing: 20 24 25 RowLayout { 26 id: toolBar 27 28 width: parent.width 29 30 QQC1.Button { 31 iconName: "project-development-new-template" 32 text: i18n("New Project") 33 onClicked: kdev.retrieveMenuAction("project/project_new").trigger() 34 } 35 36 QQC1.Button { 37 text: i18n("Open Project") 38 iconName: "project-open" 39 onClicked: ICore.projectController.openProject() 40 } 41 42 QQC1.Button { 43 text: i18n("Fetch Project") 44 iconName: "edit-download" 45 onClicked: kdev.retrieveMenuAction("project/project_fetch").trigger() 46 } 47 48 QQC1.Button { 49 iconName: "document-open-recent" 50 text: i18n("Recent Projects") 51 onClicked: kdev.showMenu("project/project_open_recent") 52 } 53 Item { 54 Layout.fillWidth: true 55 } 56 } 57 58 Label { 59 id: greetingLabel 60 61 visible: !sessionsView.visible 62 Layout.fillWidth: true 63 Layout.fillHeight: true 64 65 text: i18n("<h3>Welcome to KDevelop!</h3>\n" + 66 "<p>You can start working on a project by opening an existing or creating a new one via the above buttons.</p>\n" + 67 "<p>If you need help, please check out the <a href=\"https://userbase.kde.org/KDevelop\">User Manual.</a></p>") + 68 69 (Qt.platform.os === "windows" ? 70 i18n("<br/>\n" + 71 "<h3>Note for Windows users</h3>\n" + 72 "<p>Note that KDevelop does NOT ship a C/C++ compiler on Windows!</p>\n" + 73 "<p>You need to install either GCC via MinGW or install a recent version of the Microsoft Visual Studio IDE and make sure the environment is setup correctly <i>before</i> starting KDevelop.</p>\n" + 74 "<p>If you need further assistance, please check out the <a href=\"https://userbase.kde.org/KDevelop4/Manual/WindowsSetup\">KDevelop under Windows instructions.</a></p>") : 75 "") 76 wrapMode: Text.WordWrap 77 onLinkActivated: Qt.openUrlExternally(link) 78 79 MouseArea { 80 anchors.fill: parent 81 82 acceptedButtons: Qt.NoButton // we don't want to eat clicks on the Text 83 cursorShape: parent.hoveredLink ? Qt.PointingHandCursor : Qt.ArrowCursor 84 } 85 } 86 87 ListView { 88 id: sessionsView 89 90 Layout.fillHeight: true 91 Layout.fillWidth: true 92 93 visible: sessionsView.count > 1 // we always have at least one active session 94 clip: true 95 boundsBehavior: Flickable.StopAtBounds 96 97 ScrollBar.vertical: ScrollBar { id: verticalScrollBar } 98 99 delegate: Label { 100 readonly property string projectNamesString: projectNames.join(", ").replace(/.kdev4/g, "") 101 102 width: sessionsView.width - verticalScrollBar.width 103 height: visible ? 30 : 0 104 105 visible: projects.length > 0 106 107 text: display == "" ? projectNamesString : i18n("%1: %2", display, projectNamesString) 108 elide: Text.ElideRight 109 opacity: labelMouseArea.containsMouse ? 0.8 : 1 110 111 MouseArea { 112 id: labelMouseArea 113 114 anchors.fill: parent 115 116 hoverEnabled: true 117 cursorShape: Qt.PointingHandCursor 118 119 onClicked: sessionsModel.loadSession(uuid) 120 } 121 } 122 123 model: SessionsModel { id: sessionsModel } 124 125 header: Heading { 126 text: i18n("Sessions") 127 } 128 } 129 } 130} 131