2022-08-19 15:59:36 +02:00
|
|
|
// Copyright (C) 2016 The Qt Company Ltd.
|
2022-12-21 10:12:09 +01:00
|
|
|
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
|
2008-12-02 15:08:31 +01:00
|
|
|
|
2008-12-02 12:01:29 +01:00
|
|
|
#include "versiondialog.h"
|
2023-01-16 17:20:07 +01:00
|
|
|
|
|
|
|
|
#include "coreicons.h"
|
|
|
|
|
#include "coreplugintr.h"
|
2016-08-05 13:49:37 +02:00
|
|
|
#include "coreicons.h"
|
2023-01-16 17:20:07 +01:00
|
|
|
#include "icore.h"
|
2008-12-02 12:01:29 +01:00
|
|
|
|
2015-10-02 15:15:38 +02:00
|
|
|
#include <utils/algorithm.h>
|
2023-06-21 15:12:46 +02:00
|
|
|
#include <utils/appinfo.h>
|
2014-11-19 16:43:16 +01:00
|
|
|
#include <utils/hostosinfo.h>
|
2023-11-13 17:26:26 +01:00
|
|
|
#include <utils/layoutbuilder.h>
|
2008-12-09 15:25:01 +01:00
|
|
|
#include <utils/qtcassert.h>
|
2023-11-13 17:52:16 +01:00
|
|
|
#include <utils/stringutils.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>
|
2023-06-21 15:12:46 +02:00
|
|
|
#include <QGuiApplication>
|
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
|
|
|
|
2023-06-21 15:12:46 +02:00
|
|
|
setWindowTitle(Tr::tr("About %1").arg(QGuiApplication::applicationDisplayName()));
|
2008-12-02 12:01:29 +01:00
|
|
|
|
2023-11-13 17:26:26 +01:00
|
|
|
auto logoLabel = new QLabel;
|
|
|
|
|
logoLabel->setPixmap(Icons::QTCREATORLOGO_BIG.pixmap());
|
|
|
|
|
|
2023-11-14 18:00:47 +01:00
|
|
|
auto copyRightLabel = new QLabel(ICore::aboutInformationHtml());
|
2008-12-02 12:01:29 +01:00
|
|
|
copyRightLabel->setWordWrap(true);
|
|
|
|
|
copyRightLabel->setOpenExternalLinks(true);
|
|
|
|
|
copyRightLabel->setTextInteractionFlags(Qt::TextBrowserInteraction);
|
|
|
|
|
|
2023-11-13 17:26:26 +01:00
|
|
|
auto buttonBox = new QDialogButtonBox(QDialogButtonBox::Close);
|
2023-11-13 17:52:16 +01:00
|
|
|
QPushButton *copyButton = buttonBox->addButton(Tr::tr("Copy and Close"),
|
|
|
|
|
QDialogButtonBox::ApplyRole);
|
2008-12-02 12:01:29 +01:00
|
|
|
|
2023-11-13 17:26:26 +01:00
|
|
|
using namespace Layouting;
|
|
|
|
|
Column {
|
|
|
|
|
Row {
|
|
|
|
|
Column { logoLabel, st },
|
|
|
|
|
Column { copyRightLabel },
|
|
|
|
|
},
|
|
|
|
|
buttonBox,
|
|
|
|
|
}.attachTo(this);
|
|
|
|
|
|
|
|
|
|
layout()->setSizeConstraint(QLayout::SetFixedSize);
|
|
|
|
|
|
2023-11-13 17:52:16 +01:00
|
|
|
connect(copyButton, &QPushButton::pressed, this, [this] {
|
|
|
|
|
Utils::setClipboardAndSelection(ICore::aboutInformationCompact());
|
|
|
|
|
accept();
|
|
|
|
|
});
|
2023-11-13 17:26:26 +01:00
|
|
|
connect(buttonBox, &QDialogButtonBox::accepted, this, &QDialog::accept);
|
|
|
|
|
connect(buttonBox, &QDialogButtonBox::rejected, this, &QDialog::reject);
|
2008-12-02 12:01:29 +01:00
|
|
|
}
|
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);
|
|
|
|
|
}
|