summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/plugins/diffeditor/diffeditorwidget.cpp10
-rw-r--r--src/plugins/diffeditor/diffeditorwidget.h4
-rw-r--r--src/plugins/git/gitclient.cpp2
-rw-r--r--src/plugins/vcsbase/vcsbaseeditor.cpp5
-rw-r--r--src/plugins/vcsbase/vcsbaseplugin.cpp15
-rw-r--r--src/plugins/vcsbase/vcsbaseplugin.h6
6 files changed, 22 insertions, 20 deletions
diff --git a/src/plugins/diffeditor/diffeditorwidget.cpp b/src/plugins/diffeditor/diffeditorwidget.cpp
index ede54a4425..7a133b00e2 100644
--- a/src/plugins/diffeditor/diffeditorwidget.cpp
+++ b/src/plugins/diffeditor/diffeditorwidget.cpp
@@ -888,16 +888,6 @@ QTextCodec *DiffEditorWidget::codec() const
return const_cast<QTextCodec *>(m_leftEditor->codec());
}
-QString DiffEditorWidget::source() const
-{
- return m_source;
-}
-
-void DiffEditorWidget::setSource(const QString &source)
-{
- m_source = source;
-}
-
BaseTextEditorWidget *DiffEditorWidget::leftEditor() const
{
return m_leftEditor;
diff --git a/src/plugins/diffeditor/diffeditorwidget.h b/src/plugins/diffeditor/diffeditorwidget.h
index c1e11565ea..f38429e9fe 100644
--- a/src/plugins/diffeditor/diffeditorwidget.h
+++ b/src/plugins/diffeditor/diffeditorwidget.h
@@ -58,7 +58,6 @@ struct FileData;
class DIFFEDITOR_EXPORT DiffEditorWidget : public QWidget
{
- Q_PROPERTY(QString source READ source WRITE setSource)
Q_OBJECT
public:
struct DiffFileInfo {
@@ -84,9 +83,6 @@ public:
void setDiff(const QList<DiffFilesContents> &diffFileList, const QString &workingDirectory = QString());
QTextCodec *codec() const;
- QString source() const;
- void setSource(const QString &source);
-
#ifdef WITH_TESTS
void testAssemblyRows();
#endif // WITH_TESTS
diff --git a/src/plugins/git/gitclient.cpp b/src/plugins/git/gitclient.cpp
index 6842489a82..85e993a548 100644
--- a/src/plugins/git/gitclient.cpp
+++ b/src/plugins/git/gitclient.cpp
@@ -1045,7 +1045,7 @@ DiffEditor::DiffEditor *GitClient::createDiffEditor(const char *registerDynamicP
Core::EditorManager::openEditorWithContents(editorId, &title, m_msgWait.toUtf8()));
QTC_ASSERT(diffEditor, return 0);
diffEditor->document()->setProperty(registerDynamicProperty, dynamicPropertyValue);
- diffEditor->editorWidget()->setSource(source);
+ VcsBasePlugin::setSource(diffEditor, source);
Core::EditorManager::activateEditor(diffEditor);
return diffEditor;
diff --git a/src/plugins/vcsbase/vcsbaseeditor.cpp b/src/plugins/vcsbase/vcsbaseeditor.cpp
index f31cf7419a..f60a935d06 100644
--- a/src/plugins/vcsbase/vcsbaseeditor.cpp
+++ b/src/plugins/vcsbase/vcsbaseeditor.cpp
@@ -562,7 +562,6 @@ public:
const VcsBaseEditorParameters *m_parameters;
- QString m_source;
QString m_workingDirectory;
QRegExp m_diffFilePattern;
@@ -738,12 +737,12 @@ void VcsBaseEditorWidget::setForceReadOnly(bool b)
QString VcsBaseEditorWidget::source() const
{
- return d->m_source;
+ return VcsBasePlugin::source(editor());
}
void VcsBaseEditorWidget::setSource(const QString &source)
{
- d->m_source = source;
+ VcsBasePlugin::setSource(editor(), source);
}
QString VcsBaseEditorWidget::annotateRevisionTextFormat() const
diff --git a/src/plugins/vcsbase/vcsbaseplugin.cpp b/src/plugins/vcsbase/vcsbaseplugin.cpp
index fc73d89c67..a463ea658c 100644
--- a/src/plugins/vcsbase/vcsbaseplugin.cpp
+++ b/src/plugins/vcsbase/vcsbaseplugin.cpp
@@ -241,8 +241,7 @@ void StateListener::slotStateChanged()
const QList<Core::IEditor *> editors =
Core::EditorManager::documentModel()->editorsForDocument(currentDocument);
if (!editors.isEmpty()) {
- if (QWidget *editorWidget = editors.first()->widget())
- state.currentFile = editorWidget->property("source").toString();
+ state.currentFile = VcsBasePlugin::source(editors.first());
}
}
}
@@ -749,6 +748,18 @@ bool VcsBasePlugin::isSshPromptConfigured()
return !sshPrompt().isEmpty();
}
+static const char SOURCE_PROPERTY[] = "qtcreator_source";
+
+void VcsBasePlugin::setSource(Core::IEditor *editor, const QString &source)
+{
+ editor->setProperty(SOURCE_PROPERTY, source);
+}
+
+QString VcsBasePlugin::source(Core::IEditor *editor)
+{
+ return editor->property(SOURCE_PROPERTY).toString();
+}
+
void VcsBasePlugin::setProcessEnvironment(QProcessEnvironment *e,
bool forceCLocale,
const QString &sshPromptBinary)
diff --git a/src/plugins/vcsbase/vcsbaseplugin.h b/src/plugins/vcsbase/vcsbaseplugin.h
index a620452ae5..3199dc1cbd 100644
--- a/src/plugins/vcsbase/vcsbaseplugin.h
+++ b/src/plugins/vcsbase/vcsbaseplugin.h
@@ -48,6 +48,7 @@ namespace Utils { struct SynchronousProcessResponse; }
namespace Core {
class IVersionControl;
class Id;
+class IEditor;
}
namespace VcsBase {
@@ -155,6 +156,11 @@ public:
// Returns whether an SSH prompt is configured.
static bool isSshPromptConfigured();
+ // Sets the source of editor contents, can be directory or file.
+ static void setSource(Core::IEditor *editor, const QString &source);
+ // Returns the source of editor contents.
+ static QString source(Core::IEditor *editor);
+
// Convenience to synchronously run VCS commands
enum RunVcsFlags {
ShowStdOutInLogWindow = 0x1, // Append standard output to VCS output window.