OSDN Git Service

Add automatic upgrade checking.
[neighbornote/NeighborNote.git] / src / cx / fbn / nevernote / dialog / PreviewDialog.java
1 /*\r
2  * This file is part of NeverNote \r
3  * Copyright 2009 Randy Baumgarte\r
4  * \r
5  * This file may be licensed under the terms of of the\r
6  * GNU General Public License Version 2 (the ``GPL'').\r
7  *\r
8  * Software distributed under the License is distributed\r
9  * on an ``AS IS'' basis, WITHOUT WARRANTY OF ANY KIND, either\r
10  * express or implied. See the GPL for the specific language\r
11  * governing rights and limitations.\r
12  *\r
13  * You should have received a copy of the GPL along with this\r
14  * program. If not, go to http://www.gnu.org/licenses/gpl.html\r
15  * or write to the Free Software Foundation, Inc.,\r
16  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.\r
17  *\r
18 */\r
19 \r
20 package cx.fbn.nevernote.dialog;\r
21 \r
22 import com.trolltech.qt.gui.QDialog;\r
23 import com.trolltech.qt.gui.QHBoxLayout;\r
24 import com.trolltech.qt.gui.QImage;\r
25 import com.trolltech.qt.gui.QPixmap;\r
26 import com.trolltech.qt.gui.QPushButton;\r
27 import com.trolltech.qt.gui.QScrollArea;\r
28 import com.trolltech.qt.gui.QVBoxLayout;\r
29 import com.trolltech.qt.gui.QWidget;\r
30 \r
31 import cx.fbn.nevernote.Global;\r
32 public class PreviewDialog extends QDialog {\r
33 \r
34         \r
35         public PreviewDialog(QWidget parent) {\r
36                 \r
37                 QWidget masterLabel = new QWidget();\r
38                 \r
39                 QVBoxLayout subLayout = new QVBoxLayout();\r
40                 setMouseTracking(true);\r
41                 \r
42                 PreviewImage imageLabel = new PreviewImage(masterLabel);\r
43                 imageLabel.ID = "Number 1";\r
44         QImage image = new QImage(Global.getFileManager().getResDirPath("thumbnail.png"));\r
45         imageLabel.setPixmap(QPixmap.fromImage(image).scaled(400, 400));\r
46         subLayout.addWidget(imageLabel);\r
47 \r
48                 PreviewImage imageLabel2 = new PreviewImage(masterLabel);\r
49                 imageLabel2.ID = "Number 2";\r
50                 QImage image2 = new QImage(Global.getFileManager().getResDirPath("thumbnail.png"));\r
51         imageLabel2.setPixmap(QPixmap.fromImage(image2).scaled(400,400));\r
52         subLayout.addWidget(imageLabel2);\r
53         masterLabel.setLayout(subLayout);\r
54 \r
55         QScrollArea scrollArea = new QScrollArea();\r
56         scrollArea.setWidget(masterLabel);\r
57                 \r
58                 QPushButton okButton = new QPushButton(tr("OK"));\r
59                 okButton.clicked.connect(this, "okPushed()");\r
60                 ;\r
61                 \r
62                 QVBoxLayout verticalLayout = new QVBoxLayout();\r
63                 verticalLayout.addWidget(scrollArea);\r
64                 \r
65                 QHBoxLayout buttonLayout = new QHBoxLayout();\r
66                 buttonLayout.addStretch(1);\r
67                 buttonLayout.addWidget(okButton);\r
68                 setWindowTitle(tr("Note Preview"));     \r
69                 \r
70                 QVBoxLayout mainLayout = new QVBoxLayout();\r
71                 mainLayout.addLayout(verticalLayout);\r
72                 mainLayout.addSpacing(1);\r
73                 mainLayout.addLayout(buttonLayout);\r
74                 setLayout(mainLayout);\r
75 \r
76         }\r
77         public void okPushed() {\r
78 \r
79                 close();\r
80         }\r
81                 \r
82 }\r