File indexing completed on 2024-05-12 04:58:11

0001 /* ============================================================
0002 * Falkon - Qt web browser
0003 * Copyright (C) 2010-2018 David Rosca <nowrep@gmail.com>
0004 *
0005 * This program is free software: you can redistribute it and/or modify
0006 * it under the terms of the GNU General Public License as published by
0007 * the Free Software Foundation, either version 3 of the License, or
0008 * (at your option) any later version.
0009 *
0010 * This program is distributed in the hope that it will be useful,
0011 * but WITHOUT ANY WARRANTY; without even the implied warranty of
0012 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
0013 * GNU General Public License for more details.
0014 *
0015 * You should have received a copy of the GNU General Public License
0016 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
0017 * ============================================================ */
0018 #include "aboutdialog.h"
0019 #include "ui_aboutdialog.h"
0020 #include "browserwindow.h"
0021 #include "mainapplication.h"
0022 #include "webpage.h"
0023 #include "useragentmanager.h"
0024 #include "../config.h"
0025 
0026 #include <QWebEnginePage>
0027 #include <QWebEngineProfile>
0028 #include <QtWebEngineCoreVersion>
0029 
0030 AboutDialog::AboutDialog(QWidget* parent)
0031     : QDialog(parent)
0032     , ui(new Ui::AboutDialog)
0033 {
0034     setAttribute(Qt::WA_DeleteOnClose);
0035 
0036     ui->setupUi(this);
0037     ui->label->setPixmap(QIcon(QSL(":icons/other/about.svg")).pixmap(QSize(256, 100) * 1.1));
0038 
0039     showAbout();
0040 }
0041 
0042 AboutDialog::~AboutDialog()
0043 {
0044     delete ui;
0045 }
0046 
0047 void AboutDialog::showAbout()
0048 {
0049     QString aboutHtml;
0050     aboutHtml += QSL("<div style='margin:0px 20px;'>");
0051     aboutHtml += tr("<p><b>Application version %1</b><br/>").arg(
0052 #ifdef FALKON_GIT_REVISION
0053                        QString(QSL("%1 (%2)")).arg(QString::fromLatin1(Qz::VERSION), QL1S(FALKON_GIT_REVISION))
0054 #else
0055                        QString::fromLatin1(Qz::VERSION)
0056 #endif
0057                    );
0058     aboutHtml += tr("<b>QtWebEngine version %1</b></p>").arg(QStringLiteral(QTWEBENGINECORE_VERSION_STR));
0059     aboutHtml += QStringLiteral("<p>&copy; %1 %2<br/>").arg(QString::fromLatin1(Qz::COPYRIGHT), QString::fromLatin1(Qz::AUTHOR));
0060     aboutHtml += QStringLiteral("<a href=%1>%1</a></p>").arg(QString::fromLatin1(Qz::WWWADDRESS));
0061     aboutHtml += QStringLiteral("<p>") + mApp->userAgentManager()->defaultUserAgent() + QStringLiteral("</p>");
0062     aboutHtml += QStringLiteral("</div>");
0063     ui->textLabel->setText(aboutHtml);
0064     setFixedHeight(sizeHint().height());
0065 }