diff --git a/src/app/settings.cpp b/src/app/settings.cpp index 0777bd73a..c4b43b4d2 100644 --- a/src/app/settings.cpp +++ b/src/app/settings.cpp @@ -36,6 +36,11 @@ void Settings::endGroup() m_settings->endGroup(); } +QSettings* Settings::globalSettings() +{ + return m_settings; +} + Settings::~Settings() { if (!m_settings->group().isEmpty()) { diff --git a/src/app/settings.h b/src/app/settings.h index 73acca421..39b6a3bd0 100644 --- a/src/app/settings.h +++ b/src/app/settings.h @@ -13,6 +13,8 @@ public: static void createSettings(const QString &fileName); static void syncSettings(); + static QSettings* globalSettings(); + void setValue(const QString &key, const QVariant &defaultValue = QVariant()); QVariant value(const QString &key, const QVariant &defaultValue = QVariant()); diff --git a/src/data/html.qrc b/src/data/html.qrc index 54382bc18..781cfc53b 100644 --- a/src/data/html.qrc +++ b/src/data/html.qrc @@ -21,5 +21,6 @@ html/qupzilla.ico html/broken-page.png html/setting.png + html/config.html diff --git a/src/network/qupzillaschemehandler.cpp b/src/network/qupzillaschemehandler.cpp index 4d0e474e4..d50a086a6 100644 --- a/src/network/qupzillaschemehandler.cpp +++ b/src/network/qupzillaschemehandler.cpp @@ -23,6 +23,8 @@ #include "webpage.h" #include "speeddial.h" #include "pluginproxy.h" +#include "plugininterface.h" +#include "settings.h" QString authorString(const char* name, const QString &mail) { @@ -53,7 +55,7 @@ QupZillaSchemeReply::QupZillaSchemeReply(const QNetworkRequest &req, QObject* pa setUrl(req.url()); m_pageName = req.url().path(); - if (m_pageName == "about" || m_pageName == "reportbug" || m_pageName == "start" || m_pageName == "speeddial") { + if (m_pageName == "about" || m_pageName == "reportbug" || m_pageName == "start" || m_pageName == "speeddial" || m_pageName == "config") { m_buffer.open(QIODevice::ReadWrite); setError(QNetworkReply::NoError, tr("No Error")); @@ -83,6 +85,9 @@ void QupZillaSchemeReply::loadPage() else if (m_pageName == "speeddial") { stream << speeddialPage(); } + else if (m_pageName == "config") { + stream << configPage(); + } stream.flush(); m_buffer.reset(); @@ -287,3 +292,72 @@ QString QupZillaSchemeReply::speeddialPage() page.replace("%SD-SIZE%", QString::number(dial->sdSize())); return page; } + + +QString QupZillaSchemeReply::configPage() +{ + static QString cPage; + + if (cPage.isEmpty()) { + cPage.append(qz_readAllFileContents(":html/config.html")); + cPage.replace("%FAVICON%", "qrc:icons/qupzilla.png"); + cPage.replace("%BOX-BORDER%", "qrc:html/box-border.png"); + cPage.replace("%ABOUT-IMG%", "qrc:icons/other/about.png"); + + cPage.replace("%TITLE%", tr("QupZilla Configuration Information")); + cPage.replace("%CONFIG%", tr("Configuration Information")); + cPage.replace("%INFORMATIONS-ABOUT-VERSION%", tr("Information about version")); + cPage.replace("%CONFIG-ABOUT%", tr("This page contains information about Qupzilla's current configuration, plugins, etc, all relevant information for troubleshooting. Please include these information when sending bug reports.")); + cPage.replace("%PREFS%", tr("Preferences")); + cPage.replace("%OPTION%", tr("Option")); + cPage.replace("%VALUE%", tr("Value")); + cPage.replace("%PLUGINS%", tr("Plugins")); + cPage.replace("%PL-NAME%", tr("Name")); + cPage.replace("%PL-VER%", tr("Version")); + cPage.replace("%PL-AUTH%", tr("Author")); + cPage.replace("%PL-DESC%", tr("Description")); + + cPage.replace("%VERSION-INFO%", + QString("
%1
%2
").arg(tr("Version"), QupZilla::VERSION +#ifdef GIT_REVISION + + " (" + GIT_REVISION + ")" +#endif + ) + + QString("
%1
%2
").arg(tr("WebKit version"), QupZilla::WEBKITVERSION) + + QString("
%1
%2
").arg(tr("Build time"), QupZilla::BUILDTIME) + + QString("
%1
%2
").arg(tr("Platform"), qz_buildSystem())); + + QString allGroupsString; + QSettings* settings = Settings::globalSettings(); + foreach (const QString &group, settings->childGroups()) { + QString groupString = QString("%1").arg(group); + settings->beginGroup(group); + + foreach (const QString &key, settings->childKeys()) { + groupString.append(QString("%1%2").arg(key, settings->value(key).toString())); + } + + settings->endGroup(); + + allGroupsString.append(groupString); + } + + cPage.replace("%PREFS-INFO%", allGroupsString); + +// getPluginsList()); + QString pluginsString; + QStringList availablePlugins = mApp->plugins()->getAvailablePlugins(); + QStringList allowedPlugins = mApp->plugins()->getAllowedPlugins(); + foreach(const QString & fileName, availablePlugins) { + PluginInterface* plugin = mApp->plugins()->getPlugin(fileName); + if (!plugin) { + continue; + } + pluginsString.append(QString("%1%2%3%4").arg(plugin->pluginName(), plugin->pluginVersion(), plugin->pluginAuthor().replace("<", "<"), plugin->pluginDescription())); + } + +cPage.replace("%PLUGINS-INFO%", pluginsString); + + } + return cPage; +} \ No newline at end of file diff --git a/src/network/qupzillaschemehandler.h b/src/network/qupzillaschemehandler.h index 7dd8d81d9..a9553fc85 100644 --- a/src/network/qupzillaschemehandler.h +++ b/src/network/qupzillaschemehandler.h @@ -55,6 +55,7 @@ private: QString reportbugPage(); QString startPage(); QString speeddialPage(); + QString configPage(); QBuffer m_buffer; QString m_pageName;