Pencil2D Animation
Download Community News Docs Contribute
  • Overview
  • Articles
  • Code
  •  
  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
  • File List
Loading...
Searching...
No Matches
  • app
  • src
aboutdialog.cpp
1/*
2
3Pencil2D - Traditional Animation Software
4Copyright (C) 2012-2020 Matthew Chiawen Chang
5
6This program is free software; you can redistribute it and/or
7modify it under the terms of the GNU General Public License
8as published by the Free Software Foundation; version 2 of the License.
9
10This program is distributed in the hope that it will be useful,
11but WITHOUT ANY WARRANTY; without even the implied warranty of
12MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13GNU General Public License for more details.
14
15*/
16
17#include "aboutdialog.h"
18#include "ui_aboutdialog.h"
19
20#include <QPushButton>
21#include <QSysInfo>
22#include <QClipboard>
23
24#include "pencildef.h"
25
26
27AboutDialog::AboutDialog(QWidget* parent) :
28 QDialog(parent),
29 ui(new Ui::AboutDialog)
30{
31 ui->setupUi(this);
32
33 setWindowFlags(Qt::Dialog | Qt::WindowTitleHint | Qt::WindowCloseButtonHint);
34}
35
36AboutDialog::~AboutDialog()
37{
38 delete ui;
39}
40
41void AboutDialog::init()
42{
43 QStringList devText;
44
45#if defined(PENCIL2D_RELEASE_BUILD)
46 devText << tr("Version: %1", "Version Number in About Dialog").arg(APP_VERSION);
47#elif defined(PENCIL2D_NIGHTLY_BUILD)
48 devText << "Nightly Build " __DATE__;
49#else
50 devText << "Development Build " __DATE__;
51#endif
52
53 devText << ""; // An empty line
54
55#if defined(GIT_EXISTS)
56 devText << "commit: " S__GIT_COMMIT_HASH
57 << "date: " S__GIT_TIMESTAMP
58 << "";
59#endif
60
61 devText << QString("Operating System: %1").arg(QSysInfo::prettyProductName())
62 << QString("CPU Architecture: %1").arg(QSysInfo::buildCpuArchitecture());
63 if(QString(qVersion()) == QT_VERSION_STR)
64 {
65 devText << QString("Qt Version: %1").arg(QT_VERSION_STR);
66 }
67 else
68 {
69 devText << QString("Compile-Time Qt Version: %1").arg(QT_VERSION_STR)
70 << QString("Runtime Qt Version: %1").arg(qVersion());
71 }
72 ui->devInfoText->setText(devText.join("<br>"));
73
74 QPushButton* copyToClipboardButton = new QPushButton(tr("Copy to clipboard", "Copy system info from About Dialog"));
75 connect(copyToClipboardButton, &QPushButton::clicked, this, [devText]
76 {
77 QApplication::clipboard()->setText(devText.join("\n"));
78 });
79 ui->buttonBox->addButton(copyToClipboardButton, QDialogButtonBox::ActionRole);
80}
AboutDialog
Definition: aboutdialog.h:27
QAbstractButton::clicked
void clicked(bool checked)
QClipboard::setText
void setText(const QString &text, QClipboard::Mode mode)
QDialog
QDialogButtonBox::ActionRole
ActionRole
QGuiApplication::clipboard
QClipboard * clipboard()
QObject::connect
QMetaObject::Connection connect(const QObject *sender, const char *signal, const QObject *receiver, const char *method, Qt::ConnectionType type)
QObject::tr
QString tr(const char *sourceText, const char *disambiguation, int n)
QPushButton
QString
QString::arg
QString arg(qlonglong a, int fieldWidth, int base, QChar fillChar) const const
QStringList
QStringList::join
QString join(const QString &separator) const const
QSysInfo::buildCpuArchitecture
QString buildCpuArchitecture()
QSysInfo::prettyProductName
QString prettyProductName()
Qt::Dialog
Dialog
QWidget
QWidget::setupUi
void setupUi(QWidget *widget)
Generated on Thu May 8 2025 04:47:53 for Pencil2D by doxygen 1.9.6 based on revision 4513250b1d5b1a3676ec0e67b06b7a885ceaae39