1
/****************************************************************************
3
** Copyright (C) 2005-2005 Trolltech AS. All rights reserved.
5
** This file is part of the designer application of the Qt Toolkit.
7
** This file may be distributed under the terms of the Q Public License
8
** as defined by Trolltech AS of Norway and appearing in the file
9
** LICENSE.QPL included in the packaging of this file.
11
** This file may be distributed and/or modified under the terms of the
12
** GNU General Public License version 2 as published by the Free Software
13
** Foundation and appearing in the file LICENSE.GPL included in the
14
** packaging of this file.
16
** See http://www.trolltech.com/pricing.html or email sales@trolltech.com for
17
** information about Qt Commercial License Agreements.
18
** See http://www.trolltech.com/qpl/ for QPL licensing information.
19
** See http://www.trolltech.com/gpl/ for GPL licensing information.
21
** Contact info@trolltech.com if any conditions of this licensing are
24
** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
25
** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
27
****************************************************************************/
29
#include <QtCore/QVector>
30
#include <QtGui/QMouseEvent>
31
#include <QtGui/QGridLayout>
32
#include <QtGui/QLabel>
33
#include <QtGui/QPushButton>
34
#include <QtGui/QPainter>
35
#include <QtGui/QPainterPath>
36
#include <QtGui/QStyleOption>
37
#include "versiondialog.h"
39
class VersionLabel : public QLabel
43
VersionLabel(QWidget *parent = 0);
49
void mousePressEvent(QMouseEvent *me);
50
void mouseMoveEvent(QMouseEvent *me);
51
void mouseReleaseEvent(QMouseEvent *me);
52
void paintEvent(QPaintEvent *pe);
54
QVector<QPoint> hitPoints;
55
QVector<QPoint> missPoints;
61
VersionLabel::VersionLabel(QWidget *parent)
62
: QLabel(parent), secondStage(false), m_pushed(false)
64
setPixmap(QPixmap(":/trolltech/designer/images/designer.png"));
65
hitPoints.append(QPoint(56, 25));
66
hitPoints.append(QPoint(29, 55));
67
hitPoints.append(QPoint(56, 87));
68
hitPoints.append(QPoint(82, 55));
69
hitPoints.append(QPoint(58, 56));
75
void VersionLabel::mousePressEvent(QMouseEvent *me)
77
if (me->button() == Qt::LeftButton) {
79
m_path = QPainterPath(me->pos());
87
void VersionLabel::mouseMoveEvent(QMouseEvent *me)
89
if (me->buttons() & Qt::LeftButton)
91
m_path.lineTo(me->pos());
94
void VersionLabel::mouseReleaseEvent(QMouseEvent *me)
96
if (me->button() == Qt::LeftButton) {
98
m_path.lineTo(me->pos());
101
foreach(pt, hitPoints) {
102
if (!m_path.contains(pt)) {
108
foreach(pt, missPoints) {
109
if (m_path.contains(pt)) {
115
if (gotIt && !secondStage) {
117
m_path = QPainterPath();
128
void VersionLabel::paintEvent(QPaintEvent *pe)
132
QStyleOptionButton opt;
135
opt.state |= QStyle::State_Raised;
137
opt.state |= QStyle::State_Sunken;
138
opt.state &= ~QStyle::State_HasFocus;
139
style()->drawControl(QStyle::CE_PushButtonBevel, &opt, &p, this);
141
QLabel::paintEvent(pe);
144
VersionDialog::VersionDialog(QWidget *parent)
151
QGridLayout *layout = new QGridLayout(this);
152
VersionLabel *label = new VersionLabel(this);
153
QLabel *lbl = new QLabel(this);
154
lbl->setText(tr("<h3>%1</h3>"
155
"<br/><br/>Version %2"
156
#if defined(QT_OPENSOURCE)
157
" Open Source Edition"
159
"<br/>Qt Designer is a graphical user interface designer "
160
"for Qt applications.<br/><br/>"
161
#if defined(QT_OPENSOURCE)
162
"This version of Qt Designer is part of the Qt Open Source Edition, for use "
163
"in the development of Open Source applications. "
164
"Qt is a comprehensive C++ framework for cross-platform application "
165
"development.<br/><br/>"
166
"You need a commercial Qt license for development of proprietary (closed "
167
"source) applications. Please see <tt>http://www.trolltech.com/company/model"
168
".html</tt> for an overview of Qt licensing.<br/>"
170
"This program is licensed to you under the terms of the "
171
"Qt Commercial License Agreement. For details, see the file LICENSE "
172
"that came with this software distribution.<br/>"
174
"<br/>Copyright 2000-2005 Trolltech AS. All rights reserved."
175
"<br/><br/>The program is provided AS IS with NO WARRANTY OF ANY KIND,"
176
" INCLUDING THE WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A"
177
" PARTICULAR PURPOSE.<br/> ").arg(tr("Qt Designer"))
178
.arg(QLatin1String(QT_VERSION_STR)));
179
lbl->setWordWrap(true);
180
QPushButton *cmd = new QPushButton("OK", this);
181
cmd->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed);
182
cmd->setDefault(true);
183
connect(cmd, SIGNAL(clicked()), this, SLOT(reject()));
184
connect(label, SIGNAL(triggered()), this, SLOT(accept()));
185
layout->addWidget(label, 0, 0, 1, 1);
186
layout->addWidget(lbl, 0, 1, 4, 4);
187
layout->addWidget(cmd, 4, 2, 1, 1);
190
VersionDialog::~VersionDialog()
194
#include "versiondialog.moc"