MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent) { /* Window Title */ setWindowTitle(tr(APPLICATION_NAME)); /* Set sticky places for dockwidgets */ setCorner(Qt::TopLeftCorner, Qt::TopDockWidgetArea); setCorner(Qt::TopRightCorner, Qt::RightDockWidgetArea); setCorner(Qt::BottomLeftCorner, Qt::BottomDockWidgetArea); setCorner(Qt::BottomRightCorner, Qt::BottomDockWidgetArea); /* * Create Mastercontroller (zone -1) * Controls all zones on all bridges. */ master = new SingleController("Master", -1, this); masterDockWidget = new QDockWidget(tr("Master Controller"), this); masterDockWidget->setWidget(master); masterDockWidget->setMaximumWidth(200); addDockWidget(Qt::TopDockWidgetArea, masterDockWidget); /* Audio Controller */ audio = new audioController(this); addDockWidget(Qt::TopDockWidgetArea, audio); /* Connect Audio to Master .*/ connect(audio, SIGNAL(setRandomSame()), master, SLOT(setRandomExt())); connect(audio, SIGNAL(flash()), master, SLOT(flash())); connect(audio, SIGNAL(flashRandom()), master, SLOT(flashRandom())); connect(audio, SIGNAL(fade10()), master, SLOT(fade10Ext())); connect(audio, SIGNAL(fade20()), master, SLOT(fade20Ext())); presetController = new PresetController(this); presetController->setMinimumWidth(230); addDockWidget(Qt::TopDockWidgetArea, presetController); connect(presetController, SIGNAL(createPreset()), this, SLOT(getPreset())); connect(this, SIGNAL(presetAvailable(Preset*)), presetController, SLOT(addPreset(Preset*))); connect(presetController, SIGNAL(setPreset(Preset*)), this, SLOT(setPreset(Preset*))); /* Center the window. */ QWidget *w = window(); w->setGeometry(QStyle::alignedRect(Qt::LeftToRight, Qt::AlignCenter, w->size(), qApp->desktop()->availableGeometry())); /* Create Bridge Discovery Dialog. */ MiLightDiscover *d = new MiLightDiscover(this); connect(d, SIGNAL(selectedDevices(QStringList, bool)), this, SLOT(setupControllers(QStringList, bool))); d->exec(); setupActions(); setupToolBar(); setupMenuBar(); setupStatusBar(); loadSettings(); delete d; }
int main(void) { int i; init(); output_speed(0, 50); output_speed(1, 50); while (1) { flash(LED_M0_R); flash(LED_M0_B); flash(LED_M1_R); flash(LED_M1_B); output_enable(0); output_direction(0, DIR_FWD); delay(DELAY*2); output_direction(0, DIR_REV); delay(DELAY*2); output_disable(0); delay(DELAY); output_enable(1); output_direction(1, DIR_FWD); delay(DELAY*2); output_direction(1, DIR_REV); delay(DELAY*2); output_disable(1); delay(DELAY); } return 0; }
void loop() { for (int i=0 ; i<numPins ; i++) { flash(pins[i], period); } for (int i=numPins-1 ; i>=0 ; i--) { flash(pins[i], period); } }
void input(WINDOW *wnd) { int row=1,col=1,c; curs_set(1); while(1) { move (row,col); c = getch (); switch (c) { case KEY_LEFT: if (col > 1) col--; else flash (); break; case KEY_DOWN: if (row < LINES - 5) row++; else flash (); break; case KEY_UP: if (row > 1) row--; else flash (); break; case KEY_RIGHT: if (col < COLS - 2) col++; else flash (); break; case KEY_BACKSPACE: if(col>1) { mvwprintw(wnd,row,--col,"%c",' '); wrefresh (wnd); } else flash(); break; box(wnd, 0 , 0); case KEY_DL: deleteln (); box(wnd, 0 , 0); break; default: if(c==KEY_F(3)) goto DONE; if(col < COLS - 1) mvwinsch(wnd, row, ++col-1, c); else{ col=0; row++; mvwinsch(wnd, row, ++col, c); } box(wnd,0,0); wrefresh (wnd); break; } } DONE: refresh(); };
/* Create a new resource in the database */ static void createPost() { if (updateRec(createRec("post", params()))) { flash("inform", "New post Created"); renderView("post/post-list"); } else { flash("error", "Cannot Create Post"); renderView("post/post-edit"); } }
void kflag0_main( void ) { CYG_TEST_INIT(); CHECK(flash()); CHECK(flash()); CYG_TEST_PASS_FINISH("Kernel C API Flag 0 OK"); }
void Simon::welcome() { b.playSong("C4,8,E4,8,G4,8,C5,8,G5,4"); b.allLedsOn(0,20,20); delay(500); b.allLedsOff(); flash(Top, true, true); flash(Right, true, true); flash(Bottom, true, true); flash(Left, true, true); state = Ready; }
void input_handle_key(char ch) { bool more_matches = false; bool match_found = false; size_t num_entries = (sizeof(Default_Bindings) / sizeof(binding_t)); unsigned int len = strlen(Key_Buffer); /* If no more room then reset the buffer */ if (len+1 >= 16) { beep(); flash(); len = 0; Key_Buffer[0] = '\0'; } /* If we got a valid key then process it */ if((char)ERR != ch) { unsigned int i; /* Put the key in the buffer */ len++; Key_Buffer[len-1] = ch; Key_Buffer[len] = '\0'; /* Loop over the bindings */ for(i = 0; i < num_entries; i++) { binding_t binding = Default_Bindings[i]; char* seq = binding.sequence; /* If the binding we're looking at matches a substring but has more chars * make note of it so we can wait for the next char */ if((strlen(seq) > len) && (0 == strncmp(seq, Key_Buffer, len))) { more_matches = true; } /* If the current string matches exactly then execute it's handler */ if (0 == strcmp(Key_Buffer, seq)) { binding.callback(); Key_Buffer[0] = '\0'; match_found = true; break; } } /* If we did not find a match and we don't have any possibility of * finding a longer match, then throw out the buffer and start over */ if(!match_found && !more_matches) { beep(); flash(); len = 0; Key_Buffer[0] = '\0'; } } }
/* Update an existing resource in the database If "id" is not defined, this is the same as a create Also we tunnel delete here if the user clicked delete */ static void updatePost() { if (smatch(param("submit"), "Delete")) { removePost(); } else { if (updateFields("post", params())) { flash("inform", "Post Updated Successfully"); redirect("list"); } else { flash("error", "Cannot Update Post"); renderView("post/post-edit"); } } }
void TitleWindow::update_color() { //printf("TitleWindow::update_color %x\n", client->config.color); set_color(client->config.color); draw_box(color_x, color_y, COLOR_W, COLOR_H); flash(color_x, color_y, COLOR_W, COLOR_H); set_color(client->config.outline_color); draw_box(outline_color_x, outline_color_y, COLOR_W, COLOR_H); set_color(BLACK); draw_rectangle(color_x, color_y, COLOR_W, COLOR_H); draw_rectangle(outline_color_x, outline_color_y, COLOR_W, COLOR_H); flash(outline_color_x, outline_color_y, COLOR_W, COLOR_H); }
/** Code for debugging, when serial isn't working. debug_char() will flash the bits of the char argument, starting from the least significant bit. */ void debug_char(unsigned char c) { unsigned int c2 = (unsigned int) c; for (int i=0; i<8; i++) { if (c2 & 0x01) { // twice for 1 flash(); flash(); } else { // once for 0 flash(); } pause(); c2 = c2 >> 1; } }
void flashDotsAndDashes(String dotsAndDashes) { for (int i = 0; i < dotsAndDashes.length(); i++) { char dotOrDash = dotsAndDashes.charAt(i); if (dotOrDash == '.') { flash(dot); } else { flash(dash); } delay(dot); // gap between dots and dashes of a letter } delay(dash - dot); // gap between letters of a word }
void AttackIndicator::checkEnemies() { int heroPos = Dungeon::hero->pos; candidates.clear(); int v = Dungeon::hero->VisibleEnemies(); for (int i = 0; i < v; i++) { Mob* mob = Dungeon::hero->visibleEnemy(i); if (Level::adjacent(heroPos, mob->pos)) { candidates.push_back(mob); } } if (candidates.end() == std::find(candidates.begin(), candidates.end(), lastTarget)) { if (candidates.empty()) { lastTarget = NULL; } else { int i = Random::Int(candidates.size()); int c = 0; for (std::list<Mob*>::iterator itr = candidates.begin(); itr != candidates.end(); itr++) { if (c == i) { lastTarget = *itr; break; } c++; } updateImage(); flash(); } } else { if (!bg->visible) { flash(); } } visible(lastTarget != NULL); enable(bg->visible); }
void Simon::celebrate() { flash(Top, false, false); flash(Right, false, false); flash(Bottom, false, false); flash(Left, false, false); b.playSong("C4,8,E4,8,G4,8,C5,8,G5,4"); //b.allLedsOn(0, 255, 0); delay(300); b.allLedsOff(); delay(500); difficulty++; start(); }
int my_collision(int *first, int *second, int y, WINDOW *window) { if (my_check_col(first, y) != 2) { flash(); return -1; } if (my_check_object(first, y) == -1) { flash(); return -1; } my_check_bonus(second, first, y); my_clear(first, y); }
int GraphicGUI::resize_event(int w, int h) { int difference = h - get_h(); int canvas_xdiff = get_w() - canvas->get_w(); int canvas_ydiff = get_h() - canvas->get_h(); canvas->reposition_window(canvas->get_x(), canvas->get_y(), w - canvas_xdiff, h - canvas_ydiff); freq_text->reposition_window(freq_text->get_x(), freq_text->get_y() + difference); value_text->reposition_window(value_text->get_x(), value_text->get_y() + difference); freq_title->reposition_window(freq_title->get_x(), freq_title->get_y() + difference); level_title->reposition_window(level_title->get_x(), level_title->get_y() + difference); size_title->reposition_window(size_title->get_x(), size_title->get_y() + difference); reset->reposition_window(reset->get_x(), reset->get_y() + difference); size->reposition_window(size->get_x(), size->get_y() + difference); draw_ticks(); update_canvas(); flash(); plugin->w = w; plugin->h = h; plugin->send_configure_change(); return 1; }
int RecordGUI::resize_event(int w, int h) { int x, y, x1; // Recompute batch list based on previous extents int bottom_margin = mwindow->session->rwindow_h - batch_list->get_y() - batch_list->get_h(); int mode_margin = mwindow->session->rwindow_h - load_mode->get_y(); mwindow->session->rwindow_x = get_x(); mwindow->session->rwindow_y = get_y(); mwindow->session->rwindow_w = w; mwindow->session->rwindow_h = h; mwindow->theme->get_recordgui_sizes(this, w, h); mwindow->theme->draw_rwindow_bg(this); int new_h = mwindow->session->rwindow_h - bottom_margin - batch_list->get_y(); if(new_h < 10) new_h = 10; batch_list->reposition_window(batch_list->get_x(), batch_list->get_y(), mwindow->session->rwindow_w - 20, mwindow->session->rwindow_h - bottom_margin - batch_list->get_y()); load_mode->reposition_window(mwindow->session->rwindow_w / 2 - mwindow->theme->loadmode_w / 2, mwindow->session->rwindow_h - mode_margin); flash(); return 1; }
void Programmer::VerifyMainBlock(const std::string& hexfilename, const bool ignoreCheck) { // is MainBlock readback disabled? if (!ignoreCheck && !CanReadMainBlock()) throw std::string("MainBlock readback is disabled by the target configuration."); ProgressBar pb("Verifying"); FlashMemory flash(flashSize); flash.LoadHex(hexfilename); // read the HEX file FlashMemory verifyFlash(flashSize); int address = 0; while (address < flashSize) { ReadChunk(false, verifyFlash, address); address += PROG_CHUNK_SIZE; // update the progress bar pb.Refresh(address / double(flashSize)); } // now compare if (flash != verifyFlash) { //flash.SaveHex("orig.hex"); //verifyFlash.SaveHex("verif.hex"); throw std::string("MainBlock verification failed."); } }
int BC_PixmapSW::draw() { draw_top_background(parent_window, 0, 0, get_w(), get_h()); draw_pixmap(thepixmap); flash(); return 0; }
int test_CPD() { asic_t *device = asic_init(TI83p); uint8_t test[] = { 0xED, 0xA9 }; // CPD device->cpu->registers.HL = 0xC002; device->cpu->registers.BC = 5; device->cpu->registers.A = 0x11; cpu_write_byte(device->cpu, 0xC000, 0x11); cpu_write_byte(device->cpu, 0xC001, 0x22); cpu_write_byte(device->cpu, 0xC002, 0x33); flash(device, test, sizeof(test)); int cycles = cpu_execute(device->cpu, 16); if (device->cpu->registers.flags.Z != 0 || device->cpu->registers.HL != 0xC001 || device->cpu->registers.BC != 4 || cycles != 0) { asic_free(device); return 1; } device->cpu->registers.PC = 0; cpu_execute(device->cpu, 16); device->cpu->registers.PC = 0; cpu_execute(device->cpu, 16); if (device->cpu->registers.flags.Z != 1 || device->cpu->registers.HL != 0xBFFF || device->cpu->registers.BC != 2) { asic_free(device); return 1; } asic_free(device); return 0; }
void ScopeWaveform::update_point(int x, int y) { draw_point(); drag_x = x; drag_y = y; int frame_x = x * gui->frame_w / get_w(); if(gui->use_wave_parade) { if(x > get_w() / 3 * 2) frame_x = (x - get_w() / 3 * 2) * gui->frame_w / (get_w() / 3); else if(x > get_w() / 3) frame_x = (x - get_w() / 3) * gui->frame_w / (get_w() / 3); else frame_x = x * gui->frame_w / (get_w() / 3); } float value = ((float)get_h() - y) / get_h() * (FLOAT_MAX - FLOAT_MIN) + FLOAT_MIN; char string[BCTEXTLEN]; sprintf(string, "X: %d Value: %.3f", frame_x, value); gui->value_text->update(string, 0); draw_point(); flash(1); }
void GradientWindow::update_out_color() { //printf("GradientWindow::update_out_color 1 %08x\n", plugin->config.get_in_color()); set_color(plugin->config.get_out_color()); draw_box(out_color_x, out_color_y, COLOR_W, COLOR_H); flash(out_color_x, out_color_y, COLOR_W, COLOR_H); }
QString SystemConfig::flashInfo() { QString mount_point("/media/flash"); QString flash("%1/%2 MB"); flash=flash.arg(freeSpace(mount_point)/1024/1024).arg(diskSpace(mount_point)/1024/1024); return flash; }
/* * Handle character input from the terminal. Returns non-zero * if CTRL-D was pressed, meaning the application should exit. */ static int handle_key_input(int portfd, WINDOW* win) { static const unsigned char kctab[] = { 0x1B, 0x30 }; // ESC 0 wint_t wc = L'\0'; unsigned char kc; switch (wget_wch(win, &wc)) { case OK: if (wc == L'\4') // C-d: quit return 1; if (wc == L'\t') send_bytes(portfd, kctab, sizeof kctab, win); else if ((kc = kc_from_wide_char(wc))) send_bytes(portfd, &kc, 1, win); else flash(); break; case KEY_CODE_YES: if (wc >= KEY_MIN && wc < KEY_MIN + N_ELEMENTS(keypad2kc) && keypad2kc[wc - KEY_MIN]) send_bytes(portfd, &keypad2kc[wc - KEY_MIN], 1, win); break; default: break; } return 0; }
int test_LDDR() { asic_t *device = asic_init(TI83p); uint8_t test[] = { 0xED, 0xB8 }; // LDDR device->cpu->registers.HL = 0xC004; device->cpu->registers.DE = 0xD004; device->cpu->registers.BC = 5; cpu_write_byte(device->cpu, 0xC000, 0x11); cpu_write_byte(device->cpu, 0xC001, 0x22); cpu_write_byte(device->cpu, 0xC002, 0x33); cpu_write_byte(device->cpu, 0xC003, 0x44); cpu_write_byte(device->cpu, 0xC004, 0x55); flash(device, test, sizeof(test)); int cycles = cpu_execute(device->cpu, 100); if (cpu_read_byte(device->cpu, 0xD000) != 0x11 || cpu_read_byte(device->cpu, 0xD001) != 0x22 || cpu_read_byte(device->cpu, 0xD002) != 0x33 || cpu_read_byte(device->cpu, 0xD003) != 0x44 || cpu_read_byte(device->cpu, 0xD004) != 0x55 || device->cpu->registers.HL != 0xBFFF || device->cpu->registers.DE != 0xCFFF || device->cpu->registers.BC != 0 || cycles != 0) { asic_free(device); return 1; } asic_free(device); return 0; }
void burnDialog::checkFw(QString fileName) { if (fileName.isEmpty()) { return; } if (!IS_TARANIS(GetEepromInterface()->getBoard())) { ui->EEbackupCB->show(); } else { ui->EEbackupCB->setChecked(false); *backup=false; } ui->FWFileName->setText(fileName); FlashInterface flash(fileName); if (flash.isValid()) { ui->FramFWInfo->show(); ui->DateField->setText(flash.getDate() + " " + flash.getTime()); ui->versionField->setText(flash.getVersion()); ui->ModField->setText(flash.getEEprom()); ui->SplashFrame->hide(); if (flash.hasSplash()) { ui->SplashFrame->show(); ui->imageLabel->setFixedSize(flash.getSplashWidth(), flash.getSplashHeight()); } } else { QMessageBox::warning(this, tr("Warning"), tr("%1 may not be a valid firmware file").arg(fileName)); } ui->BurnFlashButton->setEnabled(true); QTimer::singleShot(0, this, SLOT(shrink())); g.flashDir( QFileInfo(fileName).dir().absolutePath() ); }
void introTest(WINDOW *win) { werase(win); wmove(win, height / 2 - 5, width / 2); wvline(win, ACS_VLINE, 10); wmove(win, height / 2, width / 2 - 10); whline(win, ACS_HLINE, 20); Continue(win); beep(); werase(win); box(win, ACS_VLINE, ACS_HLINE); wrefresh(win); cbreak(); mvwaddstr(win, 1, 1, "You should have a rectangle in the middle of the screen"); mvwaddstr(win, 2, 1, "You should have heard a beep"); Continue(win); flash(); mvwaddstr(win, 3, 1, "You should have seen a flash"); Continue(win); }
void ButtonWidget::jsevent( int val ) { bool newOn = (val == 1); if (on != newOn) { on = newOn; flash(); } }
static void chat_onMessage(ToxWindow* self, int num, uint8_t* msg, uint16_t len) { ChatContext* ctx = (ChatContext*) self->x; uint8_t nick[MAX_NAME_LENGTH] = {0}; time_t now; time(&now); struct tm * timeinfo; timeinfo = localtime(&now); if(ctx->friendnum != num) return; getname(num, (uint8_t*) &nick); msg[len-1] = '\0'; nick[MAX_NAME_LENGTH-1] = '\0'; fix_name(msg); fix_name(nick); wattron(ctx->history, COLOR_PAIR(2)); wprintw(ctx->history, "[%02d:%02d:%02d] ", timeinfo->tm_hour, timeinfo->tm_min, timeinfo->tm_sec); wattroff(ctx->history, COLOR_PAIR(2)); wattron(ctx->history, COLOR_PAIR(4)); wprintw(ctx->history, "%s: ", nick); wattroff(ctx->history, COLOR_PAIR(4)); wprintw(ctx->history, "%s\n", msg); self->blink = true; beep(); flash(); }
void ReflowPage::stopReflow() { FlashGraphics flash(_panel); // stop the process _reflow->stop(); // disable the "pause" and "stop" buttons drawButtonCenteredGraphic(flash,GuiButtons[START_PAUSE],FlashInfo::PAUSE_DISABLED::OFFSET); drawButtonCenteredGraphic(flash,GuiButtons[STOP]); // enable the exit button drawButtonCenteredGraphic(flash,GuiButtons[EXIT]); // move the selected button to "exit" drawSelection(false); _selectedButton=EXIT; drawSelection(true); // erase the power rectangle Panel::LcdPanel& gl(flash.getGraphicsLibrary()); gl.setBackground(0x9f489e); gl.clearRectangle(Rectangle(POWER_RECT_X,POWER_RECT_Y,POWER_RECT_WIDTH,POWER_RECT_HEIGHT)); // the state is now finished _mode=FINISHED; }