void Clock::resetStopWatch() { if ( swatch_running ) { swatch_splitms[swatch_currLap] = swatch_totalms+swatch_start.elapsed(); swatch_dispLap = swatch_currLap; if ( swatch_currLap < 98 ) // allow up to 99 laps swatch_currLap++; reset->setEnabled( swatch_currLap < 98 ); updateLap(); lapTimer->start( 2000, TRUE ); } else { swatch_start.start(); swatch_totalms = 0; swatch_currLap = 0; swatch_dispLap = 0; for ( uint i = 0; i < swatch_splitms.count(); i++ ) swatch_splitms[(int)i] = 0; updateLap(); updateClock(); reset->setText( tr("Lap/Split") ); reset->setEnabled( FALSE ); } prevLapBtn->setEnabled( swatch_dispLap ); nextLapBtn->setEnabled( swatch_dispLap < swatch_currLap ); }
void BCS_wf::updateLap( Wavefunction_data * wfdata, Sample_point * sample) { assert(sampleAttached); assert(dataAttached); if(updateEverythingLap==1) { calcLap(sample); updateEverythingVal=0; updateEverythingLap=0; electronIsStaleLap=0; electronIsStaleVal=0; } else { for(int e=0; e< nelectrons(0)+nelectrons(1); e++) { if(electronIsStaleLap(e)) { if ( abs(detVal(0))>0 ) { updateLap(e,sample); } else { calcLap(sample); } electronIsStaleLap(e)=0; electronIsStaleVal(e)=0; } } } }
void BCS_wf::updateVal(Wavefunction_data * wfdata, Sample_point * sample) { updateLap(wfdata,sample); return; }
void Clock::lapTimeout() { swatch_dispLap = swatch_currLap; updateLap(); prevLapBtn->setEnabled( swatch_dispLap ); nextLapBtn->setEnabled( swatch_dispLap < swatch_currLap ); }
void Clock::stopStartStopWatch() { if ( swatch_running ) { swatch_totalms += swatch_start.elapsed(); swatch_splitms[swatch_currLap] = swatch_totalms; stopStart->setText( tr("Start") ); reset->setText( tr("Reset") ); reset->setEnabled( TRUE ); t->stop(); swatch_running = FALSE; toggleScreenSaver( TRUE ); updateClock(); } else { swatch_start.start(); stopStart->setText( tr("Stop") ); reset->setText( tr("Lap/Split") ); reset->setEnabled( swatch_currLap < 98 ); t->start( 1000 ); swatch_running = TRUE; // disable screensaver while stop watch is running toggleScreenSaver( FALSE ); } swatch_dispLap = swatch_currLap; updateLap(); prevLapBtn->setEnabled( swatch_dispLap ); nextLapBtn->setEnabled( swatch_dispLap < swatch_currLap ); stopStart->setAccel( Key_Return ); }
void Clock::nextLap() { if ( swatch_dispLap < swatch_currLap ) { swatch_dispLap++; updateLap(); prevLapBtn->setEnabled( swatch_dispLap ); nextLapBtn->setEnabled( swatch_dispLap < swatch_currLap ); } }
void Clock::updateClock() { if ( tabs->currentPageIndex() == 0 ) { QTime tm = QDateTime::currentDateTime().time(); QString s; if ( ampm ) { int hour = tm.hour(); if (hour == 0) hour = 12; if (hour > 12) hour -= 12; s.sprintf( "%2d%c%02d", hour, ':', tm.minute() ); clockAmPm->setText( (tm.hour() >= 12) ? "PM" : "AM" ); clockAmPm->show(); } else { s.sprintf( "%2d%c%02d", tm.hour(), ':', tm.minute() ); clockAmPm->hide(); } clockLcd->display( s ); clockLcd->repaint( FALSE ); analogClock->display( QTime::currentTime() ); date->setText( TimeString::dateString( QDate::currentDate(), TimeString::currentDateFormat() ) ); } else if ( tabs->currentPageIndex() == 1 ) { int totalms = swatch_totalms; if ( swatch_running ) totalms += swatch_start.elapsed(); setSwatchLcd( stopwatchLcd, totalms, !swatch_running ); QTime swatch_time = QTime(0,0,0).addMSecs(totalms); analogStopwatch->display( swatch_time ); if ( swatch_dispLap == swatch_currLap ) { swatch_splitms[swatch_currLap] = swatch_totalms; if ( swatch_running ) swatch_splitms[swatch_currLap] += swatch_start.elapsed(); updateLap(); } } else if ( tabs->currentPageIndex() == 2 ) { // nothing. } }