BranchView: Return recipe instead of TaskTree

Change-Id: I51c6c4f7d03f264e69c637f081017d88a5ac027b
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: Orgad Shaneh <orgads@gmail.com>
This commit is contained in:
Jarek Kobus
2024-01-13 17:38:25 +01:00
parent 1bf2c447d3
commit 34b01f7530
2 changed files with 7 additions and 8 deletions

View File

@@ -277,14 +277,15 @@ void BranchView::slotCustomContextMenu(const QPoint &point)
.arg(indexName, currentName),
this,
[this] { merge(false); });
taskTree.reset(onFastForwardMerge([&] {
taskTree.reset(new TaskTree(fastForwardMergeRecipe([&] {
auto ffMerge = new QAction(
Tr::tr("&Merge \"%1\" into \"%2\" (Fast-Forward)").arg(indexName, currentName));
connect(ffMerge, &QAction::triggered, this, [this] { merge(true); });
contextMenu.insertAction(mergeAction, ffMerge);
mergeAction->setText(Tr::tr("Merge \"%1\" into \"%2\" (No &Fast-Forward)")
.arg(indexName, currentName));
}));
})));
taskTree->start();
connect(mergeAction, &QObject::destroyed, taskTree.get(), &TaskTree::stop);
contextMenu.addAction(Tr::tr("&Rebase \"%1\" on \"%2\"")
@@ -534,7 +535,7 @@ bool BranchView::reset(const QByteArray &resetType)
return false;
}
TaskTree *BranchView::onFastForwardMerge(const std::function<void()> &callback)
Group BranchView::fastForwardMergeRecipe(const std::function<void()> &callback)
{
const QModelIndex selected = selectedIndex();
QTC_CHECK(selected != m_model->currentBranch());
@@ -572,9 +573,7 @@ TaskTree *BranchView::onFastForwardMerge(const std::function<void()> &callback)
callback();
}, CallDoneIf::Success)
};
auto taskTree = new TaskTree(root);
taskTree->start();
return taskTree;
return root;
}
bool BranchView::merge(bool allowFastForward)

View File

@@ -17,7 +17,7 @@ class QToolButton;
class QTreeView;
QT_END_NAMESPACE;
namespace Tasking { class TaskTree; }
namespace Tasking { class Group; }
namespace Utils {
class ElidingLabel;
@@ -56,7 +56,7 @@ private:
bool remove();
bool rename();
bool reset(const QByteArray &resetType);
Tasking::TaskTree *onFastForwardMerge(const std::function<void()> &callback);
Tasking::Group fastForwardMergeRecipe(const std::function<void()> &callback);
bool merge(bool allowFastForward);
void rebase();
bool cherryPick();