/* ============================================================
* QupZilla - WebKit based browser
* Copyright (C) 2010-2011 David Rosca
*
* 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 3 of the License, or
* (at your option) any later version.
*
* 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 .
* ============================================================ */
#include "aboutdialog.h"
#include "ui_aboutdialog.h"
#include "qupzilla.h"
#include "webview.h"
#include "webpage.h"
#include "qtwin.h"
AboutDialog::AboutDialog(QWidget* parent) :
QDialog(parent),
ui(new Ui::AboutDialog)
{
ui->setupUi(this);
#ifdef Q_WS_WIN
if (QtWin::isCompositionEnabled()) {
QtWin::extendFrameIntoClientArea(this);
ui->verticalLayout->setContentsMargins(0, 0, 0, 0);
}
#endif
connect(ui->buttonBox, SIGNAL(clicked(QAbstractButton*)), this, SLOT(close()));
connect(ui->authorsButton, SIGNAL(clicked()), this, SLOT(buttonClicked()));
showAbout();
}
void AboutDialog::buttonClicked()
{
if (ui->authorsButton->text() == tr("Authors and Contributors"))
showAuthors();
else if (ui->authorsButton->text() == tr("< About QupZilla"))
showAbout();
}
void AboutDialog::showAbout()
{
ui->authorsButton->setText(tr("Authors and Contributors"));
if (m_aboutHtml.isEmpty()) {
m_aboutHtml.append("
");
m_aboutHtml.append(tr("
Application version %1
").arg(QupZilla::VERSION));
m_aboutHtml.append(tr("WebKit version %1
").arg(QupZilla::WEBKITVERSION));
m_aboutHtml.append(tr("
© %1 %2
All rights reserved.
").arg(QupZilla::COPYRIGHT, QupZilla::AUTHOR));
m_aboutHtml.append(tr("Build time: %1
").arg(QupZilla::BUILDTIME));
m_aboutHtml.append(QString("
%1
").arg(QupZilla::WWWADDRESS));
m_aboutHtml.append("
"+mApp->getWindow()->weView()->webPage()->userAgentForUrl(QUrl())+"
");
m_aboutHtml.append("
");
}
ui->textBrowser->setHtml(m_aboutHtml);
}
void AboutDialog::showAuthors()
{
ui->authorsButton->setText(tr("< About QupZilla"));
if (m_authorsHtml.isEmpty()) {
m_authorsHtml.append("");
m_authorsHtml.append(tr("
Main developers:
%1 <%2>
").arg(QupZilla::AUTHOR, "
nowrep@gmail.com"));
m_authorsHtml.append(tr("
Contributors:
%1
").arg("Daniele Cocca
Jan Rajnoha"));
m_authorsHtml.append(tr("
Translators:
%1
").arg("Heimen Stoffels (Dutch)
"
"Peter Vacula (Slovakia)
"
"Jonathan Hooverman (German)
"
"Unink-Lio (Chinese)
"
"Federico Fabiani (Italy)
"
"Francesco Marinucci (Italy)"
));
m_authorsHtml.append("
");
}
ui->textBrowser->setHtml(m_authorsHtml);
}
AboutDialog::~AboutDialog()
{
delete ui;
}