r22814 by jghali - Refactoring of MenuManager::addMenuItemStringstoMenuBar()
scribus-commit
scribus-commit at lists.scribus.net
Wed Jan 23 03:48:14 UTC 2019
Author: jghali
Date: Wed Jan 23 03:48:14 2019
New Revision: 22814
URL: http://scribus.net/websvn/listing.php?repname=Scribus&sc=1&rev=22814
Log:
Refactoring of MenuManager::addMenuItemStringstoMenuBar()
Modified:
trunk/Scribus/scribus/menumanager.cpp
Modified: trunk/Scribus/scribus/menumanager.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=22814&path=/trunk/Scribus/scribus/menumanager.cpp
==============================================================================
--- trunk/Scribus/scribus/menumanager.cpp (original)
+++ trunk/Scribus/scribus/menumanager.cpp Wed Jan 23 03:48:14 2019
@@ -140,35 +140,35 @@
void MenuManager::addMenuItemStringstoMenuBar(const QString &menuName, const QMap<QString, QPointer<ScrAction> > &menuActions)
{
- if (menuStrings.contains(menuName) && menuBarMenus.contains(menuName))
- {
- for (int i=0; i<menuStrings[menuName].count();++i)
- {
- //Add Separators
- if (menuStrings[menuName].at(i)=="SEPARATOR")
- menuBarMenus[menuName]->addSeparator();
- else
+ if (!menuStrings.contains(menuName) || !menuBarMenus.contains(menuName))
+ return;
+
+ for (int i=0; i<menuStrings[menuName].count();++i)
+ {
+ //Add Separators
+ if (menuStrings[menuName].at(i) == "SEPARATOR")
+ {
+ menuBarMenus[menuName]->addSeparator();
+ continue;
+ }
+
+ //Add Menu Items
+ if (menuActions.contains(menuStrings[menuName].at(i)))
+ {
+ menuBarMenus[menuName]->addAction(menuActions[menuStrings[menuName].at(i)]);
+ continue;
+ }
+
+ //Add Sub Menus
+ if (menuStrings.contains(menuStrings[menuName].at(i)))
+ {
+ QMenu *subMenu=menuBarMenus[menuName]->addMenu(menuStringTexts[menuStrings[menuName].at(i)]);
+ menuBarMenus.insert(menuStrings[menuName].at(i), subMenu);
+ if (rememberedMenus.contains(menuStrings[menuName].at(i)))
{
- //Add Menu Items
- if (menuActions.contains(menuStrings[menuName].at(i)))
- {
- menuBarMenus[menuName]->addAction(menuActions[menuStrings[menuName].at(i)]);
- }
- else
- //Add Sub Menus
- {
- if (menuStrings.contains(menuStrings[menuName].at(i)))
- {
- QMenu *subMenu=menuBarMenus[menuName]->addMenu(menuStringTexts[menuStrings[menuName].at(i)]);
- menuBarMenus.insert(menuStrings[menuName].at(i), subMenu);
- if (rememberedMenus.contains(menuStrings[menuName].at(i)))
- {
- rememberedMenus.insert(menuStrings[menuName].at(i), subMenu);
- }
- addMenuItemStringstoMenu(menuStrings[menuName].at(i), subMenu, menuActions);
- }
- }
+ rememberedMenus.insert(menuStrings[menuName].at(i), subMenu);
}
+ addMenuItemStringstoMenu(menuStrings[menuName].at(i), subMenu, menuActions);
}
}
}
More information about the scribus-commit
mailing list