TabDurationSymbol::TabDurationSymbol(Score* s, StaffTypeTablature * tab, TDuration::DurationType type, int dots) : Element(s) { setFlags(ELEMENT_MOVABLE | ELEMENT_SELECTABLE); setGenerated(true); setDuration(type, dots, tab); }
void TrackInfoObject::parse() { // Log parsing of header information in developer mode. This is useful for // tracking down corrupt files. const QString& canonicalLocation = m_fileInfo.canonicalFilePath(); if (CmdlineArgs::Instance().getDeveloper()) { qDebug() << "TrackInfoObject::parse()" << canonicalLocation; } // Parse the information stored in the sound file. SoundSourceProxy proxy(canonicalLocation, m_pSecurityToken); Mixxx::SoundSource* pProxiedSoundSource = proxy.getProxiedSoundSource(); if (pProxiedSoundSource != NULL && proxy.parseHeader() == OK) { // Dump the metadata extracted from the file into the track. // TODO(XXX): This involves locking the mutex for every setXXX // method. We should figure out an optimization where there are private // setters that don't lock the mutex. // If Artist, Title and Type fields are not blank, modify them. // Otherwise, keep their current values. // TODO(rryan): Should we re-visit this decision? if (!(pProxiedSoundSource->getArtist().isEmpty())) { setArtist(pProxiedSoundSource->getArtist()); } if (!(pProxiedSoundSource->getTitle().isEmpty())) { setTitle(pProxiedSoundSource->getTitle()); } if (!(pProxiedSoundSource->getType().isEmpty())) { setType(pProxiedSoundSource->getType()); } setAlbum(pProxiedSoundSource->getAlbum()); setAlbumArtist(pProxiedSoundSource->getAlbumArtist()); setYear(pProxiedSoundSource->getYear()); setGenre(pProxiedSoundSource->getGenre()); setComposer(pProxiedSoundSource->getComposer()); setGrouping(pProxiedSoundSource->getGrouping()); setComment(pProxiedSoundSource->getComment()); setTrackNumber(pProxiedSoundSource->getTrackNumber()); setReplayGain(pProxiedSoundSource->getReplayGain()); setBpm(pProxiedSoundSource->getBPM()); setDuration(pProxiedSoundSource->getDuration()); setBitrate(pProxiedSoundSource->getBitrate()); setSampleRate(pProxiedSoundSource->getSampleRate()); setChannels(pProxiedSoundSource->getChannels()); setKeyText(pProxiedSoundSource->getKey(), mixxx::track::io::key::FILE_METADATA); setHeaderParsed(true); } else { qDebug() << "TrackInfoObject::parse() error at file" << canonicalLocation; setHeaderParsed(false); // Add basic information derived from the filename: parseFilename(); } }
bool EPGItem::setData( vlc_epg_event_t *data ) { QDateTime newtime = QDateTime::fromTime_t( data->i_start ); QString newname = qfu( data->psz_name ); QString newdesc = qfu( data->psz_description ); QString newshortdesc = qfu( data->psz_short_description ); if ( m_start != newtime || m_name != newname || m_description != newdesc || m_shortDescription != newshortdesc || m_duration != data->i_duration ) { m_start = newtime; m_name = newname; setToolTip( newname ); m_description = newdesc; m_shortDescription = newshortdesc; setDuration( data->i_duration ); setRating( data->i_rating ); update(); return true; } return false; }
int QPauseAnimation::qt_metacall(QMetaObject::Call _c, int _id, void **_a) { _id = QAbstractAnimation::qt_metacall(_c, _id, _a); if (_id < 0) return _id; #ifndef QT_NO_PROPERTIES if (_c == QMetaObject::ReadProperty) { void *_v = _a[0]; switch (_id) { case 0: *reinterpret_cast< int*>(_v) = duration(); break; } _id -= 1; } else if (_c == QMetaObject::WriteProperty) { void *_v = _a[0]; switch (_id) { case 0: setDuration(*reinterpret_cast< int*>(_v)); break; } _id -= 1; } else if (_c == QMetaObject::ResetProperty) { _id -= 1; } else if (_c == QMetaObject::QueryPropertyDesignable) { _id -= 1; } else if (_c == QMetaObject::QueryPropertyScriptable) { _id -= 1; } else if (_c == QMetaObject::QueryPropertyStored) { _id -= 1; } else if (_c == QMetaObject::QueryPropertyEditable) { _id -= 1; } else if (_c == QMetaObject::QueryPropertyUser) { _id -= 1; } #endif // QT_NO_PROPERTIES return _id; }
void LogVariablesWidget::setLogVariableChecked( int pIndex, bool pChecked ) { mHeaderView->setChecked(pIndex, pChecked); if ( pChecked ) { Qt::ItemFlags flags = Qt::ItemIsEditable|Qt::ItemIsSelectable |Qt::ItemIsUserCheckable|Qt::ItemIsEnabled|Qt::ItemIsDragEnabled|Qt::ItemIsDropEnabled; ui->logVariableTable->item(pIndex, 0)->setFlags(Qt::ItemIsEnabled); ui->logVariableTable->item(pIndex, 1)->setFlags(flags); ui->logVariableTable->item(pIndex, 2)->setFlags(flags); ui->logVariableTable->item(pIndex, 3)->setFlags(flags); } else { ui->logVariableTable->item(pIndex, 0)->setFlags(Qt::NoItemFlags); ui->logVariableTable->item(pIndex, 1)->setFlags(Qt::NoItemFlags); ui->logVariableTable->item(pIndex, 2)->setFlags(Qt::NoItemFlags); ui->logVariableTable->item(pIndex, 3)->setFlags(Qt::NoItemFlags); setFrequency(pIndex, DataRepository::instance()->frequency()); setStartTime(pIndex, 0); setDuration(pIndex, DataRepository::instance()->duration()); } QFont font = ui->logVariableTable->item(pIndex, 0)->font(); font.setBold(pChecked); ui->logVariableTable->item(pIndex, 0)->setFont(font); ui->logVariableTable->item(pIndex, 1)->setFont(font); ui->logVariableTable->item(pIndex, 2)->setFont(font); ui->logVariableTable->item(pIndex, 3)->setFont(font); }
void Chaser::setTotalDuration(quint32 msec) { if (durationMode() == Chaser::Common) { int stepsCount = m_steps.count(); if (stepsCount == 0) stepsCount = 1; setDuration(msec / stepsCount); } else { // scale all the Chaser steps to resize // to the desired duration double dtDuration = (double)totalDuration(); for (int i = 0; i < m_steps.count(); i++) { uint origDuration = m_steps[i].duration; m_steps[i].duration = ((double)m_steps[i].duration * msec) / dtDuration; if(m_steps[i].hold) m_steps[i].hold = ((double)m_steps[i].hold * (double)m_steps[i].duration) / (double)origDuration; m_steps[i].fadeIn = m_steps[i].duration - m_steps[i].hold; if (m_steps[i].fadeOut) m_steps[i].fadeOut = ((double)m_steps[i].fadeOut * (double)m_steps[i].duration) / (double)origDuration; } } emit changed(this->id()); }
ParticleSpiralSystem() : wyQuadParticleSystem(500){ // duration setDuration(PARTICLE_DURATION_INFINITY); // angle setDirectionAngleVariance(90, 0); // speed of particles setSpeedVariance(150, 0); // radial setRadialAccelerationVariance(-380, 0); // tagential setTangentialAccelerationVariance(45, 0); // life of particles setLifeVariance(12, 0); // size, in pixels setStartSizeVariance(20, 0); // emits per second setEmissionRate(getMaxParticles() / getLife()); // color of particles setStartColorVariance(0.5f, 0.5f, 0.5f, 1.0f, 0.5f, 0.5f, 0.5f, 0.0f); setEndColorVariance(0.5f, 0.5f, 0.5f, 1.0f, 0.5f, 0.5f, 0.5f, 0.0f); //set texture setTexture(wyTexture2D::makePNG(RES("R.drawable.fire"))); // additive setBlendAdditive(false); }
ParticleFireSystem() : wyQuadParticleSystem(250){ // duration setDuration(PARTICLE_DURATION_INFINITY); // angle setDirectionAngleVariance(90, 10); // life of particles setLifeVariance(3.0f, 0.25f); // speed of particles setSpeedVariance(60, 20); // size, in pixels setStartSizeVariance(100.0f, 10.0f); // emits per frame setEmissionRate(getMaxParticles() / getLife()); // color of particles setStartColorVariance(0.76f, 0.25f, 0.12f, 1.0f, 0.0f, 0.0f, 0.0f, 0.0f); setEndColorVariance(0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 0.0f, 0.0f, 0.0f); //set texture setTexture(wyTexture2D::makePNG(RES("R.drawable.fire"))); // additive setBlendAdditive(true); }
ParticleSmokeSystem() : wyQuadParticleSystem(200){ // duration setDuration(PARTICLE_DURATION_INFINITY); // angle setDirectionAngleVariance(90, 5); // position var setParticlePositionVariance(0, 0, 20, 0); // life of particles setLifeVariance(4, 1); // speed of particles setSpeedVariance(25, 10); // size, in pixels setStartSizeVariance(60, 10); // emits per frame setEmissionRate(getMaxParticles() / getLife()); // color of particles setStartColorVariance(0.8f, 0.8f, 0.8f, 1.0f, 0.02f, 0.02f, 0.02f, 0.0f); setEndColorVariance(0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 0.0f, 0.0f, 0.0f); //set texture setTexture(wyTexture2D::makePNG(RES("R.drawable.fire"))); // additive setBlendAdditive(false); }
ParticleExplosionSystem() : wyQuadParticleSystem(700){ // duration setDuration(0.1f); // gravity setParticleGravity(0, -100); // angle setDirectionAngleVariance(90, 360); // speed of particles setSpeedVariance(70, 40); // life of particles setLifeVariance(5.0f, 2.0f); // size, in pixels setStartSizeVariance(15.0f, 10.0f); // emits per second setEmissionRate(getMaxParticles() / getDuration()); // color of particles setStartColorVariance(0.7f, 0.1f, 0.2f, 1.0f, 0.5f, 0.5f, 0.5f, 0.0f); setEndColorVariance(0.5f, 0.5f, 0.5f, 0.0f, 0.5f, 0.5f, 0.5f, 0.0f); //set texture setTexture(wyTexture2D::makePNG(RES("R.drawable.stars"))); }
ParticleRingSystem() : wyQuadParticleSystem(250){ // duration setDuration(PARTICLE_DURATION_INFINITY); // angle setDirectionAngleVariance(90, 360); // speed of particles setSpeedVariance(100, 0); // radial setRadialAccelerationVariance(-60, 0); // tagential setTangentialAccelerationVariance(15, 0); // life of particles setLifeVariance(10, 0); // size, in pixels setStartSizeVariance(30.0f, 10.0f); // emits per second setEmissionRate(10000); // color of particles setStartColorVariance(0.5f, 0.5f, 0.5f, 1.0f, 0.5f, 0.5f, 0.5f, 0.5f); setEndColorVariance(0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 0.0f, 0.0f, 0.0f); //set texture setTexture(wyTexture2D::makePNG(RES("R.drawable.stars"))); // additive setBlendAdditive(true); }
ParticleMeteorSystem() : wyQuadParticleSystem(150) { // duration setDuration(PARTICLE_DURATION_INFINITY); // gravity setParticleGravity(DP(-133.33f), DP(133.33f)); // angle setDirectionAngleVariance(90, 360); // speed of particles setSpeedVariance(DP(10), DP(3.33f)); // life of particles setLifeVariance(2, 1); // size, in pixels setStartSizeVariance(DP(40.0f), DP(6.6f)); // emits per second setEmissionRate(getMaxParticles() / getLife()); // color of particles setStartColorVariance(0.2f, 0.4f, 0.7f, 1.0f, 0.0f, 0.0f, 0.2f, 0.1f); setEndColorVariance(0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 0.0f, 0.0f, 0.0f); //set texture setTexture(wyTexture2D::makePNG(RES("R.drawable.fire"))); // additive setBlendAdditive(true); }
OperationItemDistribution::OperationItemDistribution( ItemDistribution* i, Buffer *src, Buffer* dest ) : itemdist(i) { if (!i || !src || !dest) throw LogicException( "An OperationItemDistribution always needs to point to " "a ItemDistribution, a source buffer and a destination buffer" ); stringstream o; o << "Ship " << dest->getItem()->getName() << " from " << src->getName() << " to " << dest->getName(); setName(o.str()); setDuration(i->getLeadTime()); setSizeMultiple(i->getSizeMultiple()); setSizeMinimum(i->getSizeMinimum()); setLocation(dest->getLocation()); setSource(i->getSource()); setCost(i->getCost()); setFence(i->getFence()); setHidden(true); new FlowEnd(this, dest, 1); new FlowStart(this, src, -1); initType(metadata); // Optionally, create a load if (i->getResource()) new LoadDefault(this, i->getResource(), i->getResourceQuantity()); // Insert in the list of ItemDistribution operations. // The list is not sorted (for performance reasons). nextOperation = i->firstOperation; i->firstOperation = this; }
void ViewportView::zoomTo(Node* n) { // Find all ControlInstances that are declared by this node QList<ControlInstance*> instances; for (auto i : items()) { if (auto c = dynamic_cast<ControlInstance*>(i)) { if (c->getNode() == n) { instances.push_back(c); } } } // Find a weighted sum of central points QVector3D pos; float area_sum = 0; for (auto i : instances) { const float area = i->boundingRect().width() * i->boundingRect().height(); pos += i->getControl()->pos() * area; area_sum += area; } pos /= area_sum; auto a = new QPropertyAnimation(this, "_center"); a->setDuration(100); a->setStartValue(center); a->setEndValue(pos); a->start(QPropertyAnimation::DeleteWhenStopped); }
EFX::EFX(Doc* doc) : Function(doc, Function::EFXType) { m_isRelative = false; updateRotationCache(); m_xFrequency = 2; m_yFrequency = 3; m_xPhase = M_PI / 2.0; m_yPhase = 0; m_propagationMode = Parallel; m_algorithm = EFX::Circle; setName(tr("New EFX")); m_fader = NULL; setDuration(20000); // 20s m_legacyHoldBus = Bus::invalid(); m_legacyFadeBus = Bus::invalid(); registerAttribute(tr("Width"), Function::LastWins, 0.0, 127.0, 127.0); registerAttribute(tr("Height"), Function::LastWins, 0.0, 127.0, 127.0); registerAttribute(tr("Rotation"), Function::LastWins, 0.0, 359.0, 0.0); registerAttribute(tr("X Offset"), Function::LastWins, 0.0, 255.0, 127.0); registerAttribute(tr("Y Offset"), Function::LastWins, 0.0, 255.0, 127.0); registerAttribute(tr("Start Offset"), Function::LastWins, 0.0, 359.0, 0.0); }
void MuTimer::update() { TimeEvent::Time now = std::chrono::system_clock::now(); auto &timerQueue = usingQueueA ? timerQueueA : timerQueueB; auto &timerQueue2 = usingQueueA ? timerQueueB : timerQueueA; usingQueueA = !usingQueueA; while (!timerQueue.empty() && (timerQueue.top()->when < now)) { auto t = timerQueue.top(); timerQueue.pop(); if (!t->finished) { t->callback(); if (t->loop) { t->setDuration(t->duration); timerQueue2.push(t); continue; } } removeTimer(t->id); } }
bool Media::setValueForRole(int role, const QVariant& value) { switch (role) { case MediaCenter::MediaTypeRole: return setType(value.toString()); case Qt::DisplayRole: return setTitle(value.toString()); case MediaCenter::MediaUrlRole: if (d->url != value.toString()) { qDebug() << d->url << value.toString(); qFatal("Media URLs CANNOT be changed"); } return false; case Qt::DecorationRole: return thumbnail().isEmpty() ? setThumbnail(value.toString()) : false; case MediaCenter::CreatedAtRole: return setCreatedAt(value.toDateTime()); case MediaCenter::GenreRole: return setGenre(value.toString()); case MediaCenter::DurationRole : return setDuration(value.toInt()); case MediaCenter::RatingRole : return setRating(value.toInt()); default: //qWarning() << "Unknown role " << role << " for value " << value; return false; } }
ImageFrame& ImageFrame::operator=(const ImageFrame& other) { if (this == &other) return *this; m_bitmap = other.m_bitmap->clone(); // Keep the pixels locked since we will be writing directly into the // bitmap throughout this object's lifetime. m_bitmap->bitmap().lockPixels(); setMemoryAllocator(other.allocator()); setOriginalFrameRect(other.originalFrameRect()); setStatus(other.status()); setDuration(other.duration()); setDisposalMethod(other.disposalMethod()); setPremultiplyAlpha(other.premultiplyAlpha()); // Be sure that this is called after we've called setStatus(), since we // look at our status to know what to do with the alpha value. setHasAlpha(other.hasAlpha()); // Copy raw fields to avoid ASSERT failure in requiredPreviousFrameIndex(). m_requiredPreviousFrameIndex = other.m_requiredPreviousFrameIndex; #if !ASSERT_DISABLED m_requiredPreviousFrameIndexValid = other.m_requiredPreviousFrameIndexValid; #endif return *this; }
void SpellItem::update(uint16_t spellId, const Spell* spell, int duration, uint16_t casterId, const QString& casterName, uint16_t targetId, const QString& targetName) { setSpellId(spellId); setDuration(duration); if (spell) { setSpellName(spell->name()); if (spell->targetType() != 0x06) setTargetId(targetId); } else { setSpellName(spell_name(spellId)); setTargetId(targetId); } setCasterId(casterId); if (!casterName.isEmpty()) setCasterName(casterName); else setCasterName(QString("N/A")); if (!targetName.isEmpty()) setTargetName(targetName); else setTargetName(QString("N/A")); updateCastTime(); }
QScrollbarStyleAnimation::QScrollbarStyleAnimation(Mode mode, QObject *target) : QNumberStyleAnimation(target), _mode(mode), _active(false) { switch (mode) { case Activating: setDuration(ScrollBarFadeOutDuration); setStartValue(0.0); setEndValue(1.0); break; case Deactivating: setDuration(ScrollBarFadeOutDelay + ScrollBarFadeOutDuration); setDelay(ScrollBarFadeOutDelay); setStartValue(1.0); setEndValue(0.0); break; } }
DBreathingLabel::DBreathingLabel(QWidget *parent,Qt::WindowFlags f) : QLabel(parent, f), alpha_(255) { m_showAnimation = new QPropertyAnimation(this, "alpha"); m_hideAnimation = new QPropertyAnimation(this, "alpha"); setDuration(400); }
bool ShowFunction::loadXML(QXmlStreamReader &root) { if (root.name() != KXMLShowFunction) { qWarning() << Q_FUNC_INFO << "ShowFunction node not found"; return false; } QXmlStreamAttributes attrs = root.attributes(); if (attrs.hasAttribute(KXMLShowFunctionID)) setFunctionID(attrs.value(KXMLShowFunctionID).toString().toUInt()); if (attrs.hasAttribute(KXMLShowFunctionStartTime)) setStartTime(attrs.value(KXMLShowFunctionStartTime).toString().toUInt()); if (attrs.hasAttribute(KXMLShowFunctionDuration)) setDuration(attrs.value(KXMLShowFunctionDuration).toString().toUInt()); if (attrs.hasAttribute(KXMLShowFunctionColor)) setColor(QColor(attrs.value(KXMLShowFunctionColor).toString())); if (attrs.hasAttribute(KXMLShowFunctionLocked)) setLocked(true); root.skipCurrentElement(); return true; }
void PluginTrack::loadTrack(const QString &service, const QVariantMap &track) { setService(service); setArtist(track.value("artist").toString()); setArtistId(track.value("artistId").toString()); setDate(track.value("date").toString()); setDescription(track.value("description").toString()); setDownloadable(track.value("downloadable", true).toBool()); setFormat(track.value("format").toString()); setGenre(track.value("genre").toString()); setId(track.value("id").toString()); setLargeThumbnailUrl(track.value("largeThumbnailUrl").toString()); setPlayCount(track.value("playCount").toLongLong()); setStreamUrl(track.value("streamUrl").toString()); setThumbnailUrl(track.value("thumbnailUrl").toString()); setTitle(track.value("title").toString()); setUrl(track.value("url").toString()); if (track.value("duration").type() == QVariant::String) { setDurationString(track.value("duration").toString()); } else { setDuration(track.value("duration").toLongLong()); } if (track.value("size").type() == QVariant::String) { setSizeString(track.value("size").toString()); } else { setSize(track.value("size").toLongLong()); } }
// in movie fragment mode set the actual duration of // last sample void PVA_FF_TrackHeaderAtom::updateLastTSEntry(uint32 ts) { uint32 duration = (uint32)((getTimeScale() / 1000.0f) * ts); setDuration(duration); _deltaTS = 0; // this will not increase the total duration // in movie fragmement mode as done before rendering }
//! Reset TDMA slots with given parameters. //! @param[in] slot_count total number of slots. //! @param[in] slot_number slots. //! @param[in] duration slots duration in seconds. void reset(unsigned slot_count, std::vector<unsigned>& slot_number, unsigned duration) { setTotalSlots(slot_count); setSlotNumber(slot_number); setDuration(duration); setup(); }
void AudioResource::loadAudioData(char *data, ALuint format, ALuint size, ALuint sample_rate, float duration) { setData(data); setSize(size); setDuration(duration); alBufferData(getID(), format, getData(), getSize(), sample_rate); }
bool CCCurl::initWithDuration(float d, CCPoint center, float toRadius, float angularVelocity) { setDuration(d); m_center = center; m_toRadius = toRadius; m_angularVelocity = angularVelocity; return true; }
bool Animate3D::init(Animation3D* animation) { _animation = animation; animation->retain(); setDuration(animation->getDuration()); setOriginInterval(animation->getDuration()); return true; }
//----------------------------------------------------------------------------- // setLookAt() // called by agent logic to set look at behavior locally, and propagate to sim //----------------------------------------------------------------------------- BOOL LLHUDEffectLookAt::setLookAt(ELookAtType target_type, LLViewerObject *object, LLVector3 position) { if (!mSourceObject) { return FALSE; } if (target_type >= LOOKAT_NUM_TARGETS) { llwarns << "Bad target_type " << (int)target_type << " - ignoring." << llendl; return FALSE; } // must be same or higher priority than existing effect if ((*mAttentions)[target_type].mPriority < (*mAttentions)[mTargetType].mPriority) { return FALSE; } F32 current_time = mTimer.getElapsedTimeF32(); // type of lookat behavior or target object has changed BOOL lookAtChanged = (target_type != mTargetType) || (object != mTargetObject); // lookat position has moved a certain amount and we haven't just sent an update lookAtChanged = lookAtChanged || ((dist_vec_squared(position, mLastSentOffsetGlobal) > MIN_DELTAPOS_FOR_UPDATE_SQUARED) && ((current_time - mLastSendTime) > (1.f / MAX_SENDS_PER_SEC))); if (lookAtChanged) { mLastSentOffsetGlobal = position; F32 timeout = (*mAttentions)[target_type].mTimeout; setDuration(timeout); setNeedsSendToSim(TRUE); } if (target_type == LOOKAT_TARGET_CLEAR) { clearLookAtTarget(); } else { mTargetType = target_type; mTargetObject = object; if (object) { mTargetOffsetGlobal.setVec(position); } else { mTargetOffsetGlobal = gAgent.getPosGlobalFromAgent(position); } mKillTime = mTimer.getElapsedTimeF32() + mDuration; update(); } return TRUE; }
Session::Session(unsigned int id, std::string tulpa_name, int session_type_id, std::string description, int duration, std::string date) { setID(id); setTypeID(session_type_id); setTulpaName(tulpa_name); setDescription(description); setDuration(duration); setDate(date); }