int SettingsManager::getIntSetting( const char *inSettingName, char *outValueFound ) { char valueFound = false; int value = 0; char *stringValue = getStringSetting( inSettingName ); if( stringValue != NULL ) { int numRead = sscanf( stringValue, "%d", &value ); if( numRead == 1 ) { valueFound = true; } delete [] stringValue; } *outValueFound = valueFound; return value; }
void ChatWidget::loadSettings( ClientShared* shared ) { m_shared = shared; m_toolbar->getCensorButton()->setToggleState(getBoolSetting("chat.censored")); m_fontRatio = getNumericSetting("chat.game.font"); Log::write("ChatWidget","loaded game chat settings"); m_toolbar->getFontSlider()->setValue( ((m_toolbar->getFontSlider()->getMaxValue() - m_toolbar->getFontSlider()->getMinValue()) * m_fontRatio) + m_toolbar->getFontSlider()->getMinValue()); //all this code just adds players to mute list int tbl = getTableG(); LobbyCache::Table* t = shared->getLobbyCache()->getTableAt(tbl); if(t) { ClientPlayer* s = shared->getPlayerManager()->getSelfPlayer(); /* for(int i = 0; i < t->getNumChairs(); ++i) { ClientPlayer* p = t->getChairAt(i)->getPlayer(); //valid and not me if(s && p && p->getUsername() != s->getUsername()) { m_toolbar->addPlayer(p->getUsername(),getGamePlayerColor(p->getUsername())); m_toolbar->setPlayerMuted(p->getUsername(),isMutedG(p->getUsername())); } } */ for(int i = 0; i < t->getNumWatchers(); ++i) { ClientPlayer* p = t->getWatcherAt(i); if(s && p && p->getUsername() != s->getUsername()) { m_toolbar->addPlayer(p->getUsername(),getGamePlayerColor(p->getUsername())); m_toolbar->setPlayerMuted(p->getUsername(),isMutedG(p->getUsername())); } } } std::string chatStyle = getStringSetting("chat.style"); chatStyleChanged(chatStyle); }
/* * Get device argument */ std::wstring Settings::getDeviceParameter(int intDeviceId, const std::wstring &strName) const { TelldusCore::MutexLocker locker(&mutex); return getStringSetting(Device, intDeviceId, strName, true); }
/* * Get the device model */ std::wstring Settings::getModel(int intDeviceId) const { TelldusCore::MutexLocker locker(&mutex); return getStringSetting(Device, intDeviceId, L"model", false); }
std::wstring Settings::getDeviceStateValue( int intDeviceId ) const { TelldusCore::MutexLocker locker(&mutex); return getStringSetting( Settings::Device, intDeviceId, L"stateValue", true ); }
String ConfigurationManager::getKeymap() { return getStringSetting("Keymap", "keymap-german.xml"); }
int ConfigurationManager::getIntSetting(const String& name, int defaultv) { String val = getStringSetting(name); if (val == StringUtil::BLANK) return defaultv; else return StringConverter::parseInt(val); }
QString GTDatabaseConfig::host() { return getStringSetting(HOST); }
QString GTDatabaseConfig::login() { return getStringSetting(LOGIN); }
QString GTDatabaseConfig::readOnlyLogin() { return getStringSetting(READ_ONLY_LOGIN); }
QString GTDatabaseConfig::versionDatabase() { return getStringSetting(DATABASE_VERSION); }
QString GTDatabaseConfig::uninitializedDatabase() { return getStringSetting(DATABASE_UNINITED_PREFIX) + getOsSuffix(); }
QString GTDatabaseConfig::secondDatabase() { return getStringSetting(DATABASE_PREFIX_2) + getOsSuffix(); }
/* * Get the name of the device */ std::wstring Settings::getName(Node type, int intNodeId) const { TelldusCore::MutexLocker locker(&mutex); return getStringSetting(type, intNodeId, L"name", false); }
bool ConfigurationManager::getBoolSetting(const String& name, bool defaultv) { String val = getStringSetting(name); if (val == StringUtil::BLANK) return defaultv; else return StringConverter::parseBool(val); }
std::wstring Settings::getControllerSerial(int intControllerId) const { TelldusCore::MutexLocker locker(&mutex); return getStringSetting(Controller, intControllerId, L"serial", false); }
QString GTDatabaseConfig::password() { return getStringSetting(PASSWORD); }