QTfrontend/hwform.cpp
branch0.9.18
changeset 7884 60132c558c05
parent 7860 a90936219ffa
child 7902 a82b1bf2eca1
equal deleted inserted replaced
7821:9353d5eb360e 7884:60132c558c05
   161     connect (hideFrontend, SIGNAL(activated()), this, SLOT(showMinimized()));
   161     connect (hideFrontend, SIGNAL(activated()), this, SLOT(showMinimized()));
   162 #else
   162 #else
   163     // ctrl+q closes frontend for consistency
   163     // ctrl+q closes frontend for consistency
   164     QShortcut * closeFrontend = new QShortcut(QKeySequence("Ctrl+Q"), this);
   164     QShortcut * closeFrontend = new QShortcut(QKeySequence("Ctrl+Q"), this);
   165     connect (closeFrontend, SIGNAL(activated()), this, SLOT(close()));
   165     connect (closeFrontend, SIGNAL(activated()), this, SLOT(close()));
   166     QShortcut * updateData = new QShortcut(QKeySequence("F5"), this);
   166     //QShortcut * updateData = new QShortcut(QKeySequence("F5"), this);
   167     connect (updateData, SIGNAL(activated()), &DataManager::instance(), SLOT(reload()));
   167     //connect (updateData, SIGNAL(activated()), &DataManager::instance(), SLOT(reload()));
   168 #endif
   168 #endif
   169 
   169 
   170     UpdateTeamsLists();
   170     UpdateTeamsLists();
   171     InitCampaignPage();
   171     InitCampaignPage();
   172     UpdateCampaignPage(0);
   172     UpdateCampaignPage(0);
   202     pageSwitchMapper->setMapping(ui.pageMain->BtnInfo, ID_PAGE_INFO);
   202     pageSwitchMapper->setMapping(ui.pageMain->BtnInfo, ID_PAGE_INFO);
   203 
   203 
   204     connect(ui.pageMain->BtnDataDownload, SIGNAL(clicked()), pageSwitchMapper, SLOT(map()));
   204     connect(ui.pageMain->BtnDataDownload, SIGNAL(clicked()), pageSwitchMapper, SLOT(map()));
   205     pageSwitchMapper->setMapping(ui.pageMain->BtnDataDownload, ID_PAGE_DATADOWNLOAD);
   205     pageSwitchMapper->setMapping(ui.pageMain->BtnDataDownload, ID_PAGE_DATADOWNLOAD);
   206 
   206 
   207     connect(ui.pageNetGame, SIGNAL(DLCClicked()), pageSwitchMapper, SLOT(map()));
       
   208     pageSwitchMapper->setMapping(ui.pageNetGame, ID_PAGE_DATADOWNLOAD);
       
   209 
   207 
   210 #ifdef VIDEOREC
   208 #ifdef VIDEOREC
   211     connect(ui.pageMain->BtnVideos, SIGNAL(clicked()), pageSwitchMapper, SLOT(map()));
   209     connect(ui.pageMain->BtnVideos, SIGNAL(clicked()), pageSwitchMapper, SLOT(map()));
   212     pageSwitchMapper->setMapping(ui.pageMain->BtnVideos, ID_PAGE_VIDEOS);
   210     pageSwitchMapper->setMapping(ui.pageMain->BtnVideos, ID_PAGE_VIDEOS);
   213 #endif
   211 #endif
   693         animationOldOpacity->setStartValue(1);
   691         animationOldOpacity->setStartValue(1);
   694         animationOldOpacity->setEndValue(0.01);
   692         animationOldOpacity->setEndValue(0.01);
   695         animationOldOpacity->setEasingCurve(QEasingCurve::OutExpo);
   693         animationOldOpacity->setEasingCurve(QEasingCurve::OutExpo);
   696 #endif
   694 #endif
   697 
   695 
   698         QParallelAnimationGroup *group = new QParallelAnimationGroup;
   696         // let's hide the old slide after its animation has finished
   699         group->addAnimation(animationOldSlide);
       
   700         group->addAnimation(animationNewSlide);
       
   701 #ifdef false
       
   702         group->addAnimation(animationOldOpacity);
       
   703         group->addAnimation(animationNewOpacity);
       
   704 #endif
       
   705         group->start();
       
   706 
       
   707         connect(animationOldSlide, SIGNAL(finished()), ui.Pages->widget(lastid), SLOT(hide()));
   697         connect(animationOldSlide, SIGNAL(finished()), ui.Pages->widget(lastid), SLOT(hide()));
       
   698 
       
   699         // start animations
       
   700         animationOldSlide->start(QAbstractAnimation::DeleteWhenStopped);
       
   701         animationNewSlide->start(QAbstractAnimation::DeleteWhenStopped);
       
   702 
   708     	/* this is for the situation when the animation below is interrupted by a new animation.  For some reason, finished is not being fired */ 	
   703     	/* this is for the situation when the animation below is interrupted by a new animation.  For some reason, finished is not being fired */ 	
   709     	for(int i=0;i<MAX_PAGE;i++) if (i!=id && i!=lastid) ui.Pages->widget(i)->hide();
   704     	for(int i=0;i<MAX_PAGE;i++) if (i!=id && i!=lastid) ui.Pages->widget(i)->hide();
   710     }
   705     }
   711 #endif
   706 #endif
   712 }
   707 }
   806         animationNewOpacity->setStartValue(0.01);
   801         animationNewOpacity->setStartValue(0.01);
   807         animationNewOpacity->setEndValue(1);
   802         animationNewOpacity->setEndValue(1);
   808         animationNewOpacity->setEasingCurve(QEasingCurve::OutExpo);
   803         animationNewOpacity->setEasingCurve(QEasingCurve::OutExpo);
   809 #endif
   804 #endif
   810 
   805 
   811         QParallelAnimationGroup *group = new QParallelAnimationGroup;
   806         // let's hide the old slide after its animation has finished
   812         group->addAnimation(animationOldSlide);
       
   813         group->addAnimation(animationNewSlide);
       
   814 #ifdef false
       
   815         group->addAnimation(animationOldOpacity);
       
   816         group->addAnimation(animationNewOpacity);
       
   817 #endif
       
   818         group->start();
       
   819 
       
   820         connect(animationNewSlide, SIGNAL(finished()), ui.Pages->widget(curid), SLOT(hide()));
   807         connect(animationNewSlide, SIGNAL(finished()), ui.Pages->widget(curid), SLOT(hide()));
   821     }
   808 
   822 #endif
   809         // start animations
       
   810         animationOldSlide->start(QAbstractAnimation::DeleteWhenStopped);
       
   811         animationNewSlide->start(QAbstractAnimation::DeleteWhenStopped);
       
   812     }
       
   813 #endif
       
   814 
       
   815     if (stopAnim)
       
   816         ui.Pages->widget(curid)->hide();
       
   817 
       
   818 // TODO the whole pages shown and effects stuff should be moved
       
   819 // out of hwform.cpp and into a subclass of QStackedLayout
       
   820 
   823 }
   821 }
   824 
   822 
   825 void HWForm::OpenSnapshotFolder()
   823 void HWForm::OpenSnapshotFolder()
   826 {
   824 {
   827     QString path = QDir::toNativeSeparators(cfgdir->absolutePath() + "/Screenshots");
   825     QString path = QDir::toNativeSeparators(cfgdir->absolutePath() + "/Screenshots");
  1283     if (hwnet)
  1281     if (hwnet)
  1284     {
  1282     {
  1285         QString errorStr = QMessageBox::tr("Connection to server is lost") + (reason.isEmpty()?"":("\n\n" + HWNewNet::tr("Quit reason: ") + '"' + reason +'"'));
  1283         QString errorStr = QMessageBox::tr("Connection to server is lost") + (reason.isEmpty()?"":("\n\n" + HWNewNet::tr("Quit reason: ") + '"' + reason +'"'));
  1286         ShowErrorMessage(errorStr);
  1284         ShowErrorMessage(errorStr);
  1287     }
  1285     }
  1288     if (ui.Pages->currentIndex() != ID_PAGE_NET)
  1286 
  1289     {
  1287     while (ui.Pages->currentIndex() != ID_PAGE_NET
  1290         while (!PagesStack.isEmpty()) PagesStack.pop();
  1288         && ui.Pages->currentIndex() != ID_PAGE_NETTYPE
  1291         PagesStack.push(ID_PAGE_MAIN);
  1289         && ui.Pages->currentIndex() != ID_PAGE_MAIN)
  1292         GoToPage(ID_PAGE_NET);
  1290     {
       
  1291         GoBack();
  1293     }
  1292     }
  1294 }
  1293 }
  1295 
  1294 
  1296 void HWForm::NetConnected()
  1295 void HWForm::NetConnected()
  1297 {
  1296 {