forked from qt-creator/qt-creator
Git: Allow creating a new repository from branch view
... when clicking "Add Branch" in a project that is not under git version control. The "Add Branch" serves no purpose here, so re-use it to call this (already existing) function. Done-with: Orgad Shaneh <orgad.shaneh@audiocodes.com> Change-Id: Ib23d2cbeec0598e0b6f00cbde265793cc25e6142 Reviewed-by: Orgad Shaneh <orgads@gmail.com>
This commit is contained in:
committed by
André Hartmann
parent
017f4d7c4d
commit
546956a302
@@ -67,7 +67,6 @@ BranchView::BranchView() :
|
||||
m_model(new BranchModel(GitPlugin::client(), this))
|
||||
{
|
||||
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, &BranchView::add);
|
||||
|
||||
@@ -126,10 +125,12 @@ void BranchView::refresh(const QString &repository, bool force)
|
||||
m_repository = repository;
|
||||
if (m_repository.isEmpty()) {
|
||||
m_repositoryLabel->setText(tr("<No repository>"));
|
||||
m_addButton->setToolTip(tr("Create Git Repository..."));
|
||||
m_branchView->setEnabled(false);
|
||||
} else {
|
||||
m_repositoryLabel->setText(QDir::toNativeSeparators(m_repository));
|
||||
m_repositoryLabel->setToolTip(GitPlugin::msgRepositoryLabel(m_repository));
|
||||
m_addButton->setToolTip(tr("Add Branch..."));
|
||||
m_branchView->setEnabled(true);
|
||||
}
|
||||
QString errorMessage;
|
||||
@@ -252,6 +253,11 @@ QModelIndex BranchView::selectedIndex()
|
||||
|
||||
bool BranchView::add()
|
||||
{
|
||||
if (m_repository.isEmpty()) {
|
||||
GitPlugin::instance()->initRepository();
|
||||
return true;
|
||||
}
|
||||
|
||||
QModelIndex trackedIndex = selectedIndex();
|
||||
QString trackedBranch = m_model->fullName(trackedIndex);
|
||||
if (trackedBranch.isEmpty()) {
|
||||
|
@@ -1319,6 +1319,11 @@ void GitPlugin::manageRemotes()
|
||||
showNonModalDialog(currentState().topLevel(), m_remoteDialog);
|
||||
}
|
||||
|
||||
void GitPlugin::initRepository()
|
||||
{
|
||||
createRepository();
|
||||
}
|
||||
|
||||
void GitPlugin::stashList()
|
||||
{
|
||||
showNonModalDialog(currentState().topLevel(), m_stashDialog);
|
||||
|
@@ -93,6 +93,7 @@ public:
|
||||
QObject *remoteCommand(const QStringList &options, const QString &workingDirectory,
|
||||
const QStringList &args) override;
|
||||
void manageRemotes();
|
||||
void initRepository();
|
||||
|
||||
protected:
|
||||
void updateActions(VcsBase::VcsBasePlugin::ActionState) override;
|
||||
|
Reference in New Issue
Block a user