コード例 #1
0
void LLPreviewGesture::initDefaultGesture()
{
	LLScrollListItem* item;
	item = addStep("Animation");
	LLGestureStepAnimation* anim = (LLGestureStepAnimation*)item->getUserdata();
	anim->mAnimAssetID = ANIM_AGENT_HELLO;
	anim->mAnimName = "Wave";
	updateLabel(item);

	item = addStep("Wait");
	LLGestureStepWait* wait = (LLGestureStepWait*)item->getUserdata();
	wait->mFlags = WAIT_FLAG_ALL_ANIM;
	updateLabel(item);

	item = addStep("Chat");
	LLGestureStepChat* chat_step = (LLGestureStepChat*)item->getUserdata();
	chat_step->mChatText = "Hello, avatar!";
	updateLabel(item);

	// Start with item list selected
	mStepList->selectFirstItem();

	// this is *new* content, so we are dirty
	mDirty = TRUE;
}
コード例 #2
0
ファイル: chaser.cpp プロジェクト: speakman/qlc
void Chaser::createContents(QPtrList <QString> &list)
{
  unsigned long functionId = 0;
  
  for (QString* s = list.next(); s != NULL; s = list.next())
    {
      if (*s == QString("Entry"))
	{
	  s = list.prev();
	  break;
	}
      else if (*s == QString("Function"))
	{
	  functionId = list.next()->toULong();
	  
	  Function* function = _app->doc()->searchFunction(functionId);
	  if (function != NULL)
	    {
	      addStep(function);
	    }
	  else
	    {
	      qDebug("Unable to find member for chaser <" + name() + ">");
	    }

	  functionId = 0;
	}
      else
	{
	  // Unknown keyword
	  list.next();
	}
    }
}
コード例 #3
0
ファイル: qslider.cpp プロジェクト: kthxbyte/QT2-Linaro
void QSlider::repeatTimeout()
{
    ASSERT( timer );
    timer->disconnect();
    if ( state == TimingDown )
	connect( timer, SIGNAL(timeout()), SLOT(subtractStep()) );
    else if ( state == TimingUp )
	connect( timer, SIGNAL(timeout()), SLOT(addStep()) );
    timer->start( repeatTime, FALSE );
}
コード例 #4
0
void
QvisOpacitySlider::repeatTimeout()
{
    if(timer==0)
        return;
    timer->disconnect();
    if(state == TimingDown)
        connect(timer, SIGNAL(timeout()), SLOT(subtractStep()));
    else if ( state == TimingUp )
        connect(timer, SIGNAL(timeout()), SLOT(addStep()));
    timer->setSingleShot(false);
    timer->start(repeatTime);
}
コード例 #5
0
ファイル: tcc.cpp プロジェクト: PotHix/pothix-codes
ConnectWidget::ConnectWidget( QWidget *parent, const char *name) : QVBox(parent,name){
   QPushButton *button = new QPushButton("Sair",this,"quit");

   connect(button, SIGNAL(clicked()), qApp, SLOT(quit()));

   QLCDNumber *lcd = new QLCDNumber(2,this,"lcd");
   QSlider *slider = new QSlider(Horizontal,this,"Slider");
   slider->setRange(0, 99);
   slider->setValue(0);
   slider->setPageStep(1);

   connect( slider, SIGNAL(valueChanged(int)), lcd, SLOT(display(int)) );

   QPushButton *add = new QPushButton("Somar",this,"add");
   connect(add, SIGNAL(clicked()), slider, SLOT(addStep()));
   QPushButton *subtract = new QPushButton("Subtrair",this,"subtract");
   connect(subtract, SIGNAL(clicked()), slider, SLOT(subtractStep()));
} 
コード例 #6
0
void LLPreviewGesture::onClickAdd()
{
	LLScrollListItem* library_item = mLibraryList->getFirstSelected();
	if (!library_item) return;

	S32 library_item_index = mLibraryList->getFirstSelectedIndex();

	const LLScrollListCell* library_cell = library_item->getColumn(0);
	const std::string& library_text = library_cell->getValue().asString();

	if( library_item_index >= STEP_EOF )
	{
		llerrs << "Unknown step type: " << library_text << llendl;
		return;
	}

	addStep( (EStepType)library_item_index );
	mDirty = TRUE;
	refresh();
}
コード例 #7
0
ファイル: MovementProcessor.cpp プロジェクト: Velocity-/RSCPP
void MovementProcessor::walkInterpolated(int x, int z) {
	int cur_x = player->getTile()->x;
	int cur_z = player->getTile()->z;

	if (!pendingTiles->empty()) {
		Tile t = pendingTiles->back();
		cur_x = t.x;
		cur_z = t.z;
	}

	while (cur_x != x || cur_z != z) {
		if (cur_x < x)
			cur_x++;
		else if (cur_x > x)
			cur_x--;

		if (cur_z < z)
			cur_z++;
		else if (cur_z > z)
			cur_z--;

		addStep(cur_x, cur_z);
	}
}
コード例 #8
0
 void addTableStepDefinitionWithId(step_id_type desiredId, const std::string &stepMatcher, const unsigned short expectedSize) {
     StepInfo *stepInfo = new StepInfoWithTableArg(stepMatcher, expectedSize);
     stepInfo->id = desiredId;
     addStep(stepInfo);
 }
コード例 #9
0
 void addPendingStepDefinitionWithId(step_id_type desiredId,
         const std::string &stepMatcher, const char *description) {
     StepInfo *stepInfo = new StepInfoPending(stepMatcher, description);
     stepInfo->id = desiredId;
     addStep(stepInfo);
 }
コード例 #10
0
 void addStepDefinitionWithId(step_id_type desiredId, const std::string &stepMatcher,
         const std::string source) {
     StepInfo *stepInfo = new StepInfoNoOp(stepMatcher, source);
     stepInfo->id = desiredId;
     addStep(stepInfo);
 }
コード例 #11
0
 step_id_type addStepDefinition(const std::string &stepMatcher) {
     StepInfo *stepInfo = new StepInfoNoOp(stepMatcher, "");
     addStep(stepInfo);
     return stepInfo->id;
 }
コード例 #12
0
// virtual
BOOL LLPreviewGesture::handleDragAndDrop(S32 x, S32 y, MASK mask, BOOL drop,
										 EDragAndDropType cargo_type,
										 void* cargo_data,
										 EAcceptance* accept,
										 LLString& tooltip_msg)
{
	BOOL handled = TRUE;
	switch(cargo_type)
	{
	case DAD_ANIMATION:
	case DAD_SOUND:
		{
			// TODO: Don't allow this if you can't transfer the sound/animation

			// make a script step
			LLInventoryItem* item = (LLInventoryItem*)cargo_data;
			if (item
				&& gInventory.getItem(item->getUUID()))
			{
				LLPermissions perm = item->getPermissions();
				if (!((perm.getMaskBase() & PERM_ITEM_UNRESTRICTED) == PERM_ITEM_UNRESTRICTED))
				{
					*accept = ACCEPT_NO;
					if (tooltip_msg.empty())
					{
						tooltip_msg.assign("Only animations and sounds\n"
											"with unrestricted permissions\n"
											"can be added to a gesture.");
					}
					break;
				}
				else if (drop)
				{
					LLScrollListItem* line = NULL;
					if (cargo_type == DAD_ANIMATION)
					{
						line = addStep("Animation");
						LLGestureStepAnimation* anim = (LLGestureStepAnimation*)line->getUserdata();
						anim->mAnimAssetID = item->getAssetUUID();
						anim->mAnimName = item->getName();
					}
					else if (cargo_type == DAD_SOUND)
					{
						line = addStep("Sound");
						LLGestureStepSound* sound = (LLGestureStepSound*)line->getUserdata();
						sound->mSoundAssetID = item->getAssetUUID();
						sound->mSoundName = item->getName();
					}
					updateLabel(line);
					mDirty = TRUE;
					refresh();
				}
				*accept = ACCEPT_YES_COPY_MULTI;
			}
			else
			{
				// Not in user's inventory means it was in object inventory
				*accept = ACCEPT_NO;
			}
			break;
		}
	default:
		*accept = ACCEPT_NO;
		if (tooltip_msg.empty())
		{
			tooltip_msg.assign("Only animations and sounds\n"
								"can be added to a gesture.");
		}
		break;
	}
	return handled;
}
コード例 #13
0
void TupItemTweener::fromXml(const QString &xml)
{
    #ifdef K_DEBUG
        QString msg = "TupItemTweener::fromXml() - Tween content: ";
        #ifdef Q_OS_WIN
           qWarning() << msg;
           qWarning() << xml;
        #else
           tWarning() << msg;
           tWarning() << xml;
        #endif
    #endif
    
    QDomDocument doc;

    if (doc.setContent(xml)) {
        QDomElement root = doc.documentElement();

        k->name = root.attribute("name");
        k->type = TupItemTweener::Type(root.attribute("type").toInt());

        k->initFrame = root.attribute("initFrame").toInt();
        k->initLayer = root.attribute("initLayer").toInt();
        k->initScene = root.attribute("initScene").toInt();

        k->frames = root.attribute("frames").toInt();

        QString origin = root.attribute("origin"); // [x,y]
        QStringList list = origin.split(",");
        double x = list.first().toDouble();
        double y = list.last().toDouble();

        k->originPoint = QPointF(x, y); 

        if (k->type == TupItemTweener::Composed) {
            QDomElement settings = root.firstChildElement("settings");
            QDomNode node = settings.firstChild();

            while (!node.isNull()) {
                   QDomElement e = node.toElement();

                   if (!e.isNull()) {
                       if (e.tagName() == "position") {
                           // tError() << "TupItemTweener::fromXml() - Processing position settings";

                           k->tweenList.append(TupItemTweener::Position);
                           k->compPositionInitFrame = e.attribute("init").toInt();
                           k->compPositionFrames = e.attribute("frames").toInt();

                           k->path = e.attribute("coords");
                           k->intervals = e.attribute("intervals");
                       }
                       if (e.tagName() == "rotation") {
                           // tError() << "TupItemTweener::fromXml() - Processing rotation settings";

                           k->tweenList.append(TupItemTweener::Rotation);
                           k->compRotationInitFrame = e.attribute("init").toInt();
                           k->compRotationFrames = e.attribute("frames").toInt();

                           k->rotationType = TupItemTweener::RotationType(root.attribute("rotationType").toInt());
                           k->rotateSpeed = root.attribute("rotateSpeed").toInt();
                           k->rotateDirection = TupItemTweener::RotateDirection(root.attribute("rotateDirection").toInt());

                           if (k->rotationType == TupItemTweener::Partial) {
                               k->rotateLoop = root.attribute("rotateLoop").toInt();
                               k->rotateStartDegree = root.attribute("rotateStartDegree").toInt();
                               k->rotateEndDegree = root.attribute("rotateEndDegree").toInt();
                               k->rotateReverseLoop = root.attribute("rotateReverseLoop").toInt();
                           }
                       }

                       if (e.tagName() == "scale") {
                           // tError() << "TupItemTweener::fromXml() - Processing scale settings";

                           k->tweenList.append(TupItemTweener::Scale);
                           k->compScaleInitFrame = e.attribute("init").toInt();
                           k->compScaleFrames = e.attribute("frames").toInt();
                       }
                       if (e.tagName() == "shear") {
                           // tError() << "TupItemTweener::fromXml() - Processing shear settings";

                           k->tweenList.append(TupItemTweener::Shear);
                           k->compShearInitFrame = e.attribute("init").toInt();
                           k->compShearFrames = e.attribute("frames").toInt();
                       }
                       if (e.tagName() == "opacity") {
                           // tError() << "TupItemTweener::fromXml() - Processing opacity settings";

                           k->tweenList.append(TupItemTweener::Opacity);
                           k->compOpacityInitFrame = e.attribute("init").toInt();
                           k->compOpacityFrames = e.attribute("frames").toInt();
                       }
                       if (e.tagName() == "coloring") {
                           // tError() << "TupItemTweener::fromXml() - Processing coloring settings";
                           k->tweenList.append(TupItemTweener::Coloring);
                           k->colorFillType = FillType(e.attribute("fillType").toInt());
                           k->compColoringInitFrame = e.attribute("init").toInt();
                           k->compColoringFrames = e.attribute("frames").toInt();
                       }
                   }

                   node = node.nextSibling();
            }

        } else {
            if (k->type == TupItemTweener::Position) {
                k->path = root.attribute("coords");
                k->intervals = root.attribute("intervals");
            }

            if (k->type == TupItemTweener::Rotation) {
                k->rotationType = TupItemTweener::RotationType(root.attribute("rotationType").toInt()); 
                k->rotateSpeed = root.attribute("rotateSpeed").toInt();
                k->rotateDirection = TupItemTweener::RotateDirection(root.attribute("rotateDirection").toInt());

                if (k->rotationType == TupItemTweener::Partial) {
                    k->rotateLoop = root.attribute("rotateLoop").toInt();
                    k->rotateStartDegree = root.attribute("rotateStartDegree").toInt();
                    k->rotateEndDegree = root.attribute("rotateEndDegree").toInt();
                    k->rotateReverseLoop = root.attribute("rotateReverseLoop").toInt();
                }
            }

            if (k->type == TupItemTweener::Scale) {
                k->scaleAxes = TupItemTweener::TransformAxes(root.attribute("scaleAxes").toInt()); 
                k->scaleFactor = root.attribute("scaleFactor").toDouble(); 
                k->scaleIterations = root.attribute("scaleIterations").toInt();
                k->scaleLoop = root.attribute("scaleLoop").toInt();
                k->scaleReverseLoop = root.attribute("scaleReverseLoop").toInt();
            }

            if (k->type == TupItemTweener::Shear) {
                k->shearAxes = TupItemTweener::TransformAxes(root.attribute("shearAxes").toInt());
                k->shearFactor = root.attribute("shearFactor").toDouble();
                k->shearIterations = root.attribute("shearIterations").toInt();
                k->shearLoop = root.attribute("shearLoop").toInt();
                k->shearReverseLoop = root.attribute("shearReverseLoop").toInt();
            }

            if (k->type == TupItemTweener::Opacity) {
                k->initOpacityFactor = root.attribute("initOpacityFactor").toDouble();
                k->endOpacityFactor = root.attribute("endOpacityFactor").toDouble();
                k->opacityIterations = root.attribute("opacityIterations").toInt();
                k->opacityLoop = root.attribute("opacityLoop").toInt();
                k->opacityReverseLoop = root.attribute("opacityReverseLoop").toInt();
            }

            if (k->type == TupItemTweener::Coloring) {
                k->colorFillType = FillType(root.attribute("fillType").toInt());
                QString colorText = root.attribute("initialColor");
                QStringList list = colorText.split(",");
                int red = list.at(0).toInt();
                int green = list.at(1).toInt();
                int blue = list.at(2).toInt();
                k->initialColor = QColor(red, green, blue);

                colorText = root.attribute("endingColor");
                list = colorText.split(",");
                red = list.at(0).toInt();
                green = list.at(1).toInt();
                blue = list.at(2).toInt();
                k->endingColor = QColor(red, green, blue);

                k->colorIterations = root.attribute("colorIterations").toInt();
                k->colorLoop = root.attribute("colorLoop").toInt();
                k->colorReverseLoop = root.attribute("colorReverseLoop").toInt();
            }
        }

        QDomNode node = root.firstChildElement("step");

        while (!node.isNull()) {
               QDomElement e = node.toElement();

               if (!e.isNull()) {
                   if (e.tagName() == "step") {
                       QString stepDoc;
                       {
                           QTextStream ts(&stepDoc);
                           ts << node;
                       }

                       TupTweenerStep *step = new TupTweenerStep(0);
                       step->fromXml(stepDoc);
                       addStep(*step);

                       delete step;
                    }
                }

                node = node.nextSibling();
        }
    }
}
コード例 #14
0
ファイル: shuffle.cpp プロジェクト: speakman/qlc
bool Shuffle::loadXML(const QDomElement* root)
{
	t_fixture_id step_fxi = KNoID;
	int step_number = 0;

	QDomNode node;
	QDomElement tag;

	m_steps.clear();

	Q_ASSERT(root != NULL);

	if (root->tagName() != KXMLQLCFunction)
	{
		qDebug() << "Function node not found!";
		return false;
	}

	/* Load chaser contents */
	node = root->firstChild();
	while (node.isNull() == false)
	{
		tag = node.toElement();

		if (tag.tagName() == KXMLQLCBus)
		{
			/* Bus */
			setBus(tag.text().toInt());
		}
		else if (tag.tagName() == KXMLQLCFunctionDirection)
		{
			/* Direction */
			setDirection(Function::stringToDirection(tag.text()));
		}
		else if (tag.tagName() == KXMLQLCFunctionRunOrder)
		{
			/* Run Order */
			setRunOrder(Function::stringToRunOrder(tag.text()));
		}
		else if (tag.tagName() == KXMLQLCFunctionStep)
		{
			step_number = 
				tag.attribute(KXMLQLCFunctionNumber).toInt();
			step_fxi = tag.text().toInt();

			if (step_number >= m_steps.size())
				addStep(step_fxi);
			else
				m_steps.insert(step_number,
					       new SceneState(step_fxi));
		}
		else
		{
			qDebug() << "Unknown chaser tag:" << tag.tagName();
		}

		node = node.nextSibling();
	}


	//always add a blackout state to the end!
	BlackoutState *b = new BlackoutState();
	m_steps.append(b);

	return true;
}
コード例 #15
0
ファイル: chaser.cpp プロジェクト: speakman/qlc
void Chaser::createContents(QList<QString> &list)
{
  QString device = QString::null;
  QString function = QString::null;
  
  for (QString* s = list.next(); s != NULL; s = list.next())
    {
      if (*s == QString("Entry"))
	{
	  s = list.prev();
	  break;
	}
      else if (*s == QString("Device"))
	{
	  device = *(list.next());
	}
      else if (*s == QString("Function"))
	{
	  function = *(list.next());
	  
	  if (device == QString("Global"))
	    {
	      Function* f = _app->doc()->searchFunction(function);
	      if (f != NULL)
		{
		  addStep(NULL, f);
		}
	      else
		{
		  qDebug("Unable to find member <" + function + "> for Function Collection <" + name() + ">");
		}
	    }
	  else
	    {
	      Device* d = _app->doc()->searchDevice(device, DeviceClass::ANY);
	      Function* f = NULL;
	      if (d != NULL)
		{
		  f = d->searchFunction(function);
		  if (f != NULL)
		    {
		      addStep(d, f);
		    }
		  else if ((f = d->deviceClass()->searchFunction(function)) != NULL)
		    {
		      addStep(d, f);
		    }
		  else
		    {
		      qDebug("Unable to find member <" + function + "> for Function Collection <" + name() + ">");
		    }
		}

	      device = QString::null;
	      function = QString::null;
	    }
	}
      else
	{
	  // Unknown keyword (at this time)
	  list.next();
	}
    }
}