Convert to use private pointer for ui object

This commit is contained in:
Chocobo1
2019-02-25 00:31:39 +08:00
parent bb041c0eca
commit e5dca50025
8 changed files with 88 additions and 57 deletions

View File

@@ -36,21 +36,22 @@
#include "ui_aboutdialog.h"
#include "utils.h"
class AboutDialog : public QDialog, private Ui::AboutDialog
class AboutDialog : public QDialog
{
Q_OBJECT
public:
AboutDialog(QWidget *parent)
: QDialog(parent)
, m_ui(new Ui::AboutDialog)
{
setupUi(this);
m_ui->setupUi(this);
setAttribute(Qt::WA_DeleteOnClose);
// Title
labelName->setText(QString("<b><h2>qBittorrent " QBT_VERSION " (%1-bit)</h2></b>").arg(QT_POINTER_SIZE * 8));
m_ui->labelName->setText(QString("<b><h2>qBittorrent " QBT_VERSION " (%1-bit)</h2></b>").arg(QT_POINTER_SIZE * 8));
logo->setPixmap(Utils::Gui::scaledPixmapSvg(":/icons/skin/qbittorrent-tray.svg", this, 32));
m_ui->logo->setPixmap(Utils::Gui::scaledPixmapSvg(":/icons/skin/qbittorrent-tray.svg", this, 32));
// About
QString aboutText = QString(
@@ -68,40 +69,48 @@ public:
, tr("Home Page:")
, tr("Forum:")
, tr("Bug Tracker:"));
labelAbout->setText(aboutText);
m_ui->labelAbout->setText(aboutText);
labelMascot->setPixmap(Utils::Gui::scaledPixmap(":/icons/skin/mascot.png", this));
m_ui->labelMascot->setPixmap(Utils::Gui::scaledPixmap(":/icons/skin/mascot.png", this));
// Thanks
QFile thanksfile(":/thanks.html");
if (thanksfile.open(QIODevice::ReadOnly | QIODevice::Text)) {
textBrowserThanks->setHtml(QString::fromUtf8(thanksfile.readAll().constData()));
m_ui->textBrowserThanks->setHtml(QString::fromUtf8(thanksfile.readAll().constData()));
thanksfile.close();
}
// Translation
QFile translatorsfile(":/translators.html");
if (translatorsfile.open(QIODevice::ReadOnly | QIODevice::Text)) {
textBrowserTranslation->setHtml(QString::fromUtf8(translatorsfile.readAll().constData()));
m_ui->textBrowserTranslation->setHtml(QString::fromUtf8(translatorsfile.readAll().constData()));
translatorsfile.close();
}
// License
QFile licensefile(":/gpl.html");
if (licensefile.open(QIODevice::ReadOnly | QIODevice::Text)) {
textBrowserLicense->setHtml(QString::fromUtf8(licensefile.readAll().constData()));
m_ui->textBrowserLicense->setHtml(QString::fromUtf8(licensefile.readAll().constData()));
licensefile.close();
}
// Libraries
labelQtVer->setText(QT_VERSION_STR);
labelLibtVer->setText(Utils::Misc::libtorrentVersionString());
labelBoostVer->setText(Utils::Misc::boostVersionString());
labelOpensslVer->setText(Utils::Misc::opensslVersionString());
m_ui->labelQtVer->setText(QT_VERSION_STR);
m_ui->labelLibtVer->setText(Utils::Misc::libtorrentVersionString());
m_ui->labelBoostVer->setText(Utils::Misc::boostVersionString());
m_ui->labelOpensslVer->setText(Utils::Misc::opensslVersionString());
Utils::Gui::resize(this);
show();
}
~AboutDialog()
{
delete m_ui;
}
private:
Ui::AboutDialog *m_ui;
};
#endif // ABOUTDIALOG_H