Commit b6ee370b authored by Dirk Wilden's avatar Dirk Wilden

contextMenu ordering and keyBinding log messages

git-svn-id: http://www.openflipper.org/svnrepo/OpenFlipper/branches/Free@5893 383ad7c9-94d9-4d36-a494-682f7c89f535
parent b5e8dc1c
<?xml version = '1.0' encoding = 'UTF-8'?>
<!DOCTYPE KDevPrjSession>
<KDevPrjSession>
<DocsAndViews NumberOfDocuments="5" >
<Doc0 NumberOfViews="1" URL="file:///data/home1/moebius/projects/OpenFlipper/ObjectTypes/MeshObject/MeshObjectT.hh" >
<View0 Encoding="" Type="Source" />
<DocsAndViews NumberOfDocuments="9" >
<Doc0 NumberOfViews="1" URL="file:///data/home2/wilden/projects/OpenFlipper/Plugin-TextureControl/TextureControl.cc" >
<View0 Encoding="" line="1187" Type="Source" />
</Doc0>
<Doc1 NumberOfViews="1" URL="file:///data/home1/moebius/projects/OpenFlipper/ACG/Scenegraph/PolyLineNodeT.hh" >
<View0 Encoding="" line="127" Type="Source" />
<Doc1 NumberOfViews="1" URL="file:///data/home2/wilden/projects/OpenFlipper/Plugin-TextureControl/TextureControl.hh" >
<View0 Encoding="" line="0" Type="Source" />
</Doc1>
<Doc2 NumberOfViews="1" URL="file:///data/home1/moebius/projects/OpenFlipper/OpenFlipper/widgets/coreWidget/CoreWidget.cc" >
<View0 Encoding="" line="114" Type="Source" />
<Doc2 NumberOfViews="1" URL="file:///data/home2/wilden/projects/OpenFlipper/Plugin-TextureControl/textureProperties.cc" >
<View0 Encoding="" line="197" Type="Source" />
</Doc2>
<Doc3 NumberOfViews="1" URL="file:///data/home1/moebius/projects/OpenFlipper/OpenFlipper/BasePlugin/LoadSaveInterface.hh" >
<View0 Encoding="" line="77" Type="Source" />
<Doc3 NumberOfViews="1" URL="file:///data/home2/wilden/projects/OpenFlipper/Plugin-TextureControl/textureProperties.hh" >
<View0 Encoding="" line="73" Type="Source" />
</Doc3>
<Doc4 NumberOfViews="1" URL="file:///data/home1/moebius/projects/OpenFlipper/Plugin-Info/InfoPlugin.cc" >
<View0 Encoding="" line="248" Type="Source" />
<Doc4 NumberOfViews="1" URL="file:///data/home2/wilden/projects/OpenFlipper/Plugin-TextureControl/QwtFunctionPlot.cc" >
<View0 Encoding="" line="106" Type="Source" />
</Doc4>
<Doc5 NumberOfViews="1" URL="file:///data/home2/wilden/projects/OpenFlipper/Plugin-TextureControl/QwtFunctionPlot.hh" >
<View0 Encoding="" line="64" Type="Source" />
</Doc5>
<Doc6 NumberOfViews="1" URL="file:///data/home2/wilden/projects/OpenFlipper/Plugin-TextureControl/HistogramItem.hh" >
<View0 Encoding="" line="30" Type="Source" />
</Doc6>
<Doc7 NumberOfViews="1" URL="file:///data/home2/wilden/projects/OpenFlipper/Plugin-TextureControl/HistogramItem.cc" >
<View0 Encoding="" line="78" Type="Source" />
</Doc7>
<Doc8 NumberOfViews="1" URL="file:///data/home2/wilden/projects/OpenFlipper/OpenFlipper/BasePlugin/TextureInterface.hh" >
<View0 Encoding="" line="136" Type="Source" />
</Doc8>
</DocsAndViews>
<pluginList>
<kdevdebugger>
......
......@@ -295,6 +295,9 @@ bool CoreWidget::addContextMenus( QMenu* _menu , ContextMenuType _type , int _id
bool added = false;
QMap< QString , QAction* > menuMap; //QMap sorts by key
QMap< QString , QAction* > actionMap;
// Add context menus from plugins
for ( uint i = 0 ; i < contextMenus_.size(); ++i ) {
......@@ -321,14 +324,18 @@ bool CoreWidget::addContextMenus( QMenu* _menu , ContextMenuType _type , int _id
}
QMenu* menu = contextMenus_[i].action->menu();
if (menu == 0) //is it a menu
actionMap[ contextMenus_[i].action->text() ] = contextMenus_[i].action;
else
menuMap[ contextMenus_[i].action->text() ] = contextMenus_[i].action;
// check if the dataType of the object matches the context type
_menu->addAction( contextMenus_[i].action );
added = true;
// Get all Actions in the menu and its submenus.
// Set their data to the picked Object id
QMenu* menu = contextMenus_[i].action->menu();
QList< QAction *> allActions;
if ( menu == 0) {
......@@ -352,8 +359,25 @@ bool CoreWidget::addContextMenus( QMenu* _menu , ContextMenuType _type , int _id
}
return added;
//first add all menus
QMapIterator<QString, QAction*> it(menuMap);
while (it.hasNext()) {
it.next();
_menu->addAction( it.value() );
}
_menu->addSeparator();
//then all actions
QMapIterator<QString, QAction*> it2(actionMap);
while (it2.hasNext()) {
it2.next();
_menu->addAction( it2.value() );
}
return added;
}
......
......@@ -155,10 +155,12 @@ void CoreWidget::slotRegisterKey(int _key, Qt::KeyboardModifiers _modifiers, QSt
//first check if the key is already registered by the coreWidget
bool found = false;
bool multi = false;
QString name;
for (uint i=0; i < coreKeys_.size(); i++)
if (coreKeys_[i].key == _key && coreKeys_[i].modifiers == _modifiers){
found = true;
multi = coreKeys_[i].multiUse;
name = "Core";
break;
}
......@@ -170,11 +172,12 @@ void CoreWidget::slotRegisterKey(int _key, Qt::KeyboardModifiers _modifiers, QSt
&& plugins_[i].keys[k].modifiers == _modifiers){
found = true;
multi = plugins_[i].keys[k].multiUse;
name = plugins_[i].name;
break;
}
if (found)
emit log(LOGERR, "Key already registered elsewhere.");
if (found && !multi)
emit log(LOGERR, "Key already registered by '" + name + "'");
//check if its a key for the core
if (sender() == this){
......@@ -186,7 +189,7 @@ void CoreWidget::slotRegisterKey(int _key, Qt::KeyboardModifiers _modifiers, QSt
kb.slot = false;
if (multi && !_multiUse)
log(LOGWARN, "Key registered as multiUse key.");
emit log(LOGERR, "Key already registered by '" + name + "'. Forced registration as multiUse key.");
coreKeys_.push_back( kb );
......@@ -215,7 +218,7 @@ void CoreWidget::slotRegisterKey(int _key, Qt::KeyboardModifiers _modifiers, QSt
kb.slot = false;
if (multi && !_multiUse)
log(LOGWARN, "Key registered as multiUse key.");
emit log(LOGERR, "Key already registered by '" + name + "'. Forced registration as multiUse key.");
pluginInfo->keys.append( kb );
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment