2012-06-10 16:50:54 +00:00
|
|
|
/*
|
2024-09-17 19:00:25 +00:00
|
|
|
* Deskflow -- mouse and keyboard sharing utility
|
2025-01-24 00:11:17 +00:00
|
|
|
* SPDX-FileCopyrightText: (C) 2024 Chris Rizzitello <sithlord48@gmail.com>
|
|
|
|
|
* SPDX-FileCopyrightText: (C) 2012 - 2016 Symless Ltd.
|
|
|
|
|
* SPDX-FileCopyrightText: (C) 2008 Volker Lanz <vl@fidra.de>
|
|
|
|
|
* SPDX-License-Identifier: GPL-2.0-only WITH LicenseRef-OpenSSL-Exception
|
2012-06-10 16:50:54 +00:00
|
|
|
*/
|
|
|
|
|
|
2022-09-13 15:31:45 +00:00
|
|
|
#include "AboutDialog.h"
|
2025-01-09 19:17:37 +00:00
|
|
|
#include "ui_AboutDialog.h"
|
2024-08-10 00:48:27 +00:00
|
|
|
|
2025-07-19 01:30:31 +00:00
|
|
|
#include "VersionInfo.h"
|
2025-03-19 22:14:27 +00:00
|
|
|
#include "common/Constants.h"
|
2024-07-23 19:17:40 +00:00
|
|
|
|
2024-10-31 03:04:26 +00:00
|
|
|
#include <QClipboard>
|
2024-07-26 22:53:52 +00:00
|
|
|
|
2025-01-09 19:17:37 +00:00
|
|
|
AboutDialog::AboutDialog(QWidget *parent) : QDialog(parent), ui{std::make_unique<Ui::AboutDialog>()}
|
2024-10-17 18:04:35 +00:00
|
|
|
{
|
2025-01-09 19:17:37 +00:00
|
|
|
ui->setupUi(this);
|
2024-10-12 22:03:09 +00:00
|
|
|
|
2025-01-13 03:51:24 +00:00
|
|
|
const int px = (fontMetrics().height() * 6);
|
|
|
|
|
const QSize pixmapSize(px, px);
|
|
|
|
|
ui->lblIcon->setFixedSize(pixmapSize);
|
|
|
|
|
|
2025-10-25 14:56:04 +00:00
|
|
|
ui->lblIcon->setPixmap(QPixmap(QIcon::fromTheme(kRevFqdnName).pixmap(QSize().scaled(pixmapSize, Qt::KeepAspectRatio)))
|
|
|
|
|
);
|
2025-01-13 03:51:24 +00:00
|
|
|
|
|
|
|
|
ui->btnCopyVersion->setIcon(QIcon::fromTheme(QIcon::ThemeIcon::EditCopy));
|
2025-01-09 19:17:37 +00:00
|
|
|
connect(ui->btnCopyVersion, &QPushButton::clicked, this, &AboutDialog::copyVersionText);
|
2024-11-27 03:16:34 +00:00
|
|
|
|
2025-03-06 22:15:39 +00:00
|
|
|
ui->lblVersion->setText(kDisplayVersion);
|
2025-01-09 19:17:37 +00:00
|
|
|
ui->lblDescription->setText(kAppDescription);
|
|
|
|
|
ui->lblCopyright->setText(kCopyright);
|
2025-06-18 12:25:01 +00:00
|
|
|
|
|
|
|
|
// Use non-breaking space in each awesome dev name so names are not split across lines.
|
|
|
|
|
QStringList devsNbsp;
|
|
|
|
|
for (const auto &dev : s_awesomeDevs) {
|
|
|
|
|
QString withNbsp = dev;
|
|
|
|
|
devsNbsp.append(withNbsp.replace(" ", QStringLiteral(" ")));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
ui->lblImportantDevs->setTextFormat(Qt::RichText);
|
|
|
|
|
ui->lblImportantDevs->setText(QStringLiteral("%1\n").arg(devsNbsp.join(", ")));
|
2012-07-29 01:01:33 +00:00
|
|
|
|
2025-01-09 19:17:37 +00:00
|
|
|
ui->btnOk->setDefault(true);
|
2025-06-19 12:52:46 +00:00
|
|
|
connect(ui->btnOk, &QPushButton::clicked, this, &AboutDialog::close);
|
2022-06-30 11:48:26 +00:00
|
|
|
}
|
2024-12-28 14:51:15 +00:00
|
|
|
|
2025-05-20 02:19:19 +00:00
|
|
|
void AboutDialog::copyVersionText() const
|
2024-12-28 14:51:15 +00:00
|
|
|
{
|
2025-10-17 21:50:46 +00:00
|
|
|
QString infoString = QStringLiteral("%1: %2 (%3)\nQt: %4\nSystem: %5")
|
|
|
|
|
.arg(kAppName, kVersion, kVersionGitSha, qVersion(), QSysInfo::prettyProductName());
|
2025-01-09 19:32:01 +00:00
|
|
|
#ifdef Q_OS_LINUX
|
|
|
|
|
infoString.append(QStringLiteral("\nSession: %1 (%2)")
|
|
|
|
|
.arg(qEnvironmentVariable("XDG_CURRENT_DESKTOP"), qEnvironmentVariable("XDG_SESSION_TYPE")));
|
|
|
|
|
#endif
|
|
|
|
|
QGuiApplication::clipboard()->setText(infoString);
|
2024-12-28 14:51:15 +00:00
|
|
|
}
|
2025-01-09 19:17:37 +00:00
|
|
|
|
|
|
|
|
AboutDialog::~AboutDialog() = default;
|