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
6249aabc
Commit
6249aabc
authored
Apr 06, 2010
by
hjk
Browse files
debugger: prevent the QML editor from setting breakpoints
parent
f773f429
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/plugins/debugger/debuggerplugin.cpp
View file @
6249aabc
...
...
@@ -1076,6 +1076,14 @@ void DebuggerPlugin::activateDebugMode()
modeManager
->
activateMode
(
_
(
MODE_DEBUG
));
}
static
bool
isDebuggable
(
Core
::
IEditor
*
editor
)
{
// Only blacklist XML. Whitelisting would fail on C++ code in files
// with strange names, more harm would be done this way.
Core
::
IFile
*
file
=
editor
->
file
();
return
!
(
file
&&
file
->
mimeType
()
==
"application/x-qml"
);
}
TextEditor
::
ITextEditor
*
DebuggerPlugin
::
currentTextEditor
()
{
EditorManager
*
editorManager
=
EditorManager
::
instance
();
...
...
@@ -1087,31 +1095,39 @@ TextEditor::ITextEditor *DebuggerPlugin::currentTextEditor()
void
DebuggerPlugin
::
editorOpened
(
Core
::
IEditor
*
editor
)
{
if
(
ITextEditor
*
textEditor
=
qobject_cast
<
ITextEditor
*>
(
editor
))
{
connect
(
textEditor
,
SIGNAL
(
markRequested
(
TextEditor
::
ITextEditor
*
,
int
)),
this
,
SLOT
(
requestMark
(
TextEditor
::
ITextEditor
*
,
int
)));
connect
(
editor
,
SIGNAL
(
tooltipRequested
(
TextEditor
::
ITextEditor
*
,
QPoint
,
int
)),
this
,
SLOT
(
showToolTip
(
TextEditor
::
ITextEditor
*
,
QPoint
,
int
)));
connect
(
textEditor
,
SIGNAL
(
markContextMenuRequested
(
TextEditor
::
ITextEditor
*
,
int
,
QMenu
*
)),
this
,
SLOT
(
requestContextMenu
(
TextEditor
::
ITextEditor
*
,
int
,
QMenu
*
)));
}
if
(
!
isDebuggable
(
editor
))
return
;
ITextEditor
*
textEditor
=
qobject_cast
<
ITextEditor
*>
(
editor
);
if
(
!
textEditor
)
return
;
connect
(
textEditor
,
SIGNAL
(
markRequested
(
TextEditor
::
ITextEditor
*
,
int
)),
this
,
SLOT
(
requestMark
(
TextEditor
::
ITextEditor
*
,
int
)));
connect
(
editor
,
SIGNAL
(
tooltipRequested
(
TextEditor
::
ITextEditor
*
,
QPoint
,
int
)),
this
,
SLOT
(
showToolTip
(
TextEditor
::
ITextEditor
*
,
QPoint
,
int
)));
connect
(
textEditor
,
SIGNAL
(
markContextMenuRequested
(
TextEditor
::
ITextEditor
*
,
int
,
QMenu
*
)),
this
,
SLOT
(
requestContextMenu
(
TextEditor
::
ITextEditor
*
,
int
,
QMenu
*
)));
}
void
DebuggerPlugin
::
editorAboutToClose
(
Core
::
IEditor
*
editor
)
{
if
(
ITextEditor
*
textEditor
=
qobject_cast
<
ITextEditor
*>
(
editor
))
{
disconnect
(
textEditor
,
SIGNAL
(
markRequested
(
TextEditor
::
ITextEditor
*
,
int
)),
this
,
SLOT
(
requestMark
(
TextEditor
::
ITextEditor
*
,
int
)));
disconnect
(
editor
,
SIGNAL
(
tooltipRequested
(
TextEditor
::
ITextEditor
*
,
QPoint
,
int
)),
this
,
SLOT
(
showToolTip
(
TextEditor
::
ITextEditor
*
,
QPoint
,
int
)));
disconnect
(
textEditor
,
SIGNAL
(
markContextMenuRequested
(
TextEditor
::
ITextEditor
*
,
int
,
QMenu
*
)),
this
,
SLOT
(
requestContextMenu
(
TextEditor
::
ITextEditor
*
,
int
,
QMenu
*
)));
}
if
(
!
isDebuggable
(
editor
))
return
;
ITextEditor
*
textEditor
=
qobject_cast
<
ITextEditor
*>
(
editor
);
if
(
!
textEditor
)
return
;
disconnect
(
textEditor
,
SIGNAL
(
markRequested
(
TextEditor
::
ITextEditor
*
,
int
)),
this
,
SLOT
(
requestMark
(
TextEditor
::
ITextEditor
*
,
int
)));
disconnect
(
editor
,
SIGNAL
(
tooltipRequested
(
TextEditor
::
ITextEditor
*
,
QPoint
,
int
)),
this
,
SLOT
(
showToolTip
(
TextEditor
::
ITextEditor
*
,
QPoint
,
int
)));
disconnect
(
textEditor
,
SIGNAL
(
markContextMenuRequested
(
TextEditor
::
ITextEditor
*
,
int
,
QMenu
*
)),
this
,
SLOT
(
requestContextMenu
(
TextEditor
::
ITextEditor
*
,
int
,
QMenu
*
)));
}
void
DebuggerPlugin
::
requestContextMenu
(
TextEditor
::
ITextEditor
*
editor
,
int
lineNumber
,
QMenu
*
menu
)
{
if
(
!
isDebuggable
(
editor
))
return
;
QString
fileName
=
editor
->
file
()
->
fileName
();
QString
position
=
fileName
+
QString
(
":%1"
).
arg
(
lineNumber
);
BreakpointData
*
data
=
m_manager
->
findBreakpoint
(
fileName
,
lineNumber
);
...
...
@@ -1163,13 +1179,18 @@ void DebuggerPlugin::breakpointEnableDisableMarginActionTriggered()
void
DebuggerPlugin
::
requestMark
(
ITextEditor
*
editor
,
int
lineNumber
)
{
if
(
!
isDebuggable
(
editor
))
return
;
m_manager
->
toggleBreakpoint
(
editor
->
file
()
->
fileName
(),
lineNumber
);
}
void
DebuggerPlugin
::
showToolTip
(
ITextEditor
*
editor
,
const
QPoint
&
point
,
int
pos
)
{
if
(
!
theDebuggerBoolSetting
(
UseToolTipsInMainEditor
)
||
m_manager
->
state
()
==
DebuggerNotReady
)
if
(
!
isDebuggable
(
editor
))
return
;
if
(
!
theDebuggerBoolSetting
(
UseToolTipsInMainEditor
))
return
;
if
(
m_manager
->
state
()
==
DebuggerNotReady
)
return
;
m_manager
->
setToolTipExpression
(
point
,
editor
,
pos
);
...
...
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