Esempio n. 1
0
void EventPlugin::onEventOpened()
{
	qfLogFuncFrame() << "stage count:" << stageCount();
	m_cbxStage->blockSignals(true);
	m_cbxStage->clear();
	int stage_cnt = stageCount();
	for (int i = 0; i < stage_cnt; ++i) {
		m_cbxStage->addItem("E" + QString::number(i + 1), i + 1);
	}
	m_cbxStage->setCurrentIndex(-1);
	m_cbxStage->blockSignals(false);
	loadCurrentStageId();
	//emit this->currentStageIdChanged(currentStageId());
}
QPair<int,int> AMBeamlineParallelActionsList::indicesOf(AMBeamlineActionItem *iAction){
	for(int x = 0; x < stageCount(); x++)
		for(int y = 0; y < count(); y++)
			if(action(x, y) == iAction)
				return QPair<int,int>(x,y);
	return QPair<int,int>(-1,-1);
}
int AMBeamlineParallelActionsList::indexOf(AMBeamlineActionItem *iAction){
	for(int x = 0; x < stageCount(); x++)
		for(int y = 0; y < count(); y++)
			if(action(x, y) == iAction)
				return y;
	return -1;
}
void AMBeamlineParallelActionsList::puke(){
	AMBeamlineNumberAction *nAction;
	QString stageString, tmpStr;
	for(int x = 0; x < stageCount(); x++){
		stageString = "";
		for(int y = 0; y < countAt(x); y++){
			if((nAction = qobject_cast<AMBeamlineNumberAction*>(action(x, y))))
				tmpStr.setNum(nAction->getNumber());
			else
				tmpStr.setNum( qint64(action(x,y)) );
			stageString.append(tmpStr+" ");
		}
		if(x != stageCount()-1)
			stageString.append("--V");
//		qdebug() << stageString;
	}
}
Esempio n. 5
0
bool TextureMaterialLayer::hasGlow() const
{
    for (int i = 0; i < stageCount(); ++i)
    {
        if (stage(i).glowStrength > .0001f)
            return true;
    }
    return false;
}
bool AMBeamlineParallelActionsList::setStage(int stageIndex, QList<AMBeamlineActionItem *> *stageList){
	QModelIndex modelIndex = actions_->index(stageIndex, QModelIndex());
	if(modelIndex.isValid() && stageList){
		QList<AMBeamlineActionItem*> *oldStageList = (QList<AMBeamlineActionItem*>*)actions_->data(actions_->index(stageIndex, QModelIndex()), Qt::DisplayRole).value<void*>();
		QList<AMBeamlineActionItem*> *prevStageList = NULL;
		QList<AMBeamlineActionItem*> *nextStageList = NULL;
		if(stageIndex != 0)
			prevStageList = (QList<AMBeamlineActionItem*>*)actions_->data(actions_->index(stageIndex-1, QModelIndex()), Qt::DisplayRole).value<void*>();
		if(stageIndex != stageCount() -1)
			nextStageList = (QList<AMBeamlineActionItem*>*)actions_->data(actions_->index(stageIndex+1, QModelIndex()), Qt::DisplayRole).value<void*>();

		if(oldStageList){//replace
			AMBeamlineParallelActionsListHolder *thisStageHolder = holdersHash_.valueF(oldStageList);
			for(int x = 0; x < oldStageList->count(); x++){
				disconnect(oldStageList->at(x), SIGNAL(started()), this, SLOT(onActionStarted()));
				disconnect(oldStageList->at(x), SIGNAL(succeeded()), this, SLOT(onActionSucceeded()));
				disconnect(oldStageList->at(x), SIGNAL(ready(bool)), this, SLOT(onActionReady(bool)));
				disconnect(oldStageList->at(x), SIGNAL(failed(int)), this, SLOT(onActionFailed(int)));
				disconnect(oldStageList->at(x), SIGNAL(progress(double,double)), this, SLOT(onActionProgress(double,double)));
			}
			if(prevStageList){
				for(int x = 0; x < oldStageList->count(); x++)
					disconnect(holdersHash_.valueF(prevStageList), SIGNAL(everythingFinished()), oldStageList->at(x), SLOT(start()));
				for(int x = 0; x < stageList->count(); x++)
					connect(holdersHash_.valueF(prevStageList), SIGNAL(everythingFinished()), stageList->at(x), SLOT(start()));
			}
			if(nextStageList){
				for(int x = 0; x < oldStageList->count(); x++)
					thisStageHolder->removeAction(oldStageList->at(x));
			}
			for(int x = 0; x < stageList->count(); x++)
				thisStageHolder->addAction(stageList->at(x));
			holdersHash_.removeF(oldStageList);
			holdersHash_.set(stageList, thisStageHolder);
		}
		else{//insert
int AMBeamlineParallelActionsList::stageIndexOf(QList<AMBeamlineActionItem *> *iList){
	for(int x = 0; x < stageCount(); x++)
		if(stage(x) == iList)
			return x;
	return -1;
}
int AMBeamlineParallelActionsList::countAt(int stageIndex){
	if(stageIndex >= 0 && stageIndex < stageCount())
		return stage(stageIndex)->count();
	return -1;
}
int AMBeamlineParallelActionsList::count(){
	int totalActions = 0;
	for(int x = 0; x < stageCount(); x++)
		totalActions += countAt(x);
	return totalActions;
}