summaryrefslogtreecommitdiff
path: root/src/plugins/texteditor/basetextmark.cpp
diff options
context:
space:
mode:
authorFriedemann Kleint <Friedemann.Kleint@nokia.com>2010-10-29 15:20:10 +0200
committerFriedemann Kleint <Friedemann.Kleint@nokia.com>2010-10-29 15:20:10 +0200
commit722e48c2b3bbed0e7696ff40b10aa650f4cf4d2e (patch)
tree3a3e416b6c1ebfd6a33df4f57b8777a03a2eddac /src/plugins/texteditor/basetextmark.cpp
parent259f518d55960ab003d73a683b4a9310251b4bca (diff)
downloadqt-creator-722e48c2b3bbed0e7696ff40b10aa650f4cf4d2e.tar.gz
TextEditor: Some exported header cleanup.
Remove internal markers from exported headers, introduce private class for BaseTextDocument. Reviewed-by: Leandro T. C. Melo <leandro.melo@nokia.com>
Diffstat (limited to 'src/plugins/texteditor/basetextmark.cpp')
-rw-r--r--src/plugins/texteditor/basetextmark.cpp51
1 files changed, 44 insertions, 7 deletions
diff --git a/src/plugins/texteditor/basetextmark.cpp b/src/plugins/texteditor/basetextmark.cpp
index fb425cb890..b6b638f42c 100644
--- a/src/plugins/texteditor/basetextmark.cpp
+++ b/src/plugins/texteditor/basetextmark.cpp
@@ -28,16 +28,52 @@
**************************************************************************/
#include "basetextmark.h"
-
+#include "itexteditor.h"
#include "basetextdocument.h"
#include <coreplugin/editormanager/editormanager.h>
#include <extensionsystem/pluginmanager.h>
#include <QtCore/QTimer>
+#include <QtGui/QIcon>
+
+namespace TextEditor {
+namespace Internal {
+
+class InternalMark : public TextEditor::ITextMark
+{
+public:
+ explicit InternalMark(BaseTextMark *parent) : m_parent(parent) {}
+
+ virtual QIcon icon() const
+ {
+ return m_parent->icon();
+ }
+
+ virtual void updateLineNumber(int lineNumber)
+ {
+ return m_parent->updateLineNumber(lineNumber);
+ }
+
+ virtual void updateBlock(const QTextBlock &block)
+ {
+ return m_parent->updateBlock(block);
+ }
+
+ virtual void removedFromEditor()
+ {
+ m_parent->childRemovedFromEditor(this);
+ }
+
+ virtual void documentClosing()
+ {
+ m_parent->documentClosingFor(this);
+ }
+private:
+ BaseTextMark *m_parent;
+};
-using namespace TextEditor;
-using namespace TextEditor::Internal;
+} // namespace Internal
BaseTextMark::BaseTextMark(const QString &filename, int line)
: m_markableInterface(0)
@@ -80,7 +116,7 @@ void BaseTextMark::editorOpened(Core::IEditor *editor)
if (ITextEditor *textEditor = qobject_cast<ITextEditor *>(editor)) {
if (m_markableInterface == 0) { // We aren't added to something
m_markableInterface = textEditor->markableInterface();
- m_internalMark = new InternalMark(this);
+ m_internalMark = new Internal::InternalMark(this);
if (m_markableInterface->addMark(m_internalMark, m_line)) {
// Handle reload of text documents, readding the mark as necessary
@@ -103,13 +139,13 @@ void BaseTextMark::documentReloaded()
return;
m_markableInterface = doc->documentMarker();
- m_internalMark = new InternalMark(this);
+ m_internalMark = new Internal::InternalMark(this);
if (!m_markableInterface->addMark(m_internalMark, m_line))
removeInternalMark();
}
-void BaseTextMark::childRemovedFromEditor(InternalMark *mark)
+void BaseTextMark::childRemovedFromEditor(Internal::InternalMark *mark)
{
Q_UNUSED(mark)
// m_internalMark was removed from the editor
@@ -117,7 +153,7 @@ void BaseTextMark::childRemovedFromEditor(InternalMark *mark)
removedFromEditor();
}
-void BaseTextMark::documentClosingFor(InternalMark *mark)
+void BaseTextMark::documentClosingFor(Internal::InternalMark *mark)
{
Q_UNUSED(mark)
removeInternalMark();
@@ -155,3 +191,4 @@ void BaseTextMark::moveMark(const QString & /* filename */, int /* line */)
foreach (Core::IEditor *editor, em->openedEditors())
editorOpened(editor);
}
+} // namespace TextEditor