1
mirror of https://invent.kde.org/network/falkon.git synced 2024-12-20 02:36:34 +01:00

License Viewer: Use Courier font + small visual tweaks

Added close button and changed default size
This commit is contained in:
nowrep 2013-08-25 23:50:24 +02:00
parent 0a3b8e4ad4
commit aeded87710
2 changed files with 37 additions and 5 deletions

View File

@ -18,18 +18,44 @@
#include "licenseviewer.h"
#include "qztools.h"
#include <QFont>
#include <QTextBrowser>
#include <QVBoxLayout>
#include <QDialogButtonBox>
LicenseViewer::LicenseViewer(QWidget* parent)
: QTextBrowser()
: QWidget()
{
setAttribute(Qt::WA_DeleteOnClose);
setWindowTitle(tr("License Viewer"));
resize(450, 500);
m_textBrowser = new QTextBrowser(this);
QFont serifFont = m_textBrowser->font();
serifFont.setFamily("Courier");
m_textBrowser->setFont(serifFont);
QDialogButtonBox* buttonBox = new QDialogButtonBox(this);
buttonBox->setStandardButtons(QDialogButtonBox::Close);
connect(buttonBox, SIGNAL(rejected()), this, SLOT(close()));
QVBoxLayout* l = new QVBoxLayout(this);
l->addWidget(m_textBrowser);
l->addWidget(buttonBox);
setLayout(l);
resize(600, 500);
QzTools::centerWidgetToParent(this, parent);
}
void LicenseViewer::setLicenseFile(const QString &fileName)
{
setText(QzTools::readAllFileContents(fileName));
m_textBrowser->setText(QzTools::readAllFileContents(fileName));
}
void LicenseViewer::setText(const QString &text)
{
m_textBrowser->setText(text);
}

View File

@ -18,11 +18,13 @@
#ifndef LICENSEVIEWER_H
#define LICENSEVIEWER_H
#include <QTextBrowser>
#include <QWidget>
#include "qz_namespace.h"
class QT_QUPZILLA_EXPORT LicenseViewer : public QTextBrowser
class QTextBrowser;
class QT_QUPZILLA_EXPORT LicenseViewer : public QWidget
{
Q_OBJECT
@ -30,6 +32,10 @@ public:
explicit LicenseViewer(QWidget* parent = 0);
void setLicenseFile(const QString &fileName);
void setText(const QString &text);
private:
QTextBrowser* m_textBrowser;
};
#endif // LICENSEVIEWER_H