Files
qt-creator/src/plugins/coreplugin/versiondialog.cpp

115 lines
4.2 KiB
C++
Raw Normal View History

/**************************************************************************
2008-12-02 12:01:29 +01:00
**
** This file is part of Qt Creator
**
2011-01-11 16:28:15 +01:00
** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies).
2008-12-02 12:01:29 +01:00
**
2011-04-13 08:42:33 +02:00
** Contact: Nokia Corporation (info@qt.nokia.com)
2008-12-02 12:01:29 +01:00
**
**
** GNU Lesser General Public License Usage
**
2011-04-13 08:42:33 +02:00
** 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.
**
2010-12-17 16:01:08 +01:00
** In addition, as a special exception, Nokia gives you certain additional
2011-04-13 08:42:33 +02:00
** rights. These rights are described in the Nokia Qt LGPL Exception
2010-12-17 16:01:08 +01:00
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
2011-04-13 08:42:33 +02:00
** Other Usage
**
** Alternatively, this file may be used in accordance with the terms and
** conditions contained in a signed written agreement between you and Nokia.
**
2010-12-17 16:01:08 +01:00
** If you have questions regarding the use of this file, please contact
** Nokia at info@qt.nokia.com.
2008-12-02 12:01:29 +01:00
**
**************************************************************************/
2008-12-02 15:08:31 +01:00
2008-12-02 12:01:29 +01:00
#include "versiondialog.h"
2008-12-09 15:25:01 +01:00
2008-12-02 12:01:29 +01:00
#include "coreconstants.h"
#include "icore.h"
2008-12-02 12:01:29 +01:00
2008-12-09 15:25:01 +01:00
#include <utils/qtcassert.h>
2008-12-02 12:01:29 +01:00
#include <QtCore/QDate>
#include <QtCore/QFile>
#include <QtCore/QSysInfo>
2008-12-09 15:25:01 +01:00
#include <QtGui/QDialogButtonBox>
2008-12-02 12:01:29 +01:00
#include <QtGui/QGridLayout>
#include <QtGui/QLabel>
#include <QtGui/QPushButton>
#include <QtGui/QTextBrowser>
2008-12-09 15:25:01 +01:00
using namespace Core;
using namespace Core::Internal;
using namespace Core::Constants;
2008-12-02 15:08:31 +01:00
VersionDialog::VersionDialog(QWidget *parent)
: QDialog(parent)
2008-12-02 12:01:29 +01:00
{
// 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)
setWindowIcon(QIcon(QLatin1String(Constants::ICON_QTLOGO_128)));
2008-12-02 12:01:29 +01:00
setWindowTitle(tr("About Qt Creator"));
setWindowFlags(windowFlags() & ~Qt::WindowContextHelpButtonHint);
QGridLayout *layout = new QGridLayout(this);
layout->setSizeConstraint(QLayout::SetFixedSize);
QString version = QLatin1String(IDE_VERSION_LONG);
QString ideVersionDescription;
#ifdef IDE_VERSION_DESCRIPTION
ideVersionDescription = tr("(%1)").arg(QLatin1String(IDE_VERSION_DESCRIPTION_STR));
#endif
2008-12-02 12:01:29 +01:00
QString ideRev;
2008-12-02 12:01:29 +01:00
#ifdef IDE_REVISION
//: 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));
2008-12-02 12:01:29 +01:00
#endif
const QString description = tr(
"<h3>Qt Creator %1 %8</h3>"
"Based on Qt %2 (%3 bit)<br/>"
2008-12-02 12:01:29 +01:00
"<br/>"
"Built on %4 at %5<br />"
2008-12-02 12:01:29 +01:00
"<br/>"
"%9"
"<br/>"
"Copyright 2008-%6 %7. All rights reserved.<br/>"
2008-12-02 12:01:29 +01:00
"<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/>")
.arg(version,
QLatin1String(QT_VERSION_STR), QString::number(QSysInfo::WordSize),
QLatin1String(__DATE__), QLatin1String(__TIME__), QLatin1String(IDE_YEAR),
(QLatin1String(IDE_AUTHOR)), ideVersionDescription,
ideRev);
2008-12-02 12:01:29 +01:00
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);
2008-12-09 15:25:01 +01:00
QTC_ASSERT(closeButton, /**/);
2008-12-02 12:01:29 +01:00
buttonBox->addButton(closeButton, QDialogButtonBox::ButtonRole(QDialogButtonBox::RejectRole | QDialogButtonBox::AcceptRole));
connect(buttonBox , SIGNAL(rejected()), this, SLOT(reject()));
QLabel *logoLabel = new QLabel;
logoLabel->setPixmap(QPixmap(QLatin1String(Constants::ICON_QTLOGO_128)));
2008-12-02 12:01:29 +01:00
layout->addWidget(logoLabel , 0, 0, 1, 1);
layout->addWidget(copyRightLabel, 0, 1, 4, 4);
layout->addWidget(buttonBox, 4, 0, 1, 5);
}