2 * This file is part of NeverNote
\r
3 * Copyright 2009 Randy Baumgarte
\r
5 * This file may be licensed under the terms of of the
\r
6 * GNU General Public License Version 2 (the ``GPL'').
\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
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
20 package cx.fbn.nevernote.dialog;
\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
31 import cx.fbn.nevernote.Global;
\r
32 public class PreviewDialog extends QDialog {
\r
35 public PreviewDialog(QWidget parent) {
\r
37 QWidget masterLabel = new QWidget();
\r
39 QVBoxLayout subLayout = new QVBoxLayout();
\r
40 setMouseTracking(true);
\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
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
55 QScrollArea scrollArea = new QScrollArea();
\r
56 scrollArea.setWidget(masterLabel);
\r
58 QPushButton okButton = new QPushButton(tr("OK"));
\r
59 okButton.clicked.connect(this, "okPushed()");
\r
62 QVBoxLayout verticalLayout = new QVBoxLayout();
\r
63 verticalLayout.addWidget(scrollArea);
\r
65 QHBoxLayout buttonLayout = new QHBoxLayout();
\r
66 buttonLayout.addStretch(1);
\r
67 buttonLayout.addWidget(okButton);
\r
68 setWindowTitle(tr("Note Preview"));
\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
77 public void okPushed() {
\r