1
mirror of https://invent.kde.org/network/falkon.git synced 2024-12-20 10:46:35 +01:00

Added QupZilla config page providing usefull information for troubleshooting

This commit is contained in:
Mladen Pejaković 2012-02-13 19:09:02 +01:00
parent 55ff3beb30
commit aec15d0176
5 changed files with 84 additions and 1 deletions

View File

@ -36,6 +36,11 @@ void Settings::endGroup()
m_settings->endGroup(); m_settings->endGroup();
} }
QSettings* Settings::globalSettings()
{
return m_settings;
}
Settings::~Settings() Settings::~Settings()
{ {
if (!m_settings->group().isEmpty()) { if (!m_settings->group().isEmpty()) {

View File

@ -13,6 +13,8 @@ public:
static void createSettings(const QString &fileName); static void createSettings(const QString &fileName);
static void syncSettings(); static void syncSettings();
static QSettings* globalSettings();
void setValue(const QString &key, const QVariant &defaultValue = QVariant()); void setValue(const QString &key, const QVariant &defaultValue = QVariant());
QVariant value(const QString &key, const QVariant &defaultValue = QVariant()); QVariant value(const QString &key, const QVariant &defaultValue = QVariant());

View File

@ -21,5 +21,6 @@
<file>html/qupzilla.ico</file> <file>html/qupzilla.ico</file>
<file>html/broken-page.png</file> <file>html/broken-page.png</file>
<file>html/setting.png</file> <file>html/setting.png</file>
<file>html/config.html</file>
</qresource> </qresource>
</RCC> </RCC>

View File

@ -23,6 +23,8 @@
#include "webpage.h" #include "webpage.h"
#include "speeddial.h" #include "speeddial.h"
#include "pluginproxy.h" #include "pluginproxy.h"
#include "plugininterface.h"
#include "settings.h"
QString authorString(const char* name, const QString &mail) QString authorString(const char* name, const QString &mail)
{ {
@ -53,7 +55,7 @@ QupZillaSchemeReply::QupZillaSchemeReply(const QNetworkRequest &req, QObject* pa
setUrl(req.url()); setUrl(req.url());
m_pageName = req.url().path(); 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); m_buffer.open(QIODevice::ReadWrite);
setError(QNetworkReply::NoError, tr("No Error")); setError(QNetworkReply::NoError, tr("No Error"));
@ -83,6 +85,9 @@ void QupZillaSchemeReply::loadPage()
else if (m_pageName == "speeddial") { else if (m_pageName == "speeddial") {
stream << speeddialPage(); stream << speeddialPage();
} }
else if (m_pageName == "config") {
stream << configPage();
}
stream.flush(); stream.flush();
m_buffer.reset(); m_buffer.reset();
@ -287,3 +292,72 @@ QString QupZillaSchemeReply::speeddialPage()
page.replace("%SD-SIZE%", QString::number(dial->sdSize())); page.replace("%SD-SIZE%", QString::number(dial->sdSize()));
return page; 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("<dt>%1</dt><dd>%2<dd>").arg(tr("Version"), QupZilla::VERSION
#ifdef GIT_REVISION
+ " (" + GIT_REVISION + ")"
#endif
) +
QString("<dt>%1</dt><dd>%2<dd>").arg(tr("WebKit version"), QupZilla::WEBKITVERSION) +
QString("<dt>%1</dt><dd>%2<dd>").arg(tr("Build time"), QupZilla::BUILDTIME) +
QString("<dt>%1</dt><dd>%2<dd>").arg(tr("Platform"), qz_buildSystem()));
QString allGroupsString;
QSettings* settings = Settings::globalSettings();
foreach (const QString &group, settings->childGroups()) {
QString groupString = QString("<tr><th colspan=\"2\">%1</th></tr>").arg(group);
settings->beginGroup(group);
foreach (const QString &key, settings->childKeys()) {
groupString.append(QString("<tr><td>%1</td><td>%2</td></tr>").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("<tr><td>%1</td><td>%2</td><td>%3</td><td>%4</td></tr>").arg(plugin->pluginName(), plugin->pluginVersion(), plugin->pluginAuthor().replace("<", "&lt;"), plugin->pluginDescription()));
}
cPage.replace("%PLUGINS-INFO%", pluginsString);
}
return cPage;
}

View File

@ -55,6 +55,7 @@ private:
QString reportbugPage(); QString reportbugPage();
QString startPage(); QString startPage();
QString speeddialPage(); QString speeddialPage();
QString configPage();
QBuffer m_buffer; QBuffer m_buffer;
QString m_pageName; QString m_pageName;