keyHandling.cc

00001 /*===========================================================================*\
00002  *                                                                           *
00003  *                              OpenFlipper                                  *
00004  *      Copyright (C) 2001-2009 by Computer Graphics Group, RWTH Aachen      *
00005  *                           www.openflipper.org                             *
00006  *                                                                           *
00007  *---------------------------------------------------------------------------*
00008  *  This file is part of OpenFlipper.                                        *
00009  *                                                                           *
00010  *  OpenFlipper is free software: you can redistribute it and/or modify      *
00011  *  it under the terms of the GNU Lesser General Public License as           *
00012  *  published by the Free Software Foundation, either version 3 of           *
00013  *  the License, or (at your option) any later version with the              *
00014  *  following exceptions:                                                    *
00015  *                                                                           *
00016  *  If other files instantiate templates or use macros                       *
00017  *  or inline functions from this file, or you compile this file and         *
00018  *  link it with other files to produce an executable, this file does        *
00019  *  not by itself cause the resulting executable to be covered by the        *
00020  *  GNU Lesser General Public License. This exception does not however       *
00021  *  invalidate any other reasons why the executable file might be            *
00022  *  covered by the GNU Lesser General Public License.                        *
00023  *                                                                           *
00024  *  OpenFlipper is distributed in the hope that it will be useful,           *
00025  *  but WITHOUT ANY WARRANTY; without even the implied warranty of           *
00026  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the            *
00027  *  GNU Lesser General Public License for more details.                      *
00028  *                                                                           *
00029  *  You should have received a copy of the GNU LesserGeneral Public          *
00030  *  License along with OpenFlipper. If not,                                  *
00031  *  see <http://www.gnu.org/licenses/>.                                      *
00032  *                                                                           *
00033 \*===========================================================================*/
00034 
00035 /*===========================================================================*\
00036  *                                                                           *
00037  *   $Revision: 7169 $                                                         *
00038  *   $Author: moebius $                                                      *
00039  *   $Date: 2009-09-25 10:43:58 +0200 (Fr, 25. Sep 2009) $                   *
00040  *                                                                           *
00041 \*===========================================================================*/
00042 
00043 #include "CoreWidget.hh"
00044 
00045 #include <OpenFlipper/BasePlugin/KeyInterface.hh>
00046 #include <OpenFlipper/BasePlugin/BaseInterface.hh>
00047 
00048 #include <OpenFlipper/common/GlobalOptions.hh>
00049 
00050 #include <OpenFlipper/BasePlugin/PluginFunctions.hh>
00051 
00052 //-----------------------------------------------------------------------------
00053 
00054 KeyBinding CoreWidget::getKeyBinding(QObject* _plugin, int _keyIndex ){
00055   if (_plugin == 0)
00056     return coreKeys_[_keyIndex];
00057 
00058   for (uint i=0; i < plugins_.size(); i++){
00059     if (plugins_[i].plugin == _plugin)
00060       return plugins_[i].keys[_keyIndex];
00061   }
00062 
00063   emit log(LOGERR,tr("ERROR: could not get KeyBinding"));
00064   return KeyBinding();
00065 }
00066 
00067 QString CoreWidget::getRPCName(QObject* _plugin ){
00068   if (_plugin == 0)
00069     return "";
00070 
00071   for (uint i=0; i < plugins_.size(); i++){
00072     if (plugins_[i].plugin == _plugin)
00073       return plugins_[i].rpcName;
00074   }
00075 
00076   emit log(LOGERR,tr("ERROR: could not get rpcname"));
00077   return "";
00078 }
00079 
00081 void CoreWidget::keyPressEvent(QKeyEvent* _e)
00082 {
00083   std::pair< int,Qt::KeyboardModifiers > key = std::make_pair(_e->key(), _e->modifiers() );
00084 
00085   //iterate over all assigned keys
00086   KeyRange range = keys_.equal_range(key);
00087 
00088   KeyMap::iterator it;
00089   for (it=range.first; it != range.second; ++it){
00090 
00091     QObject* plugin = (*it).second.first;
00092     KeyBinding binding = getKeyBinding( plugin, (*it).second.second );
00093 
00094     //check if its a core Key
00095     if (plugin == 0){
00096 
00097       //the key belongs to a slot
00098       if (binding.slot){
00099         bool ok;
00100         emit call("core." + binding.description, ok);
00101         return;
00102       }
00103 
00104       // =================================================================================
00105       // Map event to the cores key and modifier.
00106       // Call the core key handler with the mapped event.
00107       // =================================================================================
00108       QKeyEvent* mappedEvent = new QKeyEvent(_e->type(),binding.key, binding.modifiers,
00109                                              _e->text(), _e->isAutoRepeat(), _e->count() );
00110 
00111       coreKeyPressEvent(mappedEvent);
00112 
00113       delete mappedEvent;
00114 
00115       //if the key is multiUse also check other assigned keys
00116       if (binding.multiUse)
00117         continue;
00118       else
00119         return;
00120     }
00121 
00122     //it's a plugin key
00123 
00124     //the key belongs to a slot
00125     if (binding.slot){
00126       bool ok;
00127       emit call(getRPCName(plugin) +"."+ binding.description, ok);
00128       return;
00129     }
00130 
00131     //the key was specified through keyInterface
00132     KeyInterface* keyPlugin = qobject_cast< KeyInterface * >(plugin);
00133 
00134     if (keyPlugin){
00135 
00136       // =================================================================================
00137       // Map event to the plugins key and modifier.
00138       // Call it with the mapped event.
00139       // =================================================================================
00140       QKeyEvent* mappedEvent = new QKeyEvent(_e->type(),binding.key, binding.modifiers,
00141                                              _e->text(), _e->isAutoRepeat(), _e->count() );
00142 
00143       keyPlugin->slotKeyEvent(mappedEvent);
00144 
00145       delete mappedEvent ;
00146     }
00147 
00148     //if its not a multiUse key we are ready
00149     if (!binding.multiUse)
00150       return;
00151   }
00152 }
00153 
00154 //-----------------------------------------------------------------------------
00155 
00157 void CoreWidget::keyReleaseEvent(QKeyEvent* _e) {
00158 
00159   if (_e->isAutoRepeat()) return; //consider only "real" release events
00160 
00161 
00162   std::pair< int,Qt::KeyboardModifiers > key = std::make_pair(_e->key(), _e->modifiers() );
00163 
00164   //iterate over all assigned keys
00165   KeyRange range = keys_.equal_range(key);
00166 
00167   KeyMap::iterator it;
00168   for (it=range.first; it != range.second; ++it){
00169 
00170     QObject* plugin = (*it).second.first;
00171     KeyBinding binding = getKeyBinding( plugin, (*it).second.second );
00172 
00173     if (plugin == 0){
00174 
00175       // =================================================================================
00176       // Map event to the cores key and modifier.
00177       // Call the core key handler with the mapped event.
00178       // =================================================================================
00179       QKeyEvent* mappedEvent = new QKeyEvent(_e->type(),binding.key, binding.modifiers,
00180                                              _e->text(), _e->isAutoRepeat(), _e->count() );
00181       coreKeyReleaseEvent(mappedEvent);
00182 
00183       delete mappedEvent;
00184 
00185       //if the key is multiUse also check other assigned keys
00186       if (binding.multiUse)
00187         continue;
00188       else
00189         return;
00190     }
00191 
00192     //it's a plugin key
00193     KeyInterface* keyPlugin = qobject_cast< KeyInterface * >(plugin);
00194 
00195     if (keyPlugin){
00196 
00197       // =================================================================================
00198       // Map event to the plugins key and modifier.
00199       // Call the plugin with the mapped event.
00200       // =================================================================================
00201 
00202       QKeyEvent* mappedEvent = new QKeyEvent(_e->type(),binding.key, binding.modifiers,
00203                                              _e->text(), _e->isAutoRepeat(), _e->count() );
00204 
00205       keyPlugin->slotKeyReleaseEvent(mappedEvent);
00206 
00207       delete mappedEvent;
00208     }
00209 
00210     //if its not a multiUse key we are ready
00211     if (!binding.multiUse)
00212       return;
00213   }
00214 }
00215 
00216 //-----------------------------------------------------------------------------
00217 
00219 void CoreWidget::slotRegisterKey(int _key, Qt::KeyboardModifiers _modifiers, QString _description, bool _multiUse){
00220 
00221   //first check if the key is already registered by the coreWidget
00222   bool found = false;
00223   bool multi = false;
00224   QString name;
00225   for (uint i=0; i < coreKeys_.size(); i++)
00226     if (coreKeys_[i].key == _key && coreKeys_[i].modifiers == _modifiers){
00227       found = true;
00228       multi = coreKeys_[i].multiUse;
00229       name = "Core";
00230       break;
00231     }
00232 
00233   //then check if the key is already registered by a different plugin
00234   if (!found)
00235     for (uint i=0; i < plugins_.size(); i++)
00236       for (int k=0; k < plugins_[i].keys.count(); k++)
00237         if (plugins_[i].keys[k].key == _key
00238         && plugins_[i].keys[k].modifiers == _modifiers){
00239           found = true;
00240           multi = plugins_[i].keys[k].multiUse;
00241           name = plugins_[i].name;
00242           break;
00243         }
00244 
00245   if (found && !multi)
00246     emit log(LOGERR, tr("Key already registered by '%1'").arg( name ) );
00247 
00248   //check if its a key for the core
00249   if (sender() == this){
00250     KeyBinding kb;
00251     kb.key = _key;
00252     kb.modifiers = _modifiers;
00253     kb.description = _description;
00254     kb.multiUse = multi || _multiUse;
00255     kb.slot = false;
00256 
00257     if (multi && !_multiUse)
00258       emit log(LOGERR, tr("Key already registered by '%1'. Forced registration as multiUse key.").arg( name ));
00259 
00260     coreKeys_.push_back( kb );
00261 
00262     keys_.insert( std::make_pair( std::make_pair(_key, _modifiers) , std::make_pair ((QObject*)0, coreKeys_.size()-1 ) )) ;
00263     invKeys_.insert( std::make_pair( std::make_pair ((QObject*)0, coreKeys_.size()-1 ) , std::make_pair(_key, _modifiers) ) );
00264     return;
00265   }
00266 
00267   //find plugin
00268  PluginInfo* pluginInfo = 0;
00269 
00270   for (uint i=0; i < plugins_.size(); i++)
00271     if (plugins_[i].plugin == sender())
00272       pluginInfo = &plugins_[i];
00273 
00274   if (pluginInfo == 0){
00275     emit log(LOGERR, tr("Unable to register key. Plugin not found!"));
00276     return;
00277   }
00278 
00279   KeyBinding kb;
00280   kb.key = _key;
00281   kb.modifiers = _modifiers;
00282   kb.description = _description;
00283   kb.multiUse = multi || _multiUse;
00284   kb.slot = false;
00285 
00286   if (multi && !_multiUse)
00287     emit log(LOGERR, tr("Key already registered by '%1'. Forced registration as multiUse key.").arg( name ));
00288 
00289   pluginInfo->keys.append( kb );
00290 
00291   keys_.insert( std::make_pair( std::make_pair(_key, _modifiers) , std::make_pair(pluginInfo->plugin, pluginInfo->keys.size()-1) ) );
00292   invKeys_.insert( std::make_pair( std::make_pair(pluginInfo->plugin, pluginInfo->keys.size()-1) , std::make_pair(_key, _modifiers) ) );
00293 }
00294 
00296 void CoreWidget::slotRegisterSlotKeyBindings(){
00297 
00298   //check the core slots
00299   for (int i=0; i < coreSlots_.count(); i++){
00300 
00301     //only consider functions without arguments
00302     if ( !coreSlots_.at(i).slotName.contains( "()" ) )
00303       continue;
00304 
00305     KeyBinding kb;
00306     kb.key = -1;
00307     kb.modifiers = 0;
00308     kb.description = coreSlots_.at(i).slotName;
00309     kb.multiUse = true;
00310     kb.slot = true;
00311 
00312     coreKeys_.push_back( kb );
00313 
00314     keys_.insert( std::make_pair( std::make_pair(-1, 0) , std::make_pair ((QObject*)0, coreKeys_.size()-1 ) )) ;
00315     invKeys_.insert( std::make_pair( std::make_pair ((QObject*)0, coreKeys_.size()-1 ) , std::make_pair(-1, 0) ) );
00316   }
00317 
00318   //check all plugins
00319   for (uint i=0; i < plugins_.size(); i++)
00320 
00321     for (int j=0; j < plugins_[i].rpcFunctions.count(); j++){
00322 
00323       //only consider functions without arguments
00324       if ( !plugins_[i].rpcFunctions[j].contains( "()" )
00325          || plugins_[i].rpcFunctions[j] == "version()")
00326         continue;
00327 
00328       KeyBinding kb;
00329       kb.key = -1;
00330       kb.modifiers = 0;
00331       kb.description = plugins_[i].rpcFunctions[j];
00332       kb.multiUse = true;
00333       kb.slot = true;
00334 
00335       plugins_[i].keys.append( kb );
00336 
00337       keys_.insert( std::make_pair( std::make_pair(-1, 0) , std::make_pair(plugins_[i].plugin, plugins_[i].keys.size()-1) ) );
00338       invKeys_.insert( std::make_pair( std::make_pair(plugins_[i].plugin, plugins_[i].keys.size()-1) , std::make_pair(-1, 0) ) );
00339     }
00340 }
00341 
00343 void CoreWidget::slotAddKeyMapping(int _key, Qt::KeyboardModifiers _modifiers, QObject* _plugin, int _keyBindingID){
00344 
00345   std::pair< int,Qt::KeyboardModifiers > keyCombi = std::make_pair(_key, _modifiers );
00346   std::pair< int,Qt::KeyboardModifiers > oldCombi;
00347   std::pair< QObject*, int > oldTarget;
00348 
00349   bool replace = false;
00350 
00351   //and check if the key is already assigned without multiUse
00352   KeyMap::iterator it;
00353   for (it=keys_.begin(); it != keys_.end(); ++it){
00354 
00355     int key = (*it).first.first;
00356     Qt::KeyboardModifiers modifiers = (*it).first.second;
00357     QObject* plugin = (*it).second.first;
00358     int bindingID = (*it).second.second;
00359     KeyBinding binding = getKeyBinding(plugin, bindingID);
00360 
00361     //check if its the keyBinding we want to map/replace
00362     if (plugin == _plugin && bindingID == _keyBindingID){
00363       replace = true;
00364       oldCombi = (*it).first;
00365       oldTarget = (*it).second;
00366       continue;
00367     }
00368 
00369     //check if the mapping is conflicting with other mappings
00370     if (_key == key && _modifiers == modifiers ){
00371 
00372       if (!binding.multiUse){
00373         if (plugin == 0)
00374           emit log(LOGERR, tr("Could not add key mapping. Key already assigned to the core."));
00375         else{
00376           BaseInterface* basePlugin = qobject_cast< BaseInterface * >(plugin);
00377 
00378           if (basePlugin)
00379             emit log(LOGERR, tr("Could not add key mapping. Key already assigned to %1").arg( basePlugin->name() ) );
00380           else
00381             emit log(LOGERR, tr("Could not add key mapping. Key already assigned to an unknown plugin."));
00382         }
00383         return;
00384       }
00385     }
00386   }
00387 
00388   KeyBinding keyBinding = getKeyBinding(_plugin, _keyBindingID);
00389 
00390   //check if new binding doesn't allow multiUse but other assignments for the key exist
00391   if (!keyBinding.multiUse)
00392     if ( (replace && keys_.count(keyCombi) > 1)  || (!replace && keys_.count(keyCombi) > 0) ){
00393       emit log(LOGERR, tr("Could not add (single usage) key mapping. Key already assigned."));
00394       return;
00395     }
00396 
00397   if (replace){
00398     keys_.erase(oldCombi);
00399     invKeys_.erase(oldTarget);
00400   }
00401 
00402   //now we can add the mapping
00403   keys_.insert   ( std::make_pair( keyCombi , std::make_pair(_plugin, _keyBindingID) ));
00404   invKeys_.insert( std::make_pair( std::make_pair(_plugin, _keyBindingID),  keyCombi ));
00405 
00406 }
00407 
00409 void CoreWidget::loadKeyBindings(INIFile& _ini){
00410 
00411   QVector< int > keys;
00412   QVector< int > modifiers;
00413   QStringList pluginNames;
00414   QVector< int > bindingIDs;
00415 
00416   //first load everything from INI file
00417   if ( !_ini.section_exists("KeyBindings") )
00418      return;
00419 
00420   int keyCount;
00421   if (_ini.get_entry(keyCount,"KeyBindings","KeyCount") ){
00422 
00423     int key;
00424     int mod;
00425     QString name;
00426     int binding;
00427 
00428     for (int i=0; i < keyCount; i++){
00429 
00430       if (!_ini.get_entry(key,     "KeyBindings","Key" + QString::number(i) ) ) continue;
00431       if (!_ini.get_entry(mod,     "KeyBindings","KeyModifiers" + QString::number(i) ) )  continue;
00432       if (!_ini.get_entry(name,    "KeyBindings","KeyTarget" + QString::number(i) ) )  continue;
00433       if (!_ini.get_entry(binding, "KeyBindings","KeyBinding" + QString::number(i) ) ) continue;
00434 
00435       keys.push_back( key );
00436       modifiers.push_back( mod );
00437       pluginNames.push_back( name );
00438       bindingIDs.push_back( binding );
00439     }
00440   }
00441 
00442   //add the keyMapping
00443   for (int i=0; i < keys.count(); i++){
00444 
00445     //first we need the plugin
00446     QObject* plugin = 0;
00447 
00448     if (pluginNames[i] != "Core" ){
00449       //search for the plugin
00450       for (uint i=0; i < plugins_.size(); i++)
00451         if (plugins_[i].rpcName == pluginNames[i] ){
00452           plugin = plugins_[i].plugin;
00453           break;
00454         }
00455 
00456       if (plugin == 0)
00457         continue; //because plugin was not found
00458     }
00459 
00460     slotAddKeyMapping( keys[i], (Qt::KeyboardModifiers) modifiers[i], plugin, bindingIDs[i] );
00461   }
00462 
00463 }
00464 
00466 void CoreWidget::saveKeyBindings(INIFile& _ini){
00467 
00468   QVector< int > keys;
00469   QVector< int > modifiers;
00470   QStringList pluginNames;
00471   QVector< int > bindingIDs;
00472 
00473   //first get all keys with custom assignments
00474   KeyMap::iterator it;
00475   for (it=keys_.begin(); it != keys_.end(); ++it){
00476 
00477     int key = (*it).first.first;
00478     Qt::KeyboardModifiers mod = (*it).first.second;
00479     QObject* plugin = (*it).second.first;
00480     int bindingID = (*it).second.second;
00481     KeyBinding binding = getKeyBinding(plugin, bindingID);
00482 
00483     //check if current key assignment and original assignment differ
00484     if (key != binding.key || mod != binding.modifiers){
00485 
00486       //get the pluginName
00487       QString name;
00488 
00489       if (plugin == 0)
00490         name = "Core";
00491       else
00492         name = getRPCName(plugin);
00493 
00494       //store key assignment
00495       keys.push_back( key );
00496       modifiers.push_back( mod );
00497       pluginNames.push_back( name );
00498       bindingIDs.push_back( bindingID );
00499     }
00500   }
00501 
00502   //finally store everything to INI file
00503   if ( !_ini.section_exists("KeyBindings") )
00504     _ini.add_section("KeyBindings");
00505 
00506   _ini.add_entry("KeyBindings","KeyCount", keys.count());
00507 
00508   for (int i=0; i < keys.count(); i++){
00509 
00510     _ini.add_entry("KeyBindings","Key" + QString::number(i)         , keys[i] );
00511     _ini.add_entry("KeyBindings","KeyModifiers" + QString::number(i), modifiers[i] );
00512     _ini.add_entry("KeyBindings","KeyTarget" + QString::number(i)   , pluginNames[i] );
00513     _ini.add_entry("KeyBindings","KeyBinding" + QString::number(i)  , bindingIDs[i] );
00514   }
00515 }
00516 
00518 void CoreWidget::registerCoreKeys() {
00519 
00520   //register keys for coreWidget
00521   connect(this , SIGNAL( registerKey(int, Qt::KeyboardModifiers, QString, bool) ),
00522           this , SLOT(slotRegisterKey(int, Qt::KeyboardModifiers, QString, bool)) );
00523 
00524   emit registerKey(Qt::Key_Print  , Qt::NoModifier, "Create Snapshot");
00525   emit registerKey(Qt::Key_S      , Qt::ControlModifier, "Save Object");
00526   emit registerKey(Qt::Key_O      , Qt::ControlModifier, "Open Object");
00527   emit registerKey(Qt::Key_L      , Qt::ControlModifier, "Show/Hide Logger");
00528   emit registerKey(Qt::Key_T      , Qt::ControlModifier, "Show/Hide Toolbox");
00529   emit registerKey(Qt::Key_F      , Qt::ControlModifier, "Toggle Fullscreen");
00530   emit registerKey(Qt::Key_Escape , Qt::NoModifier, "Switch to last action mode ( Move,Picking,Light or Info Mode)");
00531   emit registerKey(Qt::Key_Space  , Qt::NoModifier, "Toggle between multiview and single view");
00532 
00533   if ( OpenFlipper::Options::isLinux() ) {
00534     emit registerKey(Qt::Key_Meta , Qt::MetaModifier, "Use Navigation mode while key is pressed");
00535     emit registerKey(Qt::Key_Meta , Qt::NoModifier, "Use Navigation mode while key is pressed");
00536   } else {
00537     emit registerKey(Qt::Key_Alt , Qt::AltModifier, "Use Navigation mode while key is pressed");
00538   }
00539 
00540   emit registerKey(Qt::Key_Shift  , Qt::ShiftModifier, "Apply context menu action to all Viewers", true);
00541   emit registerKey(Qt::Key_Shift  , Qt::NoModifier, "Apply context menu action to all Viewers", true);
00542   
00543   
00544   emit registerKey(Qt::Key_A  , Qt::NoModifier, "First Person view strafe left");
00545   emit registerKey(Qt::Key_D , Qt::NoModifier, "First Person view strafe right");
00546   emit registerKey(Qt::Key_W    , Qt::NoModifier, "First Person view move forward");
00547   emit registerKey(Qt::Key_S  , Qt::NoModifier, "First Person view move back");
00548   
00549 }
00550 
00552 void CoreWidget::coreKeyPressEvent  (QKeyEvent* _e){
00553 
00554   //emit log(LOGERR,"Key Press");
00555 
00556   if ( ( _e->key() == Qt::Key_Meta ) && OpenFlipper::Options::isLinux() ) {
00557     if ( _e->type() == QEvent::KeyPress ) {
00558       setActionMode( Viewer::ExamineMode );
00559     }
00560   }
00561 
00562   if ( ( _e->key() == Qt::Key_Alt ) && ! OpenFlipper::Options::isLinux() ) {
00563     if ( _e->type() == QEvent::KeyPress ) {
00564       //emit log(LOGERR,"Switch to examine mode");
00565       setActionMode( Viewer::ExamineMode );
00566     }
00567   }
00568 
00569 
00570   if (_e->modifiers() & Qt::ControlModifier ) {
00571     switch (_e->key()) {
00572       case Qt::Key_F :
00573           toggleFullscreen();
00574         return;
00575 
00576       case Qt::Key_L :
00577           toggleLogger();
00578         return;
00579 
00580       case Qt::Key_T :
00581           toggleToolbox();
00582         return;
00583 
00584       case Qt::Key_O :
00585         loadMenu();
00586 
00587       case Qt::Key_S :
00588         saveMenu();
00589 
00590       default:
00591         return;
00592     }
00593 
00594   }
00595 
00596   switch (_e->key()) {
00597     
00598     case Qt::Key_Escape:
00599         setActionMode( lastActionMode() );
00600       break;
00601 
00602     case Qt::Key_Print:
00603       std::cerr << "Todo : On Print Screen, create a snapshot for all viewers" << std::endl;
00604       break;
00605 
00606     case Qt::Key_Space:
00607       nextViewerLayout();
00608       break;
00609       
00610     case Qt::Key_A:
00611       strafeLeft();
00612       break;
00613       
00614     case Qt::Key_D:
00615       strafeRight();
00616       break;
00617       
00618     case Qt::Key_W:
00619       moveForward();
00620       break;      
00621 
00622     case Qt::Key_S:
00623       moveBack();
00624       break;      
00625       
00626     case Qt::Key_Shift :
00627       shiftPressed_ = true;
00628       break;
00629 
00630     default:
00631       shiftPressed_ = false;
00632       return;
00633   }
00634 }
00635 
00637 void CoreWidget::coreKeyReleaseEvent(QKeyEvent* _e){
00638 
00639 
00640   if ( ( _e->key() == Qt::Key_Meta ) && OpenFlipper::Options::isLinux() ) {
00641     if ( _e->type() == QEvent::KeyRelease ) {
00642       setActionMode( lastActionMode() );
00643     }
00644   }
00645 
00646   //emit log(LOGERR,"Key release");
00647 
00648   if ( ( _e->key() == Qt::Key_Alt ) && !OpenFlipper::Options::isLinux() ) {
00649     //emit log(LOGERR,"Key alt release");
00650     if ( _e->type() == QEvent::KeyRelease ) {
00651       //emit log(LOGERR,"Key alt release toggle");
00652       setActionMode( lastActionMode() );
00653     }
00654   }
00655 
00656 
00657   switch (_e->key()) {
00658     case Qt::Key_Shift :
00659       shiftPressed_ = false;
00660       break;
00661     default:
00662       return;
00663   }
00664 }

acg pic Project OpenFlipper, ©  Computer Graphics Group, RWTH Aachen. Documentation generated using doxygen .