From feaec1906ea336b77022809aacc2ec4115b329c2 Mon Sep 17 00:00:00 2001 From: Aqua-sama Date: Fri, 15 Jun 2018 09:59:57 +0200 Subject: AboutDialog: add profile list to details tab --- lib/about/CMakeLists.txt | 2 ++ lib/about/aboutdialog.cpp | 28 ++++++++++++++++++++++------ 2 files changed, 24 insertions(+), 6 deletions(-) (limited to 'lib') diff --git a/lib/about/CMakeLists.txt b/lib/about/CMakeLists.txt index be506fe..7f53e8d 100644 --- a/lib/about/CMakeLists.txt +++ b/lib/about/CMakeLists.txt @@ -15,6 +15,8 @@ add_library(about target_include_directories(about PRIVATE ${Boost_INCLUDE_DIRS} PRIVATE ${CMAKE_BINARY_DIR}/src + PRIVATE ${CMAKE_SOURCE_DIR}/src + PRIVATE ${CMAKE_SOURCE_DIR}/plugins ) target_link_libraries(about Qt5::Widgets) diff --git a/lib/about/aboutdialog.cpp b/lib/about/aboutdialog.cpp index 6b4ebb8..e716217 100644 --- a/lib/about/aboutdialog.cpp +++ b/lib/about/aboutdialog.cpp @@ -11,6 +11,7 @@ #include #include #include "version.h" +#include // compiler // clang also defines __GNUC__, so we need to check for clang first @@ -24,6 +25,21 @@ #define compiler "unknown compiler" #endif +inline QString getPluginList() +{ + auto *browser = qobject_cast(qApp); + Q_CHECK_PTR(browser); + + QString plugins; + for(const Plugin &p : browser->plugins()) { + plugins.append(QString("
  • %1 (%2)
  • ").arg(p.name, p.author)); + } + if(!plugins.isEmpty()) + plugins = "Loaded plugins:
      " + plugins + "setWordWrap(true); aboutLabel->setText(tr("

      smolbote %1

      " - "

      yet another no-frills browser

      ") + "

      yet another no-frills browser

      " + "

      This program is free software, and is built upon other free software: Qt " QT_VERSION_STR " and Boost " BOOST_LIB_VERSION "

      ") .arg(qApp->applicationVersion())); ui->toolBox->addItem(aboutLabel, tr("About")); @@ -54,15 +71,14 @@ AboutDialog::AboutDialog(QWidget *parent) "

      This program is distributed in the hope that it will be useful, but without any warranty.

      ")); ui->toolBox->addItem(licenseLabel, tr("License")); + + + auto *detailsLabel = new QLabel(this); detailsLabel->setWordWrap(true); detailsLabel->setText(tr("

      Build " SMOLBOTE_BRANCH ":" SMOLBOTE_COMMIT "

      " "

      Compiled with " compiler "

      " - "

      Libraries:

        " - "
      • Qt " QT_VERSION_STR "
      • " - "
      • QtWebEngine " QTWEBENGINE_VERSION_STR "
      • " - "
      • Boost " BOOST_LIB_VERSION "
      • " - "

      ")); + "

      %1

      ").arg(getPluginList())); ui->toolBox->addItem(detailsLabel, tr("Details")); } -- cgit v1.2.1