2012-10-02 09:12:39 +02:00
|
|
|
/****************************************************************************
|
2008-12-02 12:01:29 +01:00
|
|
|
**
|
2016-01-15 14:57:40 +01:00
|
|
|
** Copyright (C) 2016 The Qt Company Ltd.
|
|
|
|
|
** Contact: https://www.qt.io/licensing/
|
2008-12-02 12:01:29 +01:00
|
|
|
**
|
2012-10-02 09:12:39 +02:00
|
|
|
** This file is part of Qt Creator.
|
2008-12-02 12:01:29 +01:00
|
|
|
**
|
2012-10-02 09:12:39 +02:00
|
|
|
** Commercial License Usage
|
|
|
|
|
** Licensees holding valid commercial Qt licenses may use this file in
|
|
|
|
|
** accordance with the commercial license agreement provided with the
|
|
|
|
|
** Software or, alternatively, in accordance with the terms contained in
|
2016-01-15 14:57:40 +01:00
|
|
|
** a written agreement between you and The Qt Company. For licensing terms
|
|
|
|
|
** and conditions see https://www.qt.io/terms-conditions. For further
|
|
|
|
|
** information use the contact form at https://www.qt.io/contact-us.
|
2008-12-02 14:17:16 +01:00
|
|
|
**
|
2016-01-15 14:57:40 +01:00
|
|
|
** GNU General Public License Usage
|
|
|
|
|
** Alternatively, this file may be used under the terms of the GNU
|
|
|
|
|
** General Public License version 3 as published by the Free Software
|
|
|
|
|
** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
|
|
|
|
|
** included in the packaging of this file. Please review the following
|
|
|
|
|
** information to ensure the GNU General Public License requirements will
|
|
|
|
|
** be met: https://www.gnu.org/licenses/gpl-3.0.html.
|
2010-12-17 16:01:08 +01:00
|
|
|
**
|
2012-10-02 09:12:39 +02:00
|
|
|
****************************************************************************/
|
2008-12-02 15:08:31 +01:00
|
|
|
|
2008-12-02 12:01:29 +01:00
|
|
|
#include "versiondialog.h"
|
2016-08-05 13:49:37 +02:00
|
|
|
#include "coreicons.h"
|
2008-12-02 12:01:29 +01:00
|
|
|
|
2011-08-30 15:57:00 +02:00
|
|
|
#include <app/app_version.h>
|
2015-11-23 16:41:54 +01:00
|
|
|
#include <coreplugin/coreicons.h>
|
2013-05-24 16:45:49 +02:00
|
|
|
#include <coreplugin/icore.h>
|
2015-10-02 15:15:38 +02:00
|
|
|
#include <utils/algorithm.h>
|
2014-11-19 16:43:16 +01:00
|
|
|
#include <utils/hostosinfo.h>
|
2008-12-09 15:25:01 +01:00
|
|
|
#include <utils/qtcassert.h>
|
2016-08-03 17:55:54 +02:00
|
|
|
#include <utils/utilsicons.h>
|
2008-12-02 12:01:29 +01:00
|
|
|
|
2012-02-15 10:42:41 +01:00
|
|
|
#include <QDialogButtonBox>
|
|
|
|
|
#include <QGridLayout>
|
2013-06-25 12:10:04 +02:00
|
|
|
#include <QKeyEvent>
|
2012-02-15 10:42:41 +01:00
|
|
|
#include <QLabel>
|
|
|
|
|
#include <QPushButton>
|
2008-12-02 12:01:29 +01:00
|
|
|
|
2008-12-09 15:25:01 +01:00
|
|
|
using namespace Core;
|
|
|
|
|
using namespace Core::Internal;
|
|
|
|
|
|
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)
|
2014-11-19 16:43:16 +01:00
|
|
|
if (Utils::HostOsInfo::isLinuxHost())
|
2016-08-05 13:49:37 +02:00
|
|
|
setWindowIcon(Icons::QTCREATORLOGO_BIG.icon());
|
2008-12-02 12:01:29 +01:00
|
|
|
|
2017-08-29 11:48:48 +02:00
|
|
|
setWindowTitle(tr("About %1").arg(Core::Constants::IDE_DISPLAY_NAME));
|
2018-07-21 21:11:46 +02:00
|
|
|
auto layout = new QGridLayout(this);
|
2008-12-02 12:01:29 +01:00
|
|
|
layout->setSizeConstraint(QLayout::SetFixedSize);
|
|
|
|
|
|
2009-06-02 19:35:30 +02:00
|
|
|
QString ideRev;
|
2008-12-02 12:01:29 +01:00
|
|
|
#ifdef IDE_REVISION
|
2020-02-07 11:54:19 +01:00
|
|
|
//: This gets conditionally inserted as argument %8 into the description string.
|
|
|
|
|
const QString revUrl = QString::fromLatin1(Constants::IDE_REVISION_URL_STR);
|
|
|
|
|
const QString rev = QString::fromLatin1(Constants::IDE_REVISION_STR).left(10);
|
|
|
|
|
ideRev = tr("<br/>From revision %1<br/>")
|
|
|
|
|
.arg(revUrl.isEmpty() ? rev
|
|
|
|
|
: QString::fromLatin1("<a href=\"%1\">%2</a>").arg(revUrl, rev));
|
2008-12-02 12:01:29 +01:00
|
|
|
#endif
|
2015-02-03 08:34:38 +01:00
|
|
|
QString buildDateInfo;
|
|
|
|
|
#ifdef QTC_SHOW_BUILD_DATE
|
2015-10-01 11:59:23 +02:00
|
|
|
buildDateInfo = tr("<br/>Built on %1 %2<br/>").arg(QLatin1String(__DATE__), QLatin1String(__TIME__));
|
2015-02-03 08:34:38 +01:00
|
|
|
#endif
|
|
|
|
|
|
2015-10-02 15:15:38 +02:00
|
|
|
const QString br = QLatin1String("<br/>");
|
|
|
|
|
const QStringList additionalInfoLines = ICore::additionalAboutInformation();
|
2015-10-09 13:37:54 +03:00
|
|
|
const QString additionalInfo =
|
|
|
|
|
QStringList(Utils::transform(additionalInfoLines, &QString::toHtmlEscaped)).join(br);
|
2009-06-02 19:35:30 +02:00
|
|
|
|
2015-10-02 15:15:38 +02:00
|
|
|
const QString description = tr(
|
2013-05-24 16:45:49 +02:00
|
|
|
"<h3>%1</h3>"
|
|
|
|
|
"%2<br/>"
|
2015-02-03 08:34:38 +01:00
|
|
|
"%3"
|
|
|
|
|
"%4"
|
2015-10-02 15:15:38 +02:00
|
|
|
"%5"
|
2009-06-02 19:35:30 +02:00
|
|
|
"<br/>"
|
2015-10-02 15:15:38 +02:00
|
|
|
"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/>")
|
2013-05-24 16:45:49 +02:00
|
|
|
.arg(ICore::versionString(),
|
|
|
|
|
ICore::buildCompatibilityString(),
|
2015-02-03 08:34:38 +01:00
|
|
|
buildDateInfo,
|
2013-05-24 16:45:49 +02:00
|
|
|
ideRev,
|
2015-10-02 15:15:38 +02:00
|
|
|
additionalInfo.isEmpty() ? QString() : br + additionalInfo + br,
|
2013-05-24 16:45:49 +02:00
|
|
|
QLatin1String(Constants::IDE_YEAR),
|
|
|
|
|
QLatin1String(Constants::IDE_AUTHOR));
|
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);
|
2011-07-29 12:00:11 +02:00
|
|
|
QTC_CHECK(closeButton);
|
2008-12-02 12:01:29 +01:00
|
|
|
buttonBox->addButton(closeButton, QDialogButtonBox::ButtonRole(QDialogButtonBox::RejectRole | QDialogButtonBox::AcceptRole));
|
2016-02-02 09:10:54 +02:00
|
|
|
connect(buttonBox , &QDialogButtonBox::rejected, this, &QDialog::reject);
|
2008-12-02 12:01:29 +01:00
|
|
|
|
|
|
|
|
QLabel *logoLabel = new QLabel;
|
2016-08-05 13:49:37 +02:00
|
|
|
logoLabel->setPixmap(Icons::QTCREATORLOGO_BIG.pixmap());
|
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);
|
|
|
|
|
}
|
2013-06-25 12:10:04 +02:00
|
|
|
|
|
|
|
|
bool VersionDialog::event(QEvent *event)
|
|
|
|
|
{
|
|
|
|
|
if (event->type() == QEvent::ShortcutOverride) {
|
2018-07-21 21:11:46 +02:00
|
|
|
auto ke = static_cast<QKeyEvent *>(event);
|
2013-06-25 12:10:04 +02:00
|
|
|
if (ke->key() == Qt::Key_Escape && !ke->modifiers()) {
|
|
|
|
|
ke->accept();
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return QDialog::event(event);
|
|
|
|
|
}
|