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 //**********************************************
\r
23 //**********************************************
\r
24 //* Show a full screen preview of the note. This
\r
25 //* isn't really used much any more.
\r
26 //**********************************************
\r
27 //**********************************************
\r
31 import com.trolltech.qt.gui.QDialog;
\r
32 import com.trolltech.qt.gui.QHBoxLayout;
\r
33 import com.trolltech.qt.gui.QImage;
\r
34 import com.trolltech.qt.gui.QPixmap;
\r
35 import com.trolltech.qt.gui.QPushButton;
\r
36 import com.trolltech.qt.gui.QScrollArea;
\r
37 import com.trolltech.qt.gui.QVBoxLayout;
\r
38 import com.trolltech.qt.gui.QWidget;
\r
40 import cx.fbn.nevernote.Global;
\r
41 public class PreviewDialog extends QDialog {
\r
44 public PreviewDialog(QWidget parent) {
\r
46 QWidget masterLabel = new QWidget();
\r
48 QVBoxLayout subLayout = new QVBoxLayout();
\r
49 setMouseTracking(true);
\r
51 PreviewImage imageLabel = new PreviewImage(masterLabel);
\r
52 imageLabel.ID = "Number 1";
\r
53 QImage image = new QImage(Global.getFileManager().getResDirPath("thumbnail.png"));
\r
54 imageLabel.setPixmap(QPixmap.fromImage(image).scaled(400, 400));
\r
55 subLayout.addWidget(imageLabel);
\r
57 PreviewImage imageLabel2 = new PreviewImage(masterLabel);
\r
58 imageLabel2.ID = "Number 2";
\r
59 QImage image2 = new QImage(Global.getFileManager().getResDirPath("thumbnail.png"));
\r
60 imageLabel2.setPixmap(QPixmap.fromImage(image2).scaled(400,400));
\r
61 subLayout.addWidget(imageLabel2);
\r
62 masterLabel.setLayout(subLayout);
\r
64 QScrollArea scrollArea = new QScrollArea();
\r
65 scrollArea.setWidget(masterLabel);
\r
67 QPushButton okButton = new QPushButton(tr("OK"));
\r
68 okButton.clicked.connect(this, "okPushed()");
\r
71 QVBoxLayout verticalLayout = new QVBoxLayout();
\r
72 verticalLayout.addWidget(scrollArea);
\r
74 QHBoxLayout buttonLayout = new QHBoxLayout();
\r
75 buttonLayout.addStretch(1);
\r
76 buttonLayout.addWidget(okButton);
\r
77 setWindowTitle(tr("Note Preview"));
\r
79 QVBoxLayout mainLayout = new QVBoxLayout();
\r
80 mainLayout.addLayout(verticalLayout);
\r
81 mainLayout.addSpacing(1);
\r
82 mainLayout.addLayout(buttonLayout);
\r
83 setLayout(mainLayout);
\r
86 public void okPushed() {
\r