diff options
author | Aqua-sama <aqua@iserlohn-fortress.net> | 2018-01-30 12:25:32 +0100 |
---|---|---|
committer | Aqua-sama <aqua@iserlohn-fortress.net> | 2018-01-30 12:25:32 +0100 |
commit | e4f237152d5581ebb7dc25fec1ba60cf2655f2e9 (patch) | |
tree | dda3fedbc4a79757b540a5ab042da6908abb3e3e /src/forms | |
parent | Split cmd parsing from main into CommandLine class (diff) | |
download | smolbote-e4f237152d5581ebb7dc25fec1ba60cf2655f2e9.tar.xz |
Added profile and plugin list to About dialog
Diffstat (limited to 'src/forms')
-rw-r--r-- | src/forms/aboutdialog.cpp | 33 | ||||
-rw-r--r-- | src/forms/aboutdialog.h | 6 | ||||
-rw-r--r-- | src/forms/aboutdialog.ui | 4 |
3 files changed, 34 insertions, 9 deletions
diff --git a/src/forms/aboutdialog.cpp b/src/forms/aboutdialog.cpp index 5b788bd..93cb688 100644 --- a/src/forms/aboutdialog.cpp +++ b/src/forms/aboutdialog.cpp @@ -7,6 +7,7 @@ */ #include "aboutdialog.h" +#include "browser.h" #include "ui_aboutdialog.h" #include "version.h" #include <boost/version.hpp> @@ -28,10 +29,9 @@ AboutDialog::AboutDialog(QWidget *parent) setAttribute(Qt::WA_DeleteOnClose, true); ui->setupUi(this); - // clang-tidy: don't use static_cast to downcast from a base to a derived class, - // use dynamic_cast instead - //ui->icon->setPixmap(qApp->windowIcon().pixmap(72, 72)); - ui->icon->setPixmap(dynamic_cast<QApplication *>(QApplication::instance())->windowIcon().pixmap(72, 72)); + auto *browser = dynamic_cast<Browser *>(QApplication::instance()); + + ui->icon->setPixmap(dynamic_cast<QApplication *>(browser)->windowIcon().pixmap(72, 72)); auto *aboutLabel = new QLabel(this); aboutLabel->setWordWrap(true); @@ -63,6 +63,31 @@ AboutDialog::AboutDialog(QWidget *parent) "<li>Boost " BOOST_LIB_VERSION " </li>" "</ul></p>")); ui->toolBox->addItem(libsLabel, tr("Details")); + + // list profiles + if(!browser->profiles().isEmpty()) { + QString profilesText = tr("<p>Profile list:</p>" + "<p><ul>"); + for(const QString &name : browser->profiles()) { + if(name.isEmpty()) + profilesText += tr("<li>Off-the-record</li>"); + else + profilesText += tr("<li>%1</li>").arg(name); + } + profilesText += tr("</ul></p>"); + libsLabel->setText(libsLabel->text() + profilesText); + } + + // list plugins + if(!browser->plugins().isEmpty()) { + QString pluginText = tr("<p>Plugin list:</p>" + "<p><ul>"); + for(const Browser::Plugin &plugin : browser->plugins()) { + pluginText += tr("<li>%1 (%2)</li>").arg(plugin.meta["name"].toString(), plugin.meta["author"].toString()); + } + pluginText += tr("</ul></p>"); + libsLabel->setText(libsLabel->text() + pluginText); + } } AboutDialog::~AboutDialog() diff --git a/src/forms/aboutdialog.h b/src/forms/aboutdialog.h index 3175939..265f3c9 100644 --- a/src/forms/aboutdialog.h +++ b/src/forms/aboutdialog.h @@ -6,8 +6,8 @@ * SPDX-License-Identifier: GPL-3.0 */ -#ifndef ABOUTDIALOG_H -#define ABOUTDIALOG_H +#ifndef SMOLBOTE_ABOUTDIALOG_H +#define SMOLBOTE_ABOUTDIALOG_H #include <QDialog> @@ -28,4 +28,4 @@ private: Ui::AboutDialog *ui; }; -#endif // ABOUTDIALOG_H +#endif // SMOLBOTE_ABOUTDIALOG_H diff --git a/src/forms/aboutdialog.ui b/src/forms/aboutdialog.ui index 60fd875..f7fe21e 100644 --- a/src/forms/aboutdialog.ui +++ b/src/forms/aboutdialog.ui @@ -6,8 +6,8 @@ <rect> <x>0</x> <y>0</y> - <width>550</width> - <height>320</height> + <width>500</width> + <height>600</height> </rect> </property> <property name="windowTitle"> |