Developer Documentation
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Modules Pages
keyHandling.cc
1 /*===========================================================================*\
2 * *
3 * OpenFlipper *
4  * Copyright (c) 2001-2015, RWTH-Aachen University *
5  * Department of Computer Graphics and Multimedia *
6  * All rights reserved. *
7  * www.openflipper.org *
8  * *
9  *---------------------------------------------------------------------------*
10  * This file is part of OpenFlipper. *
11  *---------------------------------------------------------------------------*
12  * *
13  * Redistribution and use in source and binary forms, with or without *
14  * modification, are permitted provided that the following conditions *
15  * are met: *
16  * *
17  * 1. Redistributions of source code must retain the above copyright notice, *
18  * this list of conditions and the following disclaimer. *
19  * *
20  * 2. Redistributions in binary form must reproduce the above copyright *
21  * notice, this list of conditions and the following disclaimer in the *
22  * documentation and/or other materials provided with the distribution. *
23  * *
24  * 3. Neither the name of the copyright holder nor the names of its *
25  * contributors may be used to endorse or promote products derived from *
26  * this software without specific prior written permission. *
27  * *
28  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS *
29  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED *
30  * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A *
31  * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER *
32  * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, *
33  * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, *
34  * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR *
35  * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF *
36  * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING *
37  * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS *
38  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. *
39 * *
40 \*===========================================================================*/
41 
42 /*===========================================================================*\
43 * *
44 * $Revision$ *
45 * $LastChangedBy$ *
46 * $Date$ *
47 * *
48 \*===========================================================================*/
49 
50 #include "CoreWidget.hh"
51 
53 
54 //-----------------------------------------------------------------------------
55 
56 KeyBinding CoreWidget::getKeyBinding(QObject* _plugin, int _keyIndex ){
57  if (_plugin == 0)
58  return coreKeys_[_keyIndex];
59 
60  for (uint i=0; i < plugins_.size(); i++){
61  if (plugins_[i].plugin == _plugin)
62  return plugins_[i].keys[_keyIndex];
63  }
64 
65  emit log(LOGERR,tr("ERROR: could not get KeyBinding"));
66  return KeyBinding();
67 }
68 
69 QString CoreWidget::getRPCName(QObject* _plugin ){
70  if (_plugin == 0)
71  return "";
72 
73  for (uint i=0; i < plugins_.size(); i++){
74  if (plugins_[i].plugin == _plugin)
75  return plugins_[i].rpcName;
76  }
77 
78  emit log(LOGERR,tr("ERROR: could not get rpcname"));
79  return "";
80 }
81 
83 void CoreWidget::keyPressEvent(QKeyEvent* _e)
84 {
85  std::pair< int,Qt::KeyboardModifiers > key = std::make_pair(_e->key(), _e->modifiers() );
86 
87  //iterate over all assigned keys
88  KeyRange range = keys_.equal_range(key);
89 
90  KeyMap::iterator it;
91  for (it=range.first; it != range.second; ++it){
92 
93  QObject* plugin = (*it).second.first;
94  KeyBinding binding = getKeyBinding( plugin, (*it).second.second );
95 
96  //check if its a core Key
97  if (plugin == 0){
98 
99  //the key belongs to a slot
100  if (binding.slot){
101  bool ok;
102  emit call("core." + binding.description, ok);
103  return;
104  }
105 
106  // =================================================================================
107  // Map event to the cores key and modifier.
108  // Call the core key handler with the mapped event.
109  // =================================================================================
110  QKeyEvent mappedEvent (_e->type(),binding.key, binding.modifiers,
111  _e->text(), _e->isAutoRepeat(), _e->count() );
112 
113  coreKeyPressEvent(&mappedEvent);
114 
115  //if the key is multiUse also check other assigned keys
116  if (binding.multiUse)
117  continue;
118  else
119  return;
120  }
121 
122  //it's a plugin key
123 
124  //the key belongs to a slot
125  if (binding.slot){
126  bool ok;
127  emit call(getRPCName(plugin) +"."+ binding.description, ok);
128  return;
129  }
130 
131  //the key was specified through keyInterface
132  KeyInterface* keyPlugin = qobject_cast< KeyInterface * >(plugin);
133 
134  if (keyPlugin){
135 
136  // =================================================================================
137  // Map event to the plugins key and modifier.
138  // Call it with the mapped event.
139  // =================================================================================
140  QKeyEvent mappedEvent(_e->type(),binding.key, binding.modifiers,
141  _e->text(), _e->isAutoRepeat(), _e->count() );
142 
143  keyPlugin->slotKeyEvent(&mappedEvent);
144  }
145 
146  //if its not a multiUse key we are ready
147  if (!binding.multiUse)
148  return;
149  }
150 }
151 
152 //-----------------------------------------------------------------------------
153 
155 void CoreWidget::keyReleaseEvent(QKeyEvent* _e) {
156 
157  if (_e->isAutoRepeat()) return; //consider only "real" release events
158 
159  std::pair< int,Qt::KeyboardModifiers > key = std::make_pair(_e->key(), _e->modifiers() );
160 
161  //iterate over all assigned keys
162  KeyRange range = keys_.equal_range(key);
163 
164  KeyMap::iterator it;
165  for (it=range.first; it != range.second; ++it){
166 
167  QObject* plugin = (*it).second.first;
168  KeyBinding binding = getKeyBinding( plugin, (*it).second.second );
169 
170  if (plugin == 0){
171 
172  // =================================================================================
173  // Map event to the cores key and modifier.
174  // Call the core key handler with the mapped event.
175  // =================================================================================
176  QKeyEvent mappedEvent (_e->type(),binding.key, binding.modifiers,
177  _e->text(), _e->isAutoRepeat(), _e->count() );
178  coreKeyReleaseEvent(&mappedEvent);
179 
180  //if the key is multiUse also check other assigned keys
181  if (binding.multiUse)
182  continue;
183  else
184  return;
185  }
186 
187  //it's a plugin key
188  KeyInterface* keyPlugin = qobject_cast< KeyInterface * >(plugin);
189 
190  if (keyPlugin){
191 
192  // =================================================================================
193  // Map event to the plugins key and modifier.
194  // Call the plugin with the mapped event.
195  // =================================================================================
196 
197  QKeyEvent mappedEvent (_e->type(),binding.key, binding.modifiers,
198  _e->text(), _e->isAutoRepeat(), _e->count() );
199 
200  keyPlugin->slotKeyReleaseEvent(&mappedEvent);
201  }
202 
203  //if its not a multiUse key we are ready
204  if (!binding.multiUse)
205  return;
206  }
207 }
208 
209 //-----------------------------------------------------------------------------
210 
212 void CoreWidget::slotRegisterKey(int _key, Qt::KeyboardModifiers _modifiers, QString _description, bool _multiUse){
213 
214  //first check if the key is already registered by the coreWidget
215  bool found = false;
216  bool multi = false;
217  QString name;
218  for (uint i=0; i < coreKeys_.size(); i++)
219  if (coreKeys_[i].key == _key && coreKeys_[i].modifiers == _modifiers){
220  found = true;
221  multi = coreKeys_[i].multiUse;
222  name = "Core";
223  break;
224  }
225 
226  //then check if the key is already registered by a different plugin
227  if (!found)
228  for (uint i=0; i < plugins_.size(); i++)
229  for (int k=0; k < plugins_[i].keys.count(); k++)
230  if (plugins_[i].keys[k].key == _key
231  && plugins_[i].keys[k].modifiers == _modifiers){
232  found = true;
233  multi = plugins_[i].keys[k].multiUse;
234  name = plugins_[i].name;
235  break;
236  }
237 
238  if (found && !multi)
239  emit log(LOGERR, tr("Key already registered by '%1'").arg( name ) );
240 
241  //check if its a key for the core
242  if (sender() == this){
243  KeyBinding kb;
244  kb.key = _key;
245  kb.modifiers = _modifiers;
246  kb.description = _description;
247  kb.multiUse = multi || _multiUse;
248  kb.slot = false;
249 
250  if (multi && !_multiUse)
251  emit log(LOGERR, tr("Key already registered by '%1'. Forced registration as multiUse key.").arg( name ));
252 
253  coreKeys_.push_back( kb );
254 
255  keys_.insert( std::make_pair( std::make_pair(_key, _modifiers) , std::make_pair ((QObject*)0, int(coreKeys_.size()-1 ) ) )) ;
256  invKeys_.insert( std::make_pair( std::make_pair ((QObject*)0, int(coreKeys_.size()-1) ) , std::make_pair(_key, _modifiers) ) );
257  return;
258  }
259 
260  //find plugin
261  PluginInfo* pluginInfo = 0;
262 
263  for (uint i=0; i < plugins_.size(); i++)
264  if (plugins_[i].plugin == sender())
265  pluginInfo = &plugins_[i];
266 
267  if (pluginInfo == 0){
268  emit log(LOGERR, tr("Unable to register key. Plugin not found!"));
269  return;
270  }
271 
272  KeyBinding kb;
273  kb.key = _key;
274  kb.modifiers = _modifiers;
275  kb.description = _description;
276  kb.multiUse = multi || _multiUse;
277  kb.slot = false;
278 
279  if (multi && !_multiUse)
280  emit log(LOGERR, tr("Key already registered by '%1'. Forced registration as multiUse key.").arg( name ));
281 
282  pluginInfo->keys.append( kb );
283 
284  keys_.insert( std::make_pair( std::make_pair(_key, _modifiers) , std::make_pair(pluginInfo->plugin, pluginInfo->keys.size()-1) ) );
285  invKeys_.insert( std::make_pair( std::make_pair(pluginInfo->plugin, pluginInfo->keys.size()-1) , std::make_pair(_key, _modifiers) ) );
286 }
287 
290 
291  //check the core slots
292  for (int i=0; i < coreSlots_.count(); i++){
293 
294  //only consider functions without arguments
295  if ( !coreSlots_.at(i).slotName.contains( "()" ) )
296  continue;
297 
298  KeyBinding kb;
299  kb.key = -1;
300  kb.modifiers = 0;
301  kb.description = coreSlots_.at(i).slotName;
302  kb.multiUse = true;
303  kb.slot = true;
304 
305  coreKeys_.push_back( kb );
306 
307  keys_.insert( std::make_pair( std::make_pair(-1, (QFlags<Qt::KeyboardModifier>)0) , std::make_pair ((QObject*)0, int(coreKeys_.size()-1) ) )) ;
308  invKeys_.insert( std::make_pair( std::make_pair ((QObject*)0, int(coreKeys_.size()-1) ) , std::make_pair(-1, (QFlags<Qt::KeyboardModifier>)0) ) );
309  }
310 
311  //check all plugins
312  for (uint i=0; i < plugins_.size(); i++)
313 
314  for (int j=0; j < plugins_[i].rpcFunctions.count(); j++){
315 
316  //only consider functions without arguments
317  if ( !plugins_[i].rpcFunctions[j].contains( "()" )
318  || plugins_[i].rpcFunctions[j] == "version()")
319  continue;
320 
321  KeyBinding kb;
322  kb.key = -1;
323  kb.modifiers = 0;
324  kb.description = plugins_[i].rpcFunctions[j];
325  kb.multiUse = true;
326  kb.slot = true;
327 
328  plugins_[i].keys.append( kb );
329 
330  keys_.insert( std::make_pair( std::make_pair(-1, (QFlags<Qt::KeyboardModifier>)0) , std::make_pair(plugins_[i].plugin, plugins_[i].keys.size()-1) ) );
331  invKeys_.insert( std::make_pair( std::make_pair(plugins_[i].plugin, plugins_[i].keys.size()-1) , std::make_pair(-1, (QFlags<Qt::KeyboardModifier>)0) ) );
332  }
333 }
334 
336 void CoreWidget::slotAddKeyMapping(int _key, Qt::KeyboardModifiers _modifiers, QObject* _plugin, int _keyBindingID){
337 
338  std::pair< int,Qt::KeyboardModifiers > keyCombi = std::make_pair(_key, _modifiers );
339  std::pair< int,Qt::KeyboardModifiers > oldCombi;
340  std::pair< QObject*, int > oldTarget;
341 
342  bool replace = false;
343 
344  //and check if the key is already assigned without multiUse
345  KeyMap::iterator it;
346  for (it=keys_.begin(); it != keys_.end(); ++it){
347 
348  int key = (*it).first.first;
349  Qt::KeyboardModifiers modifiers = (*it).first.second;
350  QObject* plugin = (*it).second.first;
351  int bindingID = (*it).second.second;
352  KeyBinding binding = getKeyBinding(plugin, bindingID);
353 
354  //check if its the keyBinding we want to map/replace
355  if (plugin == _plugin && bindingID == _keyBindingID){
356  replace = true;
357  oldCombi = (*it).first;
358  oldTarget = (*it).second;
359  continue;
360  }
361 
362  //check if the mapping is conflicting with other mappings
363  if (_key == key && _modifiers == modifiers ){
364 
365  if (!binding.multiUse){
366  if (plugin == 0)
367  emit log(LOGERR, tr("Could not add key mapping. Key already assigned to the core."));
368  else{
369  BaseInterface* basePlugin = qobject_cast< BaseInterface * >(plugin);
370 
371  if (basePlugin)
372  emit log(LOGERR, tr("Could not add key mapping. Key already assigned to %1").arg( basePlugin->name() ) );
373  else
374  emit log(LOGERR, tr("Could not add key mapping. Key already assigned to an unknown plugin."));
375  }
376  return;
377  }
378  }
379  }
380 
381  KeyBinding keyBinding = getKeyBinding(_plugin, _keyBindingID);
382 
383  //check if new binding doesn't allow multiUse but other assignments for the key exist
384  if (!keyBinding.multiUse)
385  if ( (replace && keys_.count(keyCombi) > 1) || (!replace && keys_.count(keyCombi) > 0) ){
386  emit log(LOGERR, tr("Could not add (single usage) key mapping. Key already assigned."));
387  return;
388  }
389 
390  if (replace){
391  keys_.erase(oldCombi);
392  invKeys_.erase(oldTarget);
393  }
394 
395  //now we can add the mapping
396  keys_.insert ( std::make_pair( keyCombi , std::make_pair(_plugin, _keyBindingID) ));
397  invKeys_.insert( std::make_pair( std::make_pair(_plugin, _keyBindingID), keyCombi ));
398 
399 }
400 
403 
404  QVector< int > keys;
405  QVector< int > modifiers;
406  QStringList pluginNames;
407  QVector< int > bindingIDs;
408 
409  //first load everything from INI file
410  if ( !_ini.section_exists("KeyBindings") )
411  return;
412 
413  int keyCount;
414  if (_ini.get_entry(keyCount,"KeyBindings","KeyCount") ){
415 
416  int key;
417  int mod;
418  QString name;
419  int binding;
420 
421  for (int i=0; i < keyCount; i++){
422 
423  if (!_ini.get_entry(key, "KeyBindings","Key" + QString::number(i) ) ) continue;
424  if (!_ini.get_entry(mod, "KeyBindings","KeyModifiers" + QString::number(i) ) ) continue;
425  if (!_ini.get_entry(name, "KeyBindings","KeyTarget" + QString::number(i) ) ) continue;
426  if (!_ini.get_entry(binding, "KeyBindings","KeyBinding" + QString::number(i) ) ) continue;
427 
428  keys.push_back( key );
429  modifiers.push_back( mod );
430  pluginNames.push_back( name );
431  bindingIDs.push_back( binding );
432  }
433  }
434 
435  //add the keyMapping
436  for (int i=0; i < keys.count(); i++){
437 
438  //first we need the plugin
439  QObject* plugin = 0;
440 
441  if (pluginNames[i] != "Core" ){
442  //search for the plugin
443  for (uint i=0; i < plugins_.size(); i++)
444  if (plugins_[i].rpcName == pluginNames[i] ){
445  plugin = plugins_[i].plugin;
446  break;
447  }
448 
449  if (plugin == 0)
450  continue; //because plugin was not found
451  }
452 
453  slotAddKeyMapping( keys[i], (Qt::KeyboardModifiers) modifiers[i], plugin, bindingIDs[i] );
454  }
455 
456 }
457 
460 
461  QVector< int > keys;
462  QVector< int > modifiers;
463  QStringList pluginNames;
464  QVector< int > bindingIDs;
465 
466  //first get all keys with custom assignments
467  KeyMap::iterator it;
468  for (it=keys_.begin(); it != keys_.end(); ++it){
469 
470  int key = (*it).first.first;
471  Qt::KeyboardModifiers mod = (*it).first.second;
472  QObject* plugin = (*it).second.first;
473  int bindingID = (*it).second.second;
474  KeyBinding binding = getKeyBinding(plugin, bindingID);
475 
476  //check if current key assignment and original assignment differ
477  if (key != binding.key || mod != binding.modifiers){
478 
479  //get the pluginName
480  QString name;
481 
482  if (plugin == 0)
483  name = "Core";
484  else
485  name = getRPCName(plugin);
486 
487  //store key assignment
488  keys.push_back( key );
489  modifiers.push_back( mod );
490  pluginNames.push_back( name );
491  bindingIDs.push_back( bindingID );
492  }
493  }
494 
495  //finally store everything to INI file
496  _ini.add_entry("KeyBindings","KeyCount", keys.count());
497 
498  for (int i=0; i < keys.count(); i++){
499 
500  _ini.add_entry("KeyBindings","Key" + QString::number(i) , keys[i] );
501  _ini.add_entry("KeyBindings","KeyModifiers" + QString::number(i), modifiers[i] );
502  _ini.add_entry("KeyBindings","KeyTarget" + QString::number(i) , pluginNames[i] );
503  _ini.add_entry("KeyBindings","KeyBinding" + QString::number(i) , bindingIDs[i] );
504  }
505 }
506 
509 
510  //register keys for coreWidget
511  connect(this , SIGNAL( registerKey(int, Qt::KeyboardModifiers, QString, bool) ),
512  this , SLOT(slotRegisterKey(int, Qt::KeyboardModifiers, QString, bool)) );
513 
514  emit registerKey(Qt::Key_Print , Qt::NoModifier, "Create Snapshot");
515  emit registerKey(Qt::Key_Escape , Qt::NoModifier, "Switch to last action mode ( Move,Picking,Light or Info Mode)");
516  emit registerKey(Qt::Key_Space , Qt::NoModifier, "Toggle between multiview and single view");
517 
518  emit registerKey(Qt::Key_S , Qt::ControlModifier, "Save Object");
519  emit registerKey(Qt::Key_O , Qt::ControlModifier, "Open Object");
520  emit registerKey(Qt::Key_L , Qt::ControlModifier, "Show/Hide Logger");
521  emit registerKey(Qt::Key_T , Qt::ControlModifier, "Show/Hide Toolbox");
522  emit registerKey(Qt::Key_F , Qt::ControlModifier, "Toggle Fullscreen");
523  emit registerKey(Qt::Key_B , Qt::ControlModifier, "Show/Hide StatusBar");
524  emit registerKey(Qt::Key_N , Qt::ControlModifier, "Show/Hide ToolBar");
525  emit registerKey(Qt::Key_M , Qt::ControlModifier, "Show/Hide MenuBar");
526 
527 
528  if ( OpenFlipper::Options::isLinux() ) {
529  emit registerKey(Qt::Key_Meta , Qt::MetaModifier, "Use Navigation mode while key is pressed");
530  emit registerKey(Qt::Key_Meta , Qt::NoModifier, "Use Navigation mode while key is pressed");
531  emit registerKey(Qt::Key_Super_L , Qt::NoModifier, "Use Navigation mode while key is pressed");
532  emit registerKey(Qt::Key_Super_L , Qt::MetaModifier, "Use Navigation mode while key is pressed");
533  emit registerKey(Qt::Key_Super_R , Qt::NoModifier, "Use Navigation mode while key is pressed");
534  emit registerKey(Qt::Key_Super_R , Qt::MetaModifier, "Use Navigation mode while key is pressed");
535  } else {
536  emit registerKey(Qt::Key_Alt , Qt::AltModifier, "Use Navigation mode while key is pressed");
537  emit registerKey(Qt::Key_Alt , Qt::NoModifier, "Use Navigation mode while key is pressed");
538  }
539 
540  emit registerKey(Qt::Key_Shift , Qt::ShiftModifier, "Apply context menu action to all Viewers", true);
541  emit registerKey(Qt::Key_Shift , Qt::NoModifier, "Apply context menu action to all Viewers", true);
542 
543 
544  emit registerKey(Qt::Key_A , Qt::NoModifier, "First Person view strafe left");
545  emit registerKey(Qt::Key_D , Qt::NoModifier, "First Person view strafe right");
546  emit registerKey(Qt::Key_W , Qt::NoModifier, "First Person view move forward");
547  emit registerKey(Qt::Key_S , Qt::NoModifier, "First Person view move back");
548 
549 }
550 
552 void CoreWidget::coreKeyPressEvent (QKeyEvent* _e){
553  //emit log(LOGERR,"Key Press");
554  if ( (( _e->key() == Qt::Key_Meta ) || (_e->key() == Qt::Key_Super_L) || (_e->key() == Qt::Key_Super_R))
555  && OpenFlipper::Options::isLinux() ) {
556 
557  if ( lastActionMode() == actionMode()) {
558  if (actionMode() == Viewer::PickingMode)
559  setActionMode( Viewer::ExamineMode );
560  else
561  setActionMode( Viewer::PickingMode );
562  }
563  else
565  }
566 
567  if ( ( _e->key() == Qt::Key_Alt ) && ! OpenFlipper::Options::isLinux() ) {
568  //emit log(LOGERR,"Switch to examine mode");
569  if ( lastActionMode() == actionMode()) {
570  if (actionMode() == Viewer::PickingMode)
571  setActionMode( Viewer::ExamineMode );
572  else
573  setActionMode( Viewer::PickingMode );
574  }
575  else
577  }
578 
579 
580  if (_e->modifiers() & Qt::ControlModifier ) {
581  switch (_e->key()) {
582  case Qt::Key_B :
583  toggleStatusBar();
584  return;
585 
586  case Qt::Key_F :
588  return;
589 
590  case Qt::Key_L :
591  toggleLogger();
592  return;
593 
594  case Qt::Key_T :
595  toggleToolbox();
596  return;
597 
598  case Qt::Key_M :
599  toggleMenuBar();
600  return;
601 
602  case Qt::Key_N:
603  toggleToolBar();
604  return;
605 
606  case Qt::Key_O :
607  loadMenu();
608 
609  case Qt::Key_S :
610  saveMenu();
611  default:
612  return;
613  }
614 
615  }
616 
617  switch (_e->key()) {
618 
619  case Qt::Key_Escape:
621  break;
622 
623  case Qt::Key_Print:
624  std::cerr << "Todo : On Print Screen, create a snapshot for all viewers" << std::endl;
625  break;
626 
627  case Qt::Key_Space:
629  break;
630 
631  case Qt::Key_A:
632  strafeLeft();
633  break;
634 
635  case Qt::Key_D:
636  strafeRight();
637  break;
638 
639  case Qt::Key_W:
640  moveForward();
641  break;
642 
643  case Qt::Key_S:
644  moveBack();
645  break;
646 
647  case Qt::Key_Shift :
648  shiftPressed_ = true;
649  break;
650 
651  default:
652  shiftPressed_ = false;
653  return;
654  }
655 }
656 
659 
660  if ( (( _e->key() == Qt::Key_Meta ) || (_e->key() == Qt::Key_Super_L) || (_e->key() == Qt::Key_Super_R))
661  && OpenFlipper::Options::isLinux() ) {
663  }
664 
665  //emit log(LOGERR,"Key release");
666 
667  if ( ( _e->key() == Qt::Key_Alt ) && !OpenFlipper::Options::isLinux() ) {
669  }
670 
671 
672  switch (_e->key()) {
673  case Qt::Key_Shift :
674  shiftPressed_ = false;
675  break;
676  default:
677  return;
678  }
679 }
Interface class from which all plugins have to be created.
void registerCoreKeys()
Register all events related to the core.
Definition: keyHandling.cc:508
Keyboard Event Interface.
Definition: KeyInterface.hh:76
void strafeLeft()
When using first person mode strafe to the left.
void registerKey(int _key, Qt::KeyboardModifiers _modifiers, QString _description, bool _multiUse=false)
internal signal to register CoreWidget keys
void coreKeyReleaseEvent(QKeyEvent *_e)
if a keyReleaseEvent belongs to the core this functions is called
Definition: keyHandling.cc:658
QObject * plugin
Pointer to the loaded plugin (Already casted when loading it)
Definition: PluginInfo.hh:127
void call(QString _expression, bool &_success)
call a scripting function
bool get_entry(QString &_val, const QString &_section, const QString &_key) const
Access to a string entry.
Definition: INIFile.cc:439
void toggleLogger()
Hide or show logging area.
void toggleFullscreen()
Set application to Fullscreen and back.
Definition: CoreWidget.cc:703
void add_entry(const QString &_section, const QString &_key, const QString &_value)
Addition / modification of a string entry.
Definition: INIFile.cc:263
Viewer::ActionMode lastActionMode()
Definition: CoreWidget.hh:1449
void nextViewerLayout()
Switches over to the next view mode.
Definition: CoreWidget.cc:967
virtual void slotKeyEvent(QKeyEvent *_event)
Key Event from Main App.
Definition: KeyInterface.hh:97
void coreKeyPressEvent()
handle key events for the core
void slotRegisterKey(int _key, Qt::KeyboardModifiers _modifiers, QString _description, bool _multiUse=false)
key registration
Definition: keyHandling.cc:212
void slotAddKeyMapping(int _key, Qt::KeyboardModifiers _modifiers, QObject *_plugin, int _keyBindingID)
add a new key Mapping
Definition: keyHandling.cc:336
void saveKeyBindings(INIFile &_ini)
Store current key assignments to a given INI file.
Definition: keyHandling.cc:459
Class for the handling of simple configuration files.
Definition: INIFile.hh:105
virtual void keyReleaseEvent(QKeyEvent *_e)
passes keyReleaseEvents to either the Core or a Plugin depending on who has registered the key ...
Definition: keyHandling.cc:155
std::vector< PluginInfo > plugins_
List of all loaded plugins_.
Definition: Core.hh:1208
void log(Logtype _type, QString _message)
Logg with OUT,WARN or ERR as type.
void setActionMode(const Viewer::ActionMode _am)
Definition: picking.cc:68
virtual QString name()=0
Return a name for the plugin.
void toggleStatusBar()
Change visibility of the Status Bar.
Definition: StatusBar.cc:150
std::pair< KeyMap::iterator, KeyMap::iterator > KeyRange
typedefs
Definition: CoreWidget.hh:371
QList< SlotInfo > & coreSlots_
list of scripting slots from core
Definition: CoreWidget.hh:400
bool shiftPressed_
Store the state of the shift key.
Definition: CoreWidget.hh:436
QString getRPCName(QObject *_plugin)
typedefs
Definition: keyHandling.cc:69
void slotRegisterSlotKeyBindings()
register scripting slots to allow keyBindings
Definition: keyHandling.cc:289
void moveForward()
When using first person mode move forward.
KeyMap keys_
mapping of all keys to registered keys and the corresponding plugins
Definition: CoreWidget.hh:394
void toggleToolbox()
Hide or show toolbox area.
Definition: CoreWidget.cc:762
KeyBinding getKeyBinding(QObject *_plugin, int _keyIndex)
typedefs
Definition: keyHandling.cc:56
void toggleToolBar()
Hide or show current toolbar.
Definition: CoreWidget.cc:844
virtual void slotKeyReleaseEvent(QKeyEvent *_event)
Key Release Event from Main App.
Viewer::ActionMode actionMode()
Definition: CoreWidget.hh:1448
void moveBack()
When using first person mode move backward.
bool section_exists(const QString &_section) const
Check if given section exists in the current INI file.
Definition: INIFile.cc:233
void strafeRight()
When using first person mode strafe to the right.
void loadKeyBindings(INIFile &_ini)
Load key assignments from a given INI file.
Definition: keyHandling.cc:402
void toggleMenuBar()
Hide or show menu bar.
Definition: CoreWidget.cc:836
InverseKeyMap invKeys_
mapping of all registered keys and the corresponding plugins to currently assigned keys ...
Definition: CoreWidget.hh:397
virtual void keyPressEvent(QKeyEvent *_e)
Handle key events.
Definition: keyHandling.cc:83
std::vector< KeyBinding > coreKeys_
vector of keys registered to the core
Definition: CoreWidget.hh:391
QList< KeyBinding > keys
List of registered keys with description.
Definition: PluginInfo.hh:151