/* Will insert the attribute = value; pair in window's list, * if it's different from the defaults. * Defaults means either defaults database, or attributes saved * for the default window "*". This is to let one revert options that are * global because they were saved for all windows ("*"). */ static int insertAttribute(WMPropList *dict, WMPropList *window, WMPropList *attr, WMPropList *value, int flags) { WMPropList *def_win, *def_value = NULL; int update = 0, modified = 0; if (!(flags & UPDATE_DEFAULTS) && dict) { if ((def_win = WMGetFromPLDictionary(dict, AnyWindow)) != NULL) def_value = WMGetFromPLDictionary(def_win, attr); } /* If we could not find defaults in database, fall to hardcoded values. * Also this is true if we save defaults for all windows */ if (!def_value) def_value = ((flags & IS_BOOLEAN) != 0) ? No : EmptyString; if (flags & IS_BOOLEAN) update = (getBool(value) != getBool(def_value)); else update = !WMIsPropListEqualTo(value, def_value); if (update) { WMPutInPLDictionary(window, attr, value); modified = 1; } return modified; }
//------------------------- void Settings::loadFloppyConfig(FloppyConfig *fc) { fc->enabled = getBool("FLOPPYCONF_ENABLED", true); fc->id = getInt ("FLOPPYCONF_DRIVEID", 0); fc->writeProtected = getBool("FLOPPYCONF_WRITEPROTECTED", false); fc->soundEnabled = getBool("FLOPPYCONF_SOUND_ENABLED", true); }
void *Playlists::createInstance( const QString &name ) { if ( name == PLSName && getBool( "PLS_enabled" ) ) return new PLS; else if ( name == M3UName && getBool( "M3U_enabled" ) ) return new M3U; return NULL; }
QList< Playlists::Info > Playlists::getModulesInfo( const bool showDisabled ) const { QList< Info > modulesInfo; if ( showDisabled || getBool( "PLS_enabled" ) ) modulesInfo += Info( PLSName, PLAYLIST, QStringList( "pls" ) ); if ( showDisabled || getBool( "M3U_enabled" ) ) modulesInfo += Info( M3UName, PLAYLIST, QStringList( "m3u" ) ); return modulesInfo; }
QList< Inputs::Info > Inputs::getModulesInfo(const bool showDisabled) const { QList< Info > modulesInfo; modulesInfo += Info(ToneGeneratorName, DEMUXER, sine); if (showDisabled || getBool("PCM")) modulesInfo += Info(PCMName, DEMUXER, get("PCM/extensions").toStringList()); if (showDisabled || getBool("Rayman2")) modulesInfo += Info(Rayman2Name, DEMUXER, QStringList("apm"), ray2); return modulesInfo; }
Role::Role(const std::vector<std::string> values) : //variable modifier value felid Parent ( values[index(fields, "id" )] ), name ( values[index(fields, "name" )] ), color ( std::stol (values[index(fields, "color" )]) ), hoist ( getBool (values[index(fields, "hoist" )]) ), position ( std::stol (values[index(fields, "position" )]) ), permissions(static_cast<Permission>(std::stoll(values[index(fields, "permissions")]))), managed ( getBool (values[index(fields, "managed" )]) ), mantionable( getBool (values[index(fields, "mentionable")]) ) {}
QList< Chiptune::Info > Chiptune::getModulesInfo(const bool showDisabled) const { QList< Info > modulesInfo; #ifdef USE_GME if (showDisabled || getBool("GME")) modulesInfo += Info(GMEName, DEMUXER, QStringList() << "ay" << "gbs" << "gym" << "hes" << "kss" << "nsf" << "nsfe" << "sap" << "spc" << "vgm" << "vgz"); #endif #ifdef USE_SIDPLAY if (showDisabled || getBool("SIDPlay")) modulesInfo += Info(SIDPlayName, DEMUXER, QStringList() << "sid" << ".c64" << ".prg"); #endif return modulesInfo; }
int test() { int r = 0; for (int x = 0; x< 10; x++) { int *p = getPtr(); // Liveness info is not computed correctly due to the following expression. // This happens due to CFG being special cased for short circuit operators. // PR18159 if (p != 0 && getBool() && foo().m && getBool()) { r = *p; // no warning } } return r; }
QList< Inputs::Info > Inputs::getModulesInfo( const bool showDisabled ) const { QList< Info > modulesInfo; #ifdef Q_OS_WIN modulesInfo += Info( AudioCDName, DEMUXER, QStringList( "cda" ), cd ); #else modulesInfo += Info( AudioCDName, DEMUXER, cd ); #endif modulesInfo += Info( ToneGeneratorName, DEMUXER, sine ); if ( showDisabled || getBool( "PCM" ) ) modulesInfo += Info( PCMName, DEMUXER, get( "PCM/extensions" ).toStringList() ); if ( showDisabled || getBool( "Rayman2" ) ) modulesInfo += Info( Rayman2Name, DEMUXER, QStringList( "apm" ), ray2 ); return modulesInfo; }
std::size_t dynamic::hash() const { switch (type()) { case NULLT: return 0xBAAAAAAD; case OBJECT: { // Accumulate using addition instead of using hash_range (as in the ARRAY // case), as we need a commutative hash operation since unordered_map's // iteration order is unspecified. auto h = std::hash<std::pair<dynamic, dynamic>>{}; return std::accumulate( items().begin(), items().end(), size_t{0x0B1EC7}, [&](auto acc, auto item) { return acc + h(item); }); } case ARRAY: return folly::hash::hash_range(begin(), end()); case INT64: return std::hash<int64_t>()(getInt()); case DOUBLE: return std::hash<double>()(getDouble()); case BOOL: return std::hash<bool>()(getBool()); case STRING: // keep consistent with detail::DynamicHasher return Hash()(getString()); } assume_unreachable(); }
void Parameters::toggleBool( const std::string& name ) { if( m_boolParameters.find( name ) != m_boolParameters.end() ) { setBool( name, !getBool( name ) ); } }
bool ConfigManager::save() { if (!_config) return true; if (!getBool("saveconf", true)) return true; // Create the directories in the path, if necessary UString file = FilePath::canonicalize(getConfigFile()); try { FilePath::createDirectories(FilePath::getDirectory(file)); // Open and save the config WriteFile config; if (!config.open(file)) throw Exception(kOpenError); save(config, true); } catch (...) { exceptionDispatcherWarning("Failed saving config file \"%s\"", file.c_str()); return false; } return true; }
INT_PTR CVkProto::SvcGetAvatarInfo(WPARAM, LPARAM lParam) { PROTO_AVATAR_INFORMATION* pai = (PROTO_AVATAR_INFORMATION*)lParam; ptrA szUrl(getStringA(pai->hContact, "AvatarUrl")); if (szUrl == NULL) return GAIR_NOAVATAR; TCHAR tszFileName[MAX_PATH]; GetAvatarFileName(pai->hContact, tszFileName, _countof(tszFileName)); _tcsncpy(pai->filename, tszFileName, _countof(pai->filename)); pai->format = ProtoGetAvatarFormat(pai->filename); if (::_taccess(pai->filename, 0) == 0 && !getBool(pai->hContact, "NeedNewAvatar")) return GAIR_SUCCESS; if (IsOnline()) { AsyncHttpRequest *pReq = new AsyncHttpRequest(); pReq->flags = NLHRF_NODUMP | NLHRF_REDIRECT; pReq->m_szUrl = szUrl; pReq->pUserInfo = new CVkSendMsgParam(pai->hContact); pReq->m_pFunc = &CVkProto::OnReceiveAvatar; pReq->requestType = REQUEST_GET; pReq->m_bApiReq = false; Push(pReq); debugLogA("Requested to read an avatar from '%s'", szUrl); return GAIR_WAITFOR; } debugLogA("No avatar"); return GAIR_NOAVATAR; }
int CAimProto::OnContactDeleted(WPARAM wParam,LPARAM /*lParam*/) { if (state != 1) return 0; const HANDLE hContact = (HANDLE)wParam; if (DBGetContactSettingByte(hContact, MOD_KEY_CL, AIM_KEY_NL, 0)) return 0; DBVARIANT dbv; if (!getString(hContact, AIM_KEY_SN, &dbv)) { for(int i=1;;++i) { unsigned short item_id = getBuddyId(hContact, i); if (item_id == 0) break; unsigned short group_id = getGroupId(hContact, i); if (group_id) { bool is_not_in_list = getBool(hContact, AIM_KEY_NIL, false); aim_ssi_update(hServerConn, seqno, true); aim_delete_contact(hServerConn, seqno, dbv.pszVal, item_id, group_id, 0, is_not_in_list); char* group = group_list.find_name(group_id); update_server_group(group, group_id); aim_ssi_update(hServerConn, seqno, false); } } DBFreeVariant(&dbv); } return 0; }
int CAimProto::OnContactDeleted(WPARAM hContact, LPARAM) { if (m_state != 1) return 0; if (db_get_b(hContact, MOD_KEY_CL, AIM_KEY_NL, 0)) return 0; DBVARIANT dbv; if (!getString(hContact, AIM_KEY_SN, &dbv)) { for (int i = 1;; ++i) { unsigned short item_id = getBuddyId(hContact, i); if (item_id == 0) break; unsigned short group_id = getGroupId(hContact, i); if (group_id) { bool is_not_in_list = getBool(hContact, AIM_KEY_NIL, false); aim_ssi_update(m_hServerConn, m_seqno, true); aim_delete_contact(m_hServerConn, m_seqno, dbv.pszVal, item_id, group_id, 0, is_not_in_list); char *group = m_group_list.find_name(group_id); update_server_group(group, group_id); aim_ssi_update(m_hServerConn, m_seqno, false); } } db_free(&dbv); } return 0; }
AudioFilters::AudioFilters() : Module( "AudioFilters" ) { moduleImg = QImage( ":/audiofilters" ); init( "Equalizer", false ); int nbits = getInt( "Equalizer/nbits" ); if ( nbits < 8 || nbits > 16 ) set( "Equalizer/nbits", 10 ); int count = getInt( "Equalizer/count" ); if ( count < 2 || count > 20 ) set( "Equalizer/count", ( count = 8 ) ); for ( int i = 0 ; i < count ; ++i ) init( "Equalizer/" + QString::number( i ), 50 ); init( "VoiceRemoval", false ); init( "PhaseReverse", false ); init( "PhaseReverse/ReverseRight", false ); init( "Echo", false ); init( "Echo/Delay", 500 ); init( "Echo/Volume", 50 ); init( "Echo/Feedback", 50 ); init( "Echo/Surround", false ); if ( getBool( "Equalizer" ) ) { bool disableEQ = true; for ( int i = 0 ; i < count ; ++i ) disableEQ &= getInt( "Equalizer/" + QString::number( i ) ) == 50; if ( disableEQ ) set( "Equalizer", false ); } }
void FacebookProto::SaveName(MCONTACT hContact, const facebook_user *fbu) { // Save nick std::string nick = fbu->real_name; if (!getBool(FACEBOOK_KEY_NAME_AS_NICK, 1) && !fbu->nick.empty()) nick = fbu->nick; updateStringUtf(this, hContact, FACEBOOK_KEY_NICK, nick); // Explode whole name into first, second and last name std::vector<std::string> names; utils::text::explode(fbu->real_name, " ", &names); updateStringUtf(this, hContact, FACEBOOK_KEY_FIRST_NAME, names.size() > 0 ? names.front().c_str() : ""); updateStringUtf(this, hContact, FACEBOOK_KEY_LAST_NAME, names.size() > 1 ? names.back().c_str() : ""); std::string middle; if (names.size() > 2) { for (std::string::size_type i = 1; i < names.size() - 1; i++) { if (!middle.empty()) middle += " "; middle += names.at(i); } } updateStringUtf(this, hContact, FACEBOOK_KEY_SECOND_NAME, middle); }
QList< QPainter_Qt::Info > QPainter_Qt::getModulesInfo(const bool showDisabled) const { QList< Info > modulesInfo; if (showDisabled || getBool("Enabled")) modulesInfo += Info(QPainterWriterName, WRITER, QStringList("video")); return modulesInfo; }
void CSkypeProto::StartChatRoom(const TCHAR *tid, const TCHAR *tname) { // Create the group chat session GCSESSION gcw = { sizeof(gcw) }; gcw.iType = GCW_CHATROOM; gcw.ptszID = tid; gcw.pszModule = m_szModuleName; gcw.ptszName = tname; CallServiceSync(MS_GC_NEWSESSION, 0, (LPARAM)&gcw); // Send setting events GCDEST gcd = { m_szModuleName, tid, GC_EVENT_ADDGROUP }; GCEVENT gce = { sizeof(gce), &gcd }; // Create a user statuses gce.ptszStatus = TranslateT("Admin"); CallServiceSync(MS_GC_EVENT, NULL, reinterpret_cast<LPARAM>(&gce)); gce.ptszStatus = TranslateT("User"); CallServiceSync(MS_GC_EVENT, NULL, reinterpret_cast<LPARAM>(&gce)); // Finish initialization gcd.iType = GC_EVENT_CONTROL; gce.time = time(NULL); gce.pDest = &gcd; bool hideChats = getBool("HideChats", 1); CallServiceSync(MS_GC_EVENT, (hideChats ? WINDOW_HIDDEN : SESSION_INITDONE), reinterpret_cast<LPARAM>(&gce)); CallServiceSync(MS_GC_EVENT, SESSION_ONLINE, reinterpret_cast<LPARAM>(&gce)); }
bool ServiceLayer::configureDisplay( const flowvr::xml::TiXmlHandle &displayConf ) { flowvr::xml::TiXmlHandle window = displayConf.FirstChild("window"); if(!window.Element()) return false; { flowvr::xml::TiXmlHandle width = window.FirstChild("width").FirstChild(); flowvr::xml::TiXmlHandle height = window.FirstChild("height").FirstChild(); flowvr::xml::TiXmlHandle left = window.FirstChild("left").FirstChild(); flowvr::xml::TiXmlHandle top = window.FirstChild("top").FirstChild(); flowvr::xml::TiXmlHandle fullscreen = window.FirstChild("fullscreen").FirstChild(); flowvr::xml::TiXmlHandle title = window.FirstChild("title").FirstChild(); flowvr::xml::TiXmlHandle cursor = window.FirstChild("cursor").FirstChild(); int x,y,w,h; w = (width.Text() ? atoi(width.Text()->Value()) : 640); h = (height.Text() ? atoi(height.Text()->Value()): 480); x = (left.Text() ? atoi(left.Text()->Value()) : 0); y = (top.Text() ? atoi(top.Text()->Value()) : 0); int c = (cursor.Text() ? atoi(cursor.Text()->Value()) : 0 ); c = std::max<int>(0,c); bool bFullscreen = (fullscreen.Text() ? getBool( fullscreen.Text()->Value() ) : false); std::string strTitle = (title.Text() ? title.Text()->Value() : ""); if( !strTitle.empty() ) m_display->setTitle( strTitle ); m_display->setPosition( x,y,w,h ); m_display->setFullscreen( bFullscreen ); m_display->setCursor(c); } return false; }
void moveit_rviz_plugin::PerLinkSubObjBase::changed() { shapes_.reset(); centers_.clear(); radii_.clear(); if (!getBool()) return; getGeom(robot_relative_, centers_, radii_); if (centers_.empty()) return; shapes_.reset(new ShapesDisplay(getSceneNode(), base_->getColor(), base_->getSize())); if (centers_.size() == radii_.size() || radii_.size() == 1) { shapes_->addSpheres(centers_, radii_); base_->setStyle(PerLinkObjBase::SPHERES); } else if (base_->getStyle() == PerLinkObjBase::SPHERES) { shapes_->addSpheres(centers_, base_->getSize() * 0.5); } else { shapes_->addPoints(centers_); } }
bool SBQLConfig::getBoolDefault(const string ¶m, bool def) const { bool res; if (!getBool(param, res)) return res; else return def; }
/* * loop audio with given channel * * @param audio channel index * @param loop or not (boolean value) * @return EMO_NO_ERROR if succeeds */ SQInteger emoSetAudioChannelLooping(HSQUIRRELVM v) { if (!engine->audio->isRunning()) { sq_pushinteger(v, ERR_AUDIO_ENGINE_CLOSED); return 1; } SQInteger channelIndex; SQBool useLoop; if (sq_gettype(v, 2) != OT_NULL && getBool(v, 3, &useLoop)) { sq_getinteger(v, 2, &channelIndex); } else { sq_pushinteger(v, ERR_INVALID_PARAM_TYPE); return 1; } if (channelIndex >= engine->audio->getChannelCount()) { sq_pushinteger(v, ERR_INVALID_PARAM); return 1; } if (!engine->audio->setChannelLooping(channelIndex, useLoop)) { sq_pushinteger(v, ERR_AUDIO_ENGINE_STATUS); return 1; } sq_pushinteger(v, EMO_NO_ERROR); return 1; }
QList<DirectX::Info> DirectX::getModulesInfo(const bool showDisabled) const { QList<Info> modulesInfo; if (showDisabled || getBool("DirectDrawEnabled")) modulesInfo += Info(DirectDrawWriterName, WRITER, QStringList("video")); return modulesInfo; }
bool Func_regexp::getBoolVal(rowgroup::Row& row, FunctionParm& pm, bool& isNull, CalpontSystemCatalog::ColType& ct) { return getBool(row, pm, isNull, ct) && !isNull; }
int main(int argc, char **argv) { std::set_terminate(sp_android_terminate); auto opts = data::parseCommandLineOptions(argc, (const char **)argv, &parseOptionSwitch, &parseOptionString); if (opts.getBool("help")) { std::cout << HELP_STRING << "\n"; return 0; }; auto &args = opts.getValue("args"); if (args.size() < 2) { std::cout << "At least 1 argument is required!\n"; return -1; } auto path = args.getString(1); if (!path.empty()) { path = filesystem::currentDir(path); filesystem::ftw(path, [] (const String &path, bool isFile) { if (isFile) { size_t width = 0, height = 0; if (Bitmap::getImageSize(path, width, height)) { std::cout << path << " - " << width << "x" << height << "\n"; } else { std::cout << path << " - not image\n"; } } }, 1, false); } return 0; }
void CToxProto::BootstrapNodes() { debugLogA(__FUNCTION__": bootstraping DHT"); bool isIPv6 = getBool("EnableIPv6", 0); BootstrapNodesFromDb(isIPv6); BootstrapNodesFromIni(isIPv6); }
QList<XVideo::Info> XVideo::getModulesInfo(const bool showDisabled) const { QList<Info> modulesInfo; if (showDisabled || getBool("Enabled")) modulesInfo += Info(XVideoWriterName, WRITER, QStringList{"video"}); return modulesInfo; }
QList< PulseAudio::Info > PulseAudio::getModulesInfo(const bool showDisabled) const { QList< Info > modulesInfo; if (showDisabled || getBool("WriterEnabled")) modulesInfo += Info(PulseAudioWriterName, WRITER, QStringList("audio")); return modulesInfo; }
void FacebookProto::PrepareNotificationsChatRoom() { if (!getBool(FACEBOOK_KEY_NOTIFICATIONS_CHATROOM, DEFAULT_NOTIFICATIONS_CHATROOM)) return; // Prepare notifications chatroom if not exists MCONTACT hNotificationsChatRoom = ChatIDToHContact(FACEBOOK_NOTIFICATIONS_CHATROOM); if (hNotificationsChatRoom == NULL || getDword(hNotificationsChatRoom, "Status", ID_STATUS_OFFLINE) != ID_STATUS_ONLINE) { TCHAR nameT[200]; mir_sntprintf(nameT, _T("%s: %s"), m_tszUserName, TranslateT("Notifications")); // Create the group chat session GCSESSION gcw = { sizeof(gcw) }; gcw.iType = GCW_PRIVMESS; gcw.ptszID = _T(FACEBOOK_NOTIFICATIONS_CHATROOM); gcw.pszModule = m_szModuleName; gcw.ptszName = nameT; CallServiceSync(MS_GC_NEWSESSION, 0, (LPARAM)&gcw); // Send setting events GCDEST gcd = { m_szModuleName, _T(FACEBOOK_NOTIFICATIONS_CHATROOM), GC_EVENT_CONTROL }; GCEVENT gce = { sizeof(gce), &gcd }; gce.time = ::time(NULL); CallServiceSync(MS_GC_EVENT, WINDOW_HIDDEN, reinterpret_cast<LPARAM>(&gce)); CallServiceSync(MS_GC_EVENT, SESSION_ONLINE, reinterpret_cast<LPARAM>(&gce)); } }