forked from qt-creator/qt-creator
customize context help. The three modes are:
- show side-by-side if possible - always show side-by-side - always show full help The default is "show side-by-side if possible". It's currently considered possible if the editor is at least 800 pixels wide.
This commit is contained in:
@@ -111,6 +111,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()));
|
||||
connect(m_ui.defaultPageButton, SIGNAL(clicked()), this, SLOT(setDefaultPage()));
|
||||
@@ -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()
|
||||
|
||||
@@ -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,8 +140,59 @@
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_5">
|
||||
<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>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>On context help:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<widget class="QComboBox" name="contextHelpComboBox">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Show side-by-side if possible</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Always show side-by-side</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Always start full help</string>
|
||||
</property>
|
||||
</item>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="2">
|
||||
<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>
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="label_2">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
|
||||
@@ -154,7 +205,7 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<item row="1" column="1">
|
||||
<widget class="QComboBox" name="helpStartComboBox">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
|
||||
@@ -179,19 +230,6 @@
|
||||
</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>
|
||||
|
||||
@@ -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 {
|
||||
viewer = m_centralWidget->currentHelpViewer();
|
||||
if (!m_centralWidget->currentHelpViewer())
|
||||
activateHelpMode();
|
||||
viewer = m_centralWidget->currentHelpViewer();
|
||||
}
|
||||
|
||||
if (viewer) {
|
||||
@@ -753,6 +777,8 @@ void HelpPlugin::activateContext()
|
||||
viewer->setSource(source);
|
||||
viewer->setFocus();
|
||||
}
|
||||
if (viewer != m_helpViewerForSideBar)
|
||||
activateHelpMode();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user