Merge ITextMark and BaseTextMark

Turns out we don't even need two-phase initialization,
by transparently postponing registration until we get
a non-empty file name, either at constuction, or at
file name change times.

Change-Id: I3e87e47c820066e6707e946fc474ab9c1993e61f
Reviewed-by: Eike Ziller <eike.ziller@digia.com>
This commit is contained in:
hjk
2014-07-19 11:27:28 +02:00
parent 53bfd5285d
commit cf8a614419
32 changed files with 265 additions and 372 deletions

View File

@@ -103,8 +103,8 @@ public:
QPointer<BaseTextDocument> document;
Location location;
QPointer<DebuggerEngine> engine;
ITextMark locationMark;
QList<ITextMark *> breakpointMarks;
TextMark locationMark;
QList<TextMark *> breakpointMarks;
QList<CacheEntry> cache;
QString mimeType;
bool tryMixedInitialized;
@@ -114,14 +114,14 @@ public:
DisassemblerAgentPrivate::DisassemblerAgentPrivate()
: document(0),
locationMark(0),
locationMark(QString(), 0),
mimeType(_("text/x-qtcreator-generic-asm")),
tryMixedInitialized(false),
tryMixed(true),
resetLocationScheduled(false)
{
locationMark.setIcon(debuggerCore()->locationMarkIcon());
locationMark.setPriority(TextEditor::ITextMark::HighPriority);
locationMark.setPriority(TextEditor::TextMark::HighPriority);
}
DisassemblerAgentPrivate::~DisassemblerAgentPrivate()
@@ -353,7 +353,7 @@ void DisassemblerAgent::updateBreakpointMarkers()
return;
const DisassemblerLines contents = d->contentsAtCurrentLocation();
foreach (TextEditor::ITextMark *marker, d->breakpointMarks)
foreach (TextEditor::TextMark *marker, d->breakpointMarks)
d->document->removeMark(marker);
qDeleteAll(d->breakpointMarks);
d->breakpointMarks.clear();
@@ -364,9 +364,9 @@ void DisassemblerAgent::updateBreakpointMarkers()
const int lineNumber = contents.lineForAddress(address);
if (!lineNumber)
continue;
ITextMark *marker = new ITextMark(lineNumber);
TextMark *marker = new TextMark(QString(), lineNumber);
marker->setIcon(handler->icon(id));
marker->setPriority(ITextMark::NormalPriority);
marker->setPriority(TextMark::NormalPriority);
d->breakpointMarks.append(marker);
d->document->addMark(marker);
}