versiondialog.cpp 4.15 KB
Newer Older
1
/**************************************************************************
con's avatar
con committed
2
3
4
**
** This file is part of Qt Creator
**
hjk's avatar
hjk committed
5
** Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
con's avatar
con committed
6
**
7
** Contact: Nokia Corporation (qt-info@nokia.com)
con's avatar
con committed
8
**
9
** Commercial Usage
10
**
11
12
13
14
** Licensees holding valid Qt Commercial licenses may use this file in
** accordance with the Qt Commercial License Agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and Nokia.
15
**
16
** GNU Lesser General Public License Usage
17
**
18
19
20
21
22
23
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 2.1 as published by the Free Software
** Foundation and appearing in the file LICENSE.LGPL included in the
** packaging of this file.  Please review the following information to
** ensure the GNU Lesser General Public License version 2.1 requirements
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
24
**
25
** If you are unsure which license is appropriate for your use, please
hjk's avatar
hjk committed
26
** contact the sales department at http://qt.nokia.com/contact.
con's avatar
con committed
27
**
28
**************************************************************************/
hjk's avatar
hjk committed
29

con's avatar
con committed
30
#include "versiondialog.h"
hjk's avatar
hjk committed
31

con's avatar
con committed
32
#include "coreconstants.h"
33
#include "icore.h"
con's avatar
con committed
34

hjk's avatar
hjk committed
35
#include <utils/qtcassert.h>
con's avatar
con committed
36
37
38

#include <QtCore/QDate>
#include <QtCore/QFile>
39
#include <QtCore/QSysInfo>
hjk's avatar
hjk committed
40
41

#include <QtGui/QDialogButtonBox>
con's avatar
con committed
42
43
44
45
46
#include <QtGui/QGridLayout>
#include <QtGui/QLabel>
#include <QtGui/QPushButton>
#include <QtGui/QTextBrowser>

hjk's avatar
hjk committed
47
48
49
50
using namespace Core;
using namespace Core::Internal;
using namespace Core::Constants;

hjk's avatar
hjk committed
51
52
VersionDialog::VersionDialog(QWidget *parent)
    : QDialog(parent)
con's avatar
con committed
53
54
55
{
    // We need to set the window icon explicitly here since for some reason the
    // application icon isn't used when the size of the dialog is fixed (at least not on X11/GNOME)
56
    setWindowIcon(QIcon(":/core/images/qtcreator_logo_128.png"));
con's avatar
con committed
57
58
59
60
61
62
63

    setWindowTitle(tr("About Qt Creator"));
    setWindowFlags(windowFlags() & ~Qt::WindowContextHelpButtonHint);
    QGridLayout *layout = new QGridLayout(this);
    layout->setSizeConstraint(QLayout::SetFixedSize);

    QString version = QLatin1String(IDE_VERSION_LONG);
64
65
66
67
68

    QString ideVersionDescription;
#ifdef IDE_VERSION_DESCRIPTION
    ideVersionDescription = tr("(%1)").arg(QLatin1String(IDE_VERSION_DESCRIPTION_STR));
#endif
con's avatar
con committed
69

70
    QString ideRev;
con's avatar
con committed
71
#ifdef IDE_REVISION
72
73
     //: This gets conditionally inserted as argument %8 into the description string.
     ideRev = tr("From revision %1<br/>").arg(QString::fromLatin1(IDE_REVISION_STR).left(10));
con's avatar
con committed
74
#endif
75
76

     const QString description = tr(
77
        "<h3>Qt Creator %1 %8</h3>"
78
        "Based on Qt %2 (%3 bit)<br/>"
con's avatar
con committed
79
        "<br/>"
80
        "Built on %4 at %5<br />"
con's avatar
con committed
81
        "<br/>"
82
        "%9"
83
84
        "<br/>"
        "Copyright 2008-%6 %7. All rights reserved.<br/>"
con's avatar
con committed
85
86
87
88
        "<br/>"
        "The program is provided AS IS with NO WARRANTY OF ANY KIND, "
        "INCLUDING THE WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A "
        "PARTICULAR PURPOSE.<br/>")
89
90
        .arg(version, 
             QLatin1String(QT_VERSION_STR), QString::number(QSysInfo::WordSize),
91
             QLatin1String(__DATE__), QLatin1String(__TIME__), QLatin1String(IDE_YEAR),
92
93
             (QLatin1String(IDE_AUTHOR)), ideVersionDescription,
             ideRev);
con's avatar
con committed
94
95
96
97
98
99
100
101

    QLabel *copyRightLabel = new QLabel(description);
    copyRightLabel->setWordWrap(true);
    copyRightLabel->setOpenExternalLinks(true);
    copyRightLabel->setTextInteractionFlags(Qt::TextBrowserInteraction);

    QDialogButtonBox *buttonBox = new QDialogButtonBox(QDialogButtonBox::Close);
    QPushButton *closeButton = buttonBox->button(QDialogButtonBox::Close);
hjk's avatar
hjk committed
102
    QTC_ASSERT(closeButton, /**/);
con's avatar
con committed
103
104
105
106
    buttonBox->addButton(closeButton, QDialogButtonBox::ButtonRole(QDialogButtonBox::RejectRole | QDialogButtonBox::AcceptRole));
    connect(buttonBox , SIGNAL(rejected()), this, SLOT(reject()));

    QLabel *logoLabel = new QLabel;
107
    logoLabel->setPixmap(QPixmap(QLatin1String(":/core/images/qtcreator_logo_128.png")));
con's avatar
con committed
108
109
110
111
    layout->addWidget(logoLabel , 0, 0, 1, 1);
    layout->addWidget(copyRightLabel, 0, 1, 4, 4);
    layout->addWidget(buttonBox, 4, 0, 1, 5);
}