| 156 | } |
| 157 | |
| 158 | void SettingsWindow::initConfig() |
| 159 | { |
| 160 | ConfigManager& config = ConfigManager::getSingleton(); |
| 161 | |
| 162 | const CEGUI::Image* selImg = &CEGUI::ImageManager::getSingleton().get("OpenDungeonsSkin/SelectionBrush"); |
| 163 | |
| 164 | // Game |
| 165 | CEGUI::Editbox* nicknameEb = static_cast<CEGUI::Editbox*>( |
| 166 | mRootWindow->getChild("SettingsWindow/MainTabControl/Game/GameSP/NicknameEdit")); |
| 167 | std::string nickname = config.getGameValue(Config::NICKNAME, std::string(), false); |
| 168 | if (!nickname.empty()) |
| 169 | nicknameEb->setText(reinterpret_cast<const CEGUI::utf8*>(nickname.c_str())); |
| 170 | |
| 171 | CEGUI::Combobox* keeperVoiceCb = static_cast<CEGUI::Combobox*>( |
| 172 | mRootWindow->getChild("SettingsWindow/MainTabControl/Game/GameSP/KeeperVoice")); |
| 173 | keeperVoiceCb->resetList(); |
| 174 | std::string keeperVoice = config.getGameValue(Config::KEEPERVOICE, ConfigManager::DEFAULT_KEEPER_VOICE, false); |
| 175 | uint32_t cptVoice = 0; |
| 176 | for(const std::string& keeperVoiceAvailable : config.getKeeperVoices()) |
| 177 | { |
| 178 | CEGUI::ListboxTextItem* item = new CEGUI::ListboxTextItem(keeperVoiceAvailable, cptVoice); |
| 179 | item->setSelectionBrushImage(selImg); |
| 180 | keeperVoiceCb->addItem(item); |
| 181 | if(keeperVoiceAvailable == keeperVoice) |
| 182 | { |
| 183 | keeperVoiceCb->setText(item->getText()); |
| 184 | keeperVoiceCb->setItemSelectState(item, true); |
| 185 | } |
| 186 | ++cptVoice; |
| 187 | } |
| 188 | |
| 189 | CEGUI::Combobox* minimapTypes = static_cast<CEGUI::Combobox*>( |
| 190 | mRootWindow->getChild("SettingsWindow/MainTabControl/Game/GameSP/MiniMapType")); |
| 191 | minimapTypes->resetList(); |
| 192 | std::string minimapTypeCurrent = config.getGameValue(Config::MINIMAP_TYPE, MiniMap::DEFAULT_MINIMAP, false); |
| 193 | uint32_t cptMiniMapType = 0; |
| 194 | for(const std::string& minimapType : MiniMap::getMiniMapTypes()) |
| 195 | { |
| 196 | CEGUI::ListboxTextItem* item = new CEGUI::ListboxTextItem(minimapType, cptMiniMapType); |
| 197 | item->setSelectionBrushImage(selImg); |
| 198 | minimapTypes->addItem(item); |
| 199 | if(minimapType == minimapTypeCurrent) |
| 200 | { |
| 201 | minimapTypes->setText(item->getText()); |
| 202 | minimapTypes->setItemSelectState(item, true); |
| 203 | } |
| 204 | ++cptMiniMapType; |
| 205 | } |
| 206 | |
| 207 | std::string lightStr = config.getGameValue(Config::LIGHT_FACTOR, std::string(), false); |
| 208 | float lightFactor = lightStr.empty() ? 0.0f : Helper::toFloat(lightStr); |
| 209 | setLightFactorValue(lightFactor); |
| 210 | |
| 211 | // Input |
| 212 | CEGUI::ToggleButton* keyboardGrabCheckbox = static_cast<CEGUI::ToggleButton*>( |
| 213 | mRootWindow->getChild("SettingsWindow/MainTabControl/Input/InputSP/KeyboardGrabCheckbox")); |
| 214 | keyboardGrabCheckbox->setSelected(config.getInputValue(Config::KEYBOARD_GRAB, "No", false) == "Yes"); |
| 215 |
nothing calls this directly
no test coverage detected