From: Ovidiu Mircescu Date: Tue, 30 Jan 2018 16:15:16 +0000 (+0100) Subject: Ask to save the jobs before exit. X-Git-Tag: V8_5_0a1~2 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=b51bdcc498490eef56bd0306d0c673a6babefcfb;p=modules%2Fjobmanager.git Ask to save the jobs before exit. --- diff --git a/src/engine/BL_JobsManager.hxx b/src/engine/BL_JobsManager.hxx index 8a60afb..ad7abfe 100644 --- a/src/engine/BL_JobsManager.hxx +++ b/src/engine/BL_JobsManager.hxx @@ -80,6 +80,8 @@ namespace BL{ static void launcher_event_remove_job_thread(void * object_ptr); void launcher_event_update_job_state(const std::string & data); + bool emptyJobsList() {return _jobs.empty();} + struct thread_info { BL::JobsManager * object_ptr; diff --git a/src/genericgui/BL_GenericGui.cxx b/src/genericgui/BL_GenericGui.cxx index 71acc29..c247895 100644 --- a/src/genericgui/BL_GenericGui.cxx +++ b/src/genericgui/BL_GenericGui.cxx @@ -26,6 +26,7 @@ #include #include #include +#include #ifdef WNT #undef ERROR @@ -624,3 +625,17 @@ BL::GenericGui::updateButtonsStatesSingleSelection() DEBTRACE("ERROR in updateButtonsStates !!!!!!"); } } + +void +BL::GenericGui::saveIfNeeded() +{ + if(!_jobs_manager->emptyJobsList()) + { + if(QMessageBox::question (0, + tr("List of jobs in JOBMANAGER."), + tr("Do you want to save the list of jobs?"), + QMessageBox::Yes | QMessageBox::No, + QMessageBox::No) == QMessageBox::Yes) + _jobs_manager->save_jobs_button(); + } +} \ No newline at end of file diff --git a/src/genericgui/BL_GenericGui.hxx b/src/genericgui/BL_GenericGui.hxx index 72775f6..95ec293 100644 --- a/src/genericgui/BL_GenericGui.hxx +++ b/src/genericgui/BL_GenericGui.hxx @@ -67,6 +67,7 @@ namespace BL void reset_job_selection(); + void saveIfNeeded(); public slots: void create_job(); diff --git a/src/salomegui/BL_SalomeGui.cxx b/src/salomegui/BL_SalomeGui.cxx index 0bd4106..f2cdbe8 100644 --- a/src/salomegui/BL_SalomeGui.cxx +++ b/src/salomegui/BL_SalomeGui.cxx @@ -54,6 +54,7 @@ BL::SalomeGui::studyClosed() { if (_gengui) { + _gengui->saveIfNeeded(); _gengui->deleteDockWidget(); delete _gengui; _gengui = NULL;