void IconFactory::loadCurrentIconTheme() { const QStringList installed_themes = installedIconThemes(); const QString theme_name_from_settings = qApp->settings()->value(GROUP(GUI), SETTING(GUI::IconTheme)).toString(); if (QIcon::themeName() == theme_name_from_settings) { qDebug("Icon theme '%s' already loaded.", qPrintable(theme_name_from_settings)); return; } // Display list of installed themes. qDebug("Installed icon themes are: %s.", qPrintable(QStringList(installed_themes) .replaceInStrings(QRegExp(QSL("^|$")), QSL("\'")) .replaceInStrings(QRegExp(QSL("^\\'$")), QSL("\'\'")).join(QSL(", ")))); if (installed_themes.contains(theme_name_from_settings)) { // Desired icon theme is installed and can be loaded. qDebug("Loading icon theme '%s'.", qPrintable(theme_name_from_settings)); QIcon::setThemeName(theme_name_from_settings); } else { // Desired icon theme is not currently available. // Install "default" icon theme instead. qWarning("Icon theme '%s' cannot be loaded because it is not installed. No icon theme (or default icon theme) is loaded now.", qPrintable(theme_name_from_settings)); QIcon::setThemeName(APP_NO_THEME); } }
QList<Message> StandardFeed::obtainNewMessages(bool* error_during_obtaining) { QByteArray feed_contents; int download_timeout = qApp->settings()->value(GROUP(Feeds), SETTING(Feeds::UpdateTimeout)).toInt(); QList<QPair<QByteArray, QByteArray>> headers; headers << NetworkFactory::generateBasicAuthHeader(username(), password()); m_networkError = NetworkFactory::performNetworkOperation(url(), download_timeout, QByteArray(), feed_contents, QNetworkAccessManager::GetOperation, headers).first; if (m_networkError != QNetworkReply::NoError) { qWarning("Error during fetching of new messages for feed '%s' (id %d).", qPrintable(url()), id()); setStatus(NetworkError); *error_during_obtaining = true; return QList<Message>(); } else { *error_during_obtaining = false; } // Encode downloaded data for further parsing. QTextCodec* codec = QTextCodec::codecForName(encoding().toLocal8Bit()); QString formatted_feed_contents; if (codec == nullptr) { // No suitable codec for this encoding was found. // Use non-converted data. formatted_feed_contents = feed_contents; } else { formatted_feed_contents = codec->toUnicode(feed_contents); } // Feed data are downloaded and encoded. // Parse data and obtain messages. QList<Message> messages; switch (type()) { case StandardFeed::Rss0X: case StandardFeed::Rss2X: messages = RssParser(formatted_feed_contents).messages(); break; case StandardFeed::Rdf: messages = RdfParser().parseXmlData(formatted_feed_contents); break; case StandardFeed::Atom10: messages = AtomParser(formatted_feed_contents).messages(); default: break; } return messages; }
void WebBrowser::reloadFontSettings() { QFont fon; fon.fromString(qApp->settings()->value(GROUP(Messages), SETTING(Messages::PreviewerFontStandard)).toString()); QWebEngineSettings::globalSettings()->setFontFamily(QWebEngineSettings::StandardFont, fon.family()); QWebEngineSettings::globalSettings()->setFontSize(QWebEngineSettings::DefaultFontSize, fon.pointSize()); }
QList<ExternalTool> ExternalTool::toolsFromSettings() { QStringList tools_encoded = qApp->settings()->value(GROUP(Browser), SETTING(Browser::ExternalTools)).toStringList(); QList<ExternalTool> tools; foreach (const QString& tool_encoded, tools_encoded) { tools.append(ExternalTool::fromString(tool_encoded)); }
void FeedsView::loadAllExpandStates() { const Settings *settings = qApp->settings(); QList<RootItem*> expandable_items; expandable_items.append(sourceModel()->rootItem()->getSubTree(RootItemKind::Category | RootItemKind::ServiceRoot)); // Iterate all categories and save their expand statuses. foreach (const RootItem *item, expandable_items) { const QString setting_name = item->hashCode(); setExpanded(model()->mapFromSource(sourceModel()->indexForItem(item)), settings->value(GROUP(CategoriesExpandStates), setting_name, item->childCount() > 0).toBool()); } sortByColumn(qApp->settings()->value(GROUP(GUI), SETTING(GUI::DefaultSortColumnFeeds)).toInt(), static_cast<Qt::SortOrder>(qApp->settings()->value(GROUP(GUI), SETTING(GUI::DefaultSortOrderFeeds)).toInt())); }
/* cast_spell is used generically to cast any spoken spell, assuming we already * have the target char/obj and spell number. It checks all restrictions, * prints the words, etc. Entry point for NPC casts. Recommended entry point * for spells cast by NPCs via specprocs. */ int cast_spell(struct char_data *ch, struct char_data *tch, struct obj_data *tobj, int spellnum) { if (spellnum < 0 || spellnum > TOP_SPELL_DEFINE) { log("SYSERR: cast_spell trying to call spellnum %d/%d.", spellnum, TOP_SPELL_DEFINE); return (0); } if (GET_POS(ch) < SINFO.min_position) { switch (GET_POS(ch)) { case POS_SLEEPING: send_to_char(ch, "You dream about great magical powers.\r\n"); break; case POS_RESTING: send_to_char(ch, "You cannot concentrate while resting.\r\n"); break; case POS_SITTING: send_to_char(ch, "You can't do this sitting!\r\n"); break; case POS_MEDITATE: send_to_char(ch, "You can't do that while meditating!\r\n"); break; case POS_FIGHTING: send_to_char(ch, "Impossible! You can't concentrate enough!\r\n"); break; default: send_to_char(ch, "You can't do much of anything like this!\r\n"); break; } return (0); } if (AFF_FLAGGED(ch, AFF_CHARM) && (ch->master == tch)) { send_to_char(ch, "You are afraid you might hurt your master!\r\n"); return (0); } if ((tch != ch) && IS_SET(SINFO.targets, TAR_SELF_ONLY)) { send_to_char(ch, "You can only cast this spell upon yourself!\r\n"); return (0); } if ((tch == ch) && IS_SET(SINFO.targets, TAR_NOT_SELF)) { send_to_char(ch, "You cannot cast this spell upon yourself!\r\n"); return (0); } if (IS_SET(SINFO.routines, MAG_GROUPS) && !GROUP(ch)) { send_to_char(ch, "You can't cast this spell if you're not in a group!\r\n"); return (0); } send_to_char(ch, "%s", CONFIG_OK); say_spell(ch, spellnum, tch, tobj); return (call_magic(ch, tch, tobj, spellnum, GET_LEVEL(ch), CAST_SPELL)); }
bool SystemFactory::removeTrolltechJunkRegistryKeys() { if (qApp->settings()->value(GROUP(General), SETTING(General::RemoveTrolltechJunk)).toBool()) { QSettings registry_key(QSL("HKEY_CURRENT_USER\\Software\\TrollTech"), QSettings::NativeFormat); registry_key.remove(QSL("")); registry_key.sync(); return registry_key.status() == QSettings::NoError; } else { return false; } }
void GUI::ParseDefinitionElem(struct GUI_DEFINITION_ELEM* guielem) { char output[256]; sprintf(output, "DEBUG: Beginning parsing gui definition element: %s", guielem->name); LogToFile(DEFAULT_GUI_LOG_NAME, output); static int exist = 0; GUIcontrol* chk = ItemByName(guielem->name); if(chk) { exist++; sprintf(guielem->name, "%s%u", guielem->name, exist); } GUIcontrol* new_ctrl = NULL; new_ctrl = new GUIcontrol(guielem->name); new_ctrl->SetPos(guielem->x, guielem->y); new_ctrl->SetPatternCount(guielem->pattern_count); new_ctrl->SetPatternWidth(guielem->pattern_width); new_ctrl->SetPatternHeight(guielem->pattern_height); new_ctrl->SetCurrentPattern(guielem->pattern_current); new_ctrl->SetVisible(guielem->visible); new_ctrl->SetTexture(TextureByName(textures, guielem->texture_name)); new_ctrl->SetColor(guielem->color_red, guielem->color_green, guielem->color_blue, guielem->color_alpha); new_ctrl->SetCaption(guielem->caption); new_ctrl->SetCaptionFont(FontByName(fonts, guielem->caption_font_name)); new_ctrl->SetCaptionColor(guielem->caption_color_red, guielem->caption_color_green, guielem->caption_color_blue, guielem->caption_color_alpha); new_ctrl->SetCaptionPos(guielem->caption_x, guielem->caption_y); new_ctrl->SetText(guielem->text); new_ctrl->SetTextFont(FontByName(fonts, guielem->text_font_name)); new_ctrl->SetTextColor(guielem->text_color_red, guielem->text_color_green, guielem->text_color_blue, guielem->text_color_alpha); new_ctrl->SetTextPos(guielem->text_x, guielem->text_y); new_ctrl->SetAction(ACTION(guielem->action)); new_ctrl->SetNextName(guielem->next); new_ctrl->SetParentName(guielem->parent); new_ctrl->SetData(guielem->data); new_ctrl->SetGroup(GROUP(guielem->group)); AddControl(new_ctrl); sprintf(output, "DEBUG: Finished parsing gui definition element: %s", guielem->name); LogToFile(DEFAULT_GUI_LOG_NAME, output); };
void FeedsView::saveExpandStates(RootItem *item) { Settings *settings = qApp->settings(); QList<RootItem*> items = item->getSubTree(RootItemKind::Category | RootItemKind::ServiceRoot); // Iterate all categories and save their expand statuses. foreach (const RootItem *item, items) { const QString setting_name = item->hashCode(); QModelIndex source_index = sourceModel()->indexForItem(item); QModelIndex visible_index = model()->mapFromSource(source_index); settings->setValue(GROUP(CategoriesExpandStates), setting_name, isExpanded(visible_index)); } }
void SettingsDatabase::loadSettings() { onBeginLoadSettings(); m_ui->m_checkUseTransactions->setChecked(qApp->settings()->value(GROUP(Database), SETTING(Database::UseTransactions)).toBool()); m_ui->m_lblMysqlTestResult->setStatus(WidgetWithStatus::Information, tr("No connection test triggered so far."), tr("You did not executed any connection test yet.")); // Load SQLite. m_ui->m_cmbDatabaseDriver->addItem(qApp->database()->humanDriverName(DatabaseFactory::UsedDriver::SQLITE), APP_DB_SQLITE_DRIVER); // Load in-memory database status. m_ui->m_checkSqliteUseInMemoryDatabase->setChecked(settings()->value(GROUP(Database), SETTING(Database::UseInMemory)).toBool()); if (QSqlDatabase::isDriverAvailable(APP_DB_MYSQL_DRIVER)) { onMysqlHostnameChanged(QString()); onMysqlUsernameChanged(QString()); onMysqlPasswordChanged(QString()); onMysqlDatabaseChanged(QString()); // Load MySQL. m_ui->m_cmbDatabaseDriver->addItem(qApp->database()->humanDriverName(DatabaseFactory::UsedDriver::MYSQL), APP_DB_MYSQL_DRIVER); // Setup placeholders. m_ui->m_txtMysqlHostname->lineEdit()->setPlaceholderText(tr("Hostname of your MySQL server")); m_ui->m_txtMysqlUsername->lineEdit()->setPlaceholderText(tr("Username to login with")); m_ui->m_txtMysqlPassword->lineEdit()->setPlaceholderText(tr("Password for your username")); m_ui->m_txtMysqlDatabase->lineEdit()->setPlaceholderText(tr("Working database which you have full access to.")); m_ui->m_txtMysqlHostname->lineEdit()->setText(settings()->value(GROUP(Database), SETTING(Database::MySQLHostname)).toString()); m_ui->m_txtMysqlUsername->lineEdit()->setText(settings()->value(GROUP(Database), SETTING(Database::MySQLUsername)).toString()); m_ui->m_txtMysqlPassword->lineEdit()->setText(settings()->password(GROUP(Database), SETTING(Database::MySQLPassword)).toString()); m_ui->m_txtMysqlDatabase->lineEdit()->setText(settings()->value(GROUP(Database), SETTING(Database::MySQLDatabase)).toString()); m_ui->m_spinMysqlPort->setValue(settings()->value(GROUP(Database), SETTING(Database::MySQLPort)).toInt()); m_ui->m_checkMysqlShowPassword->setChecked(false); } int index_current_backend = m_ui->m_cmbDatabaseDriver->findData(settings()->value(GROUP(Database), SETTING(Database::ActiveDriver)).toString()); if (index_current_backend >= 0) { m_ui->m_cmbDatabaseDriver->setCurrentIndex(index_current_backend); } onEndLoadSettings(); }
OwnCloudGetFeedsCategoriesResponse OwnCloudNetworkFactory::feedsCategories() { QByteArray result_raw; NetworkResult network_reply = NetworkFactory::performNetworkOperation(m_urlFolders, qApp->settings()->value(GROUP(Feeds), SETTING(Feeds::UpdateTimeout)).toInt(), QByteArray(), QString(), result_raw, QNetworkAccessManager::GetOperation, true, m_authUsername, m_authPassword, true); if (network_reply.first != QNetworkReply::NoError) { qWarning("ownCloud: Obtaining of categories failed with error %d.", network_reply.first); m_lastError = network_reply.first; return OwnCloudGetFeedsCategoriesResponse(); } QString content_categories = QString::fromUtf8(result_raw); // Now, obtain feeds. network_reply = NetworkFactory::performNetworkOperation(m_urlFeeds, qApp->settings()->value(GROUP(Feeds), SETTING(Feeds::UpdateTimeout)).toInt(), QByteArray(), QString(), result_raw, QNetworkAccessManager::GetOperation, true, m_authUsername, m_authPassword, true); if (network_reply.first != QNetworkReply::NoError) { qWarning("ownCloud: Obtaining of feeds failed with error %d.", network_reply.first); m_lastError = network_reply.first; return OwnCloudGetFeedsCategoriesResponse(); } QString content_feeds = QString::fromUtf8(result_raw); m_lastError = network_reply.first; return OwnCloudGetFeedsCategoriesResponse(content_categories, content_feeds); }
bool OwnCloudNetworkFactory::createFeed(const QString &url, int parent_id) { QJsonObject json; json["url"] = url; json["folderId"] = parent_id; QByteArray result_raw; NetworkResult network_reply = NetworkFactory::performNetworkOperation(m_urlFeeds, qApp->settings()->value(GROUP(Feeds), SETTING(Feeds::UpdateTimeout)).toInt(), QJsonDocument(json).toJson(QJsonDocument::Compact), QSL("application/json"), result_raw, QNetworkAccessManager::PostOperation, true, m_authUsername, m_authPassword, true); m_lastError = network_reply.first; if (network_reply.first != QNetworkReply::NoError) { qWarning("ownCloud: Creating of category failed with error %d.", network_reply.first); return false; } else { return true; } }
bool OwnCloudNetworkFactory::deleteFeed(int feed_id) { QString final_url = m_urlDeleteFeed.arg(QString::number(feed_id)); QByteArray raw_output; NetworkResult network_reply = NetworkFactory::performNetworkOperation(final_url, qApp->settings()->value(GROUP(Feeds), SETTING(Feeds::UpdateTimeout)).toInt(), QByteArray(), QString(), raw_output, QNetworkAccessManager::DeleteOperation, true, m_authUsername, m_authPassword, true); m_lastError = network_reply.first; if (network_reply.first != QNetworkReply::NoError) { qWarning("ownCloud: Obtaining of categories failed with error %d.", network_reply.first); return false; } else { return true; } }
if (status == RootItem::Read) { final_url = m_fixedUrl + API_PATH + "items/read/multiple"; } else { final_url = m_fixedUrl + API_PATH + "items/unread/multiple"; } foreach (const QString &id, custom_ids) { ids.append(QJsonValue(id.toInt())); } json["items"] = ids; NetworkResult network_reply = NetworkFactory::performNetworkOperation(final_url, qApp->settings()->value(GROUP(Feeds), SETTING(Feeds::UpdateTimeout)).toInt(), QJsonDocument(json).toJson(QJsonDocument::Compact), QSL("application/json"), raw_output, QNetworkAccessManager::PutOperation, true, m_authUsername, m_authPassword, true); if (network_reply.first != QNetworkReply::NoError) { qWarning("ownCloud: Marking messages as (un)read failed with error %d.", network_reply.first); } return (m_lastError = network_reply.first); }
OwnCloudStatusResponse OwnCloudNetworkFactory::status() { QByteArray result_raw; NetworkResult network_reply = NetworkFactory::performNetworkOperation(m_urlStatus, qApp->settings()->value(GROUP(Feeds), SETTING(Feeds::UpdateTimeout)).toInt(), QByteArray(), QString(), result_raw, QNetworkAccessManager::GetOperation, true, m_authUsername, m_authPassword, true); OwnCloudStatusResponse status_response(QString::fromUtf8(result_raw)); if (network_reply.first != QNetworkReply::NoError) { qWarning("ownCloud: Obtaining status info failed with error %d.", network_reply.first); } m_lastError = network_reply.first; return status_response; }
QNetworkReply::NetworkError OwnCloudNetworkFactory::triggerFeedUpdate(int feed_id) { if (userId().isEmpty()) { // We need to get user ID first. OwnCloudUserResponse info = userInfo(); if (lastError() != QNetworkReply::NoError) { return lastError(); } else { // We have new user ID, set it up. setUserId(info.userId()); } } // Now, we can trigger the update. QByteArray raw_output; NetworkResult network_reply = NetworkFactory::performNetworkOperation(m_urlFeedsUpdate.arg(userId(), QString::number(feed_id)), qApp->settings()->value(GROUP(Feeds), SETTING(Feeds::UpdateTimeout)).toInt(), QByteArray(), QString(), raw_output, QNetworkAccessManager::GetOperation, true, m_authUsername, m_authPassword, true); if (network_reply.first != QNetworkReply::NoError) { qWarning("ownCloud: Feeds update failed with error %d.", network_reply.first); } return (m_lastError = network_reply.first); }
/* Extract a ch completely from the world, and leave his stuff behind */ void extract_char_final(struct char_data *ch) { struct char_data *k, *temp; struct descriptor_data *d; struct obj_data *obj; int i; if (IN_ROOM(ch) == NOWHERE) { log("SYSERR: NOWHERE extracting char %s. (%s, extract_char_final)", GET_NAME(ch), __FILE__); exit(1); } /* We're booting the character of someone who has switched so first we need * to stuff them back into their own body. This will set ch->desc we're * checking below this loop to the proper value. */ if (!IS_NPC(ch) && !ch->desc) { for (d = descriptor_list; d; d = d->next) if (d->original == ch) { do_return(d->character, NULL, 0, 0); break; } } if (ch->desc) { /* This time we're extracting the body someone has switched into (not the * body of someone switching as above) so we need to put the switcher back * to their own body. If this body is not possessed, the owner won't have a * body after the removal so dump them to the main menu. */ if (ch->desc->original) do_return(ch, NULL, 0, 0); else { /* Now we boot anybody trying to log in with the same character, to help * guard against duping. CON_DISCONNECT is used to close a descriptor * without extracting the d->character associated with it, for being * link-dead, so we want CON_CLOSE to clean everything up. If we're * here, we know it's a player so no IS_NPC check required. */ for (d = descriptor_list; d; d = d->next) { if (d == ch->desc) continue; if (d->character && GET_IDNUM(ch) == GET_IDNUM(d->character)) STATE(d) = CON_CLOSE; } STATE(ch->desc) = CON_MENU; write_to_output(ch->desc, "%s", CONFIG_MENU); } } /* On with the character's assets... */ if (ch->followers || ch->master) die_follower(ch); /* Check to see if we are grouped! */ if (GROUP(ch)) leave_group(ch); /* transfer objects to room, if any */ while (ch->carrying) { obj = ch->carrying; obj_from_char(obj); obj_to_room(obj, IN_ROOM(ch)); } /* transfer equipment to room, if any */ for (i = 0; i < NUM_WEARS; i++) if (GET_EQ(ch, i)) obj_to_room(unequip_char(ch, i), IN_ROOM(ch)); if (FIGHTING(ch)) stop_fighting(ch); for (k = combat_list; k; k = temp) { temp = k->next_fighting; if (FIGHTING(k) == ch) stop_fighting(k); } /* Whipe character from the memory of hunters and other intelligent NPCs... */ for (temp = character_list; temp; temp = temp->next) { /* PCs can't use MEMORY, and don't use HUNTING() */ if (!IS_NPC(temp)) continue; /* If "temp" is hunting our extracted char, stop the hunt. */ if (HUNTING(temp) == ch) HUNTING(temp) = NULL; /* If "temp" has allocated memory data and our ch is a PC, forget the * extracted character (if he/she is remembered) */ if (!IS_NPC(ch) && GET_POS(ch) == POS_DEAD && MEMORY(temp)) forget(temp, ch); /* forget() is safe to use without a check. */ } char_from_room(ch); if (IS_NPC(ch)) { if (GET_MOB_RNUM(ch) != NOTHING) /* prototyped */ mob_index[GET_MOB_RNUM(ch)].number--; clearMemory(ch); if (SCRIPT(ch)) extract_script(ch, MOB_TRIGGER); if (SCRIPT_MEM(ch)) extract_script_mem(SCRIPT_MEM(ch)); } else { save_char(ch); Crash_delete_crashfile(ch); } /* If there's a descriptor, they're in the menu now. */ if (IS_NPC(ch) || !ch->desc) free_char(ch); }
void mobile_activity(void) { struct char_data *ch, *next_ch, *vict; struct obj_data *obj, *best_obj; int door, found, max; memory_rec *names; for (ch = character_list; ch; ch = next_ch) { next_ch = ch->next; if (!IS_MOB(ch)) continue; /* Examine call for special procedure */ if (MOB_FLAGGED(ch, MOB_SPEC) && !no_specials) { if (mob_index[GET_MOB_RNUM(ch)].func == NULL) { log("SYSERR: %s (#%d): Attempting to call non-existing mob function.", GET_NAME(ch), GET_MOB_VNUM(ch)); REMOVE_BIT_AR(MOB_FLAGS(ch), MOB_SPEC); } else { char actbuf[MAX_INPUT_LENGTH] = ""; if ((mob_index[GET_MOB_RNUM(ch)].func) (ch, ch, 0, actbuf)) continue; /* go to next char */ } } /* If the mob has no specproc, do the default actions */ if (FIGHTING(ch) || !AWAKE(ch)) continue; /* hunt a victim, if applicable */ hunt_victim(ch); /* Scavenger (picking up objects) */ if (MOB_FLAGGED(ch, MOB_SCAVENGER)) if (world[IN_ROOM(ch)].contents && !rand_number(0, 10)) { max = 1; best_obj = NULL; for (obj = world[IN_ROOM(ch)].contents; obj; obj = obj->next_content) if (CAN_GET_OBJ(ch, obj) && GET_OBJ_COST(obj) > max) { best_obj = obj; max = GET_OBJ_COST(obj); } if (best_obj != NULL) { obj_from_room(best_obj); obj_to_char(best_obj, ch); act("$n gets $p.", FALSE, ch, best_obj, 0, TO_ROOM); } } /* Mob Movement */ if (!MOB_FLAGGED(ch, MOB_SENTINEL) && (GET_POS(ch) == POS_STANDING) && ((door = rand_number(0, 18)) < DIR_COUNT) && CAN_GO(ch, door) && !ROOM_FLAGGED(EXIT(ch, door)->to_room, ROOM_NOMOB) && !ROOM_FLAGGED(EXIT(ch, door)->to_room, ROOM_DEATH) && (!MOB_FLAGGED(ch, MOB_STAY_ZONE) || (world[EXIT(ch, door)->to_room].zone == world[IN_ROOM(ch)].zone))) { /* If the mob is charmed, do not move the mob. */ if (ch->master == NULL) perform_move(ch, door, 1); } /* Aggressive Mobs */ if (!MOB_FLAGGED(ch, MOB_HELPER) && (!AFF_FLAGGED(ch, AFF_BLIND) || !AFF_FLAGGED(ch, AFF_CHARM))) { found = FALSE; for (vict = world[IN_ROOM(ch)].people; vict && !found; vict = vict->next_in_room) { if (IS_NPC(vict) || !CAN_SEE(ch, vict) || PRF_FLAGGED(vict, PRF_NOHASSLE)) continue; if (MOB_FLAGGED(ch, MOB_WIMPY) && AWAKE(vict)) continue; if (MOB_FLAGGED(ch, MOB_AGGRESSIVE ) || (MOB_FLAGGED(ch, MOB_AGGR_EVIL ) && IS_EVIL(vict)) || (MOB_FLAGGED(ch, MOB_AGGR_NEUTRAL) && IS_NEUTRAL(vict)) || (MOB_FLAGGED(ch, MOB_AGGR_GOOD ) && IS_GOOD(vict))) { /* Can a master successfully control the charmed monster? */ if (aggressive_mob_on_a_leash(ch, ch->master, vict)) continue; hit(ch, vict, TYPE_UNDEFINED); found = TRUE; } } } /* Mob Memory */ if (MOB_FLAGGED(ch, MOB_MEMORY) && MEMORY(ch)) { found = FALSE; for (vict = world[IN_ROOM(ch)].people; vict && !found; vict = vict->next_in_room) { if (IS_NPC(vict) || !CAN_SEE(ch, vict) || PRF_FLAGGED(vict, PRF_NOHASSLE)) continue; for (names = MEMORY(ch); names && !found; names = names->next) { if (names->id != GET_IDNUM(vict)) continue; /* Can a master successfully control the charmed monster? */ if (aggressive_mob_on_a_leash(ch, ch->master, vict)) continue; found = TRUE; act("'Hey! You're the fiend that attacked me!!!', exclaims $n.", FALSE, ch, 0, 0, TO_ROOM); hit(ch, vict, TYPE_UNDEFINED); } } } /* Charmed Mob Rebellion: In order to rebel, there need to be more charmed * monsters than the person can feasibly control at a time. Then the * mobiles have a chance based on the charisma of their leader. * 1-4 = 0, 5-7 = 1, 8-10 = 2, 11-13 = 3, 14-16 = 4, 17-19 = 5, etc. */ if (AFF_FLAGGED(ch, AFF_CHARM) && ch->master && num_followers_charmed(ch->master) > (GET_CHA(ch->master) - 2) / 3) { if (!aggressive_mob_on_a_leash(ch, ch->master, ch->master)) { if (CAN_SEE(ch, ch->master) && !PRF_FLAGGED(ch->master, PRF_NOHASSLE)) hit(ch, ch->master, TYPE_UNDEFINED); stop_follower(ch); } } /* Helper Mobs */ if (MOB_FLAGGED(ch, MOB_HELPER) && (!AFF_FLAGGED(ch, AFF_BLIND) || !AFF_FLAGGED(ch, AFF_CHARM))) { found = FALSE; for (vict = world[IN_ROOM(ch)].people; vict && !found; vict = vict->next_in_room) { if (ch == vict || !IS_NPC(vict) || !FIGHTING(vict)) continue; if (GROUP(vict) && GROUP(vict) == GROUP(ch)) continue; if (IS_NPC(FIGHTING(vict)) || ch == FIGHTING(vict)) continue; act("$n jumps to the aid of $N!", FALSE, ch, 0, vict, TO_ROOM); hit(ch, FIGHTING(vict), TYPE_UNDEFINED); found = TRUE; } } /* Add new mobile actions here */ /* class/race specific actions */ mobNormalAction(ch); } /* end for() */ }
void IconFactory::setCurrentIconTheme(const QString &theme_name) { qApp->settings()->setValue(GROUP(GUI), GUI::IconTheme, theme_name); }
show_union_struct_prototype(has_haptic) show_union_struct_prototype(has_gpio_driver_control) show_union_struct_prototype(gpio_led_count) static struct attribute *attrs1[] = { attrify(extended_patterns), attrify(has_mappable_buttons), attrify(has_led), attrify(has_gpio), attrify(has_haptic), attrify(has_gpio_driver_control), attrify(gpio_led_count), NULL }; static struct attribute_group attrs_query = GROUP(attrs1); /* Control sysfs files */ show_store_union_struct_prototype(led_sel) show_store_union_struct_prototype(gpio_debounce) show_store_union_struct_prototype(halt) show_store_union_struct_prototype(halted) show_store_union_struct_prototype(dir) show_store_union_struct_prototype(gpiodata) show_store_union_struct_prototype(led_act) show_store_union_struct_prototype(ramp_period_a) show_store_union_struct_prototype(ramp_period_b) show_store_union_struct_prototype(SPCTRL) show_store_union_struct_prototype(STRPD) show_store_union_struct_prototype(STRPU)
GPIO_GROUP(GPIOX_11), GPIO_GROUP(GPIOX_12), GPIO_GROUP(GPIOX_13), GPIO_GROUP(GPIOX_14), GPIO_GROUP(GPIOX_15), GPIO_GROUP(GPIOX_16), GPIO_GROUP(GPIOX_17), GPIO_GROUP(GPIOX_18), GPIO_GROUP(GPIOCLK_0), GPIO_GROUP(GPIOCLK_1), GPIO_GROUP(GPIO_TEST_N), /* Bank X */ GROUP(sdio_d0, 5, 31), GROUP(sdio_d1, 5, 30), GROUP(sdio_d2, 5, 29), GROUP(sdio_d3, 5, 28), GROUP(sdio_clk, 5, 27), GROUP(sdio_cmd, 5, 26), GROUP(sdio_irq, 5, 24), GROUP(uart_tx_a, 5, 19), GROUP(uart_rx_a, 5, 18), GROUP(uart_cts_a, 5, 17), GROUP(uart_rts_a, 5, 16), GROUP(uart_tx_c, 5, 13), GROUP(uart_rx_c, 5, 12), GROUP(uart_cts_c, 5, 11), GROUP(uart_rts_c, 5, 10), GROUP(pwm_a, 5, 25),
QString SkinFactory::selectedSkinName() const { return qApp->settings()->value(GROUP(GUI), SETTING(GUI::Skin)).toString(); }
void SkinFactory::setCurrentSkinName(const QString &skin_name) { qApp->settings()->setValue(GROUP(GUI), GUI::Skin, skin_name); }
}; /* Sysfs files */ /* Query sysfs files */ show_union_struct_prototype(max_force_sensor_count) show_union_struct_prototype(has_high_resolution) static struct attribute *attrs[] = { attrify(max_force_sensor_count), attrify(has_high_resolution), NULL }; static struct attribute_group attrs_query = GROUP(attrs); /* Control sysfs files */ show_store_union_struct_prototype(reporting_mode) show_store_union_struct_prototype(no_rezero) show_store_union_struct_prototype(force_click_threshold) show_store_union_struct_prototype(int_en_force_0) show_store_union_struct_prototype(int_en_force_1) show_store_union_struct_prototype(int_en_force_2) show_store_union_struct_prototype(int_en_force_3) show_store_union_struct_prototype(int_en_force_4) show_store_union_struct_prototype(int_en_force_5) show_store_union_struct_prototype(int_en_force_6) show_store_union_struct_prototype(int_en_click) show_store_union_struct_prototype(force_interrupt_threshold)
bool OwnCloudNetworkFactory::renameFeed(const QString &new_name, int feed_id) { QString final_url = m_urlRenameFeed.arg(QString::number(feed_id)); QByteArray result_raw; QJsonObject json; json["feedTitle"] = new_name; NetworkResult network_reply = NetworkFactory::performNetworkOperation(final_url, qApp->settings()->value(GROUP(Feeds), SETTING(Feeds::UpdateTimeout)).toInt(), QJsonDocument(json).toJson(QJsonDocument::Compact), QSL("application/json"), result_raw, QNetworkAccessManager::PutOperation, true, m_authUsername, m_authPassword, true); m_lastError = network_reply.first; if (network_reply.first != QNetworkReply::NoError) { qWarning("ownCloud: Renaming of feed failed with error %d.", network_reply.first); return false; } else { return true; } }
void FeedsView::saveSortState(int column, Qt::SortOrder order) { qApp->settings()->setValue(GROUP(GUI), GUI::DefaultSortColumnFeeds, column); qApp->settings()->setValue(GROUP(GUI), GUI::DefaultSortOrderFeeds, order); }
OwnCloudGetMessagesResponse OwnCloudNetworkFactory::getMessages(int feed_id) { if (forceServerSideUpdate()) { triggerFeedUpdate(feed_id); } QString final_url = m_urlMessages.arg(QString::number(feed_id), QString::number(-1), QString::number(0)); QByteArray result_raw; NetworkResult network_reply = NetworkFactory::performNetworkOperation(final_url, qApp->settings()->value(GROUP(Feeds), SETTING(Feeds::UpdateTimeout)).toInt(), QByteArray(), QString(), result_raw, QNetworkAccessManager::GetOperation, true, m_authUsername, m_authPassword, true); OwnCloudGetMessagesResponse msgs_response(QString::fromUtf8(result_raw)); if (network_reply.first != QNetworkReply::NoError) { qWarning("ownCloud: Obtaining messages failed with error %d.", network_reply.first); } m_lastError = network_reply.first; return msgs_response; }
GPIO_GROUP(GPIOH_8, 0), GPIO_GROUP(GPIOH_9, 0), GPIO_GROUP(DIF_0_P, 0), GPIO_GROUP(DIF_0_N, 0), GPIO_GROUP(DIF_1_P, 0), GPIO_GROUP(DIF_1_N, 0), GPIO_GROUP(DIF_2_P, 0), GPIO_GROUP(DIF_2_N, 0), GPIO_GROUP(DIF_3_P, 0), GPIO_GROUP(DIF_3_N, 0), GPIO_GROUP(DIF_4_P, 0), GPIO_GROUP(DIF_4_N, 0), /* bank X */ GROUP(sd_d0_a, 8, 5), GROUP(sd_d1_a, 8, 4), GROUP(sd_d2_a, 8, 3), GROUP(sd_d3_a, 8, 2), GROUP(sdxc_d0_0_a, 5, 29), GROUP(sdxc_d47_a, 5, 12), GROUP(sdxc_d13_0_a, 5, 28), GROUP(sd_clk_a, 8, 1), GROUP(sd_cmd_a, 8, 0), GROUP(xtal_32k_out, 3, 22), GROUP(xtal_24m_out, 3, 20), GROUP(uart_tx_b0, 4, 9), GROUP(uart_rx_b0, 4, 8), GROUP(uart_cts_b0, 4, 7), GROUP(uart_rts_b0, 4, 6), GROUP(sdxc_d0_1_a, 5, 14),
/* control register access */ static struct device_attribute dev_attr_no_auto_cal = __ATTR(no_auto_cal, RMI_RW_ATTR, rmi_fn_05_no_auto_cal_show, rmi_fn_05_no_auto_cal_store); static struct attribute *attrs[] = { &dev_attr_num_of_rx_electrodes.attr, &dev_attr_num_of_tx_electrodes.attr, &dev_attr_has_delta16.attr, &dev_attr_image_window_size.attr, &dev_attr_no_auto_cal.attr, NULL }; static struct attribute_group fn05_attrs = GROUP(attrs); /*store dynamically allocated major number of char device*/ static int rmi_f05_char_dev_major_num; /* * f05_raw_data_char_dev_register - register char device * called from init * * @phy: a pointer to an rmi_phys_devices structure * * @return: zero if suceeds */ static int f05_raw_data_char_dev_register(struct f05_data *f05) { dev_t dev_no;
OP_ERROR SOP_IdBlast::cookMySop(OP_Context &context) { exint id, max; fpreal now; GA_Offset start, end; GA_PointGroup *group; GA_ROAttributeRef id_gah; GA_ROPageHandleI id_ph; UT_String pattern; UT_WorkArgs tokens; GroupIdMapPair pair; IdOffsetMap id_map, srcid_map; now = context.getTime(); if (lockInputs(context) >= UT_ERROR_ABORT) return error(); // Duplicate the incoming geometry. duplicateSource(0, context); // Get the id pattern. GROUP(pattern, now); // If it's emptry, don't do anything. if (pattern.length() == 0) { unlockInputs(); return error(); } // Tokenize the range so we can handle multiple blocks. pattern.tokenize(tokens, " "); // Try to find the 'id' point attribute on the 1st input geometry. id_gah = gdp->findPointAttribute(GA_SCOPE_PUBLIC, "id"); // If it doesn't exist, display a node error message and exit. if (id_gah.isInvalid()) { addError(SOP_MESSAGE, "Input geometry has no point 'id' attribute."); unlockInputs(); return error(); } // Bind the page handles to the attributes. id_ph.bind(id_gah.getAttribute()); max = 0; // Iterate over all the points we selected. for (GA_Iterator it(gdp->getPointRange()); it.blockAdvance(start, end); ) { // Set the page handle to the start of this block. id_ph.setPage(start); // Iterate over all the points in the block. for (GA_Offset pt = start; pt < end; ++pt) { // Get the 'id' value for the point. id = id_ph.get(pt); id_map[id] = pt; if (id > max) max = id; } } // Create the group. group = createAdhocPointGroup(*gdp); // Add the group and the id map to the pair. pair.first = group; pair.second = &id_map; // Iterate over each block in the tokens and add any ids to the group. for (int i=0; i < tokens.getArgc(); ++i) { UT_String id_range(tokens[i]); id_range.traversePattern(max, &pair, addOffsetToGroup); } // Toggle the entries if we want to delete the non-selected points. if (NEGATE(now)) { group->toggleEntries(); } // Destroy the points. gdp->destroyPointOffsets(GA_Range(*group)); unlockInputs(); return error(); }