/* moves down the figure and returns true if gameover */ static void move_down (void) { int l, i, rx, ry; if (!canMoveTo (rockblox_status.cx, rockblox_status.cy + 1, rockblox_status.co)) { /* save figure to board */ for (i = 0; i < 4; i++) { rx = getRelativeX (rockblox_status.cf, i, rockblox_status.co) + rockblox_status.cx; ry = getRelativeY (rockblox_status.cf, i, rockblox_status.co) + rockblox_status.cy; rockblox_status.board[ry][rx] = rockblox_status.cf; } /* check if formed some lines */ l = check_lines (); if (l) { /* the original scoring from "http://en.wikipedia.org/wiki/Rockblox" */ rockblox_status.score += scoring[l - 1] * rockblox_status.level; rockblox_status.lines += l; rockblox_status.level = (int) rockblox_status.lines / 10 + 1; } /* show details */ show_details (); /* generate a new figure */ new_block (); } else move_block (0, 1, rockblox_status.co); }
static void show_details_for_wired (GtkButton *button, NetDeviceEthernet *device) { /* Translators: This is used as the title of the connection * details window for ethernet, if there is only a single * profile. It is also used to display ethernet in the * device list. */ show_details (button, device, _("Wired")); }
static rc_t fastdump_table( tool_ctx_t * tool_ctx, const char * tbl_name ) { rc_t rc = 0; struct temp_registry * registry = NULL; join_stats stats; clear_join_stats( &stats ); /* helper.c */ if ( tool_ctx -> show_details ) rc = show_details( tool_ctx ); /* above */ if ( rc == 0 ) rc = check_output_exits( tool_ctx ); /* above */ if ( rc == 0 ) rc = make_temp_registry( ®istry, tool_ctx -> cleanup_task ); /* temp_registry.c */ if ( rc == 0 ) rc = execute_tbl_join( tool_ctx -> dir, tool_ctx -> accession_path, tool_ctx -> accession_short, &stats, tbl_name, tool_ctx -> temp_dir, registry, tool_ctx -> cursor_cache, tool_ctx -> buf_size, tool_ctx -> num_threads, tool_ctx -> show_progress, tool_ctx -> fmt, & tool_ctx -> join_options ); /* tbl_join.c */ if ( rc == 0 ) rc = temp_registry_merge( registry, tool_ctx -> dir, tool_ctx -> output_filename, tool_ctx -> buf_size, tool_ctx -> show_progress, tool_ctx -> force, tool_ctx -> compress ); /* temp_registry.c */ if ( registry != NULL ) destroy_temp_registry( registry ); /* temp_registry.c */ if ( rc == 0 ) print_stats( &stats ); /* helper.c */ return rc; }
static void select_click_handler(ClickRecognizerRef recognizer, void *context) { if(ErrorExists == 0 && Loading == 0){ show_details(); DictionaryIterator *iter; uint8_t value = 1; app_message_outbox_begin(&iter); dict_write_int(iter, KEY_DETAILS, &value, 1, true); dict_write_end(iter); app_message_outbox_send(); } else { APP_LOG(APP_LOG_LEVEL_DEBUG, "Select disabled."); } }
static rc_t fastdump_csra( tool_ctx_t * tool_ctx ) { rc_t rc = 0; if ( tool_ctx -> show_details ) rc = show_details( tool_ctx ); /* above */ if ( rc == 0 ) rc = check_output_exits( tool_ctx ); /* above */ if ( rc == 0 ) rc = produce_lookup_files( tool_ctx ); /* above */ if ( rc == 0 ) rc = produce_final_db_output( tool_ctx ); /* above */ return rc; }
static void init_rockblox (bool resume) { char score_name[50]; struct tm* tm; tm = rb->get_time(); rb->snprintf(score_name, sizeof(score_name), "%04d%02d%02d %02d%02d%02d", tm->tm_year + 1900, tm->tm_mon + 1, tm->tm_mday, tm->tm_hour, tm->tm_min, tm->tm_sec); #ifdef HAVE_LCD_BITMAP rb->lcd_bitmap (rockblox_background, 0, 0, LCD_WIDTH, LCD_HEIGHT); #else /* HAVE_LCD_CHARCELLS */ pgfx_display (0, 0); pgfx_display_block (3, 0, 3, 1); pgfx_display_block (4, 0, 3, 0); rb->lcd_puts(4, 1, " "); pgfx_clear_display(); pgfx_fillrect (3, 0, 2, 14); pgfx_fillrect (15, 7, 2, 7); pgfx_update(); #endif if (!resume) { rockblox_status.level = 1; rockblox_status.lines = 0; rockblox_status.score = 0; rockblox_status.nf = t_rand(BLOCKS_NUM); init_board (); new_block (); } draw_next_block(); show_details (); #ifdef HIGH_SCORE_Y show_highscores (); #endif }
Dwarf::Dwarf(DFInstance *df, const uint &index, QObject *parent) : QObject(parent) , m_df(df) , m_total_xp(0) , m_index(index) , m_raw_profession(-1) , m_migration_wave(0) , m_current_job_id(-1) , m_squad_leader_id(-1) { read_settings(); refresh_data(); connect(DT, SIGNAL(settings_changed()), SLOT(read_settings())); // setup context actions m_actions.clear(); QAction *show_details = new QAction(tr("Show Details..."), this); connect(show_details, SIGNAL(triggered()), SLOT(show_details())); m_actions << show_details; QAction *zoom_to_dwarf = new QAction(tr("Zoom To Dwarf..."),this); connect(zoom_to_dwarf, SIGNAL(triggered()), SLOT(move_view_to())); m_actions << zoom_to_dwarf; }
static int rockblox_loop (void) { int button; #if defined(ROCKBLOX_OFF_PRE) || defined(ROCKBLOX_DROP_PRE) int lastbutton = BUTTON_NONE; #endif long next_down_tick = *rb->current_tick + level_speed(rockblox_status.level); if (rockblox_menu()) { return 1; } resume = false; resume_file = false; while (1) { #ifdef HAS_BUTTON_HOLD if (rb->button_hold ()) { /* Turn on backlight timeout (revert to settings) */ backlight_use_settings(); rb->splash(0, "Paused"); while (rb->button_hold ()) rb->sleep(HZ/10); /* Turn off backlight timeout */ backlight_ignore_timeout(); /* get rid of the splash text */ rb->lcd_bitmap (rockblox_background, 0, 0, LCD_WIDTH, LCD_HEIGHT); show_details (); #ifdef HIGH_SCORE_Y show_highscores (); #endif draw_next_block (); refresh_board (); } #endif button = rb->button_get_w_tmo (MAX(next_down_tick - *rb->current_tick, 1)); switch (button) { #ifdef ROCKBLOX_RC_OFF case ROCKBLOX_RC_OFF: #endif case ROCKBLOX_OFF: #ifdef ROCKBLOX_OFF_PRE if (lastbutton != ROCKBLOX_OFF_PRE) break; #endif resume = true; return 0; break; #if defined(ROCKBLOX_ROTATE) case ROCKBLOX_ROTATE: #endif case ROCKBLOX_ROTATE_CCW: case ROCKBLOX_ROTATE_CCW | BUTTON_REPEAT: #ifdef HAVE_SCROLLWHEEL /* if the wheel is disabled, add an event to the stack. */ if(wheel_enabled == false) wheel_events++; /* if it's enabled, go ahead and rotate.. */ if(wheel_enabled) #endif #ifdef ROCKBLOX_ROTATE_CCW2 /* fallback */ case ROCKBLOX_ROTATE_CCW2: #endif move_block (0, 0, (rockblox_status.co + 1) % figures[rockblox_status.cf].max_or); break; case ROCKBLOX_ROTATE_CW: case ROCKBLOX_ROTATE_CW | BUTTON_REPEAT: #ifdef HAVE_SCROLLWHEEL if(wheel_enabled == false) wheel_events++; if(wheel_enabled) #endif #ifdef ROCKBLOX_ROTATE_CW2 /* fallback */ case ROCKBLOX_ROTATE_CW2: #endif move_block (0, 0, (rockblox_status.co + figures[rockblox_status.cf].max_or - 1) % figures[rockblox_status.cf].max_or); break; case ROCKBLOX_DOWN: case ROCKBLOX_DOWN | BUTTON_REPEAT: move_block (0, 1, rockblox_status.co); break; case ROCKBLOX_RIGHT: case ROCKBLOX_RIGHT | BUTTON_REPEAT: move_block (1, 0, rockblox_status.co); break; case ROCKBLOX_LEFT: case ROCKBLOX_LEFT | BUTTON_REPEAT: move_block (-1, 0, rockblox_status.co); break; case ROCKBLOX_DROP: #ifdef ROCKBLOX_DROP_PRE if (lastbutton != ROCKBLOX_DROP_PRE) break; #endif while (canMoveTo (rockblox_status.cx, rockblox_status.cy + 1, rockblox_status.co)) move_block (0, 1, rockblox_status.co); rockblox_status.dropped = true; break; #ifdef ROCKBLOX_RESTART case ROCKBLOX_RESTART: rb->splash (HZ * 1, "Restarting..."); init_rockblox (false); break; #endif default: if (rb->default_event_handler (button) == SYS_USB_CONNECTED) return PLUGIN_USB_CONNECTED; break; } #if defined(ROCKBLOX_OFF_PRE) || defined(ROCKBLOX_DROP_PRE) if (button != BUTTON_NONE) lastbutton = button; #endif #ifdef HAVE_SCROLLWHEEL /* check if we should enable the scroll wheel, if events * begin to stack up... */ if(wheel_enabled == false) { /* stopped rotating the wheel, reset the count */ if(wheel_events == last_wheel_event) { last_wheel_event = 0; wheel_events = 0; } /* rotated the wheel a while constantly, enable it. */ else if(wheel_events > 3) { wheel_enabled = true; } /* this evens out the last event and the "current" event. * if we get an event next time through button reading, it will * remain ahead of last_event. if we don't, they'll end up equaling * each other.. thus, the scroll count will be reset. */ if(wheel_enabled == false && wheel_events > last_wheel_event) last_wheel_event++; } #endif if (TIME_AFTER(*rb->current_tick, next_down_tick)) { move_down (); next_down_tick += level_speed(rockblox_status.level); if (TIME_AFTER(*rb->current_tick, next_down_tick)) /* restart time "raster" when we had to wait longer than usual * (pause, game restart etc) */ next_down_tick = *rb->current_tick + level_speed(rockblox_status.level); } if (rockblox_status.gameover) { #if LCD_DEPTH >= 2 rb->lcd_set_foreground (LCD_BLACK); #endif show_game_over(); resume = false; return 0; } refresh_board (); } return 0; }
static void show_details_for_row (GtkButton *button, NetDeviceEthernet *device) { show_details (button, device, NULL); }
void PostListPage::refresh_list() { if (!_client) return; if (!_client->is_authenticated()) { try { _client->authenticate(); } catch (...) { // TODO: display error } if (_client->is_authenticated()) { _ui->refreshListButton->setText("Refresh"); _ui->postText->setEnabled(true); _ui->postButton->setEnabled(true); } else { _ui->refreshListButton->setText("Authenticate"); _ui->postText->setEnabled(false); _ui->postButton->setEnabled(false); } } else { QList<Post> posts; try { posts = _client->get_local_posts(); } catch (...) { // TODO: display error } while (_post_widgets.size() < posts.size()) { PostWidget* w = new PostWidget; _layout->insertWidget(_post_widgets.size(), w); _post_widgets << w; connect(w, SIGNAL(show_details(QString)), this, SIGNAL(show_post_details(QString))); } while (_post_widgets.size() > posts.size()) { delete _post_widgets.last(); _post_widgets.pop_back(); } for (int i = 0; i < posts.size(); ++i) { _post_widgets[i]->set_post(posts[i]); } _ui->postsScrollArea->ensureVisible(0, 0); update_karma(); } }