WhiteAddDialog::WhiteAddDialog(int gr, QString name, int mode, QWidget *parent) : QDialog(parent), ui(new Ui::whiteAddDialog) { ui->setupUi(this); this->setWindowTitle("Новая деталь"); this->ui->name_box->setEditable(true); this->ui->name_box->setAutoCompletion(true); this->ui->name_box->setEnabled(false); this->ui->name_label->setEnabled(false); HeaderComboBoxDelegate *delegate = new HeaderComboBoxDelegate(); HeaderModel *headermodel = new HeaderModel(); this->ui->group_box->setItemDelegate(delegate); this->ui->group_box->setModel(headermodel); this->ui->id_label->setText(""); this->dialog_mode = mode; params_enabled = false; create_unrequired_list(); disable_params(); fill_groups_box(); fill_weight_box(); fill_unit_box(); if(gr > 0 && name.length() > 0){ // выбираем строку в комбобоксе и устанавливаем названия параметров int group_index = this->ui->group_box->findText(name); this->ui->group_box->setCurrentIndex(group_index); change_group(group_index); } connects(); }
int pure_c_kmeans( PGM_Matriz_Double *matriz, int k, int semente, int fim, PGM_Matriz_Double *centroides, int *grupo, double *somatorio_distancias ) { int alterou = 1; int *n_elem_grupo = (int*) palloc0 ( sizeof(int) * k); init_group(centroides, matriz, grupo, n_elem_grupo, k, semente); while( alterou ){ int i; alterou = 0; *somatorio_distancias = 0; for( i = 0; i < matriz->n_linhas; i++) alterou += change_group(centroides, matriz, grupo, i, somatorio_distancias); if(calculate_centroid(centroides, matriz, grupo, n_elem_grupo) < k){ switch(fim){ case 1: break; case 2: alterou += create_new_group(centroides, matriz, search_empty_group(n_elem_grupo, k)); break; case 3: return 1; } } } pfree (n_elem_grupo); return 0; }
static void cmd_ctrl_m(key_info_t key_info, keys_info_t *keys_info) { leave_change_mode(0); if(curr == 2) rename_file(view, 0); #ifndef _WIN32 else if(curr == 4) change_owner(); else if(curr == 6) change_group(); else if(curr == 8) enter_attr_mode(view); #else else if(curr == 4) enter_attr_mode(view); #endif }
int main(void) { gid_t groups[32]; int ngroups; gid_t this_group, other_group; int fd; this_group = getegid(); atomic_printf("Current group is %d\n", this_group); ngroups = getgroups(ALEN(groups), groups); test_assert(ngroups > 0); other_group = groups[0]; if (this_group == other_group && ngroups > 1) { other_group = groups[1]; } if (this_group == other_group) { atomic_puts("WARNING: unable to properly test chown()"); } fd = creat(DUMMY_FILENAME, 0600); test_assert(fd >= 0); atomic_printf("Group owner of %s is %d\n", DUMMY_FILENAME, get_gid(fd)); test_assert(this_group == get_gid(fd)); change_group(DUMMY_FILENAME, other_group); atomic_printf(" ... now owner is %d\n", get_gid(fd)); test_assert(other_group == get_gid(fd)); change_group_fd(fd, this_group); atomic_printf(" ... now back to original owner %d\n", get_gid(fd)); test_assert(this_group == get_gid(fd)); change_group_at(DUMMY_FILENAME, other_group); atomic_printf(" ... now owner is %d\n", get_gid(fd)); test_assert(other_group == get_gid(fd)); unlink(DUMMY_FILENAME); atomic_puts("EXIT-SUCCESS"); return 0; }
/* ARGSUSED */ void GpDelete_Callback ( Widget widget, XtPointer clnt, XmListCallbackStruct *list_data ) { int nselect; /*------------------------------------------------------------------*/ /* * return when no selection was made */ XtVaGetValues(ggroup_listW, XmNselectedItemCount, &nselect, NULL); if ( nselect == 0 ) return; if (SelectGroupNo) { XmListDeletePos(group_listW,SelectGroupNo); XmListDeletePos(ggroup_listW,SelectGroupNo); change_group(SelectGroupNo); GroupNo --; } }
tbb::task* execute() { if( !m_i ) { // the first task creates two trees g_default_ctx = group(); for( int i = 0; i <= 1; ++i ) { g_trees[i][1] = new tbb::task_group_context( tbb::task_group_context::isolated ); tbb::task::spawn(*new(tbb::task::allocate_root(*g_trees[i][1])) TestSetPriorityTask(i, 1)); } } else if( m_i <= last/2 ) { // is divisible for( int i = 0; i <= 1; ++i ) { const int index = 2*m_i + i; g_trees[m_tree][index] = new tbb::task_group_context ( tbb::task_group_context::bound ); tbb::task::spawn(*new(tbb::task::allocate_root(*g_trees[m_tree][index])) TestSetPriorityTask(m_tree, index)); } } --g_barrier; //REMARK("Task %i executing\n", m_i); while (!is_finished) __TBB_Yield(); change_group(*g_default_ctx); // avoid races with destruction of custom contexts --g_barrier; return NULL; }
static PRESULT win_progname_unkown_act_proc(VACTION act) { PRESULT ret = PROC_LOOP; INT32 shift; UINT8 av_mode,back_saved; UINT16 channel; UINT16 strID; #ifdef DVR_PVR_SUPPORT if(api_pvr_is_recording()) { if( act != VACT_CH_UP && act != VACT_CH_DOWN) { return ret; } } #endif api_stop_timer(&progname_timer); shift = -1; switch(act) { case VACT_CH_UP: shift = 1; case VACT_CH_DOWN: change_channel(shift); break; case VACT_GRP_UP: shift = 1; case VACT_GRP_DOWN: change_group(shift); break; case VACT_FCH_UP: shift = 1; case VACT_FCH_DOWN: change_fav_channel(shift); break; case VACT_TV_RADIO_SW: av_mode = sys_data_get_cur_chan_mode(); av_mode = (av_mode==TV_CHAN)? RADIO_CHAN : TV_CHAN; sys_data_get_cur_group_channel(&channel, av_mode); if(channel==P_INVALID_ID) /* If the opposite mode has no channel */ { if(av_mode==RADIO_CHAN) strID = RS_MSG_NO_RADIO_CHANNEL; else strID = RS_MSG_NO_TV_CHANNEL; win_compopup_init(WIN_POPUP_TYPE_SMSG); win_compopup_set_msg(NULL, NULL,strID); win_compopup_open_ext(&back_saved); osal_task_sleep(500); win_compopup_smsg_restoreback(); } else { #ifndef NEW_DEMO_FRAME UIChChgStopProg(TRUE); #endif sys_data_set_cur_chan_mode(av_mode); change_group(0); } break; case VACT_RECALL: channel = recall_play_channel(0); if(channel != P_INVALID_ID) api_play_channel(channel, TRUE, TRUE,FALSE); break; case VACT_POP_DETAIL: b_popdetail = TRUE; ret = PROC_LEAVE; break; default: break; } win_progname_redraw(); progname_timer = api_start_timer(PROGNAME_TIMER_NAME,PROGNAME_TIMER_TIME,progname_timer_func); return ret; }
static PRESULT win_progname_unkown_act_proc(VACTION act) { PRESULT ret = PROC_LOOP; INT32 shift; UINT8 av_mode, back_saved; UINT16 channel; UINT16 strID; #ifdef AD_SANZHOU P_NODE pnode; #endif api_stop_timer(&progname_timer); #ifdef MULTI_CAS #if(CAS_TYPE==CAS_IRDETO) if(getStopChannelChange()&&(act!=VACT_RECALL&&act!=VACT_SCHEDULE))//check whether stop channel change return ret; #endif #endif shift = - 1; switch (act) { case VACT_CH_UP: shift = 1; case VACT_CH_DOWN: change_channel(shift); #ifdef MIS_AD MIS_ShowEpgAdv(0); #endif break; case VACT_GRP_UP: shift = 1; case VACT_GRP_DOWN: change_group(shift); break; case VACT_FCH_UP: shift = 1; case VACT_FCH_DOWN: change_fav_channel(shift); break; case VACT_TV_RADIO_SW: av_mode = sys_data_get_cur_chan_mode(); av_mode = (av_mode == TV_CHAN) ? RADIO_CHAN : TV_CHAN; //sys_data_set_cur_intgroup_index(0); /*force to return all group*/ sys_data_get_group_channel(0, &channel, av_mode); if (channel == P_INVALID_ID) { /* If the opposite mode has no channel */ win_compopup_init(WIN_POPUP_TYPE_SMSG); if(av_mode == TV_CHAN) { win_compopup_set_msg(NULL, NULL, RS_MSG_NO_PROGRAM_TV); } else { win_compopup_set_msg(NULL, NULL, RS_MSG_NO_RADIO_CHANNEL); } win_compopup_open_ext(&back_saved); osal_task_sleep(1000); win_compopup_smsg_restoreback(); #ifdef MULTI_CAS #if(CAS_TYPE==CAS_CONAX) if(get_mmi_msg_cnt()>0) { ap_send_msg(CTRL_MSG_SUBTYPE_STATUS_MCAS, 0, FALSE); MMI_PRINTF("CTRL_MSG_SUBTYPE_STATUS_MCAS: tv/radio; code:%d\n",0); set_mmi_showed(10); } #endif #endif } else { sys_data_set_cur_chan_mode(av_mode); change_group(0); } break; case VACT_RECALL: channel = recall_play_channel(0); if (channel != P_INVALID_ID) { #ifdef MULTI_CAS #if(CAS_TYPE==CAS_CONAX) /*clean msg*/ clean_mmi_msg(1, TRUE); clean_mmi_msg(3, TRUE); clean_mmi_msg(4, TRUE); clean_mmi_msg(6, TRUE); if(get_mmi_showed()==1||get_mmi_showed()==6) win_mmipopup_close(); if(get_mmi_showed()!=5) set_mmi_showed(10); #endif #endif api_play_channel(channel, TRUE, TRUE, FALSE); #ifdef AD_SANZHOU if(get_prog_at(channel, &pnode) == SUCCESS) { szxc_ad_hide_txt(); szxc_ad_show_txt(pnode.prog_number); szxc_ad_hide_pic(AD_BANNER); szxc_ad_show_banner(pnode.prog_number,banner_pic_rt); } #endif } #ifdef MULTI_CAS #if(CAS_TYPE==CAS_CONAX) else if(get_mmi_msg_cnt()>0) { ap_send_msg(CTRL_MSG_SUBTYPE_STATUS_MCAS, 0, FALSE); MMI_PRINTF("CTRL_MSG_SUBTYPE_STATUS_MCAS: recall; code:%d\n",0); set_mmi_showed(10); } #endif #endif #ifdef MIS_AD MIS_ShowEpgAdv(0); #endif break; case VACT_SCHEDULE: api_stop_timer(&progname_timer); //close the mini_epg ap_send_msg(CTRL_MSG_SUBTYPE_CMD_EXIT, 1, TRUE); //open the schedule // ap_send_msg(CTRL_MSG_SUBTYPE_CMD_ENTER_ROOT, (UINT32)(POBJECT_HEAD)&g_win_schedule, TRUE); break; default: ; } #ifdef MULTI_CAS #if(CAS_TYPE==CAS_CDCA) show_finger_print(0, 0); #elif(CAS_TYPE==CAS_DVT) ap_cas_fingerprint_proc(0, 1); #endif #endif win_progname_redraw(TRUE); progname_timer = api_start_timer(PROGNAME_TIMER_NAME, PROGNAME_TIMER_TIME, progname_timer_func); #ifdef MIS_AD Mis_Set_SameChan_AdvShowOnce(TRUE); Mis_Set_EnterAutoShow(FALSE); #endif return ret; }