1 /****************************************************************************
3 ** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
4 ** All rights reserved.
5 ** Contact: Nokia Corporation (qt-info@nokia.com)
7 ** This file is part of the QtDeclarative module of the Qt Toolkit.
9 ** $QT_BEGIN_LICENSE:LGPL$
10 ** GNU Lesser General Public License Usage
11 ** This file may be used under the terms of the GNU Lesser General Public
12 ** License version 2.1 as published by the Free Software Foundation and
13 ** appearing in the file LICENSE.LGPL included in the packaging of this
14 ** file. Please review the following information to ensure the GNU Lesser
15 ** General Public License version 2.1 requirements will be met:
16 ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
18 ** In addition, as a special exception, Nokia gives you certain additional
19 ** rights. These rights are described in the Nokia Qt LGPL Exception
20 ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
22 ** GNU General Public License Usage
23 ** Alternatively, this file may be used under the terms of the GNU General
24 ** Public License version 3.0 as published by the Free Software Foundation
25 ** and appearing in the file LICENSE.GPL included in the packaging of this
26 ** file. Please review the following information to ensure the GNU General
27 ** Public License version 3.0 requirements will be met:
28 ** http://www.gnu.org/copyleft/gpl.html.
31 ** Alternatively, this file may be used in accordance with the terms and
32 ** conditions contained in a signed written agreement between you and Nokia.
40 ****************************************************************************/
43 import Qt.labs.folderlistmodel 1.0
47 property bool showFocusHighlight: false
48 property variant folders: folders1
49 property variant view: view1
56 nameFilters: [ "*.qml" ]
57 folder: qmlViewerFolder
61 nameFilters: [ "*.qml" ]
62 folder: qmlViewerFolder
65 SystemPalette { id: palette }
68 if (folders == folders1) {
71 view1.state = "exitLeft";
75 view2.state = "exitLeft";
78 view.state = "current";
80 folders.folder = path;
83 var path = folders.parentFolder;
84 if (folders == folders1) {
87 view1.state = "exitRight";
91 view2.state = "exitRight";
94 view.state = "current";
96 folders.folder = path;
98 function keyPressed(key) {
104 root.showFocusHighlight = true;
117 if (folders.isFolder(index)) {
120 qmlViewer.launch(filePath);
127 id: highlight; visible: false
129 color: palette.highlight
131 GradientStop { id: t1; position: 0.0; color: palette.highlight }
132 GradientStop { id: t2; position: 1.0; color: Qt.lighter(palette.highlight) }
136 width: 48; height: 48
137 Image { source: "images/folder.png"; anchors.centerIn: parent; visible: folders.isFolder(index)}
141 anchors.fill: parent; verticalAlignment: Text.AlignVCenter
143 anchors.leftMargin: 54
145 color: (wrapper.ListView.isCurrentItem && root.showFocusHighlight) ? palette.highlightedText : palette.windowText
146 elide: Text.ElideRight
152 root.showFocusHighlight = false;
153 wrapper.ListView.view.currentIndex = index;
155 onClicked: { if (folders == wrapper.ListView.view.model) launch() }
160 when: mouseRegion.pressed
161 PropertyChanges { target: highlight; visible: true }
162 PropertyChanges { target: nameText; color: palette.highlightedText }
170 anchors.top: titleBar.bottom
171 anchors.bottom: parent.bottom
175 delegate: folderDelegate
176 highlight: Rectangle {
177 color: palette.highlight
178 visible: root.showFocusHighlight && view1.count != 0
180 GradientStop { id: t1; position: 0.0; color: palette.highlight }
181 GradientStop { id: t2; position: 1.0; color: Qt.lighter(palette.highlight) }
183 width: view1.currentItem == null ? 0 : view1.currentItem.width
185 highlightMoveSpeed: 1000
192 PropertyChanges { target: view1; x: 0 }
196 PropertyChanges { target: view1; x: -root.width }
200 PropertyChanges { target: view1; x: root.width }
206 SequentialAnimation {
207 NumberAnimation { properties: "x"; duration: 250 }
211 NumberAnimation { properties: "x"; duration: 250 }
212 NumberAnimation { properties: "x"; duration: 250 }
215 Keys.onPressed: root.keyPressed(event.key)
220 anchors.top: titleBar.bottom
221 anchors.bottom: parent.bottom
225 delegate: folderDelegate
226 highlight: Rectangle {
227 color: palette.highlight
228 visible: root.showFocusHighlight && view2.count != 0
230 GradientStop { id: t1; position: 0.0; color: palette.highlight }
231 GradientStop { id: t2; position: 1.0; color: Qt.lighter(palette.highlight) }
233 width: view1.currentItem == null ? 0 : view1.currentItem.width
235 highlightMoveSpeed: 1000
240 PropertyChanges { target: view2; x: 0 }
244 PropertyChanges { target: view2; x: -root.width }
248 PropertyChanges { target: view2; x: root.width }
254 SequentialAnimation {
255 NumberAnimation { properties: "x"; duration: 250 }
259 NumberAnimation { properties: "x"; duration: 250 }
262 Keys.onPressed: root.keyPressed(event.key)
266 root.keyPressed(event.key);
267 if (event.key == Qt.Key_Return || event.key == Qt.Key_Select || event.key == Qt.Key_Right) {
268 view.currentItem.launch();
269 event.accepted = true;
270 } else if (event.key == Qt.Key_Left) {
276 source: "images/titlebar.sci";
285 height: titleBar.height - 7
288 Image { anchors.centerIn: parent; source: "images/up.png" }
289 MouseArea { id: upRegion; anchors.centerIn: parent
292 onClicked: if (folders.parentFolder != "") up()
297 when: upRegion.pressed
298 PropertyChanges { target: upButton; color: palette.highlight }
310 anchors.left: upButton.right; anchors.right: parent.right; height: parent.height
311 anchors.leftMargin: 4; anchors.rightMargin: 4
314 elide: Text.ElideLeft; horizontalAlignment: Text.AlignRight; verticalAlignment: Text.AlignVCenter