2012-06-10 16:50:54 +00:00
|
|
|
/*
|
2024-09-17 19:00:25 +00:00
|
|
|
* Deskflow -- mouse and keyboard sharing utility
|
2024-10-31 03:04:26 +00:00
|
|
|
* Copyright (C) 2024 Chris Rizzitello <sithlord48@gmail.com>
|
2024-07-23 19:17:40 +00:00
|
|
|
* Copyright (C) 2012 Symless Ltd.
|
2012-06-10 16:50:54 +00:00
|
|
|
* Copyright (C) 2008 Volker Lanz (vl@fidra.de)
|
2024-07-02 19:07:06 +00:00
|
|
|
*
|
2012-06-10 16:50:54 +00:00
|
|
|
* This package is free software; you can redistribute it and/or
|
|
|
|
|
* modify it under the terms of the GNU General Public License
|
2015-05-03 02:33:52 +00:00
|
|
|
* found in the file LICENSE that should have accompanied this file.
|
2024-07-02 19:07:06 +00:00
|
|
|
*
|
2012-06-10 16:50:54 +00:00
|
|
|
* This package is distributed in the hope that it will be useful,
|
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
|
*
|
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
|
*/
|
|
|
|
|
|
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
|
|
|
|
2024-11-27 03:16:34 +00:00
|
|
|
#include "common/constants.h"
|
2024-08-10 00:48:27 +00:00
|
|
|
#include "gui/style_utils.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
|
|
|
#include <QDateTime>
|
2024-10-31 03:04:26 +00:00
|
|
|
#include <QHBoxLayout>
|
|
|
|
|
#include <QLabel>
|
|
|
|
|
#include <QPushButton>
|
|
|
|
|
#include <QStyle>
|
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);
|
|
|
|
|
|
|
|
|
|
ui->lblIcon->setPixmap(QPixmap(QIcon::fromTheme("deskflow").pixmap(QSize().scaled(pixmapSize, Qt::KeepAspectRatio))));
|
|
|
|
|
|
|
|
|
|
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
|
|
|
|
2024-11-27 04:54:14 +00:00
|
|
|
// Set up the displayed version number
|
2025-01-09 19:32:01 +00:00
|
|
|
auto versionString = QString(kVersion);
|
|
|
|
|
if (versionString.endsWith(QStringLiteral(".0"))) {
|
|
|
|
|
versionString.chop(2);
|
2024-11-27 04:54:14 +00:00
|
|
|
} else {
|
2025-01-09 19:32:01 +00:00
|
|
|
versionString.append(QStringLiteral(" (%1)").arg(kVersionGitSha));
|
2024-11-27 04:54:14 +00:00
|
|
|
}
|
2020-08-18 12:55:25 +00:00
|
|
|
|
2025-01-09 19:17:37 +00:00
|
|
|
ui->lblVersion->setText(versionString);
|
2024-08-07 14:05:18 +00:00
|
|
|
|
2025-01-09 19:17:37 +00:00
|
|
|
ui->lblDescription->setText(kAppDescription);
|
|
|
|
|
ui->lblCopyright->setText(kCopyright);
|
|
|
|
|
ui->lblImportantDevs->setText(QStringLiteral("%1\n").arg(s_awesomeDevs.join(", ")));
|
2012-07-29 01:01:33 +00:00
|
|
|
|
2025-01-09 19:17:37 +00:00
|
|
|
ui->btnOk->setDefault(true);
|
|
|
|
|
connect(ui->btnOk, &QPushButton::clicked, this, [this] { close(); });
|
2024-10-01 13:30:24 +00:00
|
|
|
|
2024-10-31 03:04:26 +00:00
|
|
|
adjustSize();
|
2025-01-09 19:17:37 +00:00
|
|
|
resize(QSize(parent->width() * 0.65, height()));
|
|
|
|
|
setMinimumSize(size());
|
2022-06-30 11:48:26 +00:00
|
|
|
}
|
2024-12-28 14:51:15 +00:00
|
|
|
|
|
|
|
|
void AboutDialog::copyVersionText()
|
|
|
|
|
{
|
2025-01-09 19:32:01 +00:00
|
|
|
QString infoString = QStringLiteral("Deskflow: %1 (%2)\nQt: %3\nSystem: %4")
|
|
|
|
|
.arg(kVersion, kVersionGitSha, qVersion(), QSysInfo::prettyProductName());
|
|
|
|
|
#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;
|