예제 #1
0
int ApplyDialog::qt_metacall(QMetaObject::Call _c, int _id, void **_a)
{
    _id = QDialog::qt_metacall(_c, _id, _a);
    if (_id < 0)
        return _id;
    if (_c == QMetaObject::InvokeMetaMethod) {
        switch (_id) {
        case 0: dialogClosed((*reinterpret_cast< int(*)>(_a[1]))); break;
        case 1: on_saveImage_clicked(); break;
        case 2: on_next_clicked(); break;
        default: ;
        }
        _id -= 3;
    }
    return _id;
}
예제 #2
0
void MainWindow::onIdleSlot()
{
   CFamiTrackerApp* pApp = (CFamiTrackerApp*)AfxGetApp();   
   CMainFrame* pMainFrame = (CMainFrame*)pApp->m_pMainWnd;
   CFamiTrackerDoc* pDoc = (CFamiTrackerDoc*)pMainFrame->GetActiveDocument();
   CFamiTrackerView* pView = (CFamiTrackerView*)pMainFrame->GetActiveView();
   static int lastFrame = -1;
   
   ui->sampleWindow->update();

   if ( m_bCheck )
   {
      // Move to next song if playing and the current song has reached a stop.
      if ( m_bCheck && m_bPlaying && !m_bChangeSong )
      {
         // Check if time is at time limit and if so, advance to next song.
         int timeLimit = m_pWndMFC->GetTimeLimit();
         CString playTime;
         int totalPlayTime;
         
         pMainFrame->GetDescendantWindow(AFX_IDW_STATUS_BAR)->GetDlgItemText(ID_INDICATOR_TIME,playTime);
         totalPlayTime = m_pWndMFC->ConvertTime(playTime);
         
         if ( lastFrame != pView->GetPlayFrame() )
         {
            lastFrame = pView->GetPlayFrame();
            m_iFramesPlayed++;
         }
         
         if ( m_bTimeLimited &&
              (timeLimit == totalPlayTime) )
         {
            // Force stop...
            m_bPlaying = false;
            pApp->OnCmdMsg(ID_TRACKER_TOGGLE_PLAY,0,0,0);
            m_bChangeSong = true;
            
            // Create a bit of a delay between songs.
            m_pTimer->start(500);
         }
         else if ( m_bLoopLimited &&
                   m_iFramesPlayed > pDoc->ScanActualLength(pDoc->GetSelectedTrack(),m_pWndMFC->GetFrameLoopCount()) )
         {   
            // Force stop...
            m_bPlaying = false;
            pApp->OnCmdMsg(ID_TRACKER_TOGGLE_PLAY,0,0,0);
            m_bChangeSong = true;
            
            // Create a bit of a delay between songs.
            m_pTimer->start(500);
         }
         if ( !pApp->GetSoundGenerator()->IsPlaying() )
         {
            m_bPlaying = false;
            m_bChangeSong = true;
            
            // Create a bit of a delay between songs.
            m_pTimer->start(500);
         }
      }
      // Wait until player starts playing before turning the above logic back on.
      else if ( m_bChangeSong )
      {
         on_playStop_clicked();
         if ( !ui->repeat->isChecked() )
         {
            on_next_clicked();
         }
         m_bChangeSong = false;
         ui->position->setValue((pView->GetPatternView()->GetPlayFrame()*pDoc->GetPatternLength())+pView->GetPatternView()->GetPlayRow());
         startSettleTimer();
         m_pTimer->start(0);
      }
   }
   if ( m_bDraggingPosition )
   {
      // FF/RW
      m_bCheck = false;
      pView->PlayerCommand(CMD_JUMP_TO,(ui->position->value()/pDoc->GetPatternLength())-1);
      pView->GetPatternView()->JumpToRow(ui->position->value()%pDoc->GetPatternLength());
   }
   else
   {
      m_bCheck = true;
      ui->frames->setText(QString::number(m_iFramesPlayed)+"/"+QString::number(pDoc->ScanActualLength(pDoc->GetSelectedTrack(),m_pWndMFC->GetFrameLoopCount())));
      ui->position->setValue((pView->GetPatternView()->GetPlayFrame()*pDoc->GetPatternLength())+pView->GetPatternView()->GetPlayRow());
   }
}