/** * Constructor, create LED's */ KBinaryClock::KBinaryClock(const QString& configFile, Type type, int actions, QWidget *parent, const char *name) : KPanelApplet(configFile, type, actions, parent, name), ledWidth(6), _calendar(NULL), _disableCalendar(false), prefs( new Prefs(sharedConfig())), m_tooltip(this) { prefs->readConfig(); setBackgroundOrigin(AncestorOrigin); for(int i=0; i < 4; i++){ for(int j=0; j < ledWidth;j++){ KLed *led = new KLed( this ); led->setBackgroundOrigin(AncestorOrigin); ledMatrix[j][i] = led; } } // Why does kicker start out with a size of 800x409? // Kicker bug? resize(60,42); updateClock(); loadSettings(); QTimer *timer=new QTimer(this); connect (timer, SIGNAL (timeout()), this, SLOT (updateClock())); timer->start(500,false); }
void UI::inGameLoop () { initializeGame(); bool quit = false; while (!quit) { if (keyEvent || timeEvent) { string canvas = buildLayout(); system ("cls"); cout << canvas; } updateClock (); timeEvent = false; keyEvent = false; if (timePassed >= fallInterval) { if (engine->translatePiece (0, -1) ); else { int cleared = engine->clearCompleteLines(); if (cleared > 0) { totalLines += cleared; lineProgress += cleared; score += 15 * (level+1) * (calculateExpo(2 , cleared) ); } if (lineProgress >= 10) { lineProgress = lineProgress - 10; level++; fallInterval = 1000 - (100 * level); } if (engine->placeNewPiece(nextPieceCode, 4, 19) ) { nextPiece->clearPiece (); nextPieceCode = rand()%7; nextPiece->placeNewPiece (nextPieceCode, 3, 3); } else quit = true; } timeEvent = true; setClock (); updateClock (); } keyEvent = keyHandler(); Sleep (1); } }
void switchToMode(mode newMode) { stopCurrentTimer(); currentMode = newMode; switch(newMode) { case ModeIdle: text_layer_set_text(mode_text_layer, "Idle"); currentTimer = 0; break; case ModePrepare: text_layer_set_text(mode_text_layer, "Prepare"); currentTimer = prepareLength; startTimer(); break; case ModeSport: text_layer_set_text(mode_text_layer, "Go!"); currentTimer = sportLength; startTimer(); break; case ModePause: text_layer_set_text(mode_text_layer, "Pause"); currentTimer = sportLength + sportLength; startTimer(); break; } updateClock(); }
void SelectMenu::handleShow() { menu_manager_->saveBackground(); // Show the mouse g_System.showCursor(); // Update the time updateClock(); if (g_gameCtrl.agents().squadMember(cur_agent_)) { getStatic(txtAgentId_)->setTextFormated("#SELECT_SUBTITLE", g_gameCtrl.agents().squadMember(cur_agent_)->getName()); } else { getStatic(txtAgentId_)->setText(""); } for (int iAgnt=0; iAgnt<AgentManager::MAX_AGENT; iAgnt++) { Agent *pAgentFromCryo = g_gameCtrl.agents().agent(iAgnt); pTeamLBox_->setSquadLine(g_gameCtrl.agents().getSquadSlotForAgent(pAgentFromCryo), iAgnt); } showItemList(); updateAcceptEnabled(); menu_manager_->resetSinceMouseDown(); }
void CommercialGraphic::changeUseClock(bool uc) { useClock = uc; if (show) { updateClock(); } }
void CommercialGraphic::finalTime() { clockStatus = FINAL; updateClock(); if (show) scene()->update(x() + CLOCK_X, y(), CLOCK_WIDTH, GRAPHIC_HEIGHT); }
void CommercialGraphic::intermissionTime() { clockStatus = INTERMISSION; updateClock(); if (show) scene()->update(x() + CLOCK_X, y(), CLOCK_WIDTH, GRAPHIC_HEIGHT); }
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 BriefMenu::handleTick(int elapsed) { if (g_Session.updateTime(elapsed)) { updateClock(); } drawMinimap(elapsed); }
void Clock::changeClock( bool a ) { if ( ampm != a ) { int minute = dailyMinute->value(); int hour = dailyHour->value(); if ( ampm ) { if (hour == 12) hour = 0; if (dailyAmPm->currentItem() == 1 ) hour += 12; dailyHour->setMinValue( 0 ); dailyHour->setMaxValue( 23 ); dailyAmPm->hide(); } else { if (hour > 12) { hour -= 12; dailyAmPm->setCurrentItem( 1 ); } if (hour == 0) hour = 12; dailyHour->setMinValue( 1 ); dailyHour->setMaxValue( 12 ); dailyAmPm->show(); } dailyMinute->setValue( minute ); dailyHour->setValue( hour ); } ampm = a; updateClock(); }
void UI::initializeGame () { score = 0; level = 0; fallInterval = 1000 - (10 * level); totalLines = 0; lineProgress = 0; timeEvent = true; keyEvent = false; setClock (); updateClock (); engine = new GameEngine (); nextPiece = new GameEngine (2, 2, 7, 6); nextPieceCode = rand()%7; if (nextPieceCode<3) engine->placeNewPiece(nextPieceCode, 4, 19); else engine->placeNewPiece(nextPieceCode, 5, 19); nextPieceCode = rand()%7; nextPiece->placeNewPiece (nextPieceCode, 3, 3); }
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 ); }
CommercialGraphic::CommercialGraphic(BasketballGame* game, int width, QString pawayLogo, QGraphicsItem* parent) : QGraphicsPixmapItem(parent), blackBar(QPixmap(":/images/ppBar.png")), blockText(QPixmap(":/images/M.png")), awayLogo(pawayLogo){ basketballGame = game; show = false; WIDTH = width / 2; NAME_WIDTH = WIDTH - CENTER_OFFSET; inGame = false; QFont font("Arial", 60, QFont::Bold); QFont sponsorFont("Arial", 36, QFont::Bold); #ifdef Q_OS_OSX font.setPointSize(68); sponsorFont.setPointSize(44); #endif setPixmap(QPixmap(":/images/Scoreboard.png")); away = new QGraphicsTextItem(game->getAwayName()); away->setFont(font); checkAwayFont(); home = new QGraphicsTextItem(game->getHomeName()); home->setFont(font); descriptiveFont = sponsorFont; prepareGradients(game->getAwayColor(), game->getHomeColor()); maaText = "Miami All-Access"; clockStatus = SHOW_CLOCK; connect(game->getGameClock(), SIGNAL(clockUpdated()), this, SLOT(updateClock())); if (awayLogo.height() > 120) { awayLogo = awayLogo.scaledToHeight(120, Qt::SmoothTransformation); } if (blockText.height() > 120) { blockText = blockText.scaledToHeight(120, Qt::SmoothTransformation); } }
// Increments clock void timerCallback( TimerHandle_t myTimer ) { traces(TIMER_CALLBACK_ENTER); updateClock(); //void sendtoServer(void); // testing traces(TIMER_CALLBACK_EXIT); }
DigitalClock::DigitalClock(QWidget* parent) : QDialog(parent) { label = new QLabel(tr("") ); updateClock(); QPalette palette = label->palette(); palette.setColor(QPalette::WindowText, QColor("#000000")); label->setPalette(palette); layout = new QHBoxLayout; layout->addWidget(label); setLayout(layout); timer = new QTimer( this ); connect(timer, SIGNAL(timeout()), this, SLOT(updateClock()) ); timer->start(1000); }
//------------------------------------------------------------------------------ void MainWindow::timeout() { QTime current_time = QTime::currentTime(); updateCounter(current_time, s_previousTime); updateClock(current_time); s_previousTime = current_time; }
void restartPrepare(ClickRecognizerRef recognizer, void *context) { if (currentMode == ModePrepare || currentMode == ModeSport) { switchToMode(ModePrepare); } else if (currentMode == ModePause) { currentTimer += sportLength; updateClock(); } }
void TimerWindow::updateTimeLeft( int minutes ){ qDebug() << "TimerWindow::updateTimeLeft( " << minutes << " )"; minutesRemaining = minutes; updateClock(); if ( minutesRemaining <= 0 ) { emit requestLogout(); } }
void BriefMenu::handleTick(int elapsed) { if (g_Session.updateTime(elapsed)) { updateClock(); } if (mm_renderer_.handleTick(elapsed)) { redrawMiniMap(); } }
void NTPClock::TimerTick() { if (!timer) return; delete timer; timer = NULL; updateClock(); timer = new EcoreTimer(60 * 60 * 12, (sigc::slot<void>)sigc::mem_fun(*this, &NTPClock::TimerTick)); }
void handleFollowUp(MsgHeader *header, Octet *msgIbuf, ssize_t length, Boolean isFromSelf, PtpClock *ptpClock) { MsgFollowUp *follow; TimeInternal preciseOriginTimestamp; if(length < FOLLOW_UP_PACKET_LENGTH) { ERROR("short folow up message\n"); toState(PTP_FAULTY, ptpClock); return; } switch(ptpClock->port_state) { case PTP_SLAVE: if(isFromSelf) { DBG("handleFollowUp: ignore from self\n"); return; } if(getFlag(header->flags, PTP_SYNC_BURST) && !ptpClock->burst_enabled) return; DBGV("handleFollowUp: looking for uuid %02hhx:%02hhx:%02hhx:%02hhx:%02hhx:%02hhx\n", ptpClock->parent_uuid[0], ptpClock->parent_uuid[1], ptpClock->parent_uuid[2], ptpClock->parent_uuid[3], ptpClock->parent_uuid[4], ptpClock->parent_uuid[5]); follow = &ptpClock->msgTmp.follow; msgUnpackFollowUp(ptpClock->msgIbuf, follow); if( ptpClock->waitingForFollow && follow->associatedSequenceId == ptpClock->parent_last_sync_sequence_number && header->sourceCommunicationTechnology == ptpClock->parent_communication_technology && header->sourcePortId == ptpClock->parent_port_id && !memcmp(header->sourceUuid, ptpClock->parent_uuid, PTP_UUID_LENGTH) ) { ptpClock->waitingForFollow = FALSE; toInternalTime(&preciseOriginTimestamp, &follow->preciseOriginTimestamp, &ptpClock->halfEpoch); updateOffset(&preciseOriginTimestamp, &ptpClock->sync_receive_time, &ptpClock->ofm_filt, ptpClock); updateClock(ptpClock); } else { DBGV("handleFollowUp: unwanted\n"); } break; default: DBGV("handleFollowUp: disreguard\n"); return; } }
void MBC3Mapper::writeLow(quint16 address, quint8 data) { int tmpAddress = 0; switch(address & 0x6000) { case 0x0000: // RAM enable register m_ramEnable = ((data & 0x0a) == 0x0a); break; case 0x2000: // ROM bank select data = data & 0x7f; if (data == 0) data = 1; if (data == m_romBank) break; tmpAddress = data << 14; tmpAddress &= romSizeMask(); m_romBank = data; m_banks[0x04] = &m_rom[tmpAddress + 0x0000]; m_banks[0x05] = &m_rom[tmpAddress + 0x1000]; m_banks[0x06] = &m_rom[tmpAddress + 0x2000]; m_banks[0x07] = &m_rom[tmpAddress + 0x3000]; break; case 0x4000: // RAM bank select if (data < 8) { if (data == m_ramBank) break; tmpAddress = data << 13; tmpAddress &= ramSizeMask(); m_banks[0x0a] = &m_ram[tmpAddress + 0x0000]; m_banks[0x0b] = &m_ram[tmpAddress + 0x1000]; m_ramBank = data; m_ramAddress = tmpAddress; } else { if (m_ramEnable) { m_ramBank = -1; m_clockRegister = data; } } break; case 0x6000: // clock latch if (m_clockLatch == 0 && data == 1) { updateClock(); m_latchSeconds = m_seconds; m_latchMinutes = m_minutes; m_latchHours = m_hours; m_latchDays = m_days; m_latchControl = m_control; } if (data == 0x00 || data == 0x01) m_clockLatch = data; break; } }
void BriefMenu::handleShow() { menu_manager_->saveBackground(); // grab mission info int cur_miss = g_Session.getSelectedBlock().mis_id; Mission *pMission = g_App.missions().loadMission(cur_miss); assert(pMission != NULL); g_Session.setMission(pMission); // Loads mission briefing p_briefing_ = g_App.missions().loadBriefing(cur_miss); assert(p_briefing_ != NULL); start_line_ = 0; getOption(prevButId_)->setVisible(false); getOption(nextButId_)->setVisible(false); update_briefing_text(); // reset minimap renderer with current mission uint8 enh_lvl = g_Session.getSelectedBlock().enhanceLevel; MinimapRenderer::EZoom zoom = toZoomLevel(enh_lvl); bool drawEnemies = enh_lvl == p_briefing_->nb_enhts(); mm_renderer_.init(pMission, zoom, drawEnemies); updateClock(); // Initialize the informations label with current cost if (g_Session.getSelectedBlock().infoLevel < p_briefing_->nb_infos()) { getStatic(txtInfoId_)->setTextFormated("%d", p_briefing_->infoCost(g_Session.getSelectedBlock().infoLevel)); getOption(infosButId_)->setWidgetEnabled(true); } else { getStatic(txtInfoId_)->setText(""); getOption(infosButId_)->setWidgetEnabled(false); } // Initialize the enhancements label with current cost if (enh_lvl < p_briefing_->nb_enhts()) { getStatic(txtEnhId_)->setTextFormated("%d", p_briefing_->enhanceCost(enh_lvl)); getOption(enhButId_)->setWidgetEnabled(true); } else { getStatic(txtEnhId_)->setText(""); getOption(enhButId_)->setWidgetEnabled(false); } g_System.showCursor(); }
void SysTickHandler(void) { // // Call the FatFs tick timer. // disk_timerproc(); ticks++; if (ticks == 100) //Every half a second update the clock { ticks = 0; updateClock(); } }
//Interrupt Function, called upon an interrupt of a module void interrupt interruptRoutine() { //Proceed only if the Timer1 module overflow flag has been thrown if (TMR1IF) { TMR1IF = 0x00; //Clear the Timer1 module overflow interrupt flag to prevent false interrupt //Set the Timer1 module to interrupt after half a second has passed in real time TMR1H = 0xBF; //Reset the highest byte of the Timer1 module counter TMR1L = 0xFD; //Reset the lowest byte of the Timer1 module counter //Update the real time clock and update the display to display the current time updateClock(); //Update the current time on the clock to be accurate with world time updateDisplay(); //Update the display digits to represent the current time being tracked by the clock } //Proceed only if the Timer0 module overflow flag has been thrown if (TMR0IF) { TMR0IF = 0x00; //Clear the Timer0 module overflow interrupt flag to prevent false interrupts //Multiplex the next digit of the display multiplexDisplay(); //Multiplex the next digit of the display } //Proceed only if the Timer1 module match flag has been thrown if (TMR2IF) { TMR2IF = 0x00; //Clear the Timer2 module match interrupt flag to prevent false interrupts //Check to see if the minutes button is being held down if (RB6 && !RB7) { timeMinutes++; //Increment the minutes counter by 1 //Check to see if the minutes value is over an hour if (timeMinutes == 0x3C) { timeMinutes = 0x00; //Reset the minutes counter back to 0 } updateDisplay(); //Update the values on the display to reflect the newly set time } //Check to see if the hours button is being held down if (!RB6 && RB7) { timeHours++; //Increment the hours counter by 1 //Check to see if the hours value is over a day if (timeHours == 0x18) { timeHours = 0x00; //Reset the hours counter back to 0 } updateDisplay(); //Update the values on the display to reflect the newly set time } } }
void SelectMenu::handleTick(int elapsed) { tick_count_ += elapsed; // Updates the moving agent selector if (tick_count_ > 300) { rnd_ = ++rnd_ % 8; tick_count_ = 0; needRendering(); } // Update the clock if (g_Session.updateTime(elapsed)) { updateClock(); } }
void Clock::tabChanged( QWidget * ) { if ( tabs->currentPageIndex() == 0 ) { t->start(1000); } else if ( tabs->currentPageIndex() == 1 ) { if ( !swatch_running ) t->stop(); stopStart->setAccel( Key_Return ); } else if ( tabs->currentPageIndex() == 2 ) { t->start(1000); } updateClock(); }
void BriefMenu::handleShow() { menu_manager_->saveBackground(); // grab mission info int cur_miss = g_Session.getSelectedBlock().mis_id; Mission *pMission = g_App.missions().loadMission(cur_miss); assert(pMission != NULL); g_Session.setMission(pMission); // NOTE: map is required to be loaded here, because minimap is z=0 pMission->loadMap(); pMission->createMinimap(); bool found = false; int maxx = pMission->mmax_x_; int maxy = pMission->mmax_y_; for (int x = 0; x < maxx && (!found); x++) { for (int y = 0; y < maxy && (!found); y++) { if (pMission->getMinimapOverlay(x, y) == 1) { minimap_scroll_x_ = x; minimap_scroll_y_ = y; found = true; } } } minimap_blink_ticks_ = 0; minimap_blink_ = 0; start_line_ = 0; updateClock(); if (g_Session.getSelectedBlock().infoLevel < pMission->getMaxInfoLvl()) { getStatic(txtInfoId_)->setTextFormated("%d", pMission->infoCost(g_Session.getSelectedBlock().infoLevel)); } else getStatic(txtInfoId_)->setText(""); if (g_Session.getSelectedBlock().enhanceLevel < pMission->getMaxEnhanceLvl()) { getStatic(txtEnhId_)->setTextFormated("%d", pMission->enhanceCost(g_Session.getSelectedBlock().enhanceLevel)); } else getStatic(txtEnhId_)->setText(""); g_System.showCursor(); }
/* do one iteration */ static unsigned long barcode_draw (Display *dpy, Window win, void *closure) { struct state *st = (struct state *) closure; if (st->mode == BC_SCROLL) scrollModel (st); else if (st->mode == BC_GRID) updateGrid (st); else if (st->mode == BC_CLOCK12 || st->mode == BC_CLOCK24) updateClock (st); else abort(); renderFrame (st); return st->delay; }
void NTPClock::applyCalendarFromServer(std::string source, std::string s, void *listener_data, void* sender_data) { if (networkCmdCalendarApply[2] == "ntp_on") { cInfo() << "Enabling NTP"; enable(true); int timeZone; std::istringstream iss(networkCmdCalendarApply[3]); iss >> timeZone; cApply.timeZone.current = timeZone; cApply.applyTimezone(); updateClock(); }