r18706 by craig - Reenable menu language change on the fly

scribus-commit scribus-commit at lists.scribus.net
Fri Jan 10 23:15:17 UTC 2014


Author: craig
Date: Fri Jan 10 23:15:17 2014
New Revision: 18706

URL: http://scribus.net/websvn/listing.php?repname=Scribus&sc=1&rev=18706
Log:
Reenable menu language change on the fly

Modified:
    trunk/Scribus/scribus/menumanager.cpp
    trunk/Scribus/scribus/menumanager.h
    trunk/Scribus/scribus/pluginmanager.cpp
    trunk/Scribus/scribus/ui/scmwmenumanager.cpp

Modified: trunk/Scribus/scribus/menumanager.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=18706&path=/trunk/Scribus/scribus/menumanager.cpp
==============================================================================
--- trunk/Scribus/scribus/menumanager.cpp (original)
+++ trunk/Scribus/scribus/menumanager.cpp Fri Jan 10 23:15:17 2014
@@ -124,6 +124,12 @@
 		retVal=true;
 	}
 	return retVal;
+}
+
+void MenuManager::clear()
+{
+	menuStrings.clear();
+	rememberedMenus.clear();
 }
 
 
@@ -326,13 +332,25 @@
 void MenuManager::dumpMenuStrings()
 {
 	QMapIterator<QString, QList<QString> > i(menuStrings);
-	while (i.hasNext()) {
+	while (i.hasNext())
+	{
 		i.next();
 		qDebug() << "Menu name:"<<i.key();// << ": " << i.value() << endl;
 
 		QListIterator<QString> li (i.value());
-		while (li.hasNext()) {
+		while (li.hasNext())
+		{
 			qDebug() << "Menu entry:"<<li.next();
 		}
 	}
 }
+
+void MenuManager::languageChange()
+{
+	foreach (const QString &menuName, menuBarMenus.keys())
+	{
+		QMenu *m=menuBarMenus.value(menuName);
+		if (m)
+			m->setTitle(menuStringTexts[menuName]);
+	}
+}

Modified: trunk/Scribus/scribus/menumanager.h
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=18706&path=/trunk/Scribus/scribus/menumanager.h
==============================================================================
--- trunk/Scribus/scribus/menumanager.h (original)
+++ trunk/Scribus/scribus/menumanager.h Fri Jan 10 23:15:17 2014
@@ -62,6 +62,7 @@
 		QMenu *getLocalPopupMenu(const QString &menuName);
 		bool addMenuStringToMenuBar(const QString &menuName, bool rememberMenu=false);
 		bool addMenuStringToMenuBarBefore(const QString &, const QString &beforeMenuName);
+		void clear();
 		bool clearMenu(const QString &menuName);
 		bool empty();
 		bool menuExists(const QString &menuName);
@@ -76,9 +77,9 @@
 		QMenu *redoMenu() {return m_redoMenu;}
 
 	public slots:
-		void languageChange() {};
+		void languageChange();
 
-private:
+protected:
 	QMenuBar *scribusMenuBar;
 
 	QMap<QString, QList<QString> > menuStrings;

Modified: trunk/Scribus/scribus/pluginmanager.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=18706&path=/trunk/Scribus/scribus/pluginmanager.cpp
==============================================================================
--- trunk/Scribus/scribus/pluginmanager.cpp (original)
+++ trunk/Scribus/scribus/pluginmanager.cpp Fri Jan 10 23:15:17 2014
@@ -285,7 +285,7 @@
 	Q_CHECK_PTR(mw);
 	ScActionPlugin* plugin = 0;
 
-	mw->scrMenuMgr->addMenuItemString("SEPARATOR", "Extras");
+	//mw->scrMenuMgr->addMenuItemString("SEPARATOR", "Extras");
 	for (PluginMap::Iterator it = pluginMap.begin(); it != pluginMap.end(); ++it)
 	{
 		if (it.value().plugin->inherits("ScActionPlugin"))
@@ -660,9 +660,8 @@
 				pluginAction = ScCore->primaryMainWindow()->scrActions[ai.name];
 				if (pluginAction != 0)
 					pluginAction->setText( ai.text );
-//FIXME QT5 port causes disappearing menus, qt 5.1+
-				//if ((!ai.menu.isEmpty()) && (!ai.subMenuName.isEmpty()))
-				//	ScCore->primaryMainWindow()->scrMenuMgr->setText(ai.menu, ai.subMenuName);
+				if ((!ai.menu.isEmpty()) && (!ai.subMenuName.isEmpty()))
+					ScCore->primaryMainWindow()->scrMenuMgr->setText(ai.menu, ai.subMenuName);
 			}
 		}
 	}

Modified: trunk/Scribus/scribus/ui/scmwmenumanager.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=18706&path=/trunk/Scribus/scribus/ui/scmwmenumanager.cpp
==============================================================================
--- trunk/Scribus/scribus/ui/scmwmenumanager.cpp (original)
+++ trunk/Scribus/scribus/ui/scmwmenumanager.cpp Fri Jan 10 23:15:17 2014
@@ -18,6 +18,8 @@
  *   (at your option) any later version.                                   *
  *                                                                         *
  ***************************************************************************/
+
+#include <QDebug>
 
 #include "actionmanager.h"
 #include "ui/scmwmenumanager.h"
@@ -55,4 +57,5 @@
 	setText("Help", ActionManager::defaultMenuNameEntryTranslated("Help"));
 	setText("Alignment", tr("&Alignment"));
 	setText("HelpOnlineTutorials", tr("Online &Tutorials"));
+	MenuManager::languageChange();
 }




More information about the scribus-commit mailing list