keepassxc/src/gui/AboutDialog.cpp

102 lines
3.0 KiB
C++
Raw Normal View History

2012-05-02 09:37:21 -04:00
/*
* Copyright (C) 2012 Felix Geyer <debfx@fobos.de>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 2 or (at your option)
* version 3 of the License.
*
* This program 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"
#include "ui_AboutDialog.h"
#include "config-keepassx.h"
2015-07-18 03:05:26 -04:00
#include "version.h"
2012-07-18 14:44:28 -04:00
#include "core/FilePath.h"
#include "crypto/Crypto.h"
2012-05-02 09:37:21 -04:00
2017-02-22 18:45:57 -05:00
#include <QClipboard>
#include <QSysInfo>
2012-05-02 09:37:21 -04:00
AboutDialog::AboutDialog(QWidget* parent)
2017-02-22 18:45:57 -05:00
: QDialog(parent),
m_ui(new Ui::AboutDialog())
2012-05-02 09:37:21 -04:00
{
m_ui->setupUi(this);
2012-05-02 10:21:59 -04:00
2012-05-02 09:37:21 -04:00
m_ui->nameLabel->setText(m_ui->nameLabel->text() + " " + KEEPASSX_VERSION);
QFont nameLabelFont = m_ui->nameLabel->font();
nameLabelFont.setPointSize(nameLabelFont.pointSize() + 4);
m_ui->nameLabel->setFont(nameLabelFont);
2012-07-18 14:44:28 -04:00
m_ui->iconLabel->setPixmap(filePath()->applicationIcon().pixmap(48));
2012-05-02 10:21:59 -04:00
2015-07-18 03:05:26 -04:00
QString commitHash;
if (!QString(GIT_HEAD).isEmpty()) {
commitHash = GIT_HEAD;
}
else if (!QString(DIST_HASH).contains("Format")) {
commitHash = DIST_HASH;
}
2017-02-22 18:45:57 -05:00
QString debugInfo = "KeePassXC - ";
debugInfo.append(tr("Version %1\n").arg(KEEPASSX_VERSION));
2015-07-18 03:05:26 -04:00
if (!commitHash.isEmpty()) {
2017-02-22 18:45:57 -05:00
debugInfo.append(tr("Revision: %1").arg(commitHash).append("\n\n"));
2015-07-18 03:05:26 -04:00
}
2017-02-22 18:45:57 -05:00
debugInfo.append(QString("%1\n- Qt %2\n- %3\n\n")
.arg(tr("Libraries:"))
.arg(QString::fromLocal8Bit(qVersion()))
.arg(Crypto::backendVersion()));
debugInfo.append(tr("Operating system: %1 (version: %2)\nCPU architecture: %3\nKernel: %4 %5")
.arg(QSysInfo::prettyProductName())
.arg(QSysInfo::productVersion())
.arg(QSysInfo::currentCpuArchitecture())
.arg(QSysInfo::kernelType())
.arg(QSysInfo::kernelVersion()));
debugInfo.append("\n\n");
QString extensions;
#ifdef WITH_XC_HTTP
2017-02-22 18:45:57 -05:00
extensions += "\n- KeePassHTTP";
#endif
#ifdef WITH_XC_AUTOTYPE
2017-02-22 18:45:57 -05:00
extensions += "\n- Auto-Type";
#endif
#ifdef WITH_XC_YUBIKEY
2017-02-22 18:45:57 -05:00
extensions += "\n- YubiKey";
#endif
if (extensions.isEmpty())
2017-02-22 18:45:57 -05:00
extensions = " None";
debugInfo.append(tr("Enabled extensions:").append(extensions));
2017-02-22 18:45:57 -05:00
m_ui->debugInfo->setPlainText(debugInfo);
2012-05-02 09:37:21 -04:00
setAttribute(Qt::WA_DeleteOnClose);
connect(m_ui->buttonBox, SIGNAL(rejected()), SLOT(close()));
2017-02-22 18:45:57 -05:00
connect(m_ui->copyToClipboard, SIGNAL(clicked()), SLOT(copyToClipboard()));
2012-05-02 09:37:21 -04:00
}
AboutDialog::~AboutDialog()
{
}
2017-02-22 18:45:57 -05:00
void AboutDialog::copyToClipboard()
{
QClipboard* clipboard = QApplication::clipboard();
clipboard->setText(m_ui->debugInfo->toPlainText());
}