void MainWindow::on_pushButton_convert_clicked() { //コンバート if (( ui->listWidget->count() > 0 ) && (convert_exec == false)) { convert_error = false; convert_exec = false; //コンバート中か convet_index = 0; QString st = QString("Exec %1/%2").arg(convet_index+1).arg(ui->listWidget->count()); ui->textBrowser_status->setText(st); //ステータス ui->textBrowser_err->setText(tr("")); //エラー cnvOutputStr = ""; { QString fileName = ui->listWidget->item(convet_index)->text(); //コンバータの起動 if (fileName.isEmpty()) { //ファイル名なし } else { QString str; QString execstr; #ifdef Q_OS_WIN32 // Windows execstr = "Ss5Converter.exe"; #else // Mac QDir dir = QDir(execPathStr); dir.cd(".."); dir.cd(".."); dir.cd(".."); dir.cd(".."); QString str_current_path = dir.path(); execstr = str_current_path + "/Ss5Converter"; #endif str = execstr + " \"" + fileName + "\""; cnvProcess->start(str); //パスと引数 button_enable(false); convert_exec = true; //コンバート中か convet_index++; } } } }
void *multirom_ui_tab_rom_init(int tab_type) { tab_data_roms *t = mzalloc(sizeof(tab_data_roms)); themes_info->data->tab_data = t; t->list = mzalloc(sizeof(listview)); t->list->item_draw = &rom_item_draw; t->list->item_hide = &rom_item_hide; t->list->item_height = &rom_item_height; t->list->item_destroy = &rom_item_destroy; t->list->item_selected = &multirom_ui_tab_rom_selected; t->list->item_confirmed = &multirom_ui_tab_rom_confirmed; t->boot_btn = mzalloc(sizeof(button)); list_add(t->boot_btn, &t->buttons); cur_theme->tab_rom_init(themes_info->data, t, tab_type); listview_init_ui(t->list); if(tab_type == TAB_INTERNAL) multirom_ui_fill_rom_list(t->list, MASK_INTERNAL); listview_update_ui(t->list); int has_roms = (int)(t->list->items == NULL); multirom_ui_tab_rom_set_empty((void*)t, has_roms); t->boot_btn->clicked = &multirom_ui_tab_rom_boot_btn; button_init_ui(t->boot_btn, "Boot", SIZE_BIG); button_enable(t->boot_btn, !has_roms); if(tab_type == TAB_USB) { multirom_set_usb_refresh_handler(&multirom_ui_refresh_usb_handler); multirom_set_usb_refresh_thread(mrom_status, 1); } return t; }
void multirom_ui_tab_rom_set_empty(void *data, int empty) { assert(empty == 0 || empty == 1); tab_data_roms *t = (tab_data_roms*)data; int width = cur_theme->get_tab_width(themes_info->data); static const char *str[] = { "Select ROM to boot:", "No ROMs in this location!" }; t->title_text->head.x = center_x(t->list->x, width, SIZE_BIG, str[empty]); t->title_text->text = realloc(t->title_text->text, strlen(str[empty])+1); strcpy(t->title_text->text, str[empty]); if(t->boot_btn) button_enable(t->boot_btn, !empty); if(empty && !t->usb_text) { const int line_len = 37; static const char *txt = "This list is refreshed automagically,\njust plug in the USB drive and wait."; int x = t->list->x + (width/2 - (line_len*ISO_CHAR_WIDTH*SIZE_NORMAL)/2); int y = center_y(t->list->y, t->list->h, SIZE_NORMAL); t->usb_text = fb_add_text(x, y, WHITE, SIZE_NORMAL, txt); list_add(t->usb_text, &t->ui_elements); x = t->list->x + ((width/2) - (PROGDOTS_W/2)); t->usb_prog = progdots_create(x, y+100*DPI_MUL); } else if(!empty && t->usb_text) { progdots_destroy(t->usb_prog); t->usb_prog = NULL; list_rm(t->usb_text, &t->ui_elements, &fb_remove_item); t->usb_text = NULL; } }
void MainWindow::processFinished( int exitCode, QProcess::ExitStatus exitStatus) { if ( exitStatus == QProcess::CrashExit ) { // QMessageBox::warning( this, tr("Error"), tr("Crashed") ); cnvOutputStr = cnvOutputStr + "Error:" + ui->listWidget->item(convet_index-1)->text(); convert_error = true; } else if ( exitCode != 0 ) { // QMessageBox::warning( this, tr("Error"), tr("Failed") ); cnvOutputStr = cnvOutputStr + "Error:" + ui->listWidget->item(convet_index-1)->text(); convert_error = true; } else { // 正常終了時の処理 // ui->textBrowser_status->setText(tr("Convert Success!")); // QMessageBox::information(this, tr("Ss5Converter"), tr("Convert success")); } if (( ui->listWidget->count() > convet_index )) { QString st = QString("Exec %1/%2").arg(convet_index+1).arg(ui->listWidget->count()); ui->textBrowser_status->setText(st); //ステータス { QString fileName = ui->listWidget->item(convet_index)->text(); //コンバータの起動 if (fileName.isEmpty()) { //ファイル名なし } else { QString str; QString execstr; #ifdef Q_OS_WIN32 // Windows execstr = "Ss5Converter.exe"; #else // Mac QDir dir = QDir(execPathStr); dir.cd(".."); dir.cd(".."); dir.cd(".."); dir.cd(".."); QString str_current_path = dir.path(); execstr = str_current_path + "/Ss5Converter"; #endif str = execstr + " \"" + fileName + "\""; cnvProcess->start(str); //パスと引数 convet_index++; } } } else { button_enable(true); convert_exec = false; //コンバート中か if ( convert_error == false ) { ui->textBrowser_status->setText(tr("Convert Success!")); } else { ui->textBrowser_status->setText(tr("Error")); //ステータス ui->textBrowser_err->setText(cnvOutputStr); } } //カーソルを最終行へ移動 QScrollBar *sb = ui->textBrowser_err->verticalScrollBar(); sb->setValue(sb->maximum()); }