r17733 by gpittman - adding shortcuts to tooltips

scribus-commit scribus-commit at lists.scribus.net
Sun Jul 22 21:10:35 UTC 2012


Author: gpittman
Date: Sun Jul 22 21:10:35 2012
New Revision: 17733

URL: http://scribus.net/websvn/listing.php?repname=Scribus&sc=1&rev=17733
Log:
adding shortcuts to tooltips

Modified:
    branches/Version14x/Scribus/scribus/actionmanager.cpp
    branches/Version14x/Scribus/scribus/actionmanager.h
    branches/Version14x/Scribus/scribus/scraction.cpp
    branches/Version14x/Scribus/scribus/scraction.h
    branches/Version14x/Scribus/scribus/storyeditor.cpp

Modified: branches/Version14x/Scribus/scribus/actionmanager.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=17733&path=/branches/Version14x/Scribus/scribus/actionmanager.cpp
==============================================================================
--- branches/Version14x/Scribus/scribus/actionmanager.cpp (original)
+++ branches/Version14x/Scribus/scribus/actionmanager.cpp Sun Jul 22 21:10:35 2012
@@ -75,6 +75,7 @@
 	createDefaultMenus();
 	createDefaultNonMenuActions();
 	languageChange();
+	setActionTooltips(scrActions);
 }
 
 void ActionManager::createActions()
@@ -1021,6 +1022,12 @@
 	connect( (*scrActions)["specialToggleAllGuides"], SIGNAL(triggered()), mainWindow, SLOT(ToggleAllGuides()) );
 }
 
+void ActionManager::setActionTooltips(QMap<QString, QPointer<ScrAction> > *actionMap)
+{
+	for( QMap<QString, QPointer<ScrAction> >::Iterator it = actionMap->begin(); it!=actionMap->end(); ++it )
+		it.value()->setToolTipFromTextAndShortcut();
+}
+
 void ActionManager::disconnectModeActions()
 {
 	for ( QStringList::Iterator it = modeActionNames->begin(); it != modeActionNames->end(); ++it )

Modified: branches/Version14x/Scribus/scribus/actionmanager.h
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=17733&path=/branches/Version14x/Scribus/scribus/actionmanager.h
==============================================================================
--- branches/Version14x/Scribus/scribus/actionmanager.h (original)
+++ branches/Version14x/Scribus/scribus/actionmanager.h Sun Jul 22 21:10:35 2012
@@ -103,6 +103,7 @@
 		void initHelpMenuActions();
 		static void initUnicodeActions(QMap<QString, QPointer<ScrAction> > *actionMap, QWidget *actionParent, QStringList *actionNamesList);
 		void initSpecialActions();
+		static void setActionTooltips(QMap<QString, QPointer<ScrAction> > *actionMap);
 		static void languageChangeUnicodeActions(QMap<QString, QPointer<ScrAction> > *actionMap);
 		void languageChangeActions();
 		static QKeySequence defaultKey(const QString &actionName);

Modified: branches/Version14x/Scribus/scribus/scraction.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=17733&path=/branches/Version14x/Scribus/scribus/scraction.cpp
==============================================================================
--- branches/Version14x/Scribus/scribus/scraction.cpp (original)
+++ branches/Version14x/Scribus/scribus/scraction.cpp Sun Jul 22 21:10:35 2012
@@ -231,6 +231,15 @@
 	return text().remove('&').remove("...");
 }
 
+void ScrAction::setToolTipFromTextAndShortcut()
+{
+	QString sct(shortcut());
+	if (sct.isEmpty())
+		QAction::setToolTip("<qt>" + cleanMenuText() + "</qt>");
+	else
+		QAction::setToolTip("<qt>" + cleanMenuText() + " (<b>" + sct + "</b>)" + "</qt>");
+}
+
 int ScrAction::getMenuIndex() const
 {
 	return menuIndex;

Modified: branches/Version14x/Scribus/scribus/scraction.h
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=17733&path=/branches/Version14x/Scribus/scribus/scraction.h
==============================================================================
--- branches/Version14x/Scribus/scribus/scraction.h (original)
+++ branches/Version14x/Scribus/scribus/scraction.h Sun Jul 22 21:10:35 2012
@@ -112,6 +112,8 @@
 		\retval QString Stripped copy of the menu text
 	*/
 	QString cleanMenuText();
+
+	void setToolTipFromTextAndShortcut();
 
 	/*!
 		\author Craig Bradney

Modified: branches/Version14x/Scribus/scribus/storyeditor.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=17733&path=/branches/Version14x/Scribus/scribus/storyeditor.cpp
==============================================================================
--- branches/Version14x/Scribus/scribus/storyeditor.cpp (original)
+++ branches/Version14x/Scribus/scribus/storyeditor.cpp Sun Jul 22 21:10:35 2012
@@ -1961,6 +1961,7 @@
 	EditorBar->editor = Editor;
 	Editor->installEventFilter(this);
 	languageChange();
+	ActionManager::setActionTooltips(&seActions);
 }
 
 void StoryEditor::changeEvent(QEvent *e)




More information about the scribus-commit mailing list