forked from qt-creator/qt-creator
Show VCS topic in window title
Project tree root is not visible most of the time. Window title is more useful. Also shows topic for *current* open file rather than the project (supporting submodules and externally opened files) Change-Id: Id21be09c27beca1b0d37674513121a0e0e995feb Reviewed-by: Eike Ziller <eike.ziller@digia.com>
This commit is contained in:
committed by
Orgad Shaneh
parent
ab0c3da08f
commit
0b6b6b38cb
@@ -225,6 +225,7 @@ public:
|
||||
IDocument::ReloadSetting m_reloadSetting;
|
||||
|
||||
QString m_titleAddition;
|
||||
QString m_titleVcsTopic;
|
||||
|
||||
bool m_autoSaveEnabled;
|
||||
int m_autoSaveInterval;
|
||||
@@ -1962,6 +1963,8 @@ void EditorManager::updateWindowTitle()
|
||||
{
|
||||
QString windowTitle = tr("Qt Creator");
|
||||
const QString dashSep = QLatin1String(" - ");
|
||||
if (!d->m_titleVcsTopic.isEmpty())
|
||||
windowTitle.prepend(d->m_titleVcsTopic + dashSep);
|
||||
if (!d->m_titleAddition.isEmpty())
|
||||
windowTitle.prepend(d->m_titleAddition + dashSep);
|
||||
IEditor *curEditor = currentEditor();
|
||||
@@ -2579,6 +2582,17 @@ QString EditorManager::windowTitleAddition() const
|
||||
return d->m_titleAddition;
|
||||
}
|
||||
|
||||
void EditorManager::setWindowTitleVcsTopic(const QString &topic)
|
||||
{
|
||||
d->m_titleVcsTopic = topic;
|
||||
m_instance->updateWindowTitle();
|
||||
}
|
||||
|
||||
QString EditorManager::windowTitleVcsTopic()
|
||||
{
|
||||
return d->m_titleVcsTopic;
|
||||
}
|
||||
|
||||
void EditorManager::updateVariable(const QByteArray &variable)
|
||||
{
|
||||
if (VariableManager::instance()->isFileVariable(variable, kCurrentDocumentPrefix)) {
|
||||
|
||||
@@ -183,6 +183,9 @@ public:
|
||||
void setWindowTitleAddition(const QString &addition);
|
||||
QString windowTitleAddition() const;
|
||||
|
||||
static void setWindowTitleVcsTopic(const QString &topic);
|
||||
static QString windowTitleVcsTopic();
|
||||
|
||||
void addSaveAndCloseEditorActions(QMenu *contextMenu, OpenEditorsModel::Entry *entry);
|
||||
void addNativeDirActions(QMenu *contextMenu, OpenEditorsModel::Entry *entry);
|
||||
|
||||
|
||||
@@ -290,8 +290,10 @@ void StateListener::slotStateChanged()
|
||||
}
|
||||
// Assemble state and emit signal.
|
||||
Core::IVersionControl *vc = state.currentFile.isEmpty() ? projectControl : fileControl;
|
||||
if (!vc) // Need a repository to patch
|
||||
state.clearPatchFile();
|
||||
if (!vc) {
|
||||
state.clearPatchFile(); // Need a repository to patch
|
||||
Core::EditorManager::setWindowTitleVcsTopic(QString());
|
||||
}
|
||||
if (debug)
|
||||
qDebug() << state << (vc ? vc->displayName() : QString(QLatin1String("No version control")));
|
||||
emit stateChanged(state, vc);
|
||||
@@ -581,6 +583,7 @@ void VcsBasePlugin::slotStateChanged(const VcsBase::Internal::State &newInternal
|
||||
if (!d->m_state.equals(newInternalState)) {
|
||||
d->m_state.setState(newInternalState);
|
||||
updateActions(VcsEnabled);
|
||||
Core::EditorManager::setWindowTitleVcsTopic(vc->vcsTopic(d->m_state.topLevel()));
|
||||
}
|
||||
} else {
|
||||
// Some other VCS plugin or state changed: Reset us to empty state.
|
||||
|
||||
Reference in New Issue
Block a user