1 /**************************************************************************
3 ** This file is part of Qt Creator
5 ** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies).
7 ** Contact: Nokia Corporation (qt-info@nokia.com)
11 ** This file contains pre-release code and may not be distributed.
12 ** You may use this file in accordance with the terms and conditions
13 ** contained in the Technology Preview License Agreement accompanying
16 ** GNU Lesser General Public License Usage
18 ** Alternatively, this file may be used under the terms of the GNU Lesser
19 ** General Public License version 2.1 as published by the Free Software
20 ** Foundation and appearing in the file LICENSE.LGPL included in the
21 ** packaging of this file. Please review the following information to
22 ** ensure the GNU Lesser General Public License version 2.1 requirements
23 ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
25 ** In addition, as a special exception, Nokia gives you certain additional
26 ** rights. These rights are described in the Nokia Qt LGPL Exception
27 ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
29 ** If you have questions regarding the use of this file, please contact
30 ** Nokia at qt-info@nokia.com.
32 **************************************************************************/
34 #include "versiondialog.h"
36 #include "coreconstants.h"
39 #include <utils/qtcassert.h>
41 #include <QtCore/QDate>
42 #include <QtCore/QFile>
43 #include <QtCore/QSysInfo>
45 #include <QtGui/QDialogButtonBox>
46 #include <QtGui/QGridLayout>
47 #include <QtGui/QLabel>
48 #include <QtGui/QPushButton>
49 #include <QtGui/QTextBrowser>
52 using namespace Core::Internal;
53 using namespace Core::Constants;
55 VersionDialog::VersionDialog(QWidget *parent)
58 // We need to set the window icon explicitly here since for some reason the
59 // application icon isn't used when the size of the dialog is fixed (at least not on X11/GNOME)
60 setWindowIcon(QIcon(QLatin1String(Constants::ICON_QTLOGO_128)));
62 setWindowTitle(tr("About Qt Creator"));
63 setWindowFlags(windowFlags() & ~Qt::WindowContextHelpButtonHint);
64 QGridLayout *layout = new QGridLayout(this);
65 layout->setSizeConstraint(QLayout::SetFixedSize);
67 QString version = QLatin1String(IDE_VERSION_LONG);
69 QString ideVersionDescription;
70 #ifdef IDE_VERSION_DESCRIPTION
71 ideVersionDescription = tr("(%1)").arg(QLatin1String(IDE_VERSION_DESCRIPTION_STR));
76 //: This gets conditionally inserted as argument %8 into the description string.
77 ideRev = tr("From revision %1<br/>").arg(QString::fromLatin1(IDE_REVISION_STR).left(10));
80 const QString description = tr(
81 "<h3>Qt Creator %1 %8</h3>"
82 "Based on Qt %2 (%3 bit)<br/>"
84 "Built on %4 at %5<br />"
88 "Copyright 2008-%6 %7. All rights reserved.<br/>"
90 "The program is provided AS IS with NO WARRANTY OF ANY KIND, "
91 "INCLUDING THE WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A "
92 "PARTICULAR PURPOSE.<br/>")
94 QLatin1String(QT_VERSION_STR), QString::number(QSysInfo::WordSize),
95 QLatin1String(__DATE__), QLatin1String(__TIME__), QLatin1String(IDE_YEAR),
96 (QLatin1String(IDE_AUTHOR)), ideVersionDescription,
99 QLabel *copyRightLabel = new QLabel(description);
100 copyRightLabel->setWordWrap(true);
101 copyRightLabel->setOpenExternalLinks(true);
102 copyRightLabel->setTextInteractionFlags(Qt::TextBrowserInteraction);
104 QDialogButtonBox *buttonBox = new QDialogButtonBox(QDialogButtonBox::Close);
105 QPushButton *closeButton = buttonBox->button(QDialogButtonBox::Close);
106 QTC_ASSERT(closeButton, /**/);
107 buttonBox->addButton(closeButton, QDialogButtonBox::ButtonRole(QDialogButtonBox::RejectRole | QDialogButtonBox::AcceptRole));
108 connect(buttonBox , SIGNAL(rejected()), this, SLOT(reject()));
110 QLabel *logoLabel = new QLabel;
111 logoLabel->setPixmap(QPixmap(QLatin1String(Constants::ICON_QTLOGO_128)));
112 layout->addWidget(logoLabel , 0, 0, 1, 1);
113 layout->addWidget(copyRightLabel, 0, 1, 4, 4);
114 layout->addWidget(buttonBox, 4, 0, 1, 5);