OSDN Git Service

Updated copyright year.
[x264-launcher/x264-launcher.git] / src / win_about.cpp
1 ///////////////////////////////////////////////////////////////////////////////
2 // Simple x264 Launcher
3 // Copyright (C) 2004-2022 LoRd_MuldeR <MuldeR2@GMX.de>
4 //
5 // This program is free software; you can redistribute it and/or modify
6 // it under the terms of the GNU General Public License as published by
7 // the Free Software Foundation; either version 2 of the License, or
8 // (at your option) any later version.
9 //
10 // This program is distributed in the hope that it will be useful,
11 // but WITHOUT ANY WARRANTY; without even the implied warranty of
12 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13 // GNU General Public License for more details.
14 //
15 // You should have received a copy of the GNU General Public License along
16 // with this program; if not, write to the Free Software Foundation, Inc.,
17 // 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
18 //
19 // http://www.gnu.org/licenses/gpl-2.0.txt
20 ///////////////////////////////////////////////////////////////////////////////
21
22 #include "win_about.h"
23 #include "UIC_win_about.h"
24
25 //Internal
26 #include "global.h"
27
28 //MUtils
29 #include <MUtils/Version.h>
30
31 //Qt
32 #include <QProcess>
33 #include <QScrollBar>
34 #include <QDate>
35 #include <QTimer>
36 #include <QMessageBox>
37
38 ///////////////////////////////////////////////////////////////////////////////
39 // Constructor & Destructor
40 ///////////////////////////////////////////////////////////////////////////////
41
42 AboutDialog::AboutDialog(QWidget *parent)
43 :
44         QDialog(parent),
45         ui(new Ui::AboutDialog())
46 {
47         //Init the dialog, from the .ui file
48         ui->setupUi(this);
49         setWindowFlags(windowFlags() | Qt::Tool);
50
51         //Fill in the template text
52         ui->labelAbout->setText(
53                 ui->labelAbout->text().arg(
54                         QString().sprintf("%u.%02u.%u", x264_version_major(),
55                         x264_version_minor(),
56                         x264_version_build()),
57                         QString::number(qMax(MUtils::Version::app_build_date().year(),QDate::currentDate().year())),
58                         MUtils::Version::app_build_date().toString(Qt::ISODate),
59                         MUtils::Version::app_build_time().toString(Qt::ISODate),
60                         MUtils::Version::compiler_version(),
61                         MUtils::Version::compiler_arch(),
62                         QString::fromLatin1(QT_VERSION_STR)
63                 )
64         );
65
66         //Enable hover
67         ui->labelGPL->setAttribute(Qt::WA_Hover, true);
68         ((QWidget*)ui->labelGPL->parent())->setAttribute(Qt::WA_Hover, true);
69         ((QWidget*)ui->labelGPL->parent()->parent())->setAttribute(Qt::WA_Hover, true);
70
71         //Switch to first tab
72         ui->tabWidget->setCurrentIndex(ui->tabWidget->indexOf(ui->tabAbout));
73
74         //Connect button
75         connect(ui->aboutQtButton, SIGNAL(clicked()), this, SLOT(showAboutQt()));
76 }
77
78 AboutDialog::~AboutDialog(void)
79 {
80         delete ui;
81 }
82
83 ///////////////////////////////////////////////////////////////////////////////
84 // Public Functions
85 ///////////////////////////////////////////////////////////////////////////////
86
87 /*None*/
88
89 ///////////////////////////////////////////////////////////////////////////////
90 // Events
91 ///////////////////////////////////////////////////////////////////////////////
92
93 void AboutDialog::showEvent(QShowEvent *event)
94 {
95         QDialog::showEvent(event);
96
97         //Fix dialog size - need to do this in Show event
98         const QSize hint = sizeHint();
99         setFixedSize(hint.isValid() ? hint : size());
100 }
101
102 ///////////////////////////////////////////////////////////////////////////////
103 // Slots
104 ///////////////////////////////////////////////////////////////////////////////
105
106 void AboutDialog::showAboutQt(void)
107 {
108         QMessageBox::aboutQt(this);
109 }