void TimerWind::on_resetBtn_clicked() { triggerTimer.stop(); minLeft = origMins; secLeft = 0; setStyleSheet(""); ui->pauseBtn->setText(tr("Pause")); updateTimeLabel(); countingUp = false; didDoOvrTenMbox = false; didDoOvrFiftMbox = false; didDoOvrFiveMbox = false; didDoFiveMbox = false; didDo30sMbox = false; triggerTimer.start(); accurateTimer.restart(); #ifdef Q_OS_WIN taskbarProgress->resume(); taskbarProgress->setValue(100); #endif }
void PlayPanel::setPos(int utick) { if(!cs) return; if (cachedTickPosition != utick) emit posChange(utick); updatePosLabel(utick); updateTimeLabel(cs->utick2utime(utick)); }
void PlayPanel::heartBeat(int tick, int utick, int samples) { if (cachedTickPosition != utick) { updatePosLabel(utick); posSlider->setValue(utick); } int sec = samples/MScore::sampleRate; if (sec == cachedTimePosition) return; updateTimeLabel(sec); }
void TimerWind::on_startBtn_clicked() { ui->stackedWidget->setCurrentIndex(1); setWindowTitle(tr("Timing")); origMins = ui->minSelect->value(); minLeft = origMins; updateTimeLabel(); showWarn = !ui->showWarnChk->isChecked(); triggerTimer.setInterval(1000); triggerTimer.setSingleShot(false); connect(&triggerTimer, SIGNAL(timeout()), this, SLOT(time())); triggerTimer.start(); accurateTimer.start(); #ifdef Q_OS_WIN taskbarButton = new QWinTaskbarButton(this); taskbarButton->setWindow(windowHandle()); taskbarProgress = taskbarButton->progress(); taskbarProgress->show(); taskbarProgress->resume(); taskbarProgress->setValue(100); #endif }
CuculusView::CuculusView(QWidget *) : m_currentTweetIndex( 0 ) { setObjectName( "view" ); m_model = new CuculusModel; QBoxLayout *mainLayout = new QHBoxLayout( this ); QBoxLayout *topLayout = new QVBoxLayout; mainLayout->addLayout( topLayout ); m_timeLabel = new QLabel; topLayout->addWidget( m_timeLabel ); m_timeLabel->setAlignment( Qt::AlignCenter ); connect( &m_timeLabelTimer, SIGNAL( timeout() ), SLOT( updateTimeLabel() ) ); m_timeLabelTimer.start( 60 * 1000 ); QBoxLayout *countLayout = new QHBoxLayout; topLayout->addLayout( countLayout ); QLabel *label = new QLabel( i18n("What are you doing?") ); countLayout->addWidget( label ); countLayout->addStretch( 1 ); m_countLabel = new QLabel; countLayout->addWidget( m_countLabel ); m_tweetEdit = new QTextEdit; m_tweetEdit->setFixedHeight( 60 ); topLayout->addWidget( m_tweetEdit ); connect( m_tweetEdit, SIGNAL( textChanged() ), SLOT( updateEditCount() ) ); connect( m_tweetEdit, SIGNAL( textChanged() ), SLOT( checkUpdateButton() ) ); m_updateButton = new QPushButton( "Update" ); topLayout->addWidget( m_updateButton ); connect( m_updateButton, SIGNAL( clicked() ), SLOT( sendTweet() ) ); QBoxLayout *updateLayout = new QHBoxLayout; topLayout->addLayout( updateLayout ); updateLayout->addStretch( 1 ); QPushButton *button = new QPushButton( "Get latest tweets" ); updateLayout->addWidget( button ); connect( button, SIGNAL( clicked() ), SLOT( updateTimeline() ) ); m_upButton = new QPushButton; connect( m_upButton, SIGNAL( clicked() ), SLOT( pageUp() ) ); QString picPath = KStandardDirs::locate( "appdata", "1uparrow.png" ); m_upButton->setIcon( QPixmap( picPath ) ); topLayout->addWidget( m_upButton ); m_tweetsView = new TweetListView; topLayout->addWidget( m_tweetsView, 1 ); m_tweetsView->setStyleSheet("background-color: white"); m_downButton = new QPushButton; connect( m_downButton, SIGNAL( clicked() ), SLOT( pageDown() ) ); picPath = KStandardDirs::locate( "appdata", "1downarrow.png" ); m_downButton->setIcon( QPixmap( picPath ) ); topLayout->addWidget( m_downButton ); FriendsView *friendsView = new FriendsView; mainLayout->addWidget( friendsView ); updateEditCount(); checkUpdateButton(); updateTimeLabel(); updatePageButtons(); settingsChanged(); setAutoFillBackground(true); updateTimeline(); }
void OutputWidget::rootCompleate(const EventsInfo::CommandRootCompleatedInfo& res) { updateTimeLabel(res); }
void TimerWind::time() { int minPassed = 0; int secPassed = accurateTimer.restart()/1000; /* Compute minPassed */ while(secPassed >= 60) { minPassed += 1; secPassed -= 60; } if(!countingUp) { minLeft -= minPassed; secLeft -= secPassed; if(minLeft <= 0 && secLeft <= 0) { modalMsgBox(tr("Time's up!"), tr("Your time is up!"), true); countingUp = true; if(minLeft < 0) { minLeft *= -1; } if(secLeft < 0) { secLeft *= -1; } setStyleSheet("background-color: rgb(255, 0, 0);"); #ifdef Q_OS_WIN taskbarProgress->stop(); taskbarProgress->setValue(100); #endif } /* Get rid of any negatives on the seconds */ while(secLeft < 0) { minLeft -= 1; secLeft += 60; } if(showWarn) { if(minLeft <= 4 && origMins >= 5 && !didDoFiveMbox) { didDoFiveMbox = true; modalMsgBox(tr("5 minutes left!"), tr("You have 5 minutes left.")); } else if(minLeft <= 0 && secLeft <= 30 && origMins > 0 && !didDo30sMbox) { didDo30sMbox = true; modalMsgBox(tr("30 seconds left!"),tr("You have 30 seconds left.")); } } } else if(countingUp) { minLeft += minPassed; secLeft += secPassed; if(secLeft >= 60) { minLeft += 1; secLeft -= 60; } if(minLeft >= 5 && !didDoOvrFiveMbox) { didDoOvrFiveMbox = true; modalMsgBox(tr("5 minutes overtime!"), tr("You are 5 minutes overtime!"), true); } else if(minLeft >= 10 && !didDoOvrTenMbox) { didDoOvrTenMbox = true; modalMsgBox(tr("10 minutes overtime!"), tr("You are 10 minutes overtime!"), true); } else if(minLeft >= 15 && !didDoOvrFiftMbox) { didDoOvrFiftMbox = true; modalMsgBox(tr("15 minutes overtime!"), tr("You are 15 minutes overtime!"), true); } } #ifdef Q_OS_WIN if(!countingUp) { int percent = ((minLeft+(secLeft/60.0))/origMins)*100; taskbarProgress->setValue(percent); } #endif updateTimeLabel(); }