forked from qt-creator/qt-creator
Refactor source property
Get rid of source property out of DiffEditorWidget, attach dynamic property when it's needed instead. Change-Id: I6641a7b55c42b4eceba78c2e28f5140b40fe0fa5 Reviewed-by: Orgad Shaneh <orgads@gmail.com>
This commit is contained in:
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user