Skip to content
This repository was archived by the owner on Jun 3, 2024. It is now read-only.

Module RefsView: reorganize menu actions #31

Open
wants to merge 6 commits into
base: development
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 20 additions & 6 deletions Modules/RefsViews/Branches/BranchesView.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ BranchesView::BranchesView()
setupActions( this );

setViewName( tr( "References" ) );
setToolBar( tbBranchesTB );
setToolBar( tbRefsViewTB );
setWidget( mTree );

setFlags( ConsumesContexts | DataPerContext );
Expand Down Expand Up @@ -87,14 +87,28 @@ void BranchesView::showContextMenu(const QModelIndex& index, const QPoint& globa
return;
}

Heaven::Menu* menu = 0;
if (item->type() == RefItem::Branch) {
menu = menuCtxMenuRefsView;
//menu->setActivationContext( item );
Heaven::Menu* menu = nullptr;
switch (item->type()) {
case RefItem::Branch:
menu = menuMnuBranch;
break;

case RefItem::Remote:
menu = menuMnuRemote;
break;

case RefItem::Tag:
menu = menuMnuTag;
break;

default:
break;
}

if ( menu )
if ( menu ) {
//menu->setActivationContext( item );
menu->showPopup( globalPos );
}
}

void BranchesView::onCheckoutRef()
Expand Down
55 changes: 52 additions & 3 deletions Modules/RefsViews/Branches/BranchesViewActions.hid
Original file line number Diff line number Diff line change
Expand Up @@ -34,14 +34,63 @@ Ui BranchesViewActions {
ConnectTo onRenameRef();
};

ToolBar BranchesTB {
// placeholder for the real toolbar
ToolBar RefsViewTB {
Action ShowLocalBranches {
Text "Branches";
ConnectTo onShowBranches();
Checkable true;
Checked true;
};
Action ShowRemotes {
Text "Remotes";
ConnectTo onShowRemotes();
Checkable true;
Checked true;
};
Action ShowTags {
Text "Tags";
ConnectTo onShowTags();
Checkable true;
Checked true;
};
};

Menu CtxMenuRefsView {
Menu MnuBranch {
Action CheckoutRef;
Action RenameRef;
Separator;

MergePlace FetchMP;
MergePlace PushMP;
Separator;

Action RemoveRef;
};

Menu MnuRemote {
Action RenameRef;
Separator;

MergePlace FetchThisMP;
Separator;

Action RemoveRef;
};

Menu MnuRemoteBranch {
Action CheckoutRef;
Separator;

MergePlace FetchThisMP;
Separator;

Action RemoveRef;
};

Menu MnuTag {
Action CheckoutRef;
Separator;

Action RemoveRef;
};

Expand Down