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 QString version(APP_VERSION);
46 if (version == "0.0.0.0") {
47 devText << "Development Build ";
48 devText << "Build date: " __DATE__;
49 } else if (version.startsWith("99.0.0")) {
50 devText << QString("Nightly Build (%1)").arg(APP_VERSION);
51 devText << "Build date: " __DATE__;
52 } else {
53 devText << tr("Version: %1", "Version Number in About Dialog").arg(APP_VERSION);
54 }
55 devText << ""; // An empty line
56
57#if defined(GIT_EXISTS)
58 devText << "commit: " S__GIT_COMMIT_HASH
59 << "date: " S__GIT_TIMESTAMP
60 << "";
61#endif
62
63 devText << QString("Operating System: %1").arg(QSysInfo::prettyProductName())
64 << QString("CPU Architecture: %1").arg(QSysInfo::buildCpuArchitecture());
65 if(QString(qVersion()) == QT_VERSION_STR)
66 {
67 devText << QString("Qt Version: %1").arg(QT_VERSION_STR);
68 }
69 else
70 {
71 devText << QString("Compile-Time Qt Version: %1").arg(QT_VERSION_STR)
72 << QString("Runtime Qt Version: %1").arg(qVersion());
73 }
74 ui->devInfoText->setText(devText.join("<br>"));
75
76 QPushButton* copyToClipboardButton = new QPushButton(tr("Copy to clipboard", "Copy system info from About Dialog"));
77 connect(copyToClipboardButton, &QPushButton::clicked, this, [devText]
78 {
79 QApplication::clipboard()->setText(devText.join("\n"));
80 });
81 ui->buttonBox->addButton(copyToClipboardButton, QDialogButtonBox::ActionRole);
82}
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 Fri Feb 27 2026 07:33:49 for Pencil2D by doxygen 1.9.6 based on revision e1e2bc04715617e3bb4d4796f67a4493290639ca