* [PATCH qgit] Add 'Remote branches' context sub menu
@ 2007-02-04 10:02 Marco Costalba
0 siblings, 0 replies; only message in thread
From: Marco Costalba @ 2007-02-04 10:02 UTC (permalink / raw)
To: GIT list; +Cc: Pavel Roskin
It is now possible to jump to a remote branch from context (right click)
sub menu in main view.
Signed-off-by: Marco Costalba <mcostalba@gmail.com>
---
src/mainimpl.cpp | 22 ++++++++++++++++------
src/mainimpl.h | 1 +
2 files changed, 17 insertions(+), 6 deletions(-)
diff --git a/src/mainimpl.cpp b/src/mainimpl.cpp
index 694dde5..ead7e0b 100644
--- a/src/mainimpl.cpp
+++ b/src/mainimpl.cpp
@@ -1054,10 +1054,13 @@ void MainImpl::doContexPopup(SCRef sha) {
// global scope because we use a signal/slot connection
delete contextMenu;
delete contextSubMenu;
+ delete contextRmtMenu;
contextMenu = new QPopupMenu(this);
contextSubMenu = new QPopupMenu(this);
+ contextRmtMenu = new QPopupMenu(this);
connect(contextMenu, SIGNAL(activated(int)), this,
SLOT(on_goRef_activated(int)));
connect(contextSubMenu, SIGNAL(activated(int)), this,
SLOT(on_goRef_activated(int)));
+ connect(contextRmtMenu, SIGNAL(activated(int)), this,
SLOT(on_goRef_activated(int)));
Domain* t;
int tt = currentTabType(&t);
@@ -1096,18 +1099,26 @@ void MainImpl::doContexPopup(SCRef sha) {
ActPop->addTo(contextMenu);
const QStringList& bn(git->getAllRefNames(Git::BRANCH, Git::optOnlyLoaded));
+ const QStringList& rbn(git->getAllRefNames(Git::RMT_BRANCH,
Git::optOnlyLoaded));
const QStringList& tn(git->getAllRefNames(Git::TAG, Git::optOnlyLoaded));
- if (bn.empty() && tn.empty()) {
+ if (bn.empty() && rbn.empty() && tn.empty()) {
contextMenu->exec(QCursor::pos());
return;
}
- int id = 1;
+ int id = 1; // ref names have id > 0 to disambiguate from actions
+ if (!rbn.empty()) {
+ QStringList::const_iterator it = rbn.constBegin();
+ for ( ; it != rbn.constEnd(); ++it, id++)
+ contextRmtMenu->insertItem(*it, id);
+ }
+ if (contextRmtMenu->count() > 0)
+ contextMenu->insertItem("Remote branches", contextRmtMenu);
+
if (!bn.empty()) {
contextMenu->insertSeparator();
QStringList::const_iterator it = bn.constBegin();
for ( ; it != bn.constEnd(); ++it, id++) {
- // branch names have id > 0 to disambiguate them from actions,
- // Qt assigns negative id as default
+
if (id < MAX_MENU_ENTRIES)
contextMenu->insertItem(*it, id);
else
@@ -1118,8 +1129,7 @@ void MainImpl::doContexPopup(SCRef sha) {
contextMenu->insertSeparator();
QStringList::const_iterator it = tn.constBegin();
for ( ; it != tn.constEnd(); ++it, id++) {
- // tag names have id > 0 to disambiguate them from actions,
- // Qt assigns negative id as default
+
if (id < MAX_MENU_ENTRIES)
contextMenu->insertItem(*it, id);
else
diff --git a/src/mainimpl.h b/src/mainimpl.h
index e455cb9..4be6ced 100644
--- a/src/mainimpl.h
+++ b/src/mainimpl.h
@@ -151,6 +151,7 @@ private:
QRegExp longLogRE;
QGuardedPtr<QPopupMenu> contextMenu;
QGuardedPtr<QPopupMenu> contextSubMenu;
+ QGuardedPtr<QPopupMenu> contextRmtMenu;
QString startUpDir;
QString textToFind;
QFont listViewFont;
--
1.5.0-rc3.GIT
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2007-02-04 10:02 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-02-04 10:02 [PATCH qgit] Add 'Remote branches' context sub menu Marco Costalba
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).