4d78ec77b3d171684fbb1d8f27a6cb025a2a7a78
[lichviet] / qml / LichViet / FileBrowser.qml
1 /*
2 Copyright (C) 2011  by Cuong Le <metacuong@gmail.com>
3
4 This program is free software: you can redistribute it and/or modify
5 it under the terms of the GNU General Public License as published by
6 the Free Software Foundation, either version 2 of the License, or
7 (at your option) any later version.
8
9 This program is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12 GNU General Public License for more details.
13
14 You should have received a copy of the GNU General Public License
15 along with this program.  If not, see <http://www.gnu.org/licenses/>
16 */
17
18 import QtQuick 1.0
19
20 Item{
21
22 Rectangle {
23     id: rectangle1
24     anchors.fill: parent; anchors.bottomMargin: 0
25     visible: true
26     opacity:0.9
27     color:"white"
28
29     ListModel{
30         id:img
31
32         function list(){
33             while(img.count>0) img.remove(img.count-1);
34             var limg = Controller.getImages("/home/cuongle");
35             for (var i=0;i<limg.length;i++)
36                 append({name:limg[i]})
37         }
38     }
39
40     GridView {
41         anchors.fill: parent;anchors.topMargin: 35;anchors.leftMargin: 5;anchors.rightMargin: 5;anchors.bottomMargin: 12
42         model: img
43         delegate: Column {
44             Image { source:  "file:"+name; anchors.horizontalCenter: parent.horizontalCenter; width:100;height:100; }
45             Text { text: "-"; anchors.horizontalCenter: parent.horizontalCenter }
46         }
47     }
48
49
50 }
51
52 ToolBar { id: toolBar; height: 50;
53     y: screen.height-78
54     width: parent.width;
55     button1Label: "Đồng Ý"
56     button2Label: "Hủy Bỏ"
57     onButton1Clicked:
58     {
59         screen.state="menuscreen"
60     }
61     onButton2Clicked: {
62         screen.state="menuscreen"
63     }
64 }
65
66 function refresh(){
67     img.list();
68 }
69
70 }