static PyObject *meth_QPropertyAnimation_targetObject(PyObject *sipSelf, PyObject *sipArgs)
{
    PyObject *sipParseErr = NULL;

    {
        QPropertyAnimation *sipCpp;

        if (sipParseArgs(&sipParseErr, sipArgs, "B", &sipSelf, sipType_QPropertyAnimation, &sipCpp))
        {
            QObject *sipRes;

            Py_BEGIN_ALLOW_THREADS
            sipRes = sipCpp->targetObject();
            Py_END_ALLOW_THREADS

            return sipConvertFromType(sipRes,sipType_QObject,NULL);
        }
    }
Пример #2
0
void Window::disappear(){
    QPropertyAnimation *scale_x = new QPropertyAnimation(scaleTransform, "xScale");
    QPropertyAnimation *scale_y = new QPropertyAnimation(scaleTransform, "yScale");
    QPropertyAnimation *opacity = new QPropertyAnimation(this,"opacity");
    QParallelAnimationGroup *group = new QParallelAnimationGroup();

    scale_x->setEndValue(1.05);
    scale_y->setEndValue(0.95);
    opacity->setEndValue(0.0);
    group->addAnimation(scale_x);
    group->addAnimation(scale_y);
    group->addAnimation(opacity);

    group->start();

    if(!keep_when_disappear)
        connect(group, SIGNAL(finished()), this, SLOT(deleteLater()));
}
Пример #3
0
void Window::appear(){
    QPropertyAnimation *scale_x = new QPropertyAnimation(scaleTransform, "xScale");
    QPropertyAnimation *scale_y = new QPropertyAnimation(scaleTransform, "yScale");
    QPropertyAnimation *opacity = new QPropertyAnimation(this,"opacity");

    QParallelAnimationGroup *group = new QParallelAnimationGroup();


    scale_x->setEndValue(1);
    scale_y->setEndValue(1);
    opacity->setEndValue(1.0);
    group->addAnimation(scale_x);
    group->addAnimation(scale_y);
    group->addAnimation(opacity);

    group->start(QAbstractAnimation::DeleteWhenStopped);

}
Пример #4
0
void MWindow::gameFinished()
{
    for(int i = 9; i < 13; i++){
        CardPile pile = piles[i];
        NodeT<CardLabel*> *node = pile.first();
        for(int j = 0; j < pile.getCount(); j++){
            if(node != 0){
                QPropertyAnimation *animation = new QPropertyAnimation(node->value, "pos");
                 animation->setDuration((13+13)*100 - i*100 - j*100);
                 animation->setStartValue(node->value->pos());
                 animation->setEndValue(QPoint(20, 480));

                 animation->start();
                 node = node->next;
            }
        }
    }
    QMessageBox::information(this, "Felicidades!", "Has completado el juego!! Wiii! ^_^", QMessageBox::Ok);
}
Пример #5
0
 void EtherMenu::ZOrderObjectBasedOnPriority(int index, int priority, bool animated)
 {
     InfoCard* obj = objects_.at(index);
     if (animated)
     {
         QPropertyAnimation* anim = dynamic_cast<QPropertyAnimation*>(dynamic_cast<QParallelAnimationGroup*>(animations_->animationAt(index))->animationAt(3));
         if (anim)
         {
             anim->stop();
             anim->setStartValue(obj->scale());
             anim->setEndValue(max_visible_objects_- priority);
             anim->start();
         }
     }
     else
     {
         obj->setZValue(max_visible_objects_- priority);
     }
 }
Пример #6
0
void PaneWidget::pressing(const QPointF & pos)
{
    if (width() < 2 || height() < 2)
        return;
    double px = m_range.left() + m_range.width() * pos.x() / (double)(width() - 1);
    double py = m_range.top() + m_range.height() * pos.y() / (double)(height() - 1);
    QPointF endValue = QPointF(qBound(m_range.left(), (qreal)px, m_range.right()), qBound(m_range.top(), (qreal)py, m_range.bottom()));
#if QT_VERSION >= 0x040600
    // animate the change
    QPropertyAnimation * ani = new QPropertyAnimation(this, "value");
    ani->setEasingCurve(QEasingCurve::OutCubic);
    ani->setDuration(500);
    ani->setEndValue(endValue);
    ani->start(QPropertyAnimation::DeleteWhenStopped);
#else
    // set the final value
    setValue(endValue);
#endif
}
Пример #7
0
void Sprite::start(int loops)
{
    if(loops<0)loops=0;
    QMapIterator<QString, AnimationLine*> i(lines);
    QParallelAnimationGroup *pgroup = new QParallelAnimationGroup;

    while (i.hasNext())  {
        i.next();
        AnimationLine * line = i.value();
        const QByteArray &name = i.key().toLocal8Bit();
        QSequentialAnimationGroup *sgroup = new QSequentialAnimationGroup;

        QMapIterator<int,qreal> j(line->frames);

        while(j.hasNext())
        {
            j.next();

            QPropertyAnimation *trans = new QPropertyAnimation(this,name);
            trans->setStartValue(j.value());
            trans->setEasingCurve(line->easings[j.key()]);
            if(j.hasNext())
            {
                trans->setEndValue(j.peekNext().value());
                trans->setDuration(j.peekNext().key()-j.key());
            }
            else
            {
                trans->setEndValue(j.value());
                trans->setDuration(total_time - j.key());
            }
            sgroup->addAnimation(trans);
        }
        QPropertyAnimation *trans = new QPropertyAnimation(this,name);
        trans->setEndValue(line->frames[0]);
        trans->setDuration(resetTime);
        sgroup->addAnimation(trans);

        pgroup->addAnimation(sgroup);
    }

    if(--loops)connect(pgroup,SIGNAL(finished()),this,SLOT(start(int)));
    else connect(pgroup,SIGNAL(finished()),this,SLOT(deleteLater()));
Пример #8
0
SelectFile::SelectFile(QWidget *parent) :
    QDialog(parent),currentHeight(1),
    ui(new Ui::SelectFile)
{
    ui->setupUi(this);

    setWindowFlags(Qt::FramelessWindowHint);
    QPixmap mask(":/Images/images/ui_selectfile.png");//加载掩码图像
    setMask(QBitmap(mask.mask())); //设置窗体的掩码图像,抠除图像的白色区域实现不规则窗体
    QPalette p;//设置调色板
    p.setBrush(QPalette::Window, QBrush(mask));//将调色板的画刷设置为掩码位图,在不规则窗体上显示出掩码位图
    setPalette(p);

    //添加渐变动画
    QPropertyAnimation *animation = new QPropertyAnimation(this, "windowOpacity"); //动画对象类型:渐变
    animation->setDuration(1000); //维持1秒
    animation->setStartValue(0);  //起始α值
    animation->setEndValue(1);    //结束α值
    animation->start();           //动画开始

    ui->label_5->hide();
    loadMovie=new QMovie(":/Images/images/loading_2.gif");
    ui->label_5->setMovie(loadMovie);

    ui->pushButton_4->setStyleSheet("QPushButton{border-image: url(:/Images/images/pb_select_work_normal.png);}"
                                   "QPushButton:hover{border-image: url(:/Images/images/pb_select_work_hover.png);}"
                                     "QPushButton:pressed{border-image: url(:/Images/images/pb_select_work_press.png);}");
    ui->pushButton_5->setStyleSheet("QPushButton{border-image: url(:/Images/images/pb_mainui_close_normal.png);}"
                                    "QPushButton:hover{border-image: url(:/Images/images/pb_mainui_close_hover.png);}"
                                    "QPushButton:pressed{border-image: url(:/Images/images/pb_mainui_close_press.png);}");

    timer_Expand = new QTimer() ;
    timer_Expand->start(5);
    connect(timer_Expand,SIGNAL(timeout()),this,SLOT(showFlash()));

    m_fsw = new QFileSystemWatcher;
    connect(m_fsw, SIGNAL(directoryChanged(QString)), this,SLOT(copyFile(QString)));


    QDir dir;
    root_path = QDir::currentPath() + "//release"; ;
}
Пример #9
0
//打开主界面
void MinMusicWidget::slot_OpenMainWidget()
{
    if (m_parent->isHidden())
    {
        QPropertyAnimation *mainWidgetAnimation = new QPropertyAnimation(m_parent, "windowOpacity");
        mainWidgetAnimation->setDuration(500);
        mainWidgetAnimation->setStartValue(0);
        mainWidgetAnimation->setEndValue(1);
        mainWidgetAnimation->start();
        m_parent->show();
        emit sig_ShowMusicPanel();

        QPropertyAnimation *minWidgetAnimation = new QPropertyAnimation(this, "windowOpacity");
        minWidgetAnimation->setDuration(500);
        minWidgetAnimation->setStartValue(1);
        minWidgetAnimation->setEndValue(0);
        minWidgetAnimation->start();
        connect(minWidgetAnimation, SIGNAL(finished()), this, SLOT(slot_HideMinWidget()));
    }
}
Пример #10
0
void AbstractContent::dispose()
{
    // stick this item
    setFlags((GraphicsItemFlags)0x00);

    // fade out mirror too
    setMirrorEnabled(false);

    // little rotate animation
#if QT_VERSION >= 0x040600
    QPropertyAnimation * ani = new QPropertyAnimation(this, "rotation");
    ani->setEasingCurve(QEasingCurve::InQuad);
    ani->setDuration(300);
    ani->setEndValue(-30.0);
    ani->start(QPropertyAnimation::DeleteWhenStopped);
#endif

    // standard disposition
    AbstractDisposeable::dispose();
}
Пример #11
0
void IconButton::animateShow(bool visible) {
    if (visible) {
        QPropertyAnimation *animation = new QPropertyAnimation(this, "iconOpacity");
        animation->setDuration(FADE_TIME);
        animation->setEndValue(1.0);
        animation->start(QAbstractAnimation::DeleteWhenStopped);
    } else {
        QPropertyAnimation *animation = new QPropertyAnimation(this, "iconOpacity");
        animation->setDuration(FADE_TIME);
        animation->setEndValue(0.0);
        animation->start(QAbstractAnimation::DeleteWhenStopped);
    }
}
Пример #12
0
void KItemListViewAnimation::slotFinished()
{
    QPropertyAnimation* finishedAnim = qobject_cast<QPropertyAnimation*>(sender());
    for (int type = 0; type < AnimationTypeCount; ++type) {
        QMutableHashIterator<QGraphicsWidget*, QPropertyAnimation*> it(m_animation[type]);
        while (it.hasNext()) {
            it.next();
            QPropertyAnimation* propertyAnim = it.value();
            if (propertyAnim == finishedAnim) {
                QGraphicsWidget* widget = it.key();
                it.remove();
                finishedAnim->deleteLater();

                emit finished(widget, static_cast<AnimationType>(type));
                return;
            }
        }
    }
    Q_ASSERT(false);
}
Пример #13
0
/* if the help string is empty, the help widget disappears. */
void TextSelection::showHelp( const QString& help )
{
  mHelpDisplay->setText( help );
  if( help.isEmpty() ) {
    mHelpDisplay->hide();
  } else {
    mHelpDisplay->show();
#if 0
    kDebug() << "Displaying help text: " << help;

    QPropertyAnimation *ani = new QPropertyAnimation( mHelpDisplay, "geometry" );
    QRect r2 = r1;
    r2.setHeight( 200 );
    ani->setDuration( 2000 );
    ani->setStartValue( r1 );
    ani->setEndValue( r2 );
    ani->start();
#endif
  }
}
Пример #14
0
void KItemListViewAnimation::stop(QGraphicsWidget* widget, AnimationType type)
{
    QPropertyAnimation* propertyAnim = m_animation[type].value(widget);
    if (propertyAnim) {
        propertyAnim->stop();

        switch (type) {
        case MovingAnimation: break;
        case CreateAnimation: widget->setOpacity(1.0); break;
        case DeleteAnimation: widget->setOpacity(0.0); break;
        case ResizeAnimation: break;
        default: break;
        }

        m_animation[type].remove(widget);
        delete propertyAnim;

        emit finished(widget, type);
    }
}
Пример #15
0
QPropertyAnimation* LinearLayoutActor::createMoveToAnimation(const char* propertyName, qreal endProportion, qreal startProportion, int duration, int initialDelay)
{
	// Adjust animation time
	duration = VisualizationSpeed::getInstance().adjust(duration);
	int totalDuration = initialDelay + duration;

	// Create an animation and set its duration
	QPropertyAnimation* animation = new QPropertyAnimation(this, propertyName, this);
	animation->setDuration(totalDuration);

	// Stay at the current proportion at the beginning of the animation
	animation->setKeyValueAt(0.0, startProportion);

	// After the delay is finished, start from the current porportion
	if ( totalDuration > 0 )
		animation->setKeyValueAt(qreal(initialDelay) / totalDuration, startProportion);

	// At the end of the animation, reach the desired end proportion
	animation->setKeyValueAt(1.0, endProportion);
	return animation;
}
void WSOverlayScreenShotAnimation::start()
{
	if (m_animation) {
		m_animation->stop();
		delete m_animation;
	}

	setVisible(true);	

	int duration = 900;

	QPropertyAnimation* opacityAnimation = new QPropertyAnimation(this, "opacity");
	opacityAnimation->setDuration(duration);
	opacityAnimation->setStartValue(1.0);
	opacityAnimation->setEndValue(0.0);

	m_animation = opacityAnimation;
	m_animation->start(QAbstractAnimation::DeleteWhenStopped);

	connect(m_animation, SIGNAL(finished()), SLOT(finished()));
}
Пример #17
0
void DockPanel::initShowHideAnimation()
{
    QStateMachine * machine = new QStateMachine(this);

    QState * showState = new QState(machine);
    showState->assignProperty(this,"y", 0);
    QState * hideState = new QState(machine);
    //y should change with DockMode changed
    connect(this, &DockPanel::startHide, [=]{
        hideState->assignProperty(this,"y", m_dockModeData->getDockHeight());
    });
    machine->setInitialState(showState);

    QPropertyAnimation *showAnimation = new QPropertyAnimation(this, "y");
    showAnimation->setDuration(SHOW_ANIMATION_DURATION);
    showAnimation->setEasingCurve(SHOW_EASINGCURVE);
    connect(showAnimation,&QPropertyAnimation::finished,this,&DockPanel::onShowPanelFinished);

    QPropertyAnimation *hideAnimation = new QPropertyAnimation(this, "y");
    hideAnimation->setDuration(HIDE_ANIMATION_DURATION);
    hideAnimation->setEasingCurve(HIDE_EASINGCURVE);
    connect(hideAnimation,&QPropertyAnimation::finished,this,&DockPanel::onHidePanelFinished);

    QSignalTransition *st = showState->addTransition(this,SIGNAL(startHide()), hideState);
    st->addAnimation(hideAnimation);
    QSignalTransition *ht = hideState->addTransition(this,SIGNAL(startShow()),showState);
    ht->addAnimation(showAnimation);

    machine->start();
}
void RocketStorageAuthDialog::Show()
{
    if (isVisible())
        return;
        
    show();
    setFocus(Qt::ActiveWindowFocusReason);
    activateWindow();
    
    setWindowOpacity(0.0);

    QPropertyAnimation *showAnim = new QPropertyAnimation(this, "windowOpacity", this);
    showAnim->setStartValue(0.0);
    showAnim->setEndValue(1.0);
    showAnim->setDuration(300);
    showAnim->setEasingCurve(QEasingCurve(QEasingCurve::InOutQuad)); 
    showAnim->start();

    plugin_->Notifications()->CenterToMainWindow(this);
    if (!plugin_->Notifications()->IsForegroundDimmed())
    {
        plugin_->Notifications()->DimForeground();
        restoreForeground_ = true;
    }
}
void RocketStorageInfoDialog::Open()
{
    if (isVisible())
        return;
        
    show();
    setFocus(Qt::ActiveWindowFocusReason);
    activateWindow();

    setWindowOpacity(0.0);

    QPropertyAnimation *showAnim = new QPropertyAnimation(this, "windowOpacity", this);
    showAnim->setStartValue(0.0);
    showAnim->setEndValue(1.0);
    showAnim->setDuration(300);
    showAnim->setEasingCurve(QEasingCurve(QEasingCurve::InOutQuad)); 
    showAnim->start();
    
    plugin_->Notifications()->CenterToMainWindow(this);
    plugin_->Notifications()->DimForeground();
    
    // If input mode is enabled, focus the input field and 
    // select the text so user can start writing.
    if (ui.lineEditInput->isVisible())
    {
        ui.lineEditInput->setFocus(Qt::MouseFocusReason);
        ui.lineEditInput->selectAll();
    }
}
Пример #20
0
void Board::clearPieces()
{
    if (playerGoesFirst == 1)
        playerGoesFirst = currentPlayer = 2;
    else
        playerGoesFirst = currentPlayer = 1;
    gameResultText->hide();
    /*for (int i=0; i<animations.size(); i++)
    {
        delete animations[i];
    }
    animations.clear();*/
    clearAnimations = new QParallelAnimationGroup();
    QPropertyAnimation* animation;
    for (int i=0; i<pieces.size(); i++)
    {
        animation = new QPropertyAnimation(pieces[i], "pos");
        animation->setDuration(1000);
        animation->setStartValue(QPointF(pieces[i]->x(), pieces[i]->y()));
        animation->setEndValue(QPointF(pieces[i]->x(), this->originalHeight));
        animation->setEasingCurve(QEasingCurve::InQuad);
        connect(animation,SIGNAL(finished()),animation->targetObject(),SLOT(removeFromScene()));
        clearAnimations->addAnimation(animation);
    }
    clearAnimations->start();
    currentPiece = new Piece(currentPlayer, this);
}
Пример #21
0
progdlg_t * ProgressBar::show(bool animate, bool terminate_is_stop, gboolean *stop_flag, int value) {

    terminate_is_stop_ = terminate_is_stop;
    stop_flag_ = stop_flag;

    setValue(value);

#if !defined(Q_OS_MAC) || QT_VERSION > QT_VERSION_CHECK(5, 0, 0)
    if (animate) {
        QGraphicsOpacityEffect *effect = new QGraphicsOpacityEffect(this);
        this->setGraphicsEffect(effect);

        QPropertyAnimation *animation = new QPropertyAnimation(effect, "opacity");

        animation->setDuration(750);
        animation->setStartValue(0.1);
        animation->setEndValue(1.0);
        animation->setEasingCurve(QEasingCurve::InOutQuad);
        animation->start();
    }
#else
    Q_UNUSED(animate);
#endif

    QProgressBar::show();
    return &progress_dialog_;
}
Пример #22
0
void Notify::showGriant()
{
    this->show();

    titleLabel->setText(title);
    QPixmap tempPix = QPixmap(this->icon);
    tempPix = tempPix.scaled(QSize(30, 30), Qt::KeepAspectRatio);
    iconLabel->setPixmap(tempPix);

    backgroundLabel->setFixedSize(this->size());
    closeBtn->move(backgroundLabel->width() - closeBtn->width(), 0);

    // 超过长度省略号
    QFontMetrics elidfont(bodyLabel->font());
    QString text = elidfont.elidedText(this->body, Qt::ElideRight,
                                       bodyLabel->width() - 5);
    bodyLabel->setText(text);

    QPropertyAnimation *animation = new QPropertyAnimation(this, "windowOpacity", this);
    animation->setStartValue(0);
    animation->setEndValue(1);
    animation->setDuration(200);
    animation->start();

    connect(animation, &QPropertyAnimation::finished, this, [animation, this](){
        animation->deleteLater();
        QTimer::singleShot(displayTime, this, [this](){
            this->hideGriant();
        });
    });
}
Пример #23
0
void TabBar::setTabHighlighted(int index)
{
    const QByteArray propertyName = highlightPropertyName(index);
    const QColor highlightColor = KColorScheme(QPalette::Active, KColorScheme::Window).foreground(KColorScheme::PositiveText).color();

    if (tabTextColor(index) != highlightColor)
    {
        if (ReKonfig::animatedTabHighlighting())
        {
            m_tabHighlightEffect->setEnabled(true);
            m_tabHighlightEffect->setProperty(propertyName, qreal(0.9));
            QPropertyAnimation *anim = new QPropertyAnimation(m_tabHighlightEffect, propertyName);
            m_highlightAnimation.insert(propertyName, anim);

            //setup the animation
            anim->setStartValue(0.9);
            anim->setEndValue(0.0);
            anim->setDuration(500);
            anim->setLoopCount(2);
            anim->start(QAbstractAnimation::DeleteWhenStopped);

            m_animationMapper->setMapping(anim, index);
            connect(anim, SIGNAL(finished()), m_animationMapper, SLOT(map()));
        }

        setTabTextColor(index, highlightColor);
    }
}
Пример #24
0
void DeckHandler::adjustDrawSize()
{
    if(drawAnimating)
    {
        QTimer::singleShot(ANIMATION_TIME+50, this, SLOT(adjustDrawSize()));
        return;
    }

    int rowHeight = ui->drawListWidget->sizeHintForRow(0);
    int rows = drawCardList.count();
    int height = rows*rowHeight + 2*ui->drawListWidget->frameWidth();
    int maxHeight = (ui->drawListWidget->height()+ui->enemyHandListWidget->height())*4/5;
    if(height>maxHeight)    height = maxHeight;

    QPropertyAnimation *animation = new QPropertyAnimation(ui->drawListWidget, "minimumHeight");
    animation->setDuration(ANIMATION_TIME);
    animation->setStartValue(ui->drawListWidget->minimumHeight());
    animation->setEndValue(height);
    animation->setEasingCurve(QEasingCurve::OutBounce);
    animation->start();

    QPropertyAnimation *animation2 = new QPropertyAnimation(ui->drawListWidget, "maximumHeight");
    animation2->setDuration(ANIMATION_TIME);
    animation2->setStartValue(ui->drawListWidget->maximumHeight());
    animation2->setEndValue(height);
    animation2->setEasingCurve(QEasingCurve::OutBounce);
    animation2->start();

    this->drawAnimating = true;
    connect(animation, SIGNAL(finished()),
            this, SLOT(clearDrawAnimating()));
}
Пример #25
0
void GraphicsView::rotateRobotAbs(double angle, int durationInMs)
{
    if(durationInMs < 0)
    {
        double offset = abs(angle-robot->rotation());
        offset = offset * 1000.0 / 180.0; // a 180 degree rotation takes 1 seconds
        durationInMs = qRound(offset);
    }
    if(durationInMs > 5)
    {
        QPropertyAnimation *anim = new QPropertyAnimation(robot, "rotation");
        anim->setEndValue(angle);
        anim->setDuration(durationInMs);
        connect(anim, SIGNAL(finished()), SIGNAL(movementFinished()));
        anim->start(QAbstractAnimation::DeleteWhenStopped);
    }
    else
    {
        robot->setRotation(angle);
        emit movementFinished();
    }
}
Пример #26
0
void ShortLocater::on_ShortCalib_2_clicked()
{
    m_objoffset=new offset(IDMMLib,this);
    QPropertyAnimation *animation = new QPropertyAnimation(m_objoffset, "geometry");
    animation->setDuration(10000);
    animation->setStartValue(QRect(300, 200, 50, 50));
    animation->setEndValue(QRect(300, 300, 240, 170));
    animation->setEasingCurve(QEasingCurve::Linear);
    animation->setDuration(1000);
    animation->start();
    m_objoffset->show();
}
Пример #27
0
void Unite::animationDeplacement(vector<Case *> chemin ) {
    this->setSelected(false);
     float decalageX,decalageY;
     Case* caseActu=chemin[0];
     QSequentialAnimationGroup *group = new QSequentialAnimationGroup();
     QSequentialAnimationGroup *animPm = new QSequentialAnimationGroup();
     QParallelAnimationGroup *groupPara = new QParallelAnimationGroup();

     QPointF OS = offset();
     int anim;
     int j=1;

     for (unsigned int i=1;i<chemin.size(); i++) {
         QPropertyAnimation *animation = new QPropertyAnimation(this, "offset");
         animation->setDuration(200);

         decalageX = (chemin[i]->getX()-caseActu->getX())*SIZE;
         decalageY = (chemin[i]->getY()-caseActu->getY())*SIZE;

         if (decalageX>0)
             anim=30;
         else if (decalageX<0)
             anim=20;
         else if (decalageY<0)
             anim=10;
         else if (decalageY>0)
             anim=0;

         QPropertyAnimation *animPix = new QPropertyAnimation(this, "pixmap");
         animPix->setDuration(200);
         animPix->setStartValue(anim);
         animPix->setEndValue(anim+7);
         animPm->addAnimation(animPix);

         animation->setStartValue(OS);
         OS=QPointF(OS.x()+decalageX,OS.y()+decalageY);
         animation->setEndValue(OS);
         group->addAnimation(animation);

         j++;
         caseActu=chemin[i];
     }

     groupPara->addAnimation(group);
     groupPara->addAnimation(animPm);
     groupPara->start();
     this->setSelected(true);
}
Пример #28
0
OperazioniDlg::OperazioniDlg(modalitaType modalitaCorrente, QPoint startPoint, QWidget *parent) :
    QDialog(parent),
    ui(new Ui::OperazioniDlg)
{
    ui->setupUi(this);
    setWindowFlags(Qt::Popup|Qt::FramelessWindowHint);
    //setWindowModality(Qt::ApplicationModal);
    //setWindowFlags(Qt::FramelessWindowHint);
    setAttribute(Qt::WA_TranslucentBackground);
    activateWindow();

    switch (modalitaCorrente) {
    case CASSA:
        ui->cassaBtn->setDisabled(true);
        break;
    case TEST:
        ui->testBtn->setDisabled(true);
        //ui->gestioneBtn->setDisabled(true);
        //ui->stornoBtn->setDisabled(true);
        break;
    case GESTIONE:
        ui->gestioneBtn->setDisabled(true);
        //ui->testBtn->setDisabled(true);
        break;
    }

    QPoint pos = startPoint;
    QPropertyAnimation *effetto = new QPropertyAnimation(this, "geometry");
    effetto->setStartValue(QRect(pos.x(), pos.y(), minimumSize().width(), minimumSize().height()));
    effetto->setEndValue(QRect(pos.x(), pos.y() - maximumSize().height(), maximumSize().width(), maximumSize().height()));
    //effetto->setStartValue(QRect(pos.x(),pos.y(),geometry().width(),0));
    //effetto->setEndValue(QRect(pos.x(),pos.y()-geometry().height(),geometry().width(),geometry().height()));
    effetto->setDuration(300);
    //effetto->setEasingCurve(QEasingCurve::OutBack);
    connect(effetto, SIGNAL(finished()), this, SLOT(init()));

    effetto->start(QAbstractAnimation::DeleteWhenStopped);
}
Пример #29
0
void AudioChatWidgetHolder::addAudioData(const QString name, QByteArray* array)
{
    if (!audioMuteCaptureToggleButton->isChecked()) {
        //launch an animation. Don't launch it if already animating
        if (!audioMuteCaptureToggleButton->graphicsEffect() ||
            (audioMuteCaptureToggleButton->graphicsEffect()->inherits("QGraphicsOpacityEffect") &&
                ((QGraphicsOpacityEffect*)audioMuteCaptureToggleButton->graphicsEffect())->opacity() == 1)
            ) {
            QGraphicsOpacityEffect *effect = new QGraphicsOpacityEffect(audioListenToggleButton);
            audioMuteCaptureToggleButton->setGraphicsEffect(effect);
            QPropertyAnimation *anim = new QPropertyAnimation(effect, "opacity");
            anim->setStartValue(1);
            anim->setKeyValueAt(0.5,0);
            anim->setEndValue(1);
            anim->setDuration(400);
            anim->start();
        }

//        soundManager->play(VOIP_SOUND_INCOMING_CALL);

        audioMuteCaptureToggleButton->setToolTip(tr("Answer"));

        //TODO make a toaster and a sound for the incoming call
        return;
    }

    if (!outputDevice) {
        outputDevice = AudioDeviceHelper::getDefaultOutputDevice();
    }

    if (!outputProcessor) {
        //start output audio device
        outputProcessor = new QtSpeex::SpeexOutputProcessor();
        if (inputProcessor) {
            connect(outputProcessor, SIGNAL(playingFrame(QByteArray*)), inputProcessor, SLOT(addEchoFrame(QByteArray*)));
        }
        outputProcessor->open(QIODevice::ReadOnly | QIODevice::Unbuffered);
        outputDevice->start(outputProcessor);
    }

    if (outputDevice && outputDevice->error() != QAudio::NoError) {
        std::cerr << "Restarting output device. Error before reset " << outputDevice->error() << " buffer size : " << outputDevice->bufferSize() << std::endl;
        outputDevice->stop();
        outputDevice->reset();
        if (outputDevice->error() == QAudio::UnderrunError)
            outputDevice->setBufferSize(20);
        outputDevice->start(outputProcessor);
    }
    outputProcessor->putNetworkPacket(name, *array);

    //check the input device for errors
    if (inputDevice && inputDevice->error() != QAudio::NoError) {
        std::cerr << "Restarting input device. Error before reset " << inputDevice->error() << std::endl;
        inputDevice->stop();
        inputDevice->reset();
        inputDevice->start(inputProcessor);
    }
}
Пример #30
0
QStateMachine* UIAnimationFramework::installPropertyAnimation(QWidget *pTarget, const char *pszPropertyName,
                                                              const char *pszValuePropertyNameStart, const char *pszValuePropertyNameFinal,
                                                              const char *pSignalForward, const char *pSignalBackward,
                                                              bool fReversive /*= false*/, int iAnimationDuration /*= 300*/)
{
    /* State-machine: */
    QStateMachine *pStateMachine = new QStateMachine(pTarget);
    /* State-machine 'start' state: */
    QState *pStateStart = new QState(pStateMachine);
    /* State-machine 'final' state: */
    QState *pStateFinal = new QState(pStateMachine);

    /* State-machine 'forward' animation: */
    QPropertyAnimation *pForwardAnimation = new QPropertyAnimation(pTarget, pszPropertyName, pStateMachine);
    pForwardAnimation->setEasingCurve(QEasingCurve(QEasingCurve::InOutCubic));
    pForwardAnimation->setDuration(iAnimationDuration);
    pForwardAnimation->setStartValue(pTarget->property(pszValuePropertyNameStart));
    pForwardAnimation->setEndValue(pTarget->property(pszValuePropertyNameFinal));
    /* State-machine 'backward' animation: */
    QPropertyAnimation *pBackwardAnimation = new QPropertyAnimation(pTarget, pszPropertyName, pStateMachine);
    pBackwardAnimation->setEasingCurve(QEasingCurve(QEasingCurve::InOutCubic));
    pBackwardAnimation->setDuration(iAnimationDuration);
    pBackwardAnimation->setStartValue(pTarget->property(pszValuePropertyNameFinal));
    pBackwardAnimation->setEndValue(pTarget->property(pszValuePropertyNameStart));

    /* State-machine state transitions: */
    QSignalTransition *pDefaultToHovered = pStateStart->addTransition(pTarget, pSignalForward, pStateFinal);
    pDefaultToHovered->addAnimation(pForwardAnimation);
    QSignalTransition *pHoveredToDefault = pStateFinal->addTransition(pTarget, pSignalBackward, pStateStart);
    pHoveredToDefault->addAnimation(pBackwardAnimation);

    /* Initial state is 'start': */
    pStateMachine->setInitialState(!fReversive ? pStateStart : pStateFinal);
    /* Start hover-machine: */
    pStateMachine->start();
    /* Return machine: */
    return pStateMachine;
}