deskflow/src/lib/gui/dialogs/AboutDialog.cpp

65 lines
2.2 KiB
C++
Raw Normal View History

2012-06-10 16:50:54 +00:00
/*
* Deskflow -- mouse and keyboard sharing utility
* 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
*/
#include "AboutDialog.h"
2025-01-09 19:17:37 +00:00
#include "ui_AboutDialog.h"
#include "VersionInfo.h"
#include "common/Constants.h"
2024-10-31 03:04:26 +00:00
#include <QClipboard>
Improve UI design and reduce over-use of `#ifdef` (#7413) * Rename `LicenseManager` to `License` * Rename `LicenseManager` to `License` * Move License class to gui lib * Rename license related classes * Refactor serial key parsing * Don't fail fast on containers * Move licensed product name from config to code * Fixed formatting * Update code coverage generator and fixed args * WIP: Converting license to chrono * WIP: Fixed compile errors, tests failing * Fixed all serial key and license tests * Disable verbose logging * Add missing </p> * Add missing include * Revert code coverage config * Handle parse errors * Move more classes into the new gui lib and improve license/serial object ownership * WIP: Fixing signal/slots in MainWindow * Fixed slot for about to quit * Rename manual slots to solve auto-connection warnings * Fixed logging issue * By default, don't close to tray * Add .env support and furthe refactor license code, also fixed some copyright dates * Remove test code * Fixed memory error in .env parser and refactor more licensing display code * Fixed color inconsistencies * Fixed link colors and made log view expand * Disable server components rather than hiding * Reset years of blind UI layout fiddling * Fixed clean Qt task * Only show notice when time limited * Fixed main window layout * Show connected clients * Set 15 spacing * Auto connect on start * More intentional screen size * Fixed tests related to license * Tests for expiry notifications * Reorg tests and remove death test * Update gtest * Tests for dotenv parser * Test command process * What the heck is that doing there? * Merge constants headers * Fixed magic includes * Remove helper function * Remove comment * Remove extern decl * Update ChangeLog
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>
Improve UI design and reduce over-use of `#ifdef` (#7413) * Rename `LicenseManager` to `License` * Rename `LicenseManager` to `License` * Move License class to gui lib * Rename license related classes * Refactor serial key parsing * Don't fail fast on containers * Move licensed product name from config to code * Fixed formatting * Update code coverage generator and fixed args * WIP: Converting license to chrono * WIP: Fixed compile errors, tests failing * Fixed all serial key and license tests * Disable verbose logging * Add missing </p> * Add missing include * Revert code coverage config * Handle parse errors * Move more classes into the new gui lib and improve license/serial object ownership * WIP: Fixing signal/slots in MainWindow * Fixed slot for about to quit * Rename manual slots to solve auto-connection warnings * Fixed logging issue * By default, don't close to tray * Add .env support and furthe refactor license code, also fixed some copyright dates * Remove test code * Fixed memory error in .env parser and refactor more licensing display code * Fixed color inconsistencies * Fixed link colors and made log view expand * Disable server components rather than hiding * Reset years of blind UI layout fiddling * Fixed clean Qt task * Only show notice when time limited * Fixed main window layout * Show connected clients * Set 15 spacing * Auto connect on start * More intentional screen size * Fixed tests related to license * Tests for expiry notifications * Reorg tests and remove death test * Update gtest * Tests for dotenv parser * Test command process * What the heck is that doing there? * Merge constants headers * Fixed magic includes * Remove helper function * Remove comment * Remove extern decl * Update ChangeLog
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>()}
{
2025-01-09 19:17:37 +00:00
ui->setupUi(this);
2024-10-12 22:03:09 +00:00
const int px = (fontMetrics().height() * 6);
const QSize pixmapSize(px, px);
ui->lblIcon->setFixedSize(pixmapSize);
ui->lblIcon->setPixmap(QPixmap(QIcon::fromTheme(kAppId).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);
ui->lblVersion->setText(kDisplayVersion);
2025-01-09 19:17:37 +00:00
ui->lblDescription->setText(kAppDescription);
ui->lblCopyright->setText(kCopyright);
// 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("&nbsp;")));
}
ui->lblImportantDevs->setTextFormat(Qt::RichText);
ui->lblImportantDevs->setText(QStringLiteral("%1\n").arg(devsNbsp.join(", ")));
2025-01-09 19:17:37 +00:00
ui->btnOk->setDefault(true);
connect(ui->btnOk, &QPushButton::clicked, this, &AboutDialog::close);
}
void AboutDialog::copyVersionText() const
{
QString infoString = QStringLiteral("%1: %2 (%3)\nQt: %4\nSystem: %5")
.arg(kAppName, 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);
}
2025-01-09 19:17:37 +00:00
AboutDialog::~AboutDialog() = default;