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"
|
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
|
|
|
|
2024-10-31 03:04:26 +00:00
|
|
|
AboutDialog::AboutDialog(QWidget *parent) : QDialog(parent)
|
2024-10-17 18:04:35 +00:00
|
|
|
{
|
2024-10-31 03:04:26 +00:00
|
|
|
setWindowTitle(tr("About Deskflow"));
|
2024-10-12 22:03:09 +00:00
|
|
|
|
2024-10-31 03:04:26 +00:00
|
|
|
auto copyIcon = QIcon::fromTheme(
|
|
|
|
|
QIcon::ThemeIcon::EditCopy, deskflow::gui::isDarkMode() ? QIcon(s_darkCopy) : QIcon(s_lightCopy)
|
|
|
|
|
);
|
2024-08-07 14:05:18 +00:00
|
|
|
|
2024-10-31 03:04:26 +00:00
|
|
|
auto btnCopyVersion = new QPushButton(copyIcon, QString(), this);
|
|
|
|
|
btnCopyVersion->setFlat(true);
|
2024-12-28 14:51:15 +00:00
|
|
|
connect(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
|
2024-12-28 14:51:15 +00:00
|
|
|
m_versionString = QString(kVersion);
|
|
|
|
|
if (m_versionString.endsWith(QStringLiteral(".0"))) {
|
|
|
|
|
m_versionString.chop(2);
|
2024-11-27 04:54:14 +00:00
|
|
|
} else {
|
2024-12-28 14:51:15 +00:00
|
|
|
m_versionString.append(QStringLiteral(" (%1)").arg(kVersionGitSha));
|
2024-11-27 04:54:14 +00:00
|
|
|
}
|
2020-08-18 12:55:25 +00:00
|
|
|
|
2024-10-31 03:04:26 +00:00
|
|
|
auto versionLayout = new QHBoxLayout();
|
|
|
|
|
versionLayout->addWidget(new QLabel(tr("Version:")));
|
2024-12-28 14:51:15 +00:00
|
|
|
versionLayout->addWidget(new QLabel(m_versionString, this));
|
2024-10-31 03:04:26 +00:00
|
|
|
versionLayout->addWidget(btnCopyVersion);
|
|
|
|
|
versionLayout->addSpacerItem(new QSpacerItem(0, 0, QSizePolicy::Expanding, QSizePolicy::Fixed));
|
2024-08-07 14:05:18 +00:00
|
|
|
|
2024-10-31 03:04:26 +00:00
|
|
|
auto lblLogo = new QLabel(this);
|
|
|
|
|
lblLogo->setPixmap(deskflow::gui::isDarkMode() ? s_darkLogo : s_lightLogo);
|
2012-07-29 01:01:33 +00:00
|
|
|
|
2024-11-27 04:01:58 +00:00
|
|
|
auto lblCopyright = new QLabel(kCopyright, this);
|
2024-10-01 13:30:24 +00:00
|
|
|
|
2024-10-31 03:04:26 +00:00
|
|
|
auto boldFont = font();
|
|
|
|
|
boldFont.setBold(true);
|
2020-08-18 12:55:25 +00:00
|
|
|
|
2024-10-31 03:04:26 +00:00
|
|
|
auto lblDevsTitle = new QLabel(tr("Important developers"));
|
|
|
|
|
lblDevsTitle->setFont(boldFont);
|
2022-09-13 15:31:45 +00:00
|
|
|
|
2024-10-31 03:04:26 +00:00
|
|
|
auto lblDevsBody = new QLabel(QStringLiteral("%1\n").arg(s_awesomeDevs.join(", ")));
|
|
|
|
|
lblDevsBody->setWordWrap(true);
|
2020-12-21 11:09:52 +00:00
|
|
|
|
2024-10-31 03:04:26 +00:00
|
|
|
auto btnOk = new QPushButton(tr("Ok"), this);
|
|
|
|
|
btnOk->setDefault(true);
|
|
|
|
|
connect(btnOk, &QPushButton::clicked, this, [this] { close(); });
|
2024-10-01 13:30:24 +00:00
|
|
|
|
2024-10-31 03:04:26 +00:00
|
|
|
auto mainLayout = new QVBoxLayout();
|
|
|
|
|
mainLayout->addWidget(lblLogo);
|
|
|
|
|
mainLayout->addLayout(versionLayout);
|
|
|
|
|
mainLayout->addWidget(new QLabel(tr("Keyboard and mouse sharing application"), this));
|
|
|
|
|
mainLayout->addWidget(lblCopyright);
|
|
|
|
|
mainLayout->addWidget(lblDevsTitle);
|
|
|
|
|
mainLayout->addWidget(lblDevsBody);
|
|
|
|
|
mainLayout->addWidget(btnOk);
|
2022-06-30 11:48:26 +00:00
|
|
|
|
2024-10-31 03:04:26 +00:00
|
|
|
setLayout(mainLayout);
|
|
|
|
|
adjustSize();
|
|
|
|
|
setFixedSize(size());
|
2022-06-30 11:48:26 +00:00
|
|
|
}
|
2024-12-28 14:51:15 +00:00
|
|
|
|
|
|
|
|
void AboutDialog::copyVersionText()
|
|
|
|
|
{
|
|
|
|
|
QGuiApplication::clipboard()->setText(m_versionString);
|
|
|
|
|
}
|