Git: Disable branch view if no git repository found

Also provide a proper label like the old branch dialog did.

Change-Id: I78490f66ccbc6bbc58117ea86030d7c1450f8329
Reviewed-by: Orgad Shaneh <orgads@gmail.com>
This commit is contained in:
Andre Hartmann
2018-09-19 20:46:05 +02:00
committed by André Hartmann
parent c415a03cea
commit 260750cc24

View File

@@ -122,8 +122,14 @@ void BranchView::refresh(const QString &repository, bool force)
return;
m_repository = repository;
m_repositoryLabel->setText(QDir::toNativeSeparators(m_repository));
m_repositoryLabel->setToolTip(GitPlugin::msgRepositoryLabel(m_repository));
if (m_repository.isEmpty()) {
m_repositoryLabel->setText(tr("<No repository>"));
m_branchView->setEnabled(false);
} else {
m_repositoryLabel->setText(QDir::toNativeSeparators(m_repository));
m_repositoryLabel->setToolTip(GitPlugin::msgRepositoryLabel(m_repository));
m_branchView->setEnabled(true);
}
QString errorMessage;
if (!m_model->refresh(m_repository, &errorMessage))
VcsBase::VcsOutputWindow::appendError(errorMessage);