Warning, /graphics/krita/libs/libqml/qml/WelcomePage.qml is written in an unsupported language. File is not indexed.
0001 /* This file is part of the KDE project 0002 * SPDX-FileCopyrightText: 2012 Arjen Hiemstra <ahiemstra@heimr.nl> 0003 * 0004 * SPDX-License-Identifier: GPL-2.0-or-later 0005 */ 0006 0007 import QtQuick 2.3 0008 import org.krita.sketch 1.0 0009 import org.krita.sketch.components 1.0 0010 import "panels" 0011 0012 Page { 0013 property string pageName: "WelcomePage" 0014 0015 Rectangle { 0016 anchors.fill: parent; 0017 color: Settings.theme.color("pages/welcome/background"); 0018 } 0019 0020 // Header { 0021 // id: header; 0022 0023 // anchors { 0024 // top: parent.top; 0025 // left: parent.left; 0026 // right: parent.right; 0027 // } 0028 0029 // text: (window.applicationName !== undefined) ? window.applicationName : "KRITA SKETCH"; 0030 0031 // leftArea: Image { 0032 // width: Constants.GridWidth * 0.5; 0033 // height: parent.height; 0034 // source: Settings.theme.image("kritasketch.png"); 0035 // fillMode: Image.PreserveAspectFit; 0036 0037 // sourceSize.width: width; 0038 // } 0039 0040 // rightArea: [ 0041 // Button { 0042 // id: minimizeButton; 0043 0044 // anchors.verticalCenter: parent.verticalCenter; 0045 // width: Constants.GridWidth * 0.75; 0046 // height: Constants.GridHeight * 0.75; 0047 0048 // tooltip: "Minimize"; 0049 0050 // image: Settings.theme.icon("minimize"); 0051 // onClicked: Krita.Window.minimize(); 0052 // }, 0053 // Button { 0054 // id: closeButton; 0055 0056 // anchors.verticalCenter: parent.verticalCenter; 0057 // width: Constants.GridWidth * 0.75; 0058 // height: Constants.GridHeight * 0.75; 0059 0060 // tooltip: "Close"; 0061 0062 // image: Settings.theme.icon("close"); 0063 // onClicked: Krita.Window.close(); 0064 // } 0065 // ] 0066 0067 // Image { 0068 // anchors.fill: parent; 0069 // source: Settings.theme.image("header_krita_sketch_light.png"); 0070 // } 0071 // } 0072 0073 Row { 0074 id: headersRow; 0075 anchors.top: header.bottom; 0076 width: parent.width; 0077 0078 Rectangle { 0079 height: Constants.GridHeight; 0080 width: parent.width / 3; 0081 0082 gradient: Gradient { 0083 GradientStop { 0084 position: 0 0085 color: Settings.theme.color("pages/welcome/open/header/start"); 0086 } 0087 0088 0089 GradientStop { 0090 position: 1 0091 color: Settings.theme.color("pages/welcome/open/header/stop"); 0092 } 0093 } 0094 0095 0096 Label { 0097 anchors { 0098 left: parent.left; 0099 leftMargin: Constants.DefaultMargin; 0100 verticalCenter: parent.verticalCenter; 0101 } 0102 text: "Recent Images"; 0103 font: Settings.theme.font("title"); 0104 color: Settings.theme.color("pages/welcome/open/header/text"); 0105 } 0106 0107 Shadow { width: parent.width; height: Constants.GridHeight / 8; anchors.top: parent.bottom; } 0108 } 0109 0110 Rectangle { 0111 height: Constants.GridHeight; 0112 width: parent.width / 3; 0113 0114 gradient: Gradient { 0115 GradientStop { 0116 position: 0 0117 color: Settings.theme.color("pages/welcome/create/header/start"); 0118 } 0119 0120 0121 GradientStop { 0122 position: 1 0123 color: Settings.theme.color("pages/welcome/create/header/stop"); 0124 } 0125 } 0126 0127 Label { 0128 anchors { 0129 left: parent.left; 0130 leftMargin: Constants.DefaultMargin; 0131 verticalCenter: parent.verticalCenter; 0132 } 0133 text: "Create New"; 0134 font: Settings.theme.font("title"); 0135 color: Settings.theme.color("pages/welcome/create/header/text"); 0136 } 0137 0138 Shadow { width: parent.width; height: Constants.GridHeight / 8; anchors.top: parent.bottom; } 0139 } 0140 0141 Rectangle { 0142 height: Constants.GridHeight; 0143 width: parent.width / 3; 0144 0145 gradient: Gradient { 0146 GradientStop { 0147 position: 0 0148 color: Settings.theme.color("pages/welcome/news/header/start"); 0149 } 0150 0151 0152 GradientStop { 0153 position: 1 0154 color: Settings.theme.color("pages/welcome/news/header/stop"); 0155 } 0156 } 0157 0158 Label { 0159 anchors { 0160 left: parent.left; 0161 leftMargin: Constants.DefaultMargin; 0162 verticalCenter: parent.verticalCenter; 0163 } 0164 text: "Community News"; 0165 font: Settings.theme.font("title"); 0166 color: Settings.theme.color("pages/welcome/news/header/text"); 0167 } 0168 0169 Shadow { width: parent.width; height: Constants.GridHeight / 8; anchors.top: parent.bottom; } 0170 } 0171 } 0172 0173 Row { 0174 id: listsRow; 0175 anchors.bottom: parent.bottom; 0176 width: parent.width; 0177 0178 RecentFilesList { 0179 width: parent.width / 3 - 4; 0180 height: Constants.GridHeight * (Constants.GridRows - 3); 0181 0182 onClicked: d.openImage(file); 0183 } 0184 0185 Divider { height: Constants.GridHeight * (Constants.GridRows - 3); } 0186 0187 NewImageList { 0188 width: parent.width / 3 - 8; 0189 height: Constants.GridHeight * (Constants.GridRows - 3); 0190 onClicked: d.createNewImage(options); 0191 } 0192 0193 Divider { height: Constants.GridHeight * (Constants.GridRows - 3); } 0194 0195 NewsList { 0196 width: parent.width / 3 - 4; 0197 height: Constants.GridHeight * (Constants.GridRows - 3); 0198 } 0199 } 0200 0201 QtObject { 0202 id: d; 0203 0204 property bool mainPageActive: false; 0205 0206 function createNewImage(options) { 0207 if(options !== undefined) { 0208 if(options.template !== undefined) { 0209 Settings.currentFile = Krita.ImageBuilder.createImageFromTemplate(options); 0210 Settings.temporaryFile = true; 0211 } else if(options.source === undefined) { 0212 Settings.currentFile = Krita.ImageBuilder.createBlankImage(options); 0213 Settings.temporaryFile = true; 0214 } else if(options.source == "clipboard") { 0215 Settings.currentFile = Krita.ImageBuilder.createImageFromClipboard(); 0216 Settings.temporaryFile = true; 0217 } 0218 } else { 0219 pageStack.push(customImagePage); 0220 } 0221 } 0222 0223 function openImage(file) { 0224 if(file !== "") { 0225 Settings.currentFile = file; 0226 } else { 0227 pageStack.push(openImagePage); 0228 } 0229 } 0230 } 0231 0232 Connections { 0233 target: Settings; 0234 0235 onCurrentFileChanged: if (!d.mainPageActive) { 0236 d.mainPageActive = true; 0237 pageStack.push( main ); 0238 } 0239 } 0240 Component { id: main; MainPage { } } 0241 Component { id: help; HelpPage { } } 0242 Component { id: openImagePage; OpenImagePage { onFinished: { pageStack.pop(); d.openImage(file); } } } 0243 Component { id: customImagePage; CustomImagePage { onFinished: d.createNewImage(options); } } 0244 0245 }