git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Marco Costalba" <mcostalba@gmail.com>
To: "GIT list" <git@vger.kernel.org>
Cc: "Pavel Roskin" <proski@gnu.org>
Subject: [PATCH qgit] Add 'Remote branches' context sub menu
Date: Sun, 4 Feb 2007 11:02:53 +0100	[thread overview]
Message-ID: <e5bfff550702040202n419ce550sddb920bc2db7ea48@mail.gmail.com> (raw)

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

                 reply	other threads:[~2007-02-04 10:02 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=e5bfff550702040202n419ce550sddb920bc2db7ea48@mail.gmail.com \
    --to=mcostalba@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=proski@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).