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

View File

@@ -17,7 +17,7 @@ class QToolButton;
class QTreeView; class QTreeView;
QT_END_NAMESPACE; QT_END_NAMESPACE;
namespace Tasking { class TaskTree; } namespace Tasking { class Group; }
namespace Utils { namespace Utils {
class ElidingLabel; class ElidingLabel;
@@ -56,7 +56,7 @@ private:
bool remove(); bool remove();
bool rename(); bool rename();
bool reset(const QByteArray &resetType); 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); bool merge(bool allowFastForward);
void rebase(); void rebase();
bool cherryPick(); bool cherryPick();