diff --git a/src/plugins/help/generalsettingspage.cpp b/src/plugins/help/generalsettingspage.cpp index 61a93ba8518333415b89014ea76522f5c4797e36..fe2630088f64e9c5e3c635ef63fb1860359c81ae 100644 --- a/src/plugins/help/generalsettingspage.cpp +++ b/src/plugins/help/generalsettingspage.cpp @@ -110,6 +110,10 @@ QWidget *GeneralSettingsPage::createPage(QWidget *parent) int index = m_helpEngine->customValue(QLatin1String("StartOption"), 2).toInt(); m_ui.helpStartComboBox->setCurrentIndex(index); + + index = m_helpEngine->customValue(QLatin1String("ContextHelpOption"), 0).toInt(); + m_ui.contextHelpComboBox->setCurrentIndex(index); + connect(m_ui.currentPageButton, SIGNAL(clicked()), this, SLOT(setCurrentPage())); connect(m_ui.blankPageButton, SIGNAL(clicked()), this, SLOT(setBlankPage())); @@ -165,6 +169,9 @@ void GeneralSettingsPage::apply() int startOption = m_ui.helpStartComboBox->currentIndex(); m_helpEngine->setCustomValue(QLatin1String("StartOption"), startOption); + + int contextHelpOption = m_ui.contextHelpComboBox->currentIndex(); + m_helpEngine->setCustomValue(QLatin1String("ContextHelpOption"), contextHelpOption); } void GeneralSettingsPage::finish() diff --git a/src/plugins/help/generalsettingspage.ui b/src/plugins/help/generalsettingspage.ui index 5d4b58a8c698fe70829a06a2aea29dae39e70918..5987bbfdfaa175f7eefa01a8ea1ddf05ee1df3a0 100644 --- a/src/plugins/help/generalsettingspage.ui +++ b/src/plugins/help/generalsettingspage.ui @@ -6,8 +6,8 @@ <rect> <x>0</x> <y>0</y> - <width>447</width> - <height>300</height> + <width>593</width> + <height>371</height> </rect> </property> <property name="windowTitle"> @@ -140,9 +140,9 @@ </property> <layout class="QVBoxLayout" name="verticalLayout"> <item> - <layout class="QHBoxLayout" name="horizontalLayout_5"> - <item> - <widget class="QLabel" name="label_2"> + <layout class="QGridLayout" name="gridLayout"> + <item row="0" column="0"> + <widget class="QLabel" name="label_3"> <property name="sizePolicy"> <sizepolicy hsizetype="Preferred" vsizetype="Fixed"> <horstretch>0</horstretch> @@ -150,12 +150,12 @@ </sizepolicy> </property> <property name="text"> - <string>On help start:</string> + <string>On context help:</string> </property> </widget> </item> - <item> - <widget class="QComboBox" name="helpStartComboBox"> + <item row="0" column="1"> + <widget class="QComboBox" name="contextHelpComboBox"> <property name="sizePolicy"> <sizepolicy hsizetype="Preferred" vsizetype="Fixed"> <horstretch>0</horstretch> @@ -164,22 +164,22 @@ </property> <item> <property name="text"> - <string>Show my home page</string> + <string>Show side-by-side if possible</string> </property> </item> <item> <property name="text"> - <string>Show a blank page</string> + <string>Always show side-by-side</string> </property> </item> <item> <property name="text"> - <string>Show my tabs from last session</string> + <string>Always start full help</string> </property> </item> </widget> </item> - <item> + <item row="0" column="2"> <spacer name="horizontalSpacer_3"> <property name="orientation"> <enum>Qt::Horizontal</enum> @@ -192,6 +192,44 @@ </property> </spacer> </item> + <item row="1" column="0"> + <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 row="1" column="1"> + <widget class="QComboBox" name="helpStartComboBox"> + <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> </layout> </item> <item> diff --git a/src/plugins/help/helpplugin.cpp b/src/plugins/help/helpplugin.cpp index a110130675db63c7afbfaa3623f635f9998f6ac5..fb1f5cf1bb0c387f71ebb400f877f9e959ecc94b 100644 --- a/src/plugins/help/helpplugin.cpp +++ b/src/plugins/help/helpplugin.cpp @@ -53,6 +53,7 @@ #include <coreplugin/rightpane.h> #include <coreplugin/sidebar.h> #include <coreplugin/welcomemode.h> +#include <coreplugin/editormanager/editormanager.h> #include <texteditor/texteditorconstants.h> @@ -732,12 +733,35 @@ void HelpPlugin::activateContext() } HelpViewer *viewer = 0; - if (placeHolder && !Core::RightPaneWidget::instance()->hasFocus()) { + + + + bool showSideBySide = false; + + switch (m_helpEngine->customValue(QLatin1String("ContextHelpOption"), 0).toInt()) + { + case 0: // side by side if possible + { + if (Core::IEditor *editor = Core::EditorManager::instance()->currentEditor()) { + if (editor->widget() && editor->widget()->isVisible() && editor->widget()->width() < 800 ) + break; + } + } + // fall through + case 1: // side by side + showSideBySide = true; + break; + default: // help mode + break; + } + + if (placeHolder && showSideBySide && !Core::RightPaneWidget::instance()->hasFocus()) { Core::RightPaneWidget::instance()->setShown(true); viewer = m_helpViewerForSideBar; } else { + if (!m_centralWidget->currentHelpViewer()) + activateHelpMode(); viewer = m_centralWidget->currentHelpViewer(); - activateHelpMode(); } if (viewer) { @@ -753,6 +777,8 @@ void HelpPlugin::activateContext() viewer->setSource(source); viewer->setFocus(); } + if (viewer != m_helpViewerForSideBar) + activateHelpMode(); } }