void checkCrashFile(void) { char *baseDir=ADM_getBaseDir(); const char *name=CRASH_FILE; static int crashCount=0; char *where=new char[strlen(baseDir)+strlen(name)+2]; strcpy(where,baseDir); strcat(where,name); if(ADM_fileExist(where)) { IScriptEngine *engine = getDefaultScriptEngine(); if (engine != NULL) { if(GUI_Confirmation_HIG(QT_TR_NOOP("Load it"),QT_TR_NOOP("Crash file"), QT_TR_NOOP("I have detected a crash file. \nDo you want to load it ?\n(It will be deleted in all cases, you should save it if you want to keep it)"))) { A_parseScript(engine,where); } } unlink(where); }else { printf("No crash file (%s)\n",where); } delete [] where; }
/** * \fn stop * @param a */ void DIA_processingQt::stop(bool a) { ADM_info("Stop Request\n"); if (GUI_Confirmation_HIG(QT_TR_NOOP("_Resume"), QT_TR_NOOP("The processing is paused."), QT_TR_NOOP("Cancel it ?"))) { _stopRequest=true; } }
/** \fn deleteAll \brief delete all job */ void jobsWindow::DeleteAll(bool b) { if (GUI_Confirmation_HIG(QT_TR_NOOP("Sure!"), QT_TR_NOOP("Delete *all* job"), QT_TR_NOOP("Are you sure you want to delete ALL jobs?"))) { for(int sel = 0; sel < _nbJobs; sel++) { desc[sel].status = STATUS_DELETED; unlink(_jobsName[sel]); } updateRows(); } }
/** \fn deleteOne \brief delete one job */ void jobsWindow::DeleteOne(bool b) { int sel = ui.tableWidget->currentRow(); if (sel >= 0 && sel < _nbJobs) { if (GUI_Confirmation_HIG(QT_TR_NOOP("Sure!"), QT_TR_NOOP("Delete job"), QT_TR_NOOP("Are you sure you want to delete %s job?"), ADM_GetFileName(_jobsName[sel]))) { desc[sel].status = STATUS_DELETED; unlink(_jobsName[sel]); updateRows(); } } }
static gint on_destroy_abort(GtkObject * object, gpointer user_data) { DIA_progressIndexing *pf; UNUSED_ARG(object); UNUSED_ARG(user_data); pf=(DIA_progressIndexing *)user_data; if(!GUI_Confirmation_HIG(QT_TR_NOOP("Continue indexing"),QT_TR_NOOP("Abort Requested"),QT_TR_NOOP("Do you want to abort indexing ?"))) { // pf->abortRequest(); abted=1; } return TRUE; };
uint8_t DIA_job(uint32_t nb, char **name) { GtkListStore *store; GtkTreeViewColumn *column,*column2,*column3; GtkCellRenderer *renderer; int ret=0; GtkWidget *dialog; dialog=create_dialog1(); gtk_dialog_set_alternative_button_order(GTK_DIALOG(dialog), GTK_RESPONSE_OK, GTK_RESPONSE_CANCEL, -1); gtk_register_dialog(dialog); store=gtk_list_store_new (3, G_TYPE_STRING, G_TYPE_STRING,G_TYPE_STRING); // initialize our job structure jobs.dialog=dialog; jobs.nb=nb; jobs.name=name; jobs.status=new ADM_Job_Descriptor[nb]; jobs.store=store; memset(jobs.status,0,jobs.nb*sizeof(ADM_Job_Descriptor)); gtk_tree_view_set_model(GTK_TREE_VIEW(WID(treeview1)),GTK_TREE_MODEL (store)); gtk_tree_view_columns_autosize(GTK_TREE_VIEW(WID(treeview1))); // Add columns renderer = gtk_cell_renderer_text_new (); column = gtk_tree_view_column_new_with_attributes (QT_TR_NOOP(" Job Name "), renderer, "markup", (GdkModifierType) 0, NULL); gtk_tree_view_append_column (GTK_TREE_VIEW (WID(treeview1)), column); column2 = gtk_tree_view_column_new_with_attributes (QT_TR_NOOP("Started at"), renderer, "markup", (GdkModifierType) 1, NULL); gtk_tree_view_append_column (GTK_TREE_VIEW (WID(treeview1)), column2); column3 = gtk_tree_view_column_new_with_attributes (QT_TR_NOOP("Finished at"), renderer, "markup", (GdkModifierType) 2, NULL); gtk_tree_view_append_column (GTK_TREE_VIEW (WID(treeview1)), column3); // #define ASSOCIATE(x,y) gtk_dialog_add_action_widget (GTK_DIALOG (dialog), WID(x),y) ASSOCIATE(buttonDelete,COMMAND_DELETE); ASSOCIATE(buttonDeleteAll,COMMAND_DELETE_ALL); ASSOCIATE(buttonRunAll,COMMAND_RUN_ALL); ASSOCIATE(buttonRun,COMMAND_RUN); // int running=1; gtk_widget_set_usize(WID(treeview1), 180, 300); while(running) { int sel=0,event; updateStatus(); switch(event=gtk_dialog_run(GTK_DIALOG(dialog))) { case GTK_RESPONSE_OK : running=0;break; case GTK_RESPONSE_APPLY : running=0;break; case GTK_RESPONSE_CANCEL : case GTK_RESPONSE_DELETE_EVENT: running=0;break; case COMMAND_DELETE_ALL: if(GUI_Confirmation_HIG(QT_TR_NOOP("Sure!"),QT_TR_NOOP("Delete ALL jobs"),QT_TR_NOOP("Are you sure you want to delete all jobs ?"))) { for(int i=0;i<jobs.nb;i++) jobs.status[i].status=STATUS_DELETED; } break; case COMMAND_RUN: sel=getSelection(jobs.dialog); if(sel>=jobs.nb) break; jobs.status[sel].status=STATUS_RUNNING; updateStatus(); GUI_Quiet(); TLK_getDate(&(jobs.status[sel].startDate)); if(parseECMAScript(jobs.name[sel])) jobs.status[sel].status=STATUS_SUCCEED; else jobs.status[sel].status=STATUS_FAILED; TLK_getDate(&(jobs.status[sel].endDate)); updateStatus(); GUI_Verbose(); break; case COMMAND_RUN_ALL: GUI_Quiet(); for(int i=0;i<jobs.nb;i++) { if(jobs.status[i].status==STATUS_DELETED) continue; if(jobs.status[i].status==STATUS_SUCCEED) continue; jobs.status[i].status=STATUS_RUNNING; TLK_getDate(&(jobs.status[i].startDate)); updateStatus(); if(parseECMAScript(jobs.name[i])) jobs.status[i].status=STATUS_SUCCEED; else jobs.status[i].status=STATUS_FAILED; TLK_getDate(&(jobs.status[i].endDate)); } updateStatus(); GUI_Verbose(); break; case COMMAND_DELETE: sel=getSelection(jobs.dialog); if(sel>=jobs.nb) break; if(GUI_Confirmation_HIG(QT_TR_NOOP("Sure!"),QT_TR_NOOP("Delete job"),QT_TR_NOOP("Are you sure you want to delete %s job ?"),ADM_GetFileName(jobs.name[sel]))) { jobs.status[sel].status=STATUS_DELETED; } break; default: printf("Event:%d\n",event); GUI_Error_HIG("Jobs",QT_TR_NOOP("Unknown event"));break; } } gtk_unregister_dialog(dialog); gtk_widget_destroy(dialog); // Now delete the "deleted" jobs for(int i=0;i<jobs.nb;i++) { if(jobs.status[i].status==STATUS_DELETED) { unlink(jobs.name[i]); } } delete [] jobs.status; return ret; }