forked from qt-creator/qt-creator
It is now possible to configure the help viewer font.
Task-number: 253365
This commit is contained in:
@@ -76,6 +76,7 @@ public:
|
||||
void activateTab(bool onlyHelpViewer = false);
|
||||
bool find(const QString &txt, QTextDocument::FindFlags findFlags, bool incremental);
|
||||
void setLastShownPages();
|
||||
HelpViewer *helpViewerAtIndex(int index) const;
|
||||
|
||||
static CentralWidget *instance();
|
||||
|
||||
@@ -124,7 +125,6 @@ private:
|
||||
void connectSignals();
|
||||
bool eventFilter(QObject *object, QEvent *e);
|
||||
void initPrinter();
|
||||
HelpViewer *helpViewerAtIndex(int index) const;
|
||||
QString quoteTabTitle(const QString &title) const;
|
||||
|
||||
private:
|
||||
|
||||
210
src/plugins/help/generalsettingspage.cpp
Normal file
210
src/plugins/help/generalsettingspage.cpp
Normal file
@@ -0,0 +1,210 @@
|
||||
/**************************************************************************
|
||||
**
|
||||
** This file is part of Qt Creator
|
||||
**
|
||||
** Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
|
||||
**
|
||||
** Contact: Nokia Corporation (qt-info@nokia.com)
|
||||
**
|
||||
** Commercial Usage
|
||||
**
|
||||
** Licensees holding valid Qt Commercial licenses may use this file in
|
||||
** accordance with the Qt Commercial License Agreement provided with the
|
||||
** Software or, alternatively, in accordance with the terms contained in
|
||||
** a written agreement between you and Nokia.
|
||||
**
|
||||
** GNU Lesser General Public License Usage
|
||||
**
|
||||
** Alternatively, this file may be used under the terms of the GNU Lesser
|
||||
** General Public License version 2.1 as published by the Free Software
|
||||
** Foundation and appearing in the file LICENSE.LGPL included in the
|
||||
** packaging of this file. Please review the following information to
|
||||
** ensure the GNU Lesser General Public License version 2.1 requirements
|
||||
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
||||
**
|
||||
** If you are unsure which license is appropriate for your use, please
|
||||
** contact the sales department at http://www.qtsoftware.com/contact.
|
||||
**
|
||||
**************************************************************************/
|
||||
|
||||
#include "generalsettingspage.h"
|
||||
|
||||
#include <QtHelp/QHelpEngine>
|
||||
|
||||
#if defined(QT_NO_WEBKIT)
|
||||
#include <QtGui/QApplication>
|
||||
#else
|
||||
#include <QtWebKit/QWebSettings>
|
||||
#endif
|
||||
|
||||
using namespace Help::Internal;
|
||||
|
||||
GeneralSettingsPage::GeneralSettingsPage(QHelpEngine *helpEngine)
|
||||
: m_currentPage(0)
|
||||
, m_helpEngine(helpEngine)
|
||||
{
|
||||
#if !defined(QT_NO_WEBKIT)
|
||||
QWebSettings* webSettings = QWebSettings::globalSettings();
|
||||
font.setFamily(webSettings->fontFamily(QWebSettings::StandardFont));
|
||||
font.setPointSize(webSettings->fontSize(QWebSettings::DefaultFontSize));
|
||||
#else
|
||||
font = qApp->font();
|
||||
#endif
|
||||
}
|
||||
|
||||
QString GeneralSettingsPage::id() const
|
||||
{
|
||||
return QLatin1String("General settings");
|
||||
}
|
||||
|
||||
QString GeneralSettingsPage::trName() const
|
||||
{
|
||||
return tr("General settings");
|
||||
}
|
||||
|
||||
QString GeneralSettingsPage::category() const
|
||||
{
|
||||
return QLatin1String("Help");
|
||||
}
|
||||
|
||||
QString GeneralSettingsPage::trCategory() const
|
||||
{
|
||||
return tr("Help");
|
||||
}
|
||||
|
||||
QWidget *GeneralSettingsPage::createPage(QWidget *parent)
|
||||
{
|
||||
m_currentPage = new QWidget(parent);
|
||||
|
||||
m_ui.setupUi(m_currentPage);
|
||||
m_ui.sizeComboBox->setEditable(false);
|
||||
m_ui.styleComboBox->setEditable(false);
|
||||
|
||||
font = qVariantValue<QFont>(m_helpEngine->customValue(QLatin1String("font"),
|
||||
font));
|
||||
|
||||
updateFontSize();
|
||||
updateFontStyle();
|
||||
updateFontFamily();
|
||||
|
||||
return m_currentPage;
|
||||
}
|
||||
|
||||
void GeneralSettingsPage::apply()
|
||||
{
|
||||
const QString &family = m_ui.familyComboBox->currentFont().family();
|
||||
font.setFamily(family);
|
||||
|
||||
int fontSize = 14;
|
||||
int currentIndex = m_ui.sizeComboBox->currentIndex();
|
||||
if (currentIndex != -1)
|
||||
fontSize = m_ui.sizeComboBox->itemData(currentIndex).toInt();
|
||||
font.setPointSize(fontSize);
|
||||
|
||||
QString fontStyle = QLatin1String("Normal");
|
||||
currentIndex = m_ui.styleComboBox->currentIndex();
|
||||
if (currentIndex != -1)
|
||||
fontStyle = m_ui.styleComboBox->itemText(currentIndex);
|
||||
font.setBold(fontDatabase.bold(family, fontStyle));
|
||||
font.setItalic(fontDatabase.italic(family, fontStyle));
|
||||
|
||||
const int weight = fontDatabase.weight(family, fontStyle);
|
||||
if (weight >= 0) // Weight < 0 asserts...
|
||||
font.setWeight(weight);
|
||||
|
||||
m_helpEngine->setCustomValue(QLatin1String("font"), font);
|
||||
|
||||
#if !defined(QT_NO_WEBKIT)
|
||||
QWebSettings* webSettings = QWebSettings::globalSettings();
|
||||
webSettings->setFontFamily(QWebSettings::StandardFont, font.family());
|
||||
webSettings->setFontSize(QWebSettings::DefaultFontSize, font.pointSize());
|
||||
#else
|
||||
emit fontChanged();
|
||||
#endif
|
||||
}
|
||||
|
||||
void GeneralSettingsPage::finish()
|
||||
{
|
||||
// Hmm, what to do here?
|
||||
}
|
||||
|
||||
void GeneralSettingsPage::updateFontSize()
|
||||
{
|
||||
const QString &family = font.family();
|
||||
const QString &fontStyle = fontDatabase.styleString(font);
|
||||
|
||||
QList<int> pointSizes = fontDatabase.pointSizes(family, fontStyle);
|
||||
if (pointSizes.empty())
|
||||
pointSizes = QFontDatabase::standardSizes();
|
||||
|
||||
m_ui.sizeComboBox->clear();
|
||||
m_ui.sizeComboBox->setCurrentIndex(-1);
|
||||
m_ui.sizeComboBox->setEnabled(!pointSizes.empty());
|
||||
|
||||
// try to maintain selection or select closest.
|
||||
if (!pointSizes.empty()) {
|
||||
QString n;
|
||||
foreach (int pointSize, pointSizes)
|
||||
m_ui.sizeComboBox->addItem(n.setNum(pointSize), QVariant(pointSize));
|
||||
const int closestIndex = closestPointSizeIndex(font.pointSize());
|
||||
if (closestIndex != -1)
|
||||
m_ui.sizeComboBox->setCurrentIndex(closestIndex);
|
||||
}
|
||||
}
|
||||
|
||||
void GeneralSettingsPage::updateFontStyle()
|
||||
{
|
||||
const QString &fontStyle = fontDatabase.styleString(font);
|
||||
const QStringList &styles = fontDatabase.styles(font.family());
|
||||
|
||||
m_ui.styleComboBox->clear();
|
||||
m_ui.styleComboBox->setCurrentIndex(-1);
|
||||
m_ui.styleComboBox->setEnabled(!styles.empty());
|
||||
|
||||
if (!styles.empty()) {
|
||||
int normalIndex = -1;
|
||||
const QString normalStyle = QLatin1String("Normal");
|
||||
foreach (const QString &style, styles) {
|
||||
// try to maintain selection or select 'normal' preferably
|
||||
const int newIndex = m_ui.styleComboBox->count();
|
||||
m_ui.styleComboBox->addItem(style);
|
||||
if (fontStyle == style) {
|
||||
m_ui.styleComboBox->setCurrentIndex(newIndex);
|
||||
} else {
|
||||
if (fontStyle == normalStyle)
|
||||
normalIndex = newIndex;
|
||||
}
|
||||
}
|
||||
if (m_ui.styleComboBox->currentIndex() == -1 && normalIndex != -1)
|
||||
m_ui.styleComboBox->setCurrentIndex(normalIndex);
|
||||
}
|
||||
}
|
||||
|
||||
void GeneralSettingsPage::updateFontFamily()
|
||||
{
|
||||
m_ui.familyComboBox->setCurrentFont(font);
|
||||
}
|
||||
|
||||
int GeneralSettingsPage::closestPointSizeIndex(int desiredPointSize) const
|
||||
{
|
||||
// try to maintain selection or select closest.
|
||||
int closestIndex = -1;
|
||||
int closestAbsError = 0xFFFF;
|
||||
|
||||
const int pointSizeCount = m_ui.sizeComboBox->count();
|
||||
for (int i = 0; i < pointSizeCount; i++) {
|
||||
const int itemPointSize = m_ui.sizeComboBox->itemData(i).toInt();
|
||||
const int absError = qAbs(desiredPointSize - itemPointSize);
|
||||
if (absError < closestAbsError) {
|
||||
closestIndex = i;
|
||||
closestAbsError = absError;
|
||||
if (closestAbsError == 0)
|
||||
break;
|
||||
} else { // past optimum
|
||||
if (absError > closestAbsError) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
return closestIndex;
|
||||
}
|
||||
84
src/plugins/help/generalsettingspage.h
Normal file
84
src/plugins/help/generalsettingspage.h
Normal file
@@ -0,0 +1,84 @@
|
||||
/**************************************************************************
|
||||
**
|
||||
** This file is part of Qt Creator
|
||||
**
|
||||
** Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
|
||||
**
|
||||
** Contact: Nokia Corporation (qt-info@nokia.com)
|
||||
**
|
||||
** Commercial Usage
|
||||
**
|
||||
** Licensees holding valid Qt Commercial licenses may use this file in
|
||||
** accordance with the Qt Commercial License Agreement provided with the
|
||||
** Software or, alternatively, in accordance with the terms contained in
|
||||
** a written agreement between you and Nokia.
|
||||
**
|
||||
** GNU Lesser General Public License Usage
|
||||
**
|
||||
** Alternatively, this file may be used under the terms of the GNU Lesser
|
||||
** General Public License version 2.1 as published by the Free Software
|
||||
** Foundation and appearing in the file LICENSE.LGPL included in the
|
||||
** packaging of this file. Please review the following information to
|
||||
** ensure the GNU Lesser General Public License version 2.1 requirements
|
||||
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
||||
**
|
||||
** If you are unsure which license is appropriate for your use, please
|
||||
** contact the sales department at http://www.qtsoftware.com/contact.
|
||||
**
|
||||
**************************************************************************/
|
||||
|
||||
#ifndef GENERALSETTINGSPAGE_H
|
||||
#define GENERALSETTINGSPAGE_H
|
||||
|
||||
#include <QtGui/QWidget>
|
||||
#include <QtGui/QFontDatabase>
|
||||
|
||||
#include <coreplugin/dialogs/ioptionspage.h>
|
||||
|
||||
#include "ui_generalsettingspage.h"
|
||||
|
||||
QT_FORWARD_DECLARE_CLASS(QFont)
|
||||
QT_FORWARD_DECLARE_CLASS(QHelpEngine)
|
||||
|
||||
namespace Help {
|
||||
namespace Internal {
|
||||
|
||||
class GeneralSettingsPage : public Core::IOptionsPage
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
GeneralSettingsPage(QHelpEngine *helpEngine);
|
||||
|
||||
QString id() const;
|
||||
virtual QString trName() const;
|
||||
QString category() const;
|
||||
QString trCategory() const;
|
||||
|
||||
QWidget *createPage(QWidget *parent);
|
||||
void apply();
|
||||
void finish();
|
||||
|
||||
signals:
|
||||
void fontChanged();
|
||||
|
||||
private:
|
||||
void updateFontSize();
|
||||
void updateFontStyle();
|
||||
void updateFontFamily();
|
||||
int closestPointSizeIndex(int desiredPointSize) const;
|
||||
|
||||
private:
|
||||
QWidget *m_currentPage;
|
||||
QHelpEngine *m_helpEngine;
|
||||
|
||||
QFont font;
|
||||
QFontDatabase fontDatabase;
|
||||
|
||||
Ui::GeneralSettingsPage m_ui;
|
||||
};
|
||||
|
||||
} // Internal
|
||||
} // Help
|
||||
|
||||
#endif // GENERALSETTINGSPAGE_H
|
||||
266
src/plugins/help/generalsettingspage.ui
Normal file
266
src/plugins/help/generalsettingspage.ui
Normal file
@@ -0,0 +1,266 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>GeneralSettingsPage</class>
|
||||
<widget class="QWidget" name="GeneralSettingsPage">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>447</width>
|
||||
<height>300</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Form</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_2">
|
||||
<item>
|
||||
<widget class="QGroupBox" name="groupBox">
|
||||
<property name="title">
|
||||
<string>Font</string>
|
||||
</property>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_3">
|
||||
<item>
|
||||
<widget class="QLabel" name="label_5">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Family:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QFontComboBox" name="familyComboBox"/>
|
||||
</item>
|
||||
<item>
|
||||
<spacer>
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeType">
|
||||
<enum>QSizePolicy::Preferred</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>20</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="label_7">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Style:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QComboBox" name="styleComboBox">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
|
||||
<horstretch>1</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer>
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeType">
|
||||
<enum>QSizePolicy::Preferred</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>20</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="label_6">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Size:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QComboBox" name="sizeComboBox">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
|
||||
<horstretch>1</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="horizontalSpacer_2">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QGroupBox" name="groupBox_2">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="title">
|
||||
<string>Startup</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_5">
|
||||
<item>
|
||||
<widget class="QLabel" name="label_2">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>On help start:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QComboBox" name="comboBox">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Show my home page</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Show a blank page</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Show my tabs from last session</string>
|
||||
</property>
|
||||
</item>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="horizontalSpacer_3">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_4">
|
||||
<item>
|
||||
<widget class="QLabel" name="label">
|
||||
<property name="text">
|
||||
<string>Home Page:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLineEdit" name="homePageLineEdit"/>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_2">
|
||||
<item>
|
||||
<spacer name="horizontalSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||
<item>
|
||||
<widget class="QPushButton" name="currentPageButton">
|
||||
<property name="text">
|
||||
<string>Current Page</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="restoreDefaultHomePageButton">
|
||||
<property name="text">
|
||||
<string>Restore to default</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="verticalSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>20</width>
|
||||
<height>126</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<resources/>
|
||||
<connections/>
|
||||
</ui>
|
||||
@@ -16,7 +16,8 @@ HEADERS += helpplugin.h \
|
||||
searchwidget.h \
|
||||
helpfindsupport.h \
|
||||
help_global.h \
|
||||
helpindexfilter.h
|
||||
helpindexfilter.h \
|
||||
generalsettingspage.h
|
||||
|
||||
SOURCES += helpplugin.cpp \
|
||||
docsettingspage.cpp \
|
||||
@@ -25,10 +26,13 @@ SOURCES += helpplugin.cpp \
|
||||
centralwidget.cpp \
|
||||
searchwidget.cpp \
|
||||
helpfindsupport.cpp \
|
||||
helpindexfilter.cpp
|
||||
helpindexfilter.cpp \
|
||||
generalsettingspage.cpp
|
||||
|
||||
FORMS += docsettingspage.ui \
|
||||
filtersettingspage.ui
|
||||
filtersettingspage.ui \
|
||||
generalsettingspage.ui
|
||||
|
||||
RESOURCES += help.qrc
|
||||
include(../../shared/help/help.pri)
|
||||
|
||||
|
||||
@@ -28,16 +28,18 @@
|
||||
**************************************************************************/
|
||||
|
||||
#include "helpplugin.h"
|
||||
|
||||
#include "bookmarkmanager.h"
|
||||
#include "centralwidget.h"
|
||||
#include "contentwindow.h"
|
||||
#include "docsettingspage.h"
|
||||
#include "filtersettingspage.h"
|
||||
#include "generalsettingspage.h"
|
||||
#include "helpfindsupport.h"
|
||||
#include "helpindexfilter.h"
|
||||
#include "helpmode.h"
|
||||
#include "helpviewer.h"
|
||||
#include "contentwindow.h"
|
||||
#include "indexwindow.h"
|
||||
#include "bookmarkmanager.h"
|
||||
#include "centralwidget.h"
|
||||
#include "helpfindsupport.h"
|
||||
#include "searchwidget.h"
|
||||
|
||||
#include <extensionsystem/pluginmanager.h>
|
||||
@@ -175,16 +177,21 @@ bool HelpPlugin::initialize(const QStringList &arguments, QString *error)
|
||||
|
||||
addAutoReleasedObject(new HelpManager(m_helpEngine));
|
||||
|
||||
m_filterSettingsPage = new FilterSettingsPage(m_helpEngine);
|
||||
addAutoReleasedObject(m_filterSettingsPage);
|
||||
|
||||
m_docSettingsPage = new DocSettingsPage(m_helpEngine);
|
||||
addAutoReleasedObject(m_docSettingsPage);
|
||||
|
||||
m_filterSettingsPage = new FilterSettingsPage(m_helpEngine);
|
||||
addAutoReleasedObject(m_filterSettingsPage);
|
||||
connect(m_docSettingsPage, SIGNAL(documentationAdded()),
|
||||
m_filterSettingsPage, SLOT(updateFilterPage()));
|
||||
connect(m_docSettingsPage, SIGNAL(dialogAccepted()), this,
|
||||
SLOT(checkForHelpChanges()));
|
||||
|
||||
GeneralSettingsPage *generalSettings = new GeneralSettingsPage(m_helpEngine);
|
||||
addAutoReleasedObject(generalSettings);
|
||||
connect(generalSettings, SIGNAL(fontChanged()), this, SLOT(fontChanged()));
|
||||
|
||||
m_contentWidget = new ContentWindow(m_helpEngine);
|
||||
m_contentWidget->setWindowTitle(tr("Contents"));
|
||||
m_indexWidget = new IndexWindow(m_helpEngine);
|
||||
@@ -464,6 +471,12 @@ void HelpPlugin::createRightPaneSideBar()
|
||||
agg->add(m_helpViewerForSideBar);
|
||||
agg->add(new HelpViewerFindSupport(m_helpViewerForSideBar));
|
||||
rightPaneLayout->addWidget(m_helpViewerForSideBar);
|
||||
#if defined(QT_NO_WEBKIT)
|
||||
QFont font = m_helpViewerForSideBar->font();
|
||||
font = qVariantValue<QFont>(m_helpEngine->customValue(QLatin1String("font"),
|
||||
font));
|
||||
m_helpViewerForSideBar->setFont(font);
|
||||
#endif
|
||||
m_core->addContextObject(new Core::BaseContext(m_helpViewerForSideBar, QList<int>()
|
||||
<< m_core->uniqueIDManager()->uniqueIdentifier(Constants::C_HELP_SIDEBAR),
|
||||
this));
|
||||
@@ -603,6 +616,18 @@ void HelpPlugin::extensionsInitialized()
|
||||
connect(welcomeMode, SIGNAL(openContextHelpPage(QString)), this,
|
||||
SLOT(openContextHelpPage(QString)));
|
||||
}
|
||||
|
||||
#if !defined(QT_NO_WEBKIT)
|
||||
QWebSettings* webSettings = QWebSettings::globalSettings();
|
||||
QFont font(webSettings->fontFamily(QWebSettings::StandardFont),
|
||||
webSettings->fontSize(QWebSettings::DefaultFontSize));
|
||||
|
||||
font = qVariantValue<QFont>(m_helpEngine->customValue(QLatin1String("font"),
|
||||
font));
|
||||
|
||||
webSettings->setFontFamily(QWebSettings::StandardFont, font.family());
|
||||
webSettings->setFontSize(QWebSettings::DefaultFontSize, font.pointSize());
|
||||
#endif
|
||||
}
|
||||
|
||||
void HelpPlugin::shutdown()
|
||||
@@ -652,6 +677,26 @@ void HelpPlugin::updateSideBarSource(const QUrl &newUrl)
|
||||
m_helpViewerForSideBar->setSource(newUrl);
|
||||
}
|
||||
|
||||
void HelpPlugin::fontChanged()
|
||||
{
|
||||
#if defined(QT_NO_WEBKIT)
|
||||
QFont font = qApp->font();
|
||||
font = qVariantValue<QFont>(m_helpEngine->customValue(QLatin1String("font"),
|
||||
font));
|
||||
|
||||
if (m_helpViewerForSideBar)
|
||||
m_helpViewerForSideBar->setFont(font);
|
||||
|
||||
if (m_centralWidget) {
|
||||
int i = 0;
|
||||
while (HelpViewer* viewer = m_centralWidget->helpViewerAtIndex(i++)) {
|
||||
if (viewer->font() != font)
|
||||
viewer->setFont(font);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
void HelpPlugin::activateContext()
|
||||
{
|
||||
Core::RightPanePlaceHolder* placeHolder = Core::RightPanePlaceHolder::current();
|
||||
|
||||
@@ -135,6 +135,8 @@ private slots:
|
||||
void updateSideBarSource();
|
||||
void updateSideBarSource(const QUrl &newUrl);
|
||||
|
||||
void fontChanged();
|
||||
|
||||
private:
|
||||
QToolBar *createToolBar();
|
||||
void createRightPaneSideBar();
|
||||
|
||||
Reference in New Issue
Block a user