Beispiel #1
0
// Increment all Objects in the Manager
void AnimationManager::update()
{
	for (int i = 0; i < animationList.size(); i++)
	{
		AnimationEntry& entry = animationList[i];

		if (!entry.getIgnoreBattery() && (scnManager->skipAnimations || (GLOBAL(settings).disableAnimationsOnBattery && (evtManager->getACPowerStatus() == EventManager::Unplugged))))
		{
			finishAnimation(entry.getObject());
			i--;
			continue;
		}

		// If this entry is Started, increment its animation
		if (entry.getObject()->getAnimationState() == AnimStarted && !entry.isQueued())
		{
			// Increment Animation
			if (entry.delayComplete())
			{
				entry.getObject()->onAnimTick();

				if (!entry.getObject()->isAnimating())
				{
					// No animation is left, finish the animation
					finishedAnimation(entry);
					i--;
				}
			}
		}
	}
}
AlbumArtworkItem::AlbumArtworkItem(int size) {
    m_size = size;
    m_updatingArtwork = false;   // Not animating
    //_updateArtwork();            // Load an album cover
    //_switchArtwork();            // Display the loaded album cover

    // Setup animation to run for 1.5 seconds.
    m_timeline.setFrameRange(0, FRAME_RANGE);
    m_timeline.setDuration(1500);
    m_timeline.setCurveShape(QTimeLine::LinearCurve);
    connect(&m_timeline, SIGNAL(frameChanged(int)), SLOT(updateAnimation(int)));
    connect(&m_timeline, SIGNAL(finished()), SLOT(finishedAnimation()));
}
Beispiel #3
0
void AnimationManager::finishAnimation( Animatable * anim )
{
	// Loop through the animation list and remove the animation
	for (int i = 0; i < animationList.size(); i++)
	{
		const AnimationEntry& animEntry = animationList[i];

		if (animEntry.getObject() == anim)
		{
			animEntry.getObject()->finishAnimation();
			finishedAnimation(animEntry);
			i--;
		}
	}
}
Beispiel #4
0
void BikeDisplay::travel(unsigned int personId,unsigned int site1, unsigned int site2,unsigned int ms)
{
    static QMutex mutex;
    mutex.lock();


    QParallelAnimationGroup *group=new QParallelAnimationGroup(this);

    {
        BikeItem *bike=getFreeBike();
        bike->show();
        QPropertyAnimation *animation=new QPropertyAnimation(bike, "pos");
        animation->setDuration(ms-10);
        animation->setStartValue(m_sitePos[site1]-
                                 QPointF(BIKEWIDTH/2,BIKEWIDTH/2));
        animation->setEndValue(m_sitePos[site2]-
                               QPointF(BIKEWIDTH/2,BIKEWIDTH/2));

        group->addAnimation(animation);
    }
    {
        PersonItem *person=getPerson(personId);
        person->show();
        QPropertyAnimation *animation=new QPropertyAnimation(person, "pos");
        animation->setDuration(ms-10);
        animation->setStartValue(m_sitePos[site1]-
                                 QPointF(BIKEWIDTH/2,BIKEWIDTH*1.2));
        animation->setEndValue(m_sitePos[site2]-
                               QPointF(BIKEWIDTH/2,BIKEWIDTH*1.2));

        group->addAnimation(animation);
    }

    group->start();

    QObject::connect(group, SIGNAL(finished()), this,
                     SLOT(finishedAnimation()));

    mutex.unlock();
}
Beispiel #5
0
// =================
//        PRIVATE
// =================
void LWindowFrame::InitWindow(){
	anim = new QPropertyAnimation(this); //For simple window animations
	  anim->setTargetObject(this);
	  anim->setDuration(ANIMTIME); //In milliseconds
	  connect(anim, SIGNAL(finished()), this, SLOT(finishedAnimation()) );
	titleBar = new QLabel(this); //This is the "container" for all the title buttons/widgets
	  titleBar->setObjectName("TitleBar");
	  titleBar->setSizePolicy(QSizePolicy::Minimum,QSizePolicy::Minimum);
	  titleBar->setFocusPolicy(Qt::NoFocus);
	  titleBar->setCursor(Qt::ArrowCursor);
	title = new QLabel(this); //Shows the window title/text
	  title->setObjectName("Title");
	  title->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Preferred);
	  title->setCursor(Qt::ArrowCursor);
	  title->setFocusPolicy(Qt::NoFocus);
	icon = new QLabel(this); //Contains the window icon
	  icon->setObjectName("Icon");
	  icon->setCursor(Qt::ArrowCursor);
	  icon->setFocusPolicy(Qt::NoFocus);
	minB = new QToolButton(this); //Minimize Button
	  minB->setObjectName("Minimize");
	  minB->setCursor(Qt::ArrowCursor);
	  minB->setFocusPolicy(Qt::NoFocus);
	  connect(minB, SIGNAL(clicked()), this, SLOT(minClicked()) );
	maxB = new QToolButton(this); //Maximize Button
	  maxB->setObjectName("Maximize");
	  maxB->setCursor(Qt::ArrowCursor);
	  maxB->setFocusPolicy(Qt::NoFocus);
	  connect(maxB, SIGNAL(clicked()), this, SLOT(maxClicked()) );
	closeB = new QToolButton(this);
	  closeB->setObjectName("Close");
	  closeB->setCursor(Qt::ArrowCursor);
	  closeB->setFocusPolicy(Qt::NoFocus);
	  connect(closeB, SIGNAL(clicked()), this, SLOT(closeClicked()) );
	otherB = new QToolButton(this); //Button to place any other actions
	  otherB->setObjectName("Options");
	  otherB->setCursor(Qt::ArrowCursor);
	  otherB->setPopupMode(QToolButton::InstantPopup);
	  otherB->setStyleSheet("QToolButton::menu-indicator{ image: none; }");
	  otherB->setFocusPolicy(Qt::NoFocus);
	otherM = new QMenu(this); //menu of "other" actions for the window
	  otherB->setMenu(otherM);
	  connect(otherM, SIGNAL(triggered(QAction*)), this, SLOT(otherClicked(QAction*)) );
	//Now assemble the titlebar
	QHBoxLayout *HL = new QHBoxLayout(this);
	HL->setContentsMargins(0,0,0,0);
	HL->addWidget(otherB);
	HL->addWidget(icon);
	HL->addWidget(title);
	HL->addWidget(minB);
	HL->addWidget(maxB);
	HL->addWidget(closeB);
	titleBar->setLayout(HL);
	QVBoxLayout *VL = new QVBoxLayout(this);
	this->setLayout(VL);
	//The WinWidget container appears shifted right/down by 1 pixel for some reason
	// Adjust the margins to account for this variation
	VL->setContentsMargins(1,1,2,2); 
	VL->setSpacing(0);
	//Have the window take the same initial size of the client window
        QRect geom = LWM::SYSTEM->WM_Window_Geom(CID);
	qDebug() << " - Load Size Hints" << "initial size:" << geom.size();
	icccm_size_hints SH = LWM::SYSTEM->WM_ICCCM_GetNormalHints(CID);
	qDebug() << " - - Got Normal Hints";
	if(!SH.isValid()){ SH = LWM::SYSTEM->WM_ICCCM_GetSizeHints(CID); }
	qDebug() << " - - Start resizing...";
	if(SH.base_width>geom.width() && SH.base_height>geom.height()){ this->resize(SH.base_width, SH.base_height); }
	else if(SH.min_width>geom.width() && SH.min_height>geom.height()){ this->resize(SH.min_width, SH.min_height); }
	else if(SH.width>geom.width() && SH.height>geom.height()){ this->resize(SH.width, SH.height); }
	else if(geom.isNull()){ this->resize(100,80); }
        else{ this->resize( geom.size() ); }
	qDebug() << " - done";
	
	//Now embed the native window into the frame
	WIN = QWindow::fromWinId(CID);
	WinWidget = QWidget::createWindowContainer( WIN, this);
	  WinWidget->setCursor(Qt::ArrowCursor); //this is just a fallback - the window itself will adjust it
	//WINBACK = new QBackingStore(WIN); //create a data backup for the widget
	
	//Now assemble te initial layout for the window (all while still invisible)
	/*VL->addWidget(titleBar);
	VL->addWidget(WinWidget);
        VL->setStretch(1,1);*/
}