本文整理汇总了C++中Doc::function方法的典型用法代码示例。如果您正苦于以下问题:C++ Doc::function方法的具体用法?C++ Doc::function怎么用?C++ Doc::function使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Doc
的用法示例。
在下文中一共展示了Doc::function方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: start
void Collection::start(MasterTimer* timer)
{
Q_ASSERT(timer != NULL);
Doc* doc = qobject_cast <Doc*> (parent());
Q_ASSERT(doc != NULL);
m_childCount = 0;
QListIterator <t_function_id> it(m_steps);
while (it.hasNext() == true)
{
Function* function;
function = doc->function(it.next());
Q_ASSERT(function != NULL);
m_childCountMutex.lock();
m_childCount++;
m_childCountMutex.unlock();
connect(function, SIGNAL(stopped(t_function_id)),
this, SLOT(slotChildStopped(t_function_id)));
function->start(timer);
}
Function::start(timer);
}
示例2: handleStopFunction
QString Script::handleStopFunction(const QList <QStringList>& tokens)
{
qDebug() << Q_FUNC_INFO;
if (tokens.size() > 1)
return QString("Too many arguments");
bool ok = false;
quint32 id = tokens[0][1].toUInt(&ok);
if (ok == false)
return QString("Invalid function ID: %1").arg(tokens[0][1]);
Doc* doc = qobject_cast<Doc*> (parent());
Q_ASSERT(doc != NULL);
Function* function = doc->function(id);
if (function != NULL)
{
if (function->stopped() == false)
function->stop();
else
qWarning() << "Function (" << function->name() << ") is not running.";
m_startedFunctions.removeAll(function);
return QString();
}
else
{
return QString("No such function (ID %1)").arg(id);
}
}
示例3: slotChildStopped
void Collection::slotChildStopped(quint32 fid)
{
Doc* doc = qobject_cast <Doc*> (parent());
Q_ASSERT(doc != NULL);
Function* function = doc->function(fid);
disconnect(function, SIGNAL(stopped(quint32)),
this, SLOT(slotChildStopped(quint32)));
QMutexLocker locker(&m_functionListMutex);
m_runningChildren.remove(fid);
}
示例4: stopMemberAt
void Chaser::stopMemberAt(int index)
{
Doc* doc = qobject_cast <Doc*> (parent());
Q_ASSERT(doc != NULL);
t_function_id fid = m_steps.at(index);
Q_ASSERT(fid != Function::invalidId());
Function* function = doc->function(fid);
Q_ASSERT(function != NULL);
function->stop(m_masterTimer);
}
示例5: postLoad
void Collection::postLoad()
{
Doc* doc = qobject_cast <Doc*> (parent());
Q_ASSERT(doc != NULL);
/* Check that all member functions exist (nonexistent functions can
be present only when a corrupted file has been loaded) */
QMutableListIterator<quint32> it(m_functions);
while (it.hasNext() == true)
{
/* Remove any nonexistent member functions */
if (doc->function(it.next()) == NULL)
it.remove();
}
}
示例6: slotChildStopped
void Collection::slotChildStopped(t_function_id fid)
{
Doc* doc = qobject_cast <Doc*> (parent());
Q_ASSERT(doc != NULL);
Function* function;
function = doc->function(fid);
Q_ASSERT(function != NULL);
disconnect(function, SIGNAL(stopped(t_function_id)),
this, SLOT(slotChildStopped(t_function_id)));
m_childCountMutex.lock();
m_childCount--;
m_childCountMutex.unlock();
}
示例7: it
QList <Function*> Chaser::stepFunctions() const
{
Doc* doc = qobject_cast<Doc*> (parent());
Q_ASSERT(doc != NULL);
QList <Function*> list;
QListIterator <t_function_id> it(m_steps);
while (it.hasNext() == true)
{
Function* function = doc->function(it.next());
if (function != NULL)
list << function;
}
return list;
}
示例8: stop
void Collection::stop(MasterTimer* timer)
{
Doc* doc = qobject_cast <Doc*> (parent());
Q_ASSERT(doc != NULL);
/* TODO: this stops these functions, regardless of whether they
were started by this collection or not */
QListIterator <t_function_id> it(m_steps);
while (it.hasNext() == true)
{
Function* function = doc->function(it.next());
Q_ASSERT(function != NULL);
function->stop(timer);
}
Function::stop(timer);
}
示例9: contains
bool Chaser::contains(quint32 functionId)
{
Doc *doc = this->doc();
Q_ASSERT(doc != NULL);
foreach(ChaserStep step, m_steps)
{
Function *function = doc->function(step.fid);
// contains() can be called during init, function may be NULL
if (function == NULL)
continue;
if (function->id() == functionId)
return true;
if (function->contains(functionId))
return true;
}
示例10: write
void Collection::write(MasterTimer* timer, QList<Universe *> universes)
{
Q_UNUSED(universes);
if (elapsed() == 0)
{
Doc* doc = qobject_cast <Doc*> (parent());
Q_ASSERT(doc != NULL);
QMutexLocker locker(&m_functionListMutex);
QListIterator <quint32> it(m_functions);
while (it.hasNext() == true)
{
Function* function = doc->function(it.next());
Q_ASSERT(function != NULL);
// Append the IDs of all functions started by this collection
// to a set so that we can track which of them are still controlled
// by this collection which are not.
m_runningChildren << function->id();
// Listen to the children's stopped signals so that this collection
// can give up its rights to stop the function later.
connect(function, SIGNAL(stopped(quint32)),
this, SLOT(slotChildStopped(quint32)));
function->adjustAttribute(getAttributeValue(Function::Intensity), Function::Intensity);
function->start(timer, true, 0, overrideFadeInSpeed(), overrideFadeOutSpeed(), overrideDuration());
}
}
incrementElapsed();
{
QMutexLocker locker(&m_functionListMutex);
if (m_runningChildren.size() > 0)
return;
}
stop();
}
示例11: postRun
void Collection::postRun(MasterTimer* timer, QList<Universe *> universes)
{
Doc* doc = qobject_cast <Doc*> (parent());
Q_ASSERT(doc != NULL);
{
QMutexLocker locker(&m_functionListMutex);
/** Stop the member functions only if they have been started by this
collection. */
QSetIterator <quint32> it(m_runningChildren);
while (it.hasNext() == true)
{
Function* function = doc->function(it.next());
Q_ASSERT(function != NULL);
function->stop();
}
m_runningChildren.clear();
}
Function::postRun(timer, universes);
}
示例12: postLoad
void Chaser::postLoad()
{
if (m_legacyHoldBus != Bus::invalid())
{
quint32 value = Bus::instance()->value(m_legacyHoldBus);
setDuration((value / MasterTimer::frequency()) * 1000);
}
Doc *doc = this->doc();
Q_ASSERT(doc != NULL);
QMutableListIterator <ChaserStep> it(m_steps);
while (it.hasNext() == true)
{
ChaserStep step(it.next());
Function *function = doc->function(step.fid);
if (function == NULL)
it.remove();
else if (function->contains(id())) // forbid self-containment
it.remove();
}
}
示例13: arm
void EFX::arm()
{
class Scene* startScene = NULL;
class Scene* stopScene = NULL;
int serialNumber = 0;
Doc* doc = qobject_cast <Doc*> (parent());
Q_ASSERT(doc != NULL);
/* Initialization scene */
if (m_startSceneID != Function::invalidId() &&
m_startSceneEnabled == true)
{
startScene = static_cast <class Scene*>
(doc->function(m_startSceneID));
}
/* De-initialization scene */
if (m_stopSceneID != Function::invalidId() &&
m_stopSceneEnabled == true)
{
stopScene = static_cast <class Scene*>
(doc->function(m_stopSceneID));
}
QListIterator <EFXFixture*> it(m_fixtures);
while (it.hasNext() == true)
{
EFXFixture* ef = it.next();
Q_ASSERT(ef != NULL);
ef->setSerialNumber(serialNumber++);
ef->setStartScene(startScene);
ef->setStopScene(stopScene);
/* If fxi == NULL, the fixture has been destroyed */
Fixture* fxi = doc->fixture(ef->fixture());
if (fxi == NULL)
continue;
/* If this fixture has no mode, it's a generic dimmer that
can't do pan&tilt anyway. */
const QLCFixtureMode* mode = fxi->fixtureMode();
if (mode == NULL)
continue;
/* Find exact channel numbers for MSB/LSB pan and tilt */
for (t_channel i = 0; i < mode->channels().size(); i++)
{
QLCChannel* ch = mode->channel(i);
Q_ASSERT(ch != NULL);
if (ch->group() == KQLCChannelGroupPan)
{
if (ch->controlByte() == 0)
{
ef->setMsbPanChannel(
fxi->universeAddress() + i);
}
else if (ch->controlByte() == 1)
{
ef->setLsbPanChannel(
fxi->universeAddress() + i);
}
}
else if (ch->group() == KQLCChannelGroupTilt)
{
if (ch->controlByte() == 0)
{
ef->setMsbTiltChannel(
fxi->universeAddress() + i);
}
else if (ch->controlByte() == 1)
{
ef->setLsbTiltChannel(
fxi->universeAddress() + i);
}
}
}
}
/* Choose a point calculation function depending on the algorithm */
if (m_algorithm == KCircleAlgorithmName)
pointFunc = circlePoint;
else if (m_algorithm == KEightAlgorithmName)
pointFunc = eightPoint;
else if (m_algorithm == KLineAlgorithmName)
pointFunc = linePoint;
else if (m_algorithm == KTriangleAlgorithmName)
pointFunc = trianglePoint;
else if (m_algorithm == KDiamondAlgorithmName)
pointFunc = diamondPoint;
else if (m_algorithm == KLissajousAlgorithmName)
pointFunc = lissajousPoint;
else
pointFunc = circlePoint; // Fallback
resetElapsed();
}