Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Marco Bubke
flatpak-qt-creator
Commits
2948651f
Commit
2948651f
authored
Aug 06, 2009
by
Daniel Molkentin
Browse files
Show tutorials in context help pane by default, but honor context help settings.
Reviewed-by: kh
parent
6ab034ba
Changes
3
Hide whitespace changes
Inline
Side-by-side
src/plugins/help/helpplugin.cpp
View file @
2948651f
...
...
@@ -76,6 +76,7 @@
#include
<QtGui/QToolBar>
#include
<QtGui/QComboBox>
#include
<QtGui/QDesktopServices>
#include
<QtGui/QMessageBox>
#include
<QtHelp/QHelpEngine>
#ifndef QT_NO_WEBKIT
...
...
@@ -118,7 +119,7 @@ void HelpManager::registerDocumentation(const QStringList &fileNames)
void
HelpManager
::
openHelpPage
(
const
QString
&
url
)
{
m_plugin
->
openHelpPage
(
url
);
m_plugin
->
handleHelpRequest
(
url
);
}
void
HelpManager
::
openContextHelpPage
(
const
QString
&
url
)
...
...
@@ -405,7 +406,7 @@ bool HelpPlugin::initialize(const QStringList &arguments, QString *error)
createRightPaneSideBar
();
QDesktopServices
::
setUrlHandler
(
"qthelp"
,
this
,
"
openHelpPage
"
);
QDesktopServices
::
setUrlHandler
(
"qthelp"
,
this
,
"
handleHelpRequest
"
);
if
(
Core
::
ActionContainer
*
advancedMenu
=
am
->
actionContainer
(
Core
::
Constants
::
M_EDIT_ADVANCED
))
{
...
...
@@ -674,12 +675,6 @@ void HelpPlugin::modeChanged(Core::IMode *mode)
}
}
void
HelpPlugin
::
openContextHelpPage
(
const
QString
&
url
)
{
Core
::
RightPaneWidget
::
instance
()
->
setShown
(
true
);
m_helpViewerForSideBar
->
setSource
(
QUrl
(
url
));
}
void
HelpPlugin
::
updateSideBarSource
()
{
const
QUrl
&
url
=
m_centralWidget
->
currentSource
();
...
...
@@ -713,35 +708,9 @@ void HelpPlugin::fontChanged()
#endif
}
void
HelpPlugin
::
activate
Context
()
HelpViewer
*
HelpPlugin
::
viewerFor
Context
Mode
()
{
Core
::
RightPanePlaceHolder
*
placeHolder
=
Core
::
RightPanePlaceHolder
::
current
();
if
(
placeHolder
&&
Core
::
RightPaneWidget
::
instance
()
->
hasFocus
())
{
switchToHelpMode
();
return
;
}
else
if
(
m_core
->
modeManager
()
->
currentMode
()
==
m_mode
)
return
;
QString
id
;
QMap
<
QString
,
QUrl
>
links
;
// Find out what to show
if
(
Core
::
IContext
*
context
=
m_core
->
currentContextObject
())
{
if
(
!
m_contextHelpEngine
)
{
m_contextHelpEngine
=
new
QHelpEngineCore
(
m_helpEngine
->
collectionFile
(),
this
);
m_contextHelpEngine
->
setupData
();
m_contextHelpEngine
->
setCurrentFilter
(
tr
(
"Unfiltered"
));
}
id
=
context
->
contextHelpId
();
links
=
m_contextHelpEngine
->
linksForIdentifier
(
id
);
}
HelpViewer
*
viewer
=
0
;
bool
showSideBySide
=
false
;
switch
(
m_helpEngine
->
customValue
(
QLatin1String
(
"ContextHelpOption"
),
0
).
toInt
())
...
...
@@ -761,7 +730,8 @@ void HelpPlugin::activateContext()
break
;
}
if
(
placeHolder
&&
showSideBySide
&&
!
Core
::
RightPaneWidget
::
instance
()
->
hasFocus
())
{
Core
::
RightPanePlaceHolder
*
placeHolder
=
Core
::
RightPanePlaceHolder
::
current
();
if
(
placeHolder
&&
showSideBySide
)
{
Core
::
RightPaneWidget
::
instance
()
->
setShown
(
true
);
viewer
=
m_helpViewerForSideBar
;
}
else
{
...
...
@@ -770,6 +740,37 @@ void HelpPlugin::activateContext()
viewer
=
m_centralWidget
->
currentHelpViewer
();
}
return
viewer
;
}
void
HelpPlugin
::
activateContext
()
{
Core
::
RightPanePlaceHolder
*
placeHolder
=
Core
::
RightPanePlaceHolder
::
current
();
if
(
placeHolder
&&
m_helpViewerForSideBar
->
hasFocus
())
{
switchToHelpMode
();
return
;
}
else
if
(
m_core
->
modeManager
()
->
currentMode
()
==
m_mode
)
return
;
QString
id
;
QMap
<
QString
,
QUrl
>
links
;
// Find out what to show
if
(
Core
::
IContext
*
context
=
m_core
->
currentContextObject
())
{
if
(
!
m_contextHelpEngine
)
{
m_contextHelpEngine
=
new
QHelpEngineCore
(
m_helpEngine
->
collectionFile
(),
this
);
m_contextHelpEngine
->
setupData
();
m_contextHelpEngine
->
setCurrentFilter
(
tr
(
"Unfiltered"
));
}
id
=
context
->
contextHelpId
();
links
=
m_contextHelpEngine
->
linksForIdentifier
(
id
);
}
QMessageBox
::
warning
(
0
,
"id"
,
id
);
HelpViewer
*
viewer
=
viewerForContextMode
();
if
(
viewer
)
{
if
(
links
.
isEmpty
())
{
// No link found or no context object
...
...
@@ -876,9 +877,12 @@ void HelpPlugin::addNewBookmark(const QString &title, const QString &url)
m_bookmarkManager
->
showBookmarkDialog
(
m_centralWidget
,
title
,
url
);
}
void
HelpPlugin
::
openHelpPage
(
const
QUrl
&
url
)
void
HelpPlugin
::
handleHelpRequest
(
const
QUrl
&
url
)
{
openHelpPage
(
url
.
toString
());
if
(
url
.
queryItemValue
(
"view"
)
==
QLatin1String
(
"split"
))
openContextHelpPage
(
url
.
toString
());
else
openHelpPage
(
url
.
toString
());
}
void
HelpPlugin
::
openHelpPage
(
const
QString
&
url
)
...
...
@@ -899,4 +903,13 @@ void HelpPlugin::openHelpPage(const QString& url)
}
}
void
HelpPlugin
::
openContextHelpPage
(
const
QString
&
url
)
{
Core
::
ModeManager
*
modeManager
=
Core
::
ICore
::
instance
()
->
modeManager
();
if
(
modeManager
->
currentMode
()
==
modeManager
->
mode
(
Core
::
Constants
::
MODE_WELCOME
))
modeManager
->
activateMode
(
Core
::
Constants
::
MODE_EDIT
);
HelpViewer
*
viewer
=
viewerForContextMode
();
viewer
->
setSource
(
QUrl
(
url
));
}
Q_EXPORT_PLUGIN
(
HelpPlugin
)
src/plugins/help/helpplugin.h
View file @
2948651f
...
...
@@ -111,7 +111,7 @@ public:
void
setIndexFilter
(
const
QString
&
filter
);
QString
indexFilter
()
const
;
void
openHelpPage
(
const
QUrl
&
url
);
void
handleHelpRequest
(
const
QUrl
&
url
);
void
openHelpPage
(
const
QString
&
url
);
void
openContextHelpPage
(
const
QString
&
url
);
...
...
@@ -146,6 +146,7 @@ private:
QToolBar
*
createToolBar
();
void
createRightPaneSideBar
();
void
activateHelpMode
();
HelpViewer
*
viewerForContextMode
();
Core
::
ICore
*
m_core
;
QHelpEngine
*
m_helpEngine
;
...
...
src/plugins/qt4projectmanager/gettingstartedwelcomepagewidget.cpp
View file @
2948651f
...
...
@@ -48,8 +48,6 @@
namespace
Qt4ProjectManager
{
namespace
Internal
{
// TODO: remove
GettingStartedWelcomePageWidget
::
GettingStartedWelcomePageWidget
(
QWidget
*
parent
)
:
QWidget
(
parent
),
ui
(
new
Ui
::
GettingStartedWelcomePageWidget
)
...
...
@@ -67,13 +65,13 @@ GettingStartedWelcomePageWidget::GettingStartedWelcomePageWidget(QWidget *parent
ui
->
tutorialTreeWidget
->
addItem
(
tr
(
"<b>Qt Creator - A quick tour</b>"
),
QString
(
"qthelp://com.nokia.qtcreator.%1%2/doc/index.html"
).
arg
(
IDE_VERSION_MAJOR
).
arg
(
IDE_VERSION_MINOR
));
ui
->
tutorialTreeWidget
->
addItem
(
tr
(
"Creating an address book"
),
QLatin1String
(
"qthelp://com.nokia.qtcreator/doc/tutorials-addressbook-sdk.html"
));
QLatin1String
(
"qthelp://com.nokia.qtcreator/doc/tutorials-addressbook-sdk.html
?view=split
"
));
ui
->
tutorialTreeWidget
->
addItem
(
tr
(
"Understanding widgets"
),
QLatin1String
(
"qthelp://com.trolltech.qt/qdoc/widgets-tutorial.html"
));
QLatin1String
(
"qthelp://com.trolltech.qt/qdoc/widgets-tutorial.html
?view=split
"
));
ui
->
tutorialTreeWidget
->
addItem
(
tr
(
"Building with qmake"
),
QLatin1String
(
"qthelp://com.trolltech.qmake/qdoc/qmake-tutorial.html"
));
QLatin1String
(
"qthelp://com.trolltech.qmake/qdoc/qmake-tutorial.html
?view=split
"
));
ui
->
tutorialTreeWidget
->
addItem
(
tr
(
"Writing test cases"
),
QLatin1String
(
"qthelp://com.trolltech.qt/qdoc/qtestlib-tutorial.html"
));
QLatin1String
(
"qthelp://com.trolltech.qt/qdoc/qtestlib-tutorial.html
?view=split
"
));
srand
(
QDateTime
::
currentDateTime
().
toTime_t
());
QStringList
tips
=
tipsOfTheDay
();
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment