QTfrontend/hwform.cpp
changeset 6440 1fa9dc94c93f
parent 6428 2d2b5e3c59a7
child 6442 e6e409d9d6db
equal deleted inserted replaced
6439:cb7d84d3ebb4 6440:1fa9dc94c93f
    40 #include <QShortcut>
    40 #include <QShortcut>
    41 #include <QDesktopServices>
    41 #include <QDesktopServices>
    42 #include <QInputDialog>
    42 #include <QInputDialog>
    43 #include <QPropertyAnimation>
    43 #include <QPropertyAnimation>
    44 #include <QGraphicsEffect>
    44 #include <QGraphicsEffect>
       
    45 #include <QParallelAnimationGroup>
    45 
    46 
    46 #include "hwform.h"
    47 #include "hwform.h"
    47 #include "game.h"
    48 #include "game.h"
    48 #include "team.h"
    49 #include "team.h"
    49 #include "teamselect.h"
    50 #include "teamselect.h"
   558         stopAnim = true;
   559         stopAnim = true;
   559 
   560 
   560     if (frontendEffects && !stopAnim)
   561     if (frontendEffects && !stopAnim)
   561     {
   562     {
   562         /**Start animation :**/
   563         /**Start animation :**/
   563 
   564         int coeff = 1;
       
   565 #ifdef Q_OS_LINUX
       
   566         coeff = 2;
   564         QGraphicsOpacityEffect *effectNew = new QGraphicsOpacityEffect(ui.Pages->widget(id));
   567         QGraphicsOpacityEffect *effectNew = new QGraphicsOpacityEffect(ui.Pages->widget(id));
   565         ui.Pages->widget(id)->setGraphicsEffect(effectNew);
   568         ui.Pages->widget(id)->setGraphicsEffect(effectNew);
   566 
   569 
   567         QGraphicsOpacityEffect *effectLast = new QGraphicsOpacityEffect(ui.Pages->widget(lastid));
   570         QGraphicsOpacityEffect *effectLast = new QGraphicsOpacityEffect(ui.Pages->widget(lastid));
   568         ui.Pages->widget(lastid)->setGraphicsEffect(effectLast);
   571         ui.Pages->widget(lastid)->setGraphicsEffect(effectLast);
       
   572 #endif
   569 
   573 
   570         //New page animation
   574         //New page animation
   571         animationNewSlide = new QPropertyAnimation(ui.Pages->widget(id), "pos");
   575         animationNewSlide = new QPropertyAnimation(ui.Pages->widget(id), "pos");
   572         animationNewSlide->setDuration(500);
   576         animationNewSlide->setDuration(500);
   573         animationNewSlide->setStartValue(QPoint(width()/2, 0));
   577         animationNewSlide->setStartValue(QPoint(width()/coeff, 0));
   574         animationNewSlide->setEndValue(QPoint(0, 0));
   578         animationNewSlide->setEndValue(QPoint(0, 0));
   575         animationNewSlide->setEasingCurve(QEasingCurve::OutCubic);
   579         animationNewSlide->setEasingCurve(QEasingCurve::OutExpo);
   576         animationNewSlide->start();
   580 
   577 
   581 #ifdef Q_OS_LINUX
   578         animationNewOpacity = new QPropertyAnimation(effectNew, "opacity");
   582         animationNewOpacity = new QPropertyAnimation(effectNew, "opacity");
   579         animationNewOpacity->setDuration(500);
   583         animationNewOpacity->setDuration(500);
   580         animationNewOpacity->setStartValue(0.01);
   584         animationNewOpacity->setStartValue(0.01);
   581         animationNewOpacity->setEndValue(1);
   585         animationNewOpacity->setEndValue(1);
   582         animationNewOpacity->setEasingCurve(QEasingCurve::OutCubic);
   586         animationNewOpacity->setEasingCurve(QEasingCurve::OutExpo);
   583         animationNewOpacity->start();
   587 #endif
   584 
   588 
   585         //Last page animation
   589         //Last page animation
   586         ui.Pages->widget(lastid)->setHidden(false);
   590         ui.Pages->widget(lastid)->setHidden(false);
   587 
   591 
   588         animationOldSlide = new QPropertyAnimation(ui.Pages->widget(lastid), "pos");
   592         animationOldSlide = new QPropertyAnimation(ui.Pages->widget(lastid), "pos");
   589         animationOldSlide->setDuration(500);
   593         animationOldSlide->setDuration(500);
   590         animationOldSlide->setStartValue(QPoint(0, 0));
   594         animationOldSlide->setStartValue(QPoint(0, 0));
   591         animationOldSlide->setEndValue(QPoint(-width()/2, 0));
   595         animationOldSlide->setEndValue(QPoint(-width()/coeff, 0));
   592         animationOldSlide->setEasingCurve(QEasingCurve::OutCubic);
   596         animationOldSlide->setEasingCurve(QEasingCurve::OutExpo);
   593         animationOldSlide->start();
   597 
   594 
   598 #ifdef Q_OS_LINUX
   595         animationOldOpacity = new QPropertyAnimation(effectLast, "opacity");
   599         animationOldOpacity = new QPropertyAnimation(effectLast, "opacity");
   596         animationOldOpacity->setDuration(500);
   600         animationOldOpacity->setDuration(500);
   597         animationOldOpacity->setStartValue(1);
   601         animationOldOpacity->setStartValue(1);
   598         animationOldOpacity->setEndValue(0.01);
   602         animationOldOpacity->setEndValue(0.01);
   599         animationOldOpacity->setEasingCurve(QEasingCurve::OutCubic);
   603         animationOldOpacity->setEasingCurve(QEasingCurve::OutExpo);
   600         animationOldOpacity->start();
   604 #endif
       
   605 
       
   606         QParallelAnimationGroup *group = new QParallelAnimationGroup;
       
   607         group->addAnimation(animationOldSlide);
       
   608         group->addAnimation(animationNewSlide);
       
   609 #ifdef Q_OS_LINUX
       
   610         group->addAnimation(animationOldOpacity);
       
   611         group->addAnimation(animationNewOpacity);
       
   612 #endif
       
   613         group->start();
   601 
   614 
   602         connect(animationOldSlide, SIGNAL(finished()), ui.Pages->widget(lastid), SLOT(hide()));
   615         connect(animationOldSlide, SIGNAL(finished()), ui.Pages->widget(lastid), SLOT(hide()));
   603     }
   616     }
   604 }
   617 }
   605 
   618 
   652 
   665 
   653     /**Start animation :**/
   666     /**Start animation :**/
   654 
   667 
   655     if (curid != 0 && frontendEffects && !stopAnim)
   668     if (curid != 0 && frontendEffects && !stopAnim)
   656     {
   669     {
   657 
   670         int coeff = 1;
       
   671 #ifdef Q_OS_LINUX
       
   672         coeff = 2;
   658         QGraphicsOpacityEffect *effectNew = new QGraphicsOpacityEffect(ui.Pages->widget(id));
   673         QGraphicsOpacityEffect *effectNew = new QGraphicsOpacityEffect(ui.Pages->widget(id));
   659         effectNew->setOpacity(1);
   674         effectNew->setOpacity(1);
   660         ui.Pages->widget(id)->setGraphicsEffect(effectNew);
   675         ui.Pages->widget(id)->setGraphicsEffect(effectNew);
   661 
   676 
   662         QGraphicsOpacityEffect *effectLast = new QGraphicsOpacityEffect(ui.Pages->widget(curid));
   677         QGraphicsOpacityEffect *effectLast = new QGraphicsOpacityEffect(ui.Pages->widget(curid));
   663         ui.Pages->widget(curid)->setGraphicsEffect(effectLast);
   678         ui.Pages->widget(curid)->setGraphicsEffect(effectLast);
       
   679 #endif
   664 
   680 
   665         //Last page animation
   681         //Last page animation
   666         animationOldSlide = new QPropertyAnimation(ui.Pages->widget(id), "pos");
   682         animationOldSlide = new QPropertyAnimation(ui.Pages->widget(id), "pos");
   667         animationOldSlide->setDuration(500);
   683         animationOldSlide->setDuration(500);
   668         animationOldSlide->setStartValue(QPoint(-width()/2, 0));
   684         animationOldSlide->setStartValue(QPoint(-width()/coeff, 0));
   669         animationOldSlide->setEndValue(QPoint(0, 0));
   685         animationOldSlide->setEndValue(QPoint(0, 0));
   670         animationOldSlide->setEasingCurve(QEasingCurve::OutCubic);
   686         animationOldSlide->setEasingCurve(QEasingCurve::OutExpo);
   671         animationOldSlide->start();
   687 
   672 
   688 #ifdef Q_OS_LINUX
   673         animationOldOpacity = new QPropertyAnimation(effectLast, "opacity");
   689         animationOldOpacity = new QPropertyAnimation(effectLast, "opacity");
   674         animationOldOpacity->setDuration(500);
   690         animationOldOpacity->setDuration(500);
   675         animationOldOpacity->setStartValue(1);
   691         animationOldOpacity->setStartValue(1);
   676         animationOldOpacity->setEndValue(0.01);
   692         animationOldOpacity->setEndValue(0.01);
   677         animationOldOpacity->setEasingCurve(QEasingCurve::OutCubic);
   693         animationOldOpacity->setEasingCurve(QEasingCurve::OutExpo);
   678         animationOldOpacity->start();
   694 #endif
   679 
       
   680         //New page animation
   695         //New page animation
   681         ui.Pages->widget(curid)->setHidden(false);
   696         ui.Pages->widget(curid)->setHidden(false);
   682 
   697 
   683         animationNewSlide = new QPropertyAnimation(ui.Pages->widget(curid), "pos");
   698         animationNewSlide = new QPropertyAnimation(ui.Pages->widget(curid), "pos");
   684         animationNewSlide->setDuration(500);
   699         animationNewSlide->setDuration(500);
   685         animationNewSlide->setStartValue(QPoint(0, 0));
   700         animationNewSlide->setStartValue(QPoint(0, 0));
   686         animationNewSlide->setEndValue(QPoint(width()/2, 0));
   701         animationNewSlide->setEndValue(QPoint(width()/coeff, 0));
   687         animationNewSlide->setEasingCurve(QEasingCurve::OutCubic);
   702         animationNewSlide->setEasingCurve(QEasingCurve::OutExpo);
   688         animationNewSlide->start();
   703 
   689 
   704 #ifdef Q_OS_LINUX
   690         animationNewOpacity = new QPropertyAnimation(effectNew, "opacity");
   705         animationNewOpacity = new QPropertyAnimation(effectNew, "opacity");
   691         animationNewOpacity->setDuration(500);
   706         animationNewOpacity->setDuration(500);
   692         animationNewOpacity->setStartValue(0.01);
   707         animationNewOpacity->setStartValue(0.01);
   693         animationNewOpacity->setEndValue(1);
   708         animationNewOpacity->setEndValue(1);
   694         animationNewOpacity->setEasingCurve(QEasingCurve::OutCubic);
   709         animationNewOpacity->setEasingCurve(QEasingCurve::OutExpo);
   695         animationNewOpacity->start();
   710 #endif
       
   711 
       
   712         QParallelAnimationGroup *group = new QParallelAnimationGroup;
       
   713         group->addAnimation(animationOldSlide);
       
   714         group->addAnimation(animationNewSlide);
       
   715 #ifdef Q_OS_LINUX
       
   716         group->addAnimation(animationOldOpacity);
       
   717         group->addAnimation(animationNewOpacity);
       
   718 #endif
       
   719         group->start();
   696 
   720 
   697         connect(animationNewSlide, SIGNAL(finished()), ui.Pages->widget(curid), SLOT(hide()));
   721         connect(animationNewSlide, SIGNAL(finished()), ui.Pages->widget(curid), SLOT(hide()));
   698     }
   722     }
   699 
   723 
   700 
   724