forked from qt-creator/qt-creator
Git: Replace branch dialog with branches side panel
This allows all kind of typical Git workflow (rebasing, merging, cherry-picking) without having the branches dialog on top of all windows. Task-number: QTCREATORBUG-19618 Change-Id: Iab078d79a589ff60fa8385c98ec2a23b352c084c Reviewed-by: Orgad Shaneh <orgads@gmail.com>
This commit is contained in:
committed by
André Hartmann
parent
b173c3d83f
commit
e543ef5eb1
@@ -1,216 +0,0 @@
|
|||||||
/****************************************************************************
|
|
||||||
**
|
|
||||||
** Copyright (C) 2016 The Qt Company Ltd.
|
|
||||||
** Contact: https://www.qt.io/licensing/
|
|
||||||
**
|
|
||||||
** This file is part of Qt Creator.
|
|
||||||
**
|
|
||||||
** Commercial License Usage
|
|
||||||
** Licensees holding valid commercial Qt licenses may use this file in
|
|
||||||
** accordance with the commercial license agreement provided with the
|
|
||||||
** Software or, alternatively, in accordance with the terms contained in
|
|
||||||
** a written agreement between you and The Qt Company. For licensing terms
|
|
||||||
** and conditions see https://www.qt.io/terms-conditions. For further
|
|
||||||
** information use the contact form at https://www.qt.io/contact-us.
|
|
||||||
**
|
|
||||||
** GNU General Public License Usage
|
|
||||||
** Alternatively, this file may be used under the terms of the GNU
|
|
||||||
** General Public License version 3 as published by the Free Software
|
|
||||||
** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
|
|
||||||
** included in the packaging of this file. Please review the following
|
|
||||||
** information to ensure the GNU General Public License requirements will
|
|
||||||
** be met: https://www.gnu.org/licenses/gpl-3.0.html.
|
|
||||||
**
|
|
||||||
****************************************************************************/
|
|
||||||
|
|
||||||
#include "branchdialog.h"
|
|
||||||
#include "branchadddialog.h"
|
|
||||||
#include "branchcheckoutdialog.h"
|
|
||||||
#include "branchmodel.h"
|
|
||||||
#include "branchutils.h"
|
|
||||||
#include "gitclient.h"
|
|
||||||
#include "gitplugin.h"
|
|
||||||
#include "gitutils.h"
|
|
||||||
#include "gitconstants.h"
|
|
||||||
#include "ui_branchdialog.h"
|
|
||||||
|
|
||||||
#include <vcsbase/vcsoutputwindow.h>
|
|
||||||
#include <coreplugin/documentmanager.h>
|
|
||||||
|
|
||||||
#include <utils/execmenu.h>
|
|
||||||
#include <utils/qtcassert.h>
|
|
||||||
|
|
||||||
#include <QAction>
|
|
||||||
#include <QItemSelectionModel>
|
|
||||||
#include <QMessageBox>
|
|
||||||
#include <QList>
|
|
||||||
#include <QMenu>
|
|
||||||
|
|
||||||
#include <QDebug>
|
|
||||||
|
|
||||||
using namespace VcsBase;
|
|
||||||
|
|
||||||
namespace Git {
|
|
||||||
namespace Internal {
|
|
||||||
|
|
||||||
BranchDialog::BranchDialog(QWidget *parent) :
|
|
||||||
QDialog(parent),
|
|
||||||
BranchUtils(this),
|
|
||||||
m_ui(new Ui::BranchDialog)
|
|
||||||
{
|
|
||||||
setModal(false);
|
|
||||||
setWindowFlags(windowFlags() & ~Qt::WindowContextHelpButtonHint);
|
|
||||||
setAttribute(Qt::WA_DeleteOnClose, true); // Do not update unnecessarily
|
|
||||||
|
|
||||||
m_ui->setupUi(this);
|
|
||||||
setBranchView(m_ui->branchView);
|
|
||||||
m_ui->includeOldCheckBox->setToolTip(
|
|
||||||
tr("Include branches and tags that have not been active for %n days.", 0,
|
|
||||||
Constants::OBSOLETE_COMMIT_AGE_IN_DAYS));
|
|
||||||
m_ui->includeTagsCheckBox->setChecked(GitPlugin::client()->settings().boolValue(
|
|
||||||
GitSettings::showTagsKey));
|
|
||||||
|
|
||||||
connect(m_ui->refreshButton, &QAbstractButton::clicked, this, &BranchDialog::refreshCurrentRepository);
|
|
||||||
connect(m_ui->addButton, &QAbstractButton::clicked, this, [this] { add(); });
|
|
||||||
connect(m_ui->checkoutButton, &QAbstractButton::clicked, this, [this] { checkout(); });
|
|
||||||
connect(m_ui->removeButton, &QAbstractButton::clicked, this, [this] { remove(); });
|
|
||||||
connect(m_ui->renameButton, &QAbstractButton::clicked, this, &BranchDialog::rename);
|
|
||||||
connect(m_ui->diffButton, &QAbstractButton::clicked, this, &BranchDialog::diff);
|
|
||||||
connect(m_ui->logButton, &QAbstractButton::clicked, this, &BranchDialog::log);
|
|
||||||
connect(m_ui->resetButton, &QAbstractButton::clicked, this, [this] { reset(); });
|
|
||||||
connect(m_ui->mergeButton, &QAbstractButton::clicked, this, &BranchDialog::merge);
|
|
||||||
connect(m_ui->rebaseButton, &QAbstractButton::clicked, this, [this] { rebase(); });
|
|
||||||
connect(m_ui->cherryPickButton, &QAbstractButton::clicked, this, [this] { cherryPick(); });
|
|
||||||
connect(m_ui->trackButton, &QAbstractButton::clicked, this, &BranchDialog::setRemoteTracking);
|
|
||||||
connect(m_ui->includeOldCheckBox, &QCheckBox::toggled, this, [this](bool value) {
|
|
||||||
m_model->setOldBranchesIncluded(value);
|
|
||||||
refreshCurrentRepository();
|
|
||||||
});
|
|
||||||
connect(m_ui->includeTagsCheckBox, &QCheckBox::toggled, this, [this](bool value) {
|
|
||||||
GitPlugin::client()->settings().setValue(GitSettings::showTagsKey, value);
|
|
||||||
refreshCurrentRepository();
|
|
||||||
});
|
|
||||||
|
|
||||||
m_ui->branchView->setModel(m_model);
|
|
||||||
m_ui->branchView->setFocus();
|
|
||||||
|
|
||||||
connect(m_ui->branchView->selectionModel(), &QItemSelectionModel::selectionChanged,
|
|
||||||
this, &BranchDialog::enableButtons);
|
|
||||||
connect(m_model, &QAbstractItemModel::dataChanged, this, &BranchDialog::resizeColumns);
|
|
||||||
connect(m_model, &QAbstractItemModel::rowsInserted, this, &BranchDialog::resizeColumns);
|
|
||||||
connect(m_model, &QAbstractItemModel::rowsRemoved, this, &BranchDialog::resizeColumns);
|
|
||||||
connect(m_model, &QAbstractItemModel::modelReset, this, &BranchDialog::expandAndResize);
|
|
||||||
|
|
||||||
m_ui->branchView->selectionModel()->clear();
|
|
||||||
enableButtons();
|
|
||||||
}
|
|
||||||
|
|
||||||
BranchDialog::~BranchDialog()
|
|
||||||
{
|
|
||||||
delete m_ui;
|
|
||||||
}
|
|
||||||
|
|
||||||
void BranchDialog::refresh(const QString &repository, bool force)
|
|
||||||
{
|
|
||||||
if (m_repository == repository && !force)
|
|
||||||
return;
|
|
||||||
|
|
||||||
m_repository = repository;
|
|
||||||
m_ui->repositoryLabel->setText(GitPlugin::msgRepositoryLabel(m_repository));
|
|
||||||
QString errorMessage;
|
|
||||||
if (!m_model->refresh(m_repository, &errorMessage))
|
|
||||||
VcsOutputWindow::appendError(errorMessage);
|
|
||||||
}
|
|
||||||
|
|
||||||
void BranchDialog::expandAndResize()
|
|
||||||
{
|
|
||||||
m_ui->branchView->expandAll();
|
|
||||||
resizeColumns();
|
|
||||||
}
|
|
||||||
|
|
||||||
void BranchDialog::refreshIfSame(const QString &repository)
|
|
||||||
{
|
|
||||||
if (m_repository == repository)
|
|
||||||
refreshCurrentRepository();
|
|
||||||
}
|
|
||||||
|
|
||||||
void BranchDialog::resizeColumns()
|
|
||||||
{
|
|
||||||
m_ui->branchView->resizeColumnToContents(0);
|
|
||||||
m_ui->branchView->resizeColumnToContents(1);
|
|
||||||
}
|
|
||||||
|
|
||||||
void BranchDialog::enableButtons()
|
|
||||||
{
|
|
||||||
QModelIndex idx = selectedIndex();
|
|
||||||
QModelIndex currentBranch = m_model->currentBranch();
|
|
||||||
const bool hasSelection = idx.isValid();
|
|
||||||
const bool currentSelected = hasSelection && idx == currentBranch;
|
|
||||||
const bool isLocal = m_model->isLocal(idx);
|
|
||||||
const bool isLeaf = m_model->isLeaf(idx);
|
|
||||||
const bool isTag = m_model->isTag(idx);
|
|
||||||
const bool hasActions = hasSelection && isLeaf;
|
|
||||||
const bool currentLocal = m_model->isLocal(currentBranch);
|
|
||||||
|
|
||||||
m_ui->removeButton->setEnabled(hasActions && !currentSelected && (isLocal || isTag));
|
|
||||||
m_ui->renameButton->setEnabled(hasActions && (isLocal || isTag));
|
|
||||||
m_ui->logButton->setEnabled(hasActions);
|
|
||||||
m_ui->diffButton->setEnabled(hasActions);
|
|
||||||
m_ui->checkoutButton->setEnabled(hasActions && !currentSelected);
|
|
||||||
m_ui->rebaseButton->setEnabled(hasActions && !currentSelected);
|
|
||||||
m_ui->resetButton->setEnabled(hasActions && currentLocal && !currentSelected);
|
|
||||||
m_ui->mergeButton->setEnabled(hasActions && !currentSelected);
|
|
||||||
m_ui->cherryPickButton->setEnabled(hasActions && !currentSelected);
|
|
||||||
m_ui->trackButton->setEnabled(hasActions && currentLocal && !currentSelected && !isTag);
|
|
||||||
}
|
|
||||||
|
|
||||||
void BranchDialog::refreshCurrentRepository()
|
|
||||||
{
|
|
||||||
refresh(m_repository, true);
|
|
||||||
}
|
|
||||||
|
|
||||||
void BranchDialog::rename()
|
|
||||||
{
|
|
||||||
if (BranchUtils::rename())
|
|
||||||
refreshCurrentRepository();
|
|
||||||
}
|
|
||||||
|
|
||||||
void BranchDialog::diff()
|
|
||||||
{
|
|
||||||
QString fullName = m_model->fullName(selectedIndex(), true);
|
|
||||||
if (fullName.isEmpty())
|
|
||||||
return;
|
|
||||||
GitPlugin::client()->diffBranch(m_repository, fullName);
|
|
||||||
}
|
|
||||||
|
|
||||||
void BranchDialog::log()
|
|
||||||
{
|
|
||||||
QString branchName = m_model->fullName(selectedIndex(), true);
|
|
||||||
if (branchName.isEmpty())
|
|
||||||
return;
|
|
||||||
GitPlugin::client()->log(m_repository, QString(), false, {branchName});
|
|
||||||
}
|
|
||||||
|
|
||||||
void BranchDialog::merge()
|
|
||||||
{
|
|
||||||
bool allowFastForward = true;
|
|
||||||
if (isFastForwardMerge()) {
|
|
||||||
QMenu popup;
|
|
||||||
QAction *fastForward = popup.addAction(tr("Fast-Forward"));
|
|
||||||
popup.addAction(tr("No Fast-Forward"));
|
|
||||||
QAction *chosen = Utils::execMenuAtWidget(&popup, m_ui->mergeButton);
|
|
||||||
if (!chosen)
|
|
||||||
return;
|
|
||||||
allowFastForward = (chosen == fastForward);
|
|
||||||
}
|
|
||||||
|
|
||||||
BranchUtils::merge(allowFastForward);
|
|
||||||
}
|
|
||||||
|
|
||||||
void BranchDialog::setRemoteTracking()
|
|
||||||
{
|
|
||||||
m_model->setRemoteTracking(selectedIndex());
|
|
||||||
}
|
|
||||||
|
|
||||||
} // namespace Internal
|
|
||||||
} // namespace Git
|
|
@@ -1,242 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<ui version="4.0">
|
|
||||||
<class>Git::Internal::BranchDialog</class>
|
|
||||||
<widget class="QDialog" name="Git::Internal::BranchDialog">
|
|
||||||
<property name="geometry">
|
|
||||||
<rect>
|
|
||||||
<x>0</x>
|
|
||||||
<y>0</y>
|
|
||||||
<width>514</width>
|
|
||||||
<height>527</height>
|
|
||||||
</rect>
|
|
||||||
</property>
|
|
||||||
<property name="windowTitle">
|
|
||||||
<string>Branches</string>
|
|
||||||
</property>
|
|
||||||
<layout class="QVBoxLayout" name="verticalLayout_3">
|
|
||||||
<item>
|
|
||||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
|
||||||
<item>
|
|
||||||
<widget class="QLabel" name="repositoryLabel">
|
|
||||||
<property name="text">
|
|
||||||
<string notr="true">Repository: Dummy</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<widget class="QPushButton" name="refreshButton">
|
|
||||||
<property name="sizePolicy">
|
|
||||||
<sizepolicy hsizetype="Maximum" vsizetype="Fixed">
|
|
||||||
<horstretch>0</horstretch>
|
|
||||||
<verstretch>0</verstretch>
|
|
||||||
</sizepolicy>
|
|
||||||
</property>
|
|
||||||
<property name="text">
|
|
||||||
<string>Re&fresh</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
</layout>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<widget class="QGroupBox" name="localBranchGroupBox">
|
|
||||||
<property name="title">
|
|
||||||
<string>Branches</string>
|
|
||||||
</property>
|
|
||||||
<layout class="QHBoxLayout" name="horizontalLayout_2">
|
|
||||||
<property name="topMargin">
|
|
||||||
<number>4</number>
|
|
||||||
</property>
|
|
||||||
<property name="bottomMargin">
|
|
||||||
<number>4</number>
|
|
||||||
</property>
|
|
||||||
<item>
|
|
||||||
<layout class="QVBoxLayout" name="verticalLayout_6">
|
|
||||||
<item>
|
|
||||||
<widget class="QTreeView" name="branchView">
|
|
||||||
<property name="rootIsDecorated">
|
|
||||||
<bool>false</bool>
|
|
||||||
</property>
|
|
||||||
<property name="uniformRowHeights">
|
|
||||||
<bool>true</bool>
|
|
||||||
</property>
|
|
||||||
<attribute name="headerVisible">
|
|
||||||
<bool>false</bool>
|
|
||||||
</attribute>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<widget class="QCheckBox" name="includeTagsCheckBox">
|
|
||||||
<property name="text">
|
|
||||||
<string>Include ta&gs</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<widget class="QCheckBox" name="includeOldCheckBox">
|
|
||||||
<property name="text">
|
|
||||||
<string>&Include old entries</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
</layout>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<layout class="QVBoxLayout" name="verticalLayout">
|
|
||||||
<property name="spacing">
|
|
||||||
<number>15</number>
|
|
||||||
</property>
|
|
||||||
<item>
|
|
||||||
<layout class="QVBoxLayout" name="verticalLayout_2">
|
|
||||||
<property name="spacing">
|
|
||||||
<number>3</number>
|
|
||||||
</property>
|
|
||||||
<item>
|
|
||||||
<widget class="QPushButton" name="addButton">
|
|
||||||
<property name="text">
|
|
||||||
<string>&Add...</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<widget class="QPushButton" name="removeButton">
|
|
||||||
<property name="text">
|
|
||||||
<string>&Remove</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<widget class="QPushButton" name="renameButton">
|
|
||||||
<property name="text">
|
|
||||||
<string>Re&name</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<widget class="QPushButton" name="checkoutButton">
|
|
||||||
<property name="text">
|
|
||||||
<string>C&heckout</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
</layout>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<layout class="QVBoxLayout" name="verticalLayout_4">
|
|
||||||
<property name="spacing">
|
|
||||||
<number>3</number>
|
|
||||||
</property>
|
|
||||||
<item>
|
|
||||||
<widget class="QPushButton" name="diffButton">
|
|
||||||
<property name="text">
|
|
||||||
<string>&Diff</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<widget class="QPushButton" name="logButton">
|
|
||||||
<property name="text">
|
|
||||||
<string>&Log</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
</layout>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<layout class="QVBoxLayout" name="verticalLayout_5">
|
|
||||||
<property name="spacing">
|
|
||||||
<number>3</number>
|
|
||||||
</property>
|
|
||||||
<item>
|
|
||||||
<widget class="QPushButton" name="mergeButton">
|
|
||||||
<property name="text">
|
|
||||||
<string>&Merge</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<widget class="QPushButton" name="rebaseButton">
|
|
||||||
<property name="text">
|
|
||||||
<string>Re&base</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<widget class="QPushButton" name="resetButton">
|
|
||||||
<property name="text">
|
|
||||||
<string>Re&set</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
</layout>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<widget class="QPushButton" name="cherryPickButton">
|
|
||||||
<property name="toolTip">
|
|
||||||
<string>Cherry pick top commit from selected branch.</string>
|
|
||||||
</property>
|
|
||||||
<property name="text">
|
|
||||||
<string>Cherry &Pick</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<widget class="QPushButton" name="trackButton">
|
|
||||||
<property name="toolTip">
|
|
||||||
<string>Set current branch to track the selected one.</string>
|
|
||||||
</property>
|
|
||||||
<property name="text">
|
|
||||||
<string>&Track</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<spacer name="verticalSpacer">
|
|
||||||
<property name="orientation">
|
|
||||||
<enum>Qt::Vertical</enum>
|
|
||||||
</property>
|
|
||||||
<property name="sizeHint" stdset="0">
|
|
||||||
<size>
|
|
||||||
<width>20</width>
|
|
||||||
<height>40</height>
|
|
||||||
</size>
|
|
||||||
</property>
|
|
||||||
</spacer>
|
|
||||||
</item>
|
|
||||||
</layout>
|
|
||||||
</item>
|
|
||||||
</layout>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<widget class="QDialogButtonBox" name="buttonBox">
|
|
||||||
<property name="orientation">
|
|
||||||
<enum>Qt::Horizontal</enum>
|
|
||||||
</property>
|
|
||||||
<property name="standardButtons">
|
|
||||||
<set>QDialogButtonBox::Close</set>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
</layout>
|
|
||||||
</widget>
|
|
||||||
<resources/>
|
|
||||||
<connections>
|
|
||||||
<connection>
|
|
||||||
<sender>buttonBox</sender>
|
|
||||||
<signal>rejected()</signal>
|
|
||||||
<receiver>Git::Internal::BranchDialog</receiver>
|
|
||||||
<slot>reject()</slot>
|
|
||||||
<hints>
|
|
||||||
<hint type="sourcelabel">
|
|
||||||
<x>466</x>
|
|
||||||
<y>614</y>
|
|
||||||
</hint>
|
|
||||||
<hint type="destinationlabel">
|
|
||||||
<x>544</x>
|
|
||||||
<y>23</y>
|
|
||||||
</hint>
|
|
||||||
</hints>
|
|
||||||
</connection>
|
|
||||||
</connections>
|
|
||||||
</ui>
|
|
266
src/plugins/git/branchview.cpp
Normal file
266
src/plugins/git/branchview.cpp
Normal file
@@ -0,0 +1,266 @@
|
|||||||
|
/****************************************************************************
|
||||||
|
**
|
||||||
|
** Copyright (C) 2018 Andre Hartmann <aha_1980@gmx.de>
|
||||||
|
** Contact: https://www.qt.io/licensing/
|
||||||
|
**
|
||||||
|
** This file is part of Qt Creator.
|
||||||
|
**
|
||||||
|
** Commercial License Usage
|
||||||
|
** Licensees holding valid commercial Qt licenses may use this file in
|
||||||
|
** accordance with the commercial license agreement provided with the
|
||||||
|
** Software or, alternatively, in accordance with the terms contained in
|
||||||
|
** a written agreement between you and The Qt Company. For licensing terms
|
||||||
|
** and conditions see https://www.qt.io/terms-conditions. For further
|
||||||
|
** information use the contact form at https://www.qt.io/contact-us.
|
||||||
|
**
|
||||||
|
** GNU General Public License Usage
|
||||||
|
** Alternatively, this file may be used under the terms of the GNU
|
||||||
|
** General Public License version 3 as published by the Free Software
|
||||||
|
** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
|
||||||
|
** included in the packaging of this file. Please review the following
|
||||||
|
** information to ensure the GNU General Public License requirements will
|
||||||
|
** be met: https://www.gnu.org/licenses/gpl-3.0.html.
|
||||||
|
**
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
#include "branchview.h"
|
||||||
|
|
||||||
|
#include "branchadddialog.h"
|
||||||
|
#include "branchcheckoutdialog.h"
|
||||||
|
#include "branchmodel.h"
|
||||||
|
#include "gitclient.h"
|
||||||
|
#include "gitconstants.h"
|
||||||
|
#include "gitplugin.h"
|
||||||
|
#include "gitutils.h"
|
||||||
|
|
||||||
|
#include <coreplugin/actionmanager/command.h>
|
||||||
|
#include <coreplugin/documentmanager.h>
|
||||||
|
#include <coreplugin/inavigationwidgetfactory.h>
|
||||||
|
#include <utils/elidinglabel.h>
|
||||||
|
#include <utils/navigationtreeview.h>
|
||||||
|
#include <utils/qtcassert.h>
|
||||||
|
#include <utils/utilsicons.h>
|
||||||
|
#include <vcsbase/vcsoutputwindow.h>
|
||||||
|
|
||||||
|
#include <QDir>
|
||||||
|
#include <QLabel>
|
||||||
|
#include <QKeySequence>
|
||||||
|
#include <QMenu>
|
||||||
|
#include <QMessageBox>
|
||||||
|
#include <QPoint>
|
||||||
|
#include <QTreeView>
|
||||||
|
#include <QToolButton>
|
||||||
|
#include <QVBoxLayout>
|
||||||
|
|
||||||
|
using namespace Core;
|
||||||
|
|
||||||
|
namespace Git {
|
||||||
|
namespace Internal {
|
||||||
|
|
||||||
|
BranchView::BranchView() :
|
||||||
|
BranchUtils(this),
|
||||||
|
m_includeOldEntriesAction(new QAction(tr("Include Old Entries"), this)),
|
||||||
|
m_includeTagsAction(new QAction(tr("Include Tags"), this)),
|
||||||
|
m_addButton(new QToolButton(this)),
|
||||||
|
m_refreshButton(new QToolButton(this)),
|
||||||
|
m_repositoryLabel(new Utils::ElidingLabel(this)),
|
||||||
|
m_branchView(new Utils::NavigationTreeView(this))
|
||||||
|
{
|
||||||
|
setBranchView(m_branchView);
|
||||||
|
m_addButton->setIcon(Utils::Icons::PLUS_TOOLBAR.icon());
|
||||||
|
m_addButton->setToolTip(tr("Add Branch"));
|
||||||
|
m_addButton->setProperty("noArrow", true);
|
||||||
|
connect(m_addButton, &QToolButton::clicked, this, [this] { add(); });
|
||||||
|
|
||||||
|
m_refreshButton->setIcon(Utils::Icons::RESET_TOOLBAR.icon());
|
||||||
|
m_refreshButton->setToolTip(tr("Refresh"));
|
||||||
|
m_refreshButton->setProperty("noArrow", true);
|
||||||
|
connect(m_refreshButton, &QToolButton::clicked, this, &BranchView::refreshCurrentRepository);
|
||||||
|
|
||||||
|
m_branchView->setModel(m_model);
|
||||||
|
m_branchView->setHeaderHidden(true);
|
||||||
|
setFocus();
|
||||||
|
|
||||||
|
m_repositoryLabel->setElideMode(Qt::ElideLeft);
|
||||||
|
auto layout = new QVBoxLayout(this);
|
||||||
|
layout->addWidget(m_repositoryLabel);
|
||||||
|
layout->addWidget(m_branchView);
|
||||||
|
layout->setContentsMargins(0, 2, 0, 0);
|
||||||
|
setLayout(layout);
|
||||||
|
|
||||||
|
m_includeOldEntriesAction->setCheckable(true);
|
||||||
|
m_includeOldEntriesAction->setToolTip(
|
||||||
|
tr("Include branches and tags that have not been active for %n days.", nullptr,
|
||||||
|
Constants::OBSOLETE_COMMIT_AGE_IN_DAYS));
|
||||||
|
connect(m_includeOldEntriesAction, &QAction::toggled,
|
||||||
|
this, &BranchView::BranchView::setIncludeOldEntries);
|
||||||
|
m_includeTagsAction->setCheckable(true);
|
||||||
|
m_includeTagsAction->setChecked(
|
||||||
|
GitPlugin::client()->settings().boolValue(GitSettings::showTagsKey));
|
||||||
|
connect(m_includeTagsAction, &QAction::toggled,
|
||||||
|
this, &BranchView::BranchView::setIncludeTags);
|
||||||
|
|
||||||
|
m_branchView->setContextMenuPolicy(Qt::CustomContextMenu);
|
||||||
|
connect(m_branchView, &QWidget::customContextMenuRequested,
|
||||||
|
this, &BranchView::slotCustomContextMenu);
|
||||||
|
connect(m_model, &QAbstractItemModel::modelReset,
|
||||||
|
this, &BranchView::expandAndResize);
|
||||||
|
|
||||||
|
m_branchView->selectionModel()->clear();
|
||||||
|
m_repository = GitPlugin::instance()->currentState().topLevel();
|
||||||
|
refreshCurrentRepository();
|
||||||
|
}
|
||||||
|
|
||||||
|
void BranchView::refreshIfSame(const QString &repository)
|
||||||
|
{
|
||||||
|
if (m_repository == repository)
|
||||||
|
refreshCurrentRepository();
|
||||||
|
}
|
||||||
|
|
||||||
|
void BranchView::refresh(const QString &repository, bool force)
|
||||||
|
{
|
||||||
|
if (m_repository == repository && !force)
|
||||||
|
return;
|
||||||
|
|
||||||
|
m_repository = repository;
|
||||||
|
m_repositoryLabel->setText(QDir::toNativeSeparators(m_repository));
|
||||||
|
m_repositoryLabel->setToolTip(GitPlugin::msgRepositoryLabel(m_repository));
|
||||||
|
QString errorMessage;
|
||||||
|
if (!m_model->refresh(m_repository, &errorMessage))
|
||||||
|
VcsBase::VcsOutputWindow::appendError(errorMessage);
|
||||||
|
}
|
||||||
|
|
||||||
|
QToolButton *BranchView::addButton() const
|
||||||
|
{
|
||||||
|
return m_addButton;
|
||||||
|
}
|
||||||
|
|
||||||
|
QToolButton *BranchView::refreshButton() const
|
||||||
|
{
|
||||||
|
return m_refreshButton;
|
||||||
|
}
|
||||||
|
|
||||||
|
void BranchView::refreshCurrentRepository()
|
||||||
|
{
|
||||||
|
refresh(m_repository, true);
|
||||||
|
}
|
||||||
|
|
||||||
|
void BranchView::resizeColumns()
|
||||||
|
{
|
||||||
|
for (int column = 0, total = m_model->columnCount(); column < total; ++column)
|
||||||
|
m_branchView->resizeColumnToContents(column);
|
||||||
|
}
|
||||||
|
|
||||||
|
void BranchView::slotCustomContextMenu(const QPoint &point)
|
||||||
|
{
|
||||||
|
const QModelIndex index = m_branchView->indexAt(point);
|
||||||
|
if (!index.isValid())
|
||||||
|
return;
|
||||||
|
|
||||||
|
const QModelIndex currentBranch = m_model->currentBranch();
|
||||||
|
const bool hasSelection = index.isValid();
|
||||||
|
const bool currentSelected = hasSelection && index == currentBranch;
|
||||||
|
const bool isLocal = m_model->isLocal(index);
|
||||||
|
const bool isLeaf = m_model->isLeaf(index);
|
||||||
|
const bool isTag = m_model->isTag(index);
|
||||||
|
const bool hasActions = hasSelection && isLeaf;
|
||||||
|
const bool currentLocal = m_model->isLocal(currentBranch);
|
||||||
|
|
||||||
|
QMenu contextMenu;
|
||||||
|
contextMenu.addAction(tr("Add..."), this, [this] { add(); });
|
||||||
|
if (hasActions) {
|
||||||
|
if (!currentSelected && (isLocal || isTag))
|
||||||
|
contextMenu.addAction(tr("Remove"), this, [this] { remove(); });
|
||||||
|
if (isLocal || isTag)
|
||||||
|
contextMenu.addAction(tr("Rename"), this, [this] { rename(); });
|
||||||
|
if (!currentSelected) {
|
||||||
|
contextMenu.addAction(tr("Checkout"), this, [this] { checkout(); });
|
||||||
|
}
|
||||||
|
contextMenu.addSeparator();
|
||||||
|
contextMenu.addAction(tr("Diff"), this, [this] {
|
||||||
|
const QString fullName = m_model->fullName(selectedIndex(), true);
|
||||||
|
if (!fullName.isEmpty())
|
||||||
|
GitPlugin::client()->diffBranch(m_repository, fullName);
|
||||||
|
});
|
||||||
|
contextMenu.addAction(tr("Log"), this, [this] {
|
||||||
|
const QString branchName = m_model->fullName(selectedIndex(), true);
|
||||||
|
if (!branchName.isEmpty())
|
||||||
|
GitPlugin::client()->log(m_repository, QString(), false, {branchName});
|
||||||
|
});
|
||||||
|
contextMenu.addSeparator();
|
||||||
|
if (!currentSelected) {
|
||||||
|
if (currentLocal)
|
||||||
|
contextMenu.addAction(tr("Reset"), this, [this] { reset(); });
|
||||||
|
QString mergeTitle;
|
||||||
|
if (BranchUtils::isFastForwardMerge()) {
|
||||||
|
contextMenu.addAction(tr("Merge (Fast-Forward)"), this, [this] { merge(true); });
|
||||||
|
mergeTitle = tr("Merge (No Fast-Forward)");
|
||||||
|
} else {
|
||||||
|
mergeTitle = tr("Merge");
|
||||||
|
}
|
||||||
|
|
||||||
|
contextMenu.addAction(mergeTitle, this, [this] { merge(); });
|
||||||
|
contextMenu.addAction(tr("Rebase"), this, [this] { rebase(); });
|
||||||
|
contextMenu.addSeparator();
|
||||||
|
contextMenu.addAction(tr("Cherry Pick"), this, [this] { cherryPick(); });
|
||||||
|
}
|
||||||
|
if (currentLocal && !currentSelected && !isTag) {
|
||||||
|
contextMenu.addAction(tr("Track"), this, [this] {
|
||||||
|
m_model->setRemoteTracking(selectedIndex());
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
contextMenu.exec(m_branchView->viewport()->mapToGlobal(point));
|
||||||
|
}
|
||||||
|
|
||||||
|
void BranchView::expandAndResize()
|
||||||
|
{
|
||||||
|
m_branchView->expandAll();
|
||||||
|
resizeColumns();
|
||||||
|
}
|
||||||
|
|
||||||
|
void BranchView::setIncludeOldEntries(bool filter)
|
||||||
|
{
|
||||||
|
m_model->setOldBranchesIncluded(filter);
|
||||||
|
refreshCurrentRepository();
|
||||||
|
}
|
||||||
|
|
||||||
|
void BranchView::setIncludeTags(bool includeTags)
|
||||||
|
{
|
||||||
|
GitPlugin::client()->settings().setValue(GitSettings::showTagsKey, includeTags);
|
||||||
|
refreshCurrentRepository();
|
||||||
|
}
|
||||||
|
|
||||||
|
BranchViewFactory::BranchViewFactory()
|
||||||
|
{
|
||||||
|
setDisplayName(tr("Git Branches"));
|
||||||
|
setPriority(500);
|
||||||
|
setId(Constants::GIT_BRANCH_VIEW_ID);
|
||||||
|
}
|
||||||
|
|
||||||
|
NavigationView BranchViewFactory::createWidget()
|
||||||
|
{
|
||||||
|
m_view = new BranchView;
|
||||||
|
Core::NavigationView navigationView(m_view);
|
||||||
|
|
||||||
|
auto filter = new QToolButton;
|
||||||
|
filter->setIcon(Utils::Icons::FILTER.icon());
|
||||||
|
filter->setToolTip(tr("Filter"));
|
||||||
|
filter->setPopupMode(QToolButton::InstantPopup);
|
||||||
|
filter->setProperty("noArrow", true);
|
||||||
|
auto filterMenu = new QMenu(filter);
|
||||||
|
filterMenu->addAction(m_view->m_includeOldEntriesAction);
|
||||||
|
filterMenu->addAction(m_view->m_includeTagsAction);
|
||||||
|
filter->setMenu(filterMenu);
|
||||||
|
|
||||||
|
navigationView.dockToolBarWidgets << filter << m_view->addButton() << m_view->refreshButton();
|
||||||
|
return navigationView;
|
||||||
|
}
|
||||||
|
|
||||||
|
BranchView *BranchViewFactory::view() const
|
||||||
|
{
|
||||||
|
return m_view;
|
||||||
|
}
|
||||||
|
|
||||||
|
} // namespace Internal
|
||||||
|
} // namespace Git
|
@@ -1,6 +1,6 @@
|
|||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
**
|
**
|
||||||
** Copyright (C) 2016 The Qt Company Ltd.
|
** Copyright (C) 2018 Andre Hartmann <aha_1980@gmx.de>
|
||||||
** Contact: https://www.qt.io/licensing/
|
** Contact: https://www.qt.io/licensing/
|
||||||
**
|
**
|
||||||
** This file is part of Qt Creator.
|
** This file is part of Qt Creator.
|
||||||
@@ -27,47 +27,70 @@
|
|||||||
|
|
||||||
#include "branchutils.h"
|
#include "branchutils.h"
|
||||||
|
|
||||||
#include <QDialog>
|
#include <coreplugin/inavigationwidgetfactory.h>
|
||||||
|
|
||||||
|
#include <QPointer>
|
||||||
|
#include <QWidget>
|
||||||
|
|
||||||
QT_BEGIN_NAMESPACE
|
QT_BEGIN_NAMESPACE
|
||||||
class QModelIndex;
|
class QPoint;
|
||||||
QT_END_NAMESPACE
|
class QToolButton;
|
||||||
|
class QTreeView;
|
||||||
|
QT_END_NAMESPACE;
|
||||||
|
|
||||||
|
namespace Utils {
|
||||||
|
class ElidingLabel;
|
||||||
|
class NavigationTreeView;
|
||||||
|
}
|
||||||
|
|
||||||
namespace Git {
|
namespace Git {
|
||||||
namespace Internal {
|
namespace Internal {
|
||||||
|
|
||||||
namespace Ui { class BranchDialog; }
|
|
||||||
|
|
||||||
class BranchModel;
|
class BranchModel;
|
||||||
|
|
||||||
/**
|
class BranchView : public QWidget, public BranchUtils
|
||||||
* Branch dialog. Displays a list of local branches at the top and remote
|
|
||||||
* branches below. Offers to checkout/delete local branches.
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
class BranchDialog : public QDialog, public BranchUtils
|
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
explicit BranchDialog(QWidget *parent = 0);
|
explicit BranchView();
|
||||||
~BranchDialog() override;
|
|
||||||
|
|
||||||
void refresh(const QString &repository, bool force);
|
|
||||||
void refreshIfSame(const QString &repository);
|
void refreshIfSame(const QString &repository);
|
||||||
|
void refresh(const QString &repository, bool force);
|
||||||
|
|
||||||
|
QToolButton *addButton() const;
|
||||||
|
QToolButton *refreshButton() const;
|
||||||
|
|
||||||
|
QAction *m_includeOldEntriesAction = nullptr;
|
||||||
|
QAction *m_includeTagsAction = nullptr;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void expandAndResize();
|
|
||||||
void resizeColumns();
|
|
||||||
void enableButtons();
|
|
||||||
void refreshCurrentRepository();
|
void refreshCurrentRepository();
|
||||||
void rename();
|
void resizeColumns();
|
||||||
void diff();
|
void slotCustomContextMenu(const QPoint &point);
|
||||||
void log();
|
void expandAndResize();
|
||||||
void merge();
|
void setIncludeOldEntries(bool filter);
|
||||||
void setRemoteTracking();
|
void setIncludeTags(bool includeTags);
|
||||||
|
|
||||||
Ui::BranchDialog *m_ui;
|
QToolButton *m_addButton = nullptr;
|
||||||
|
QToolButton *m_refreshButton = nullptr;
|
||||||
|
Utils::ElidingLabel *m_repositoryLabel = nullptr;
|
||||||
|
Utils::NavigationTreeView *m_branchView = nullptr;
|
||||||
|
};
|
||||||
|
|
||||||
|
class BranchViewFactory : public Core::INavigationWidgetFactory
|
||||||
|
{
|
||||||
|
Q_OBJECT
|
||||||
|
|
||||||
|
public:
|
||||||
|
BranchViewFactory();
|
||||||
|
|
||||||
|
BranchView *view() const;
|
||||||
|
|
||||||
|
private:
|
||||||
|
Core::NavigationView createWidget() override;
|
||||||
|
|
||||||
|
QPointer<BranchView> m_view;
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace Internal
|
} // namespace Internal
|
@@ -14,7 +14,6 @@ HEADERS += gitplugin.h \
|
|||||||
gitsubmiteditor.h \
|
gitsubmiteditor.h \
|
||||||
gitversioncontrol.h \
|
gitversioncontrol.h \
|
||||||
gitsettings.h \
|
gitsettings.h \
|
||||||
branchdialog.h \
|
|
||||||
branchmodel.h \
|
branchmodel.h \
|
||||||
stashdialog.h \
|
stashdialog.h \
|
||||||
gitutils.h \
|
gitutils.h \
|
||||||
@@ -26,7 +25,8 @@ HEADERS += gitplugin.h \
|
|||||||
branchcheckoutdialog.h \
|
branchcheckoutdialog.h \
|
||||||
githighlighters.h \
|
githighlighters.h \
|
||||||
gitgrep.h \
|
gitgrep.h \
|
||||||
branchutils.h
|
branchutils.h \
|
||||||
|
branchview.h
|
||||||
|
|
||||||
SOURCES += gitplugin.cpp \
|
SOURCES += gitplugin.cpp \
|
||||||
gitclient.cpp \
|
gitclient.cpp \
|
||||||
@@ -39,7 +39,6 @@ SOURCES += gitplugin.cpp \
|
|||||||
gitsubmiteditor.cpp \
|
gitsubmiteditor.cpp \
|
||||||
gitversioncontrol.cpp \
|
gitversioncontrol.cpp \
|
||||||
gitsettings.cpp \
|
gitsettings.cpp \
|
||||||
branchdialog.cpp \
|
|
||||||
branchmodel.cpp \
|
branchmodel.cpp \
|
||||||
stashdialog.cpp \
|
stashdialog.cpp \
|
||||||
gitutils.cpp \
|
gitutils.cpp \
|
||||||
@@ -51,12 +50,12 @@ SOURCES += gitplugin.cpp \
|
|||||||
branchcheckoutdialog.cpp \
|
branchcheckoutdialog.cpp \
|
||||||
githighlighters.cpp \
|
githighlighters.cpp \
|
||||||
gitgrep.cpp \
|
gitgrep.cpp \
|
||||||
branchutils.cpp
|
branchutils.cpp \
|
||||||
|
branchview.cpp
|
||||||
|
|
||||||
FORMS += changeselectiondialog.ui \
|
FORMS += changeselectiondialog.ui \
|
||||||
settingspage.ui \
|
settingspage.ui \
|
||||||
gitsubmitpanel.ui \
|
gitsubmitpanel.ui \
|
||||||
branchdialog.ui \
|
|
||||||
stashdialog.ui \
|
stashdialog.ui \
|
||||||
remotedialog.ui \
|
remotedialog.ui \
|
||||||
remoteadditiondialog.ui \
|
remoteadditiondialog.ui \
|
||||||
|
@@ -22,13 +22,12 @@ QtcPlugin {
|
|||||||
"branchcheckoutdialog.cpp",
|
"branchcheckoutdialog.cpp",
|
||||||
"branchcheckoutdialog.h",
|
"branchcheckoutdialog.h",
|
||||||
"branchcheckoutdialog.ui",
|
"branchcheckoutdialog.ui",
|
||||||
"branchdialog.cpp",
|
|
||||||
"branchdialog.h",
|
|
||||||
"branchdialog.ui",
|
|
||||||
"branchmodel.cpp",
|
"branchmodel.cpp",
|
||||||
"branchmodel.h",
|
"branchmodel.h",
|
||||||
"branchutils.cpp",
|
"branchutils.cpp",
|
||||||
"branchutils.h",
|
"branchutils.h",
|
||||||
|
"branchview.cpp",
|
||||||
|
"branchview.h",
|
||||||
"changeselectiondialog.cpp",
|
"changeselectiondialog.cpp",
|
||||||
"changeselectiondialog.h",
|
"changeselectiondialog.h",
|
||||||
"changeselectiondialog.ui",
|
"changeselectiondialog.ui",
|
||||||
|
@@ -42,6 +42,7 @@ const char GIT_COMMIT_TEXT_EDITOR_ID[] = "Git Commit Editor";
|
|||||||
const char GIT_COMMIT_TEXT_EDITOR_DISPLAY_NAME[] = QT_TRANSLATE_NOOP("VCS", "Git Commit Editor");
|
const char GIT_COMMIT_TEXT_EDITOR_DISPLAY_NAME[] = QT_TRANSLATE_NOOP("VCS", "Git Commit Editor");
|
||||||
const char GIT_REBASE_EDITOR_ID[] = "Git Rebase Editor";
|
const char GIT_REBASE_EDITOR_ID[] = "Git Rebase Editor";
|
||||||
const char GIT_REBASE_EDITOR_DISPLAY_NAME[] = QT_TRANSLATE_NOOP("VCS", "Git Rebase Editor");
|
const char GIT_REBASE_EDITOR_DISPLAY_NAME[] = QT_TRANSLATE_NOOP("VCS", "Git Rebase Editor");
|
||||||
|
const char GIT_BRANCH_VIEW_ID[] = "Git Branches";
|
||||||
|
|
||||||
const char GIT_CONTEXT[] = "Git Context";
|
const char GIT_CONTEXT[] = "Git Context";
|
||||||
const char GITSUBMITEDITOR_ID[] = "Git Submit Editor";
|
const char GITSUBMITEDITOR_ID[] = "Git Submit Editor";
|
||||||
|
@@ -25,6 +25,7 @@
|
|||||||
|
|
||||||
#include "gitplugin.h"
|
#include "gitplugin.h"
|
||||||
|
|
||||||
|
#include "branchview.h"
|
||||||
#include "changeselectiondialog.h"
|
#include "changeselectiondialog.h"
|
||||||
#include "commitdata.h"
|
#include "commitdata.h"
|
||||||
#include "gitclient.h"
|
#include "gitclient.h"
|
||||||
@@ -32,7 +33,6 @@
|
|||||||
#include "giteditor.h"
|
#include "giteditor.h"
|
||||||
#include "gitsubmiteditor.h"
|
#include "gitsubmiteditor.h"
|
||||||
#include "gitversioncontrol.h"
|
#include "gitversioncontrol.h"
|
||||||
#include "branchdialog.h"
|
|
||||||
#include "remotedialog.h"
|
#include "remotedialog.h"
|
||||||
#include "stashdialog.h"
|
#include "stashdialog.h"
|
||||||
#include "settingspage.h"
|
#include "settingspage.h"
|
||||||
@@ -55,6 +55,7 @@
|
|||||||
#include <coreplugin/editormanager/editormanager.h>
|
#include <coreplugin/editormanager/editormanager.h>
|
||||||
#include <coreplugin/editormanager/ieditor.h>
|
#include <coreplugin/editormanager/ieditor.h>
|
||||||
#include <coreplugin/locator/commandlocator.h>
|
#include <coreplugin/locator/commandlocator.h>
|
||||||
|
#include <coreplugin/navigationwidget.h>
|
||||||
#include <coreplugin/vcsmanager.h>
|
#include <coreplugin/vcsmanager.h>
|
||||||
|
|
||||||
#include <coreplugin/messagebox.h>
|
#include <coreplugin/messagebox.h>
|
||||||
@@ -303,6 +304,7 @@ bool GitPlugin::initialize(const QStringList &arguments, QString *errorMessage)
|
|||||||
this, &GitPlugin::updateRepositoryBrowserAction);
|
this, &GitPlugin::updateRepositoryBrowserAction);
|
||||||
|
|
||||||
new GitGrep(this);
|
new GitGrep(this);
|
||||||
|
m_branchViewFactory = new BranchViewFactory;
|
||||||
|
|
||||||
const auto describeFunc = [this](const QString &source, const QString &id) {
|
const auto describeFunc = [this](const QString &source, const QString &id) {
|
||||||
m_gitClient->show(source, id);
|
m_gitClient->show(source, id);
|
||||||
@@ -1307,7 +1309,7 @@ template <class NonModalDialog>
|
|||||||
|
|
||||||
void GitPlugin::branchList()
|
void GitPlugin::branchList()
|
||||||
{
|
{
|
||||||
showNonModalDialog(currentState().topLevel(), m_branchDialog);
|
Core::NavigationWidget::activateSubWidget(Constants::GIT_BRANCH_VIEW_ID, Core::Side::Right);
|
||||||
}
|
}
|
||||||
|
|
||||||
void GitPlugin::remoteList()
|
void GitPlugin::remoteList()
|
||||||
@@ -1326,8 +1328,8 @@ void GitPlugin::updateActions(VcsBasePlugin::ActionState as)
|
|||||||
const bool repositoryEnabled = state.hasTopLevel();
|
const bool repositoryEnabled = state.hasTopLevel();
|
||||||
if (m_stashDialog)
|
if (m_stashDialog)
|
||||||
m_stashDialog->refresh(state.topLevel(), false);
|
m_stashDialog->refresh(state.topLevel(), false);
|
||||||
if (m_branchDialog)
|
if (m_branchViewFactory && m_branchViewFactory->view())
|
||||||
m_branchDialog->refresh(state.topLevel(), false);
|
m_branchViewFactory->view()->refresh(state.topLevel(), false);
|
||||||
if (m_remoteDialog)
|
if (m_remoteDialog)
|
||||||
m_remoteDialog->refresh(state.topLevel(), false);
|
m_remoteDialog->refresh(state.topLevel(), false);
|
||||||
|
|
||||||
@@ -1399,8 +1401,8 @@ void GitPlugin::delayedPushToGerrit()
|
|||||||
|
|
||||||
void GitPlugin::updateBranches(const QString &repository)
|
void GitPlugin::updateBranches(const QString &repository)
|
||||||
{
|
{
|
||||||
if (m_branchDialog && m_branchDialog->isVisible())
|
if (m_branchViewFactory && m_branchViewFactory->view())
|
||||||
m_branchDialog->refreshIfSame(repository);
|
m_branchViewFactory->view()->refreshIfSame(repository);
|
||||||
}
|
}
|
||||||
|
|
||||||
QObject *GitPlugin::remoteCommand(const QStringList &options, const QString &workingDirectory,
|
QObject *GitPlugin::remoteCommand(const QStringList &options, const QString &workingDirectory,
|
||||||
|
@@ -62,6 +62,7 @@ class GitClient;
|
|||||||
class CommitData;
|
class CommitData;
|
||||||
class StashDialog;
|
class StashDialog;
|
||||||
class BranchDialog;
|
class BranchDialog;
|
||||||
|
class BranchViewFactory;
|
||||||
class RemoteDialog;
|
class RemoteDialog;
|
||||||
|
|
||||||
typedef void (GitClient::*GitClientMemberFunc)(const QString &);
|
typedef void (GitClient::*GitClientMemberFunc)(const QString &);
|
||||||
@@ -209,7 +210,7 @@ private:
|
|||||||
|
|
||||||
GitClient *m_gitClient = nullptr;
|
GitClient *m_gitClient = nullptr;
|
||||||
QPointer<StashDialog> m_stashDialog;
|
QPointer<StashDialog> m_stashDialog;
|
||||||
QPointer<BranchDialog> m_branchDialog;
|
QPointer<BranchViewFactory> m_branchViewFactory;
|
||||||
QPointer<RemoteDialog> m_remoteDialog;
|
QPointer<RemoteDialog> m_remoteDialog;
|
||||||
QString m_submitRepository;
|
QString m_submitRepository;
|
||||||
QString m_commitMessageFileName;
|
QString m_commitMessageFileName;
|
||||||
|
Reference in New Issue
Block a user