本文整理汇总了C++中Chaser类的典型用法代码示例。如果您正苦于以下问题:C++ Chaser类的具体用法?C++ Chaser怎么用?C++ Chaser使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Chaser类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: pal
void FunctionWizard::accept()
{
PaletteGenerator pal(m_doc, fixtures());
if (m_coloursCheck->isChecked() == true)
pal.createColours();
if (m_goboCheck->isChecked() == true)
pal.createGobos();
if (m_shutterCheck->isChecked() == true)
pal.createShutters();
if (m_intensityCheck->isChecked() == true)
{
QList <Scene*> sceneList;
// Random chaser
sceneList = IntensityGenerator::randomScenes(fixtures(), m_doc,
QDateTime::currentDateTime().toTime_t());
if (sceneList.size() > 0)
{
int i = 0;
Chaser* chaser = new Chaser(m_doc);
chaser->setName(tr("Random Multi"));
m_doc->addFunction(chaser);
foreach (Scene* scene, sceneList)
{
scene->setName(tr("Random Step %1").arg(++i));
m_doc->addFunction(scene);
chaser->addStep(scene->id());
}
示例2: cl
void VCCueList_Test::functionRemoved()
{
QWidget w;
VCCueList cl(&w, m_doc);
Chaser* c = createChaser(m_doc);
cl.setChaser(c->id());
// Chaser members are removed from list
m_doc->deleteFunction(c->steps().first().fid);
QCOMPARE(cl.m_tree->topLevelItemCount(), 4);
// deferred changes arrive afetr 100ms
QTest::qWait(150);
QCOMPARE(cl.m_tree->topLevelItemCount(), 3);
QCOMPARE(cl.m_tree->topLevelItem(0)->text(0), QString("1"));
QCOMPARE(cl.m_tree->topLevelItem(1)->text(0), QString("2"));
QCOMPARE(cl.m_tree->topLevelItem(2)->text(0), QString("3"));
QCOMPARE(cl.m_tree->topLevelItem(0)->text(1), QString("Second"));
QCOMPARE(cl.m_tree->topLevelItem(1)->text(1), QString("Third"));
QCOMPARE(cl.m_tree->topLevelItem(2)->text(1), QString("Fourth"));
// Chaser is removed completely
m_doc->deleteFunction(c->id());
QCOMPARE(cl.m_tree->topLevelItemCount(), 0);
QCOMPARE(cl.chaserID(), Function::invalidId());
}
示例3: createChaser
static Chaser* createChaser(Doc* doc)
{
Fixture* fxi = new Fixture(doc);
fxi->setChannels(1);
doc->addFixture(fxi);
Scene* s1 = new Scene(doc);
s1->setName("First");
s1->setValue(fxi->id(), 0, 255);
doc->addFunction(s1);
Scene* s2 = new Scene(doc);
s2->setName("Second");
s2->setValue(fxi->id(), 0, 127);
doc->addFunction(s2);
Scene* s3 = new Scene(doc);
s3->setName("Third");
s3->setValue(fxi->id(), 0, 64);
doc->addFunction(s3);
Scene* s4 = new Scene(doc);
s4->setName("Fourth");
s4->setValue(fxi->id(), 0, 32);
doc->addFunction(s4);
Chaser* c = new Chaser(doc);
c->addStep(ChaserStep(s1->id()));
c->addStep(ChaserStep(s2->id()));
c->addStep(ChaserStep(s3->id()));
c->addStep(ChaserStep(s4->id()));
doc->addFunction(c);
return c;
}
示例4: it
bool IntensityGenerator::createRandomChaser()
{
if (m_random.size() == 0)
return false;
// Abort if doc can't fit the chaser and its members
if (m_doc->functionsFree() < quint32(m_random.size() + 1))
return false;
// Abort immediately if doc won't take all sequence steps
QListIterator <Scene*> it(m_random);
while (it.hasNext() == true)
{
if (m_doc->addFunction(it.next()) == false)
return false;
}
// Create the random chaser
Chaser* chaser = new Chaser(m_doc);
chaser->setName("Intensity - Random");
if (m_doc->addFunction(chaser) == false)
{
// Abort if doc won't accept the chaser
delete chaser;
return false;
}
else
{
for (int i = 0; i < m_random.size(); i++)
chaser->addStep(m_random[i]->id());
return true;
}
}
示例5: doc
void Chaser_Test::createCopy()
{
Doc doc(this);
Chaser* c1 = new Chaser(m_doc);
c1->setName("First");
c1->setFadeInSpeed(42);
c1->setFadeOutSpeed(69);
c1->setDuration(1337);
c1->setDirection(Chaser::Backward);
c1->setRunOrder(Chaser::SingleShot);
c1->addStep(ChaserStep(20));
c1->addStep(ChaserStep(30));
c1->addStep(ChaserStep(40));
doc.addFunction(c1);
QVERIFY(c1->id() != Function::invalidId());
Function* f = c1->createCopy(&doc);
QVERIFY(f != NULL);
QVERIFY(f != c1);
QVERIFY(f->id() != c1->id());
Chaser* copy = qobject_cast<Chaser*> (f);
QVERIFY(copy != NULL);
QVERIFY(copy->fadeInSpeed() == 42);
QVERIFY(copy->fadeOutSpeed() == 69);
QVERIFY(copy->duration() == 1337);
QVERIFY(copy->direction() == Chaser::Backward);
QVERIFY(copy->runOrder() == Chaser::SingleShot);
QVERIFY(copy->steps().size() == 3);
QVERIFY(copy->steps().at(0) == ChaserStep(20));
QVERIFY(copy->steps().at(1) == ChaserStep(30));
QVERIFY(copy->steps().at(2) == ChaserStep(40));
}
示例6: Q_ASSERT
Function* FunctionManager::copyFunction(t_function_id fid)
{
Function* newFunction = NULL;
QString msg;
Function* function = _app->doc()->function(fid);
Q_ASSERT(function != NULL);
switch(function->type())
{
case Function::Scene:
{
newFunction = _app->doc()->newFunction(Function::Scene);
Scene* scene = static_cast<Scene*> (newFunction);
scene->copyFrom(static_cast<Scene*> (function));
scene->setName("Copy of " + function->name());
}
break;
case Function::Chaser:
{
newFunction = _app->doc()->newFunction(Function::Chaser);
Chaser* chaser = static_cast<Chaser*> (newFunction);
chaser->copyFrom(static_cast<Chaser*> (function));
chaser->setName("Copy of " + function->name());
}
break;
case Function::Collection:
{
newFunction =
_app->doc()->newFunction(Function::Collection);
Collection* fc = static_cast<Collection*> (newFunction);
fc->copyFrom(static_cast<Collection*> (function));
fc->setName("Copy of " + function->name());
}
break;
case Function::EFX:
{
newFunction = _app->doc()->newFunction(Function::EFX);
EFX* efx = static_cast<EFX*> (newFunction);
efx->copyFrom(static_cast<EFX*> (function));
efx->setName("Copy of " + function->name());
}
break;
default:
newFunction = NULL;
break;
}
return newFunction;
}
示例7: Scene
void Chaser_Test::tap()
{
Scene* s1 = new Scene(m_doc);
m_doc->addFunction(s1);
Scene* s2 = new Scene(m_doc);
m_doc->addFunction(s2);
Scene* s3 = new Scene(m_doc);
m_doc->addFunction(s3);
Scene* s4 = new Scene(m_doc);
m_doc->addFunction(s4);
Chaser* c = new Chaser(m_doc);
c->addStep(s1->id());
c->addStep(s2->id());
c->addStep(s3->id());
c->addStep(s4->id());
m_doc->addFunction(c);
c->preRun(m_doc->masterTimer());
QVERIFY(c->m_runner != NULL);
QCOMPARE(c->duration(), uint(0));
c->write(m_doc->masterTimer(), QList<Universe*>());
QCOMPARE(c->m_runner->m_next, false);
c->tap();
QTest::qWait(MasterTimer::tick());
c->tap();
QCOMPARE(c->m_runner->m_next, true);
}
示例8: Chaser
void Chaser_Test::postRun()
{
Chaser* c = new Chaser(m_doc);
m_doc->addFunction(c);
UniverseArray ua(512);
MasterTimerStub timer(m_doc, ua);
c->preRun(&timer);
QCOMPARE(c->isRunning(), true);
// The chaser has no steps so ChaserRunner::postrun() shouldn't do much
c->postRun(&timer, &ua);
QCOMPARE(c->isRunning(), false); // Make sure Function::postRun() is called
}
示例9: Chaser
void Chaser_Test::postRun()
{
Chaser* c = new Chaser(m_doc);
m_doc->addFunction(c);
QList<Universe*> ua;
ua.append(new Universe(0, new GrandMaster()));
MasterTimerStub timer(m_doc, ua);
c->preRun(&timer);
QCOMPARE(c->isRunning(), true);
// The chaser has no steps so ChaserRunner::postrun() shouldn't do much
c->postRun(&timer, ua);
QCOMPARE(c->isRunning(), false); // Make sure Function::postRun() is called
}
示例10:
/*****************************************************************************
* Sorting
*****************************************************************************/
bool Chaser::operator<(const Chaser& chs) const
{
if (m_startTime < chs.getStartTime())
return true;
else
return false;
}
示例11: switch
void DeviceManagerView::copyFunction(Function* function, Device* device)
{
switch(function->type())
{
case Function::Scene:
{
Scene* scene = static_cast<Scene*>
(_app->doc()->newFunction(Function::Scene));
scene->copyFrom(static_cast<Scene*> (function), device->id());
}
break;
case Function::Chaser:
{
Chaser* chaser = static_cast<Chaser*>
(_app->doc()->newFunction(Function::Chaser));
chaser->copyFrom(static_cast<Chaser*> (function));
assert(device == NULL);
}
break;
case Function::Collection:
{
FunctionCollection* fc = static_cast<FunctionCollection*>
(_app->doc()->newFunction(Function::Collection));
fc->copyFrom(static_cast<FunctionCollection*> (function));
assert(device == NULL);
}
break;
case Function::Sequence:
{
Sequence* sequence = static_cast<Sequence*>
(_app->doc()->newFunction(Function::Sequence));
sequence->copyFrom(static_cast<Sequence*> (function), device->id());
}
break;
default:
break;
}
}
示例12: doc
void Doc_Test::addFunction()
{
Doc doc(this, m_fixtureDefCache);
QVERIFY(doc.m_functionAllocation == 0);
Scene* s = new Scene(&doc);
QVERIFY(s->id() == Function::invalidId());
QVERIFY(doc.addFunction(s) == true);
QVERIFY(s->id() == 0);
QVERIFY(doc.m_functionAllocation == 1);
QVERIFY(doc.isModified() == true);
doc.resetModified();
Chaser* c = new Chaser(&doc);
QVERIFY(c->id() == Function::invalidId());
QVERIFY(doc.addFunction(c) == true);
QVERIFY(c->id() == 1);
QVERIFY(doc.m_functionAllocation == 2);
QVERIFY(doc.isModified() == true);
doc.resetModified();
Collection* o = new Collection(&doc);
QVERIFY(o->id() == Function::invalidId());
QVERIFY(doc.addFunction(o, 0) == false);
QVERIFY(doc.isModified() == false);
QVERIFY(o->id() == Function::invalidId());
QVERIFY(doc.m_functionAllocation == 2);
QVERIFY(doc.addFunction(o, 2) == true);
QVERIFY(o->id() == 2);
QVERIFY(doc.m_functionAllocation == 3);
QVERIFY(doc.isModified() == true);
doc.resetModified();
EFX* e = new EFX(&doc);
QVERIFY(e->id() == Function::invalidId());
QVERIFY(doc.addFunction(e, KFunctionArraySize) == false);
QVERIFY(e->id() == Function::invalidId());
QVERIFY(doc.addFunction(e) == true);
QVERIFY(e->id() == 3);
QVERIFY(doc.m_functionAllocation == 4);
QVERIFY(doc.isModified() == true);
}
示例13: Doc
void Chaser_Test::tap()
{
Doc* doc = new Doc(this, m_cache);
Fixture* fxi = new Fixture(doc);
fxi->setAddress(0);
fxi->setUniverse(0);
fxi->setChannels(2);
doc->addFixture(fxi);
Scene* s1 = new Scene(doc);
s1->setName("Scene1");
s1->setValue(fxi->id(), 0, UCHAR_MAX);
s1->setValue(fxi->id(), 1, UCHAR_MAX);
doc->addFunction(s1);
Chaser* c = new Chaser(doc);
c->setName("Chaser");
c->setRunOrder(Chaser::PingPong);
c->setDirection(Chaser::Backward);
c->addStep(s1->id());
QVERIFY(c->m_tapped == false);
c->slotBusTapped(Bus::defaultFade());
QVERIFY(c->m_tapped == false);
c->slotBusTapped(Bus::defaultHold());
QVERIFY(c->m_tapped == true);
delete doc;
}
示例14: doc
void Chaser_Test::createCopy()
{
Doc doc(this, m_cache);
Chaser* c1 = new Chaser(m_doc);
c1->setName("First");
c1->setBus(15);
c1->setDirection(Chaser::Backward);
c1->setRunOrder(Chaser::SingleShot);
c1->addStep(20);
c1->addStep(30);
c1->addStep(40);
doc.addFunction(c1);
QVERIFY(c1->id() != Function::invalidId());
Function* f = c1->createCopy(&doc);
QVERIFY(f != NULL);
QVERIFY(f != c1);
QVERIFY(f->id() != c1->id());
Chaser* copy = qobject_cast<Chaser*> (f);
QVERIFY(copy != NULL);
QVERIFY(copy->busID() == 15);
QVERIFY(copy->direction() == Chaser::Backward);
QVERIFY(copy->runOrder() == Chaser::SingleShot);
QVERIFY(copy->steps().size() == 3);
QVERIFY(copy->steps().at(0) == 20);
QVERIFY(copy->steps().at(1) == 30);
QVERIFY(copy->steps().at(2) == 40);
}
示例15: chaser
void VCCueList::addFunctions(QVariantList idsList, int insertIndex)
{
if (idsList.isEmpty())
return;
if (isEditing())
{
Chaser *ch = chaser();
if (ch == NULL)
return;
if (insertIndex == -1)
insertIndex = ch->stepsCount();
for (QVariant vID : idsList) // C++11
{
quint32 fid = vID.toUInt();
ChaserStep step(fid);
if (ch->durationMode() == Chaser::PerStep)
{
Function *func = m_doc->function(fid);
if (func == NULL)
continue;
step.duration = func->totalDuration();
if (step.duration == 0)
step.duration = 1000;
step.hold = step.duration;
}
Tardis::instance()->enqueueAction(Tardis::ChaserAddStep, ch->id(), QVariant(), insertIndex);
ch->addStep(step, insertIndex++);
}
ChaserEditor::updateStepsList(m_doc, chaser(), m_stepsList);
emit stepsListChanged();
}
else
{
Function *f = m_doc->function(idsList.first().toUInt());
if (f == NULL || f->type() != Function::ChaserType)
return;
setChaserID(f->id());
}
}