void ChannelUser::updateFromTags(ChatServer::Tags const & pTags) { QString lDisplayName = pTags.value("display-name"); bool lSubscriber = pTags.value("subscriber") == "1"; bool lTurbo = pTags.value("turbo") == "1"; QString lUserType = pTags.value("user-type"); Color lColor = parseColor(pTags.value("color")); user().updateFlag(IUser::Flag::VETERAN, lTurbo); bool lChanged = false; lChanged |= updateIfChanged(mDisplayName, lDisplayName, !lDisplayName.isEmpty()); lChanged |= updateIfChanged(mUserType, lUserType, !lUserType.isEmpty()); lChanged |= updateIfChanged(mColor, lColor, lColor.isValid()); lChanged |= updateIfChanged<Flag>(mFlags, Flag::SUBSCRIBER, lSubscriber); lChanged |= updateIfChanged<Flag>(mFlags, Flag::MODERATOR, lUserType == "mod"); if (lChanged) emit infoUpdated(); }
/** Reconfigure features for already open device. * * For each supported feature that has changed, update the device. * * @pre feature_set_ initialized * @pre oldconfig_ has previous settings * * @param newconfig [in,out] configuration parameters, may be updated * to conform with device restrictions. * * @post oldconfig_ settings updated */ void Features::reconfigure(Config *newconfig) { updateIfChanged(DC1394_FEATURE_BRIGHTNESS, oldconfig_.auto_brightness, &newconfig->auto_brightness, oldconfig_.brightness, &newconfig->brightness); updateIfChanged(DC1394_FEATURE_EXPOSURE, oldconfig_.auto_exposure, &newconfig->auto_exposure, oldconfig_.exposure, &newconfig->exposure); updateIfChanged(DC1394_FEATURE_FOCUS, oldconfig_.auto_focus, &newconfig->auto_focus, oldconfig_.focus, &newconfig->focus); updateIfChanged(DC1394_FEATURE_GAIN, oldconfig_.auto_gain, &newconfig->auto_gain, oldconfig_.gain, &newconfig->gain); updateIfChanged(DC1394_FEATURE_GAMMA, oldconfig_.auto_gamma, &newconfig->auto_gamma, oldconfig_.gamma, &newconfig->gamma); updateIfChanged(DC1394_FEATURE_HUE, oldconfig_.auto_hue, &newconfig->auto_hue, oldconfig_.hue, &newconfig->hue); updateIfChanged(DC1394_FEATURE_IRIS, oldconfig_.auto_iris, &newconfig->auto_iris, oldconfig_.iris, &newconfig->iris); updateIfChanged(DC1394_FEATURE_PAN, oldconfig_.auto_pan, &newconfig->auto_pan, oldconfig_.pan, &newconfig->pan); updateIfChanged(DC1394_FEATURE_SATURATION, oldconfig_.auto_saturation, &newconfig->auto_saturation, oldconfig_.saturation, &newconfig->saturation); updateIfChanged(DC1394_FEATURE_SHARPNESS, oldconfig_.auto_sharpness, &newconfig->auto_sharpness, oldconfig_.sharpness, &newconfig->sharpness); updateIfChanged(DC1394_FEATURE_SHUTTER, oldconfig_.auto_shutter, &newconfig->auto_shutter, oldconfig_.shutter, &newconfig->shutter); updateIfChanged(DC1394_FEATURE_TRIGGER, oldconfig_.auto_trigger, &newconfig->auto_trigger, oldconfig_.trigger, &newconfig->trigger); // White balance has two component parameters: Blue/U and Red/V. updateIfChanged(DC1394_FEATURE_WHITE_BALANCE, oldconfig_.auto_white_balance, &newconfig->auto_white_balance, oldconfig_.white_balance_BU, &newconfig->white_balance_BU, oldconfig_.white_balance_RV, &newconfig->white_balance_RV); updateIfChanged(DC1394_FEATURE_ZOOM, oldconfig_.auto_zoom, &newconfig->auto_zoom, oldconfig_.zoom, &newconfig->zoom); // reconfigure trigger class, if supported by this camera if (hasTrigger()) trigger_->reconfigure(newconfig); strobe_->reconfigure(newconfig); // save modified values oldconfig_ = *newconfig; }
bool Media::setGenre(const QString &genre) { return updateIfChanged(d->genre, genre); }
bool Media::setCreatedAt(const QDateTime& createdAt) { return updateIfChanged(d->createdAt, createdAt); }
bool Media::setRating(const int &rating) { return updateIfChanged(d->rating, rating); }
bool Media::setDuration(int duration) { return updateIfChanged(d->duration, duration); }
bool Media::setArtist(const QSharedPointer< Artist >& artist) { return updateIfChanged(d->artist, artist); }
bool Media::setAlbum(const QSharedPointer< Album >& album) { return updateIfChanged(d->album, album); }
bool Media::setType(const QString& type) { return updateIfChanged(d->type, type); }
bool Media::setThumbnail(const QString& thumbnail) { return updateIfChanged(d->thumbnail, thumbnail); }
bool Media::setTitle(const QString& title) { return updateIfChanged(d->title, title); }