deskflow/src/apps/deskflow-gui/dialogs/AboutDialog.cpp

80 lines
2.7 KiB
C++
Raw Normal View History

2012-06-10 16:50:54 +00:00
/*
* Deskflow -- mouse and keyboard sharing utility
2024-10-31 03:04:26 +00:00
* Copyright (C) 2024 Chris Rizzitello <sithlord48@gmail.com>
* Copyright (C) 2012 Symless Ltd.
2012-06-10 16:50:54 +00:00
* Copyright (C) 2008 Volker Lanz (vl@fidra.de)
*
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
* found in the file LICENSE that should have accompanied this file.
*
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/>.
*/
#include "AboutDialog.h"
2025-01-09 19:17:37 +00:00
#include "ui_AboutDialog.h"
#include "common/constants.h"
#include "gui/style_utils.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("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);
// Set up the displayed version number
auto versionString = QString(kVersion);
if (versionString.endsWith(QStringLiteral(".0"))) {
versionString.chop(2);
} else {
versionString.append(QStringLiteral(" (%1)").arg(kVersionGitSha));
}
2025-01-09 19:17:37 +00:00
ui->lblVersion->setText(versionString);
Refactored core process management and IPC client (#7425) * Also ignore `command_pre` for Fedora itself * Improve warning message * Fixed layout issues on main window * Restore fusion theme for Windows dark mode * Further correct main window layout * Set CWD for launch on Windows to same dir as .env * Use signals for tray icon instead of callback * Reduce complexity for setting tray icon * Further reduce tray icon complexity * Reduce tray retry time * Fixed tray not showing on macOS * Refactor function names * Move tray icon to lib * Decouple server connection class * Move server connection to lib * Move client config to lib * Remove redundant forward declarations * Fixed some namespaces in the new lib * Move core process code to new class * Improve member names on new process class * Remove copy/pasta code * Move OSX helpers to lib * Add .mm to lib config * Fixed copyright * Improve reliability of log line handling * Fixed TLS certificate generate bugs * Remove client list * Refactor core process handling to fix various problems * Fixed process/connection status bugs * Fixed function signature issue on macOS * Fixed override warnings * Fixed string format warning * Save `wasStarted` state and use that instead * Use only filename in dialog * Use lambda for simple slot * Scroll to bottom if at bottome * Set value based on position before text added and set horizontal scroll too * Add 1px tollerance for Linux * Simplify start/stop mutex * Always stop service on restart * Increase scroll bottom threshold to 2 * Log warning instead of critical * Fixed long-standing dir CD-up hack * Remove include * Remove include * Fixed rogue dumbisense includes * Account for optional distro_like * Add QAction include to solve incomplete type * Remove rogue #pragma * Static cast log value * Solve event queue delete warning * Fixed integ test on Windows 10 * Reduce enum verbosity * Use static instance instead of global * Make function const * Use unique_ptr instead of new and delete, and made some functions const * Fixed smart pointer use * Fixed variable shadowing * Fixed wrong use of using * Fixed missing namespace using * Simplify TLS error handling * Improve UX around certificate errors and success * Decouple app config from core process through interface * First iteration of core process test * Mark dtor as override * Rename attach launch entry * Add TODO * Create proxy for process * Move IPC client to deps * Fixed warnings * Reorganize new GUI lib dir structure * Update includes to reflect new paths * Reorg GUI tests * Abstract IPC client * Refactor about screen * Fixed .ui warnings * Remove redundant include * Fixed typo * Fixed typos and add spelling * Fixed misleading function name * Improve comment * Improve code coverage for core process * Remove noisy log line * Make global const * Use default dtor * Use vector instead of new * Make ctor explicit * Make ctor explicit (2) * Use enum class * Fixed bad enum * Stub out core tool * Stub out dir operation * Extract byte functions * Add missing return path * Simplify byte/int functions * Fix truncation * Use ctor member assignment * Fixed segfault in process proxy * Fixed print warning * Make function const * Cleanup header * Fixed missing name * Update ChangeLog * Make more functions const
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(", ")));
2025-01-09 19:17:37 +00:00
ui->btnOk->setDefault(true);
connect(ui->btnOk, &QPushButton::clicked, this, [this] { close(); });
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());
}
void AboutDialog::copyVersionText()
{
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);
}
2025-01-09 19:17:37 +00:00
AboutDialog::~AboutDialog() = default;