Commit 90cb7df5 authored by hjk's avatar hjk
Browse files

debugger: re-organize code a bit

parent c6206249
......@@ -1207,6 +1207,37 @@ void DebuggerPlugin::requestContextMenu(TextEditor::ITextEditor *editor,
}
}
void DebuggerPlugin::toggleBreakpoint()
{
ITextEditor *textEditor = currentTextEditor();
QTC_ASSERT(textEditor, return);
int lineNumber = textEditor->currentLine();
if (lineNumber >= 0)
toggleBreakpoint(textEditor->file()->fileName(), lineNumber);
}
void DebuggerPlugin::toggleBreakpoint(const QString &fileName, int lineNumber)
{
BreakHandler *handler = m_manager->breakHandler();
QTC_ASSERT(handler, return);
BreakpointData needle;
needle.bpFileName = fileName;
needle.bpLineNumber.setNum(lineNumber);
BreakpointData *data = handler->findSimilarBreakpoint(needle);
if (data) {
handler->removeBreakpoint(data);
} else {
data = new BreakpointData;
data->fileName = fileName;
data->lineNumber = QByteArray::number(lineNumber);
data->pending = true;
data->setMarkerFileName(fileName);
data->setMarkerLineNumber(lineNumber);
handler->appendBreakpoint(data);
}
m_manager->attemptBreakpointSynchronization();
}
void DebuggerPlugin::breakpointSetRemoveMarginActionTriggered()
{
QAction *act = qobject_cast<QAction *>(sender());
......@@ -1550,37 +1581,6 @@ void DebuggerPlugin::enableReverseDebuggingTriggered(const QVariant &value)
m_manager->debuggerManagerActions().reverseDirectionAction->setEnabled(value.toBool());
}
void DebuggerPlugin::toggleBreakpoint()
{
ITextEditor *textEditor = currentTextEditor();
QTC_ASSERT(textEditor, return);
int lineNumber = textEditor->currentLine();
if (lineNumber >= 0)
toggleBreakpoint(textEditor->file()->fileName(), lineNumber);
}
void DebuggerPlugin::toggleBreakpoint(const QString &fileName, int lineNumber)
{
BreakHandler *handler = m_manager->breakHandler();
QTC_ASSERT(handler, return);
BreakpointData needle;
needle.bpFileName = fileName;
needle.bpLineNumber.setNum(lineNumber);
BreakpointData *data = handler->findSimilarBreakpoint(needle);
if (data) {
handler->removeBreakpoint(data);
} else {
data = new BreakpointData;
data->fileName = fileName;
data->lineNumber = QByteArray::number(lineNumber);
data->pending = true;
data->setMarkerFileName(fileName);
data->setMarkerLineNumber(lineNumber);
handler->appendBreakpoint(data);
}
m_manager->attemptBreakpointSynchronization();
}
void DebuggerPlugin::attachRemoteTcf()
{
const DebuggerStartParametersPtr sp(new DebuggerStartParameters);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment