void Window::configureActions() { showAboutAction = new QAction(tr("&About"), this); showAboutAction->setIcon(aboutIcon); connect(showAboutAction, SIGNAL(triggered()), this, SLOT(showAbout())); showResultAction = new QAction(tr("&Show result"), this); showResultAction->setIcon(logoIcon); connect(showResultAction, SIGNAL(triggered()), this, SLOT(showResult())); quitAction = new QAction(tr("&Quit"), this); quitAction->setIcon(QIcon(":/images/Close.png")); connect(quitAction, SIGNAL(triggered()), qApp, SLOT(quit())); startTrackingAction = new QAction(tr("Start tracking"), this); startTrackingAction->setIcon(playIcon); connect(startTrackingAction, SIGNAL(triggered()), this, SLOT(startTracking())); pauseTrackingAction = new QAction(tr("Pause tracking"), this); pauseTrackingAction->setIcon(pauseIcon); connect(pauseTrackingAction, SIGNAL(triggered()), this, SLOT(pauseTracking())); pauseTrackingAction->setEnabled(false); resetTrackedTimeAction = new QAction(tr("Reset tracking result"), this); connect(resetTrackedTimeAction, SIGNAL(triggered()), this, SLOT(resetTrackingResult())); resetTrackedTimeAction->setEnabled(false); }
void Tracker::playOrPause() { if (state == STOPPED) { ui.play_pause_button->setText("Pause"); state = PLAYING; beginTracking(); } else if (state == PLAYING) { ui.play_pause_button->setText("Play"); state = PAUSED; pauseTracking(); } else { ui.play_pause_button->setText("Pause"); state = PLAYING; beginTracking(); } }