Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 7636 in orxonox.OLD for branches/qt_gui/src/lib/event/key_mapper.cc


Ignore:
Timestamp:
May 17, 2006, 10:50:16 AM (18 years ago)
Author:
bensch
Message:

orxonox/qt_gui: more gui-elements

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/qt_gui/src/lib/event/key_mapper.cc

    r7635 r7636  
    138138void KeyMapper::loadKeyBindings(IniParser* iniParser)
    139139{
    140   if( !iniParser->getSection (CONFIG_SECTION_PLAYER "1"))
    141   {
    142     PRINTF(1)("Could not find key bindings " CONFIG_SECTION_PLAYER"1\n");
     140  if( !iniParser->getSection (CONFIG_SECTION_CONTROL))
     141  {
     142    PRINTF(1)("Could not find key bindings " CONFIG_SECTION_CONTROL "\n");
    143143    return;
    144144  }
     
    158158
    159159  // PARSE MISC SECTION
    160   if( !iniParser->getSection (CONFIG_SECTION_MISC_KEYS))
    161   {
    162     PRINTF(1)("Could not find key bindings" CONFIG_SECTION_MISC_KEYS "\n");
     160//   if( !iniParser->getSection (CONFIG_SECTION_MISC_KEYS))
     161//   {
     162//     PRINTF(1)("Could not find key bindings" CONFIG_SECTION_MISC_KEYS "\n");
     163//     return;
     164//   }
     165//
     166//   iniParser->firstVar();
     167//   while( iniParser->getCurrentName() != "" )
     168//   {
     169//     PRINTF(3)("MISC: Parsing %s, %s now.\n", iniParser->getCurrentName(), iniParser->getCurrentValue());
     170//     index = nameToIndex (iniParser->getCurrentValue());
     171//     this->mapKeys(iniParser->getCurrentName(), index);
     172//     iniParser->nextVar();
     173//   }
     174}
     175
     176void KeyMapper::loadKeyBindings()
     177{
     178  if( !Preferences::getInstance()->sectionExists(CONFIG_SECTION_CONTROL))
     179  {
     180    PRINTF(1)("Could not find key bindings " CONFIG_SECTION_CONTROL "\n");
    163181    return;
    164182  }
    165 
    166   iniParser->firstVar();
    167   while( iniParser->getCurrentName() != "" )
    168   {
    169     PRINTF(3)("MISC: Parsing %s, %s now.\n", iniParser->getCurrentName(), iniParser->getCurrentValue());
    170     index = nameToIndex (iniParser->getCurrentValue());
    171     this->mapKeys(iniParser->getCurrentName(), index);
    172     iniParser->nextVar();
    173   }
    174 }
    175 
    176 void KeyMapper::loadKeyBindings()
    177 {
    178   if( !Preferences::getInstance()->sectionExists(CONFIG_SECTION_PLAYER "1"))
    179   {
    180     PRINTF(1)("Could not find key bindings " CONFIG_SECTION_PLAYER"1\n");
    181     return;
    182   }
    183183  int* index;
    184184
    185   std::list<std::string> keys = Preferences::getInstance()->listKeys(CONFIG_SECTION_PLAYER "1");
     185  std::list<std::string> keys = Preferences::getInstance()->listKeys(CONFIG_SECTION_CONTROL);
    186186  for ( std::list<std::string>::const_iterator it = keys.begin(); it!=keys.end(); it++ )
    187187  {
    188     PRINTF(3)("Keys: Parsing %s, %s now.\n", it->c_str(), Preferences::getInstance()->getString(CONFIG_SECTION_PLAYER "1", *it, "").c_str());
     188    PRINTF(3)("Keys: Parsing %s, %s now.\n", it->c_str(), Preferences::getInstance()->getString(CONFIG_SECTION_CONTROL, *it, "").c_str());
    189189    // map the name to an sdl index
    190     index = nameToIndex (Preferences::getInstance()->getString(CONFIG_SECTION_PLAYER "1", *it, ""));
     190    index = nameToIndex (Preferences::getInstance()->getString(CONFIG_SECTION_CONTROL, *it, ""));
    191191    // map the index to a internal name
    192     this->mapKeys(*it, index);
    193   }
    194 
    195 
    196   // PARSE MISC SECTION
    197   if( !Preferences::getInstance()->sectionExists (CONFIG_SECTION_MISC_KEYS))
    198   {
    199     PRINTF(1)("Could not find key bindings " CONFIG_SECTION_MISC_KEYS "\n");
    200     return;
    201   }
    202 
    203   keys = Preferences::getInstance()->listKeys(CONFIG_SECTION_MISC_KEYS);
    204   for ( std::list<std::string>::const_iterator it = keys.begin(); it!=keys.end(); it++ )
    205   {
    206     PRINTF(3)("MISC: Parsing %s, %s now.\n", it->c_str(), Preferences::getInstance()->getString(CONFIG_SECTION_MISC_KEYS, *it, "").c_str());
    207     index = nameToIndex (Preferences::getInstance()->getString(CONFIG_SECTION_MISC_KEYS, *it, ""));
    208192    this->mapKeys(*it, index);
    209193  }
Note: See TracChangeset for help on using the changeset viewer.