7 #include "gui/editor/SJobBar.hpp" 9 #include <fwCom/Signal.hxx> 10 #include <fwCom/Slots.hpp> 11 #include <fwCom/Slots.hxx> 13 #include <fwGui/dialog/ProgressDialog.hpp> 15 #include <fwServices/macros.hpp> 17 #include <fwThread/Worker.hxx> 26 static const ::fwCom::Slots::SlotKeyType SHOW_JOB_SLOT =
"showJob";
27 static const ::fwCom::Signals::SignalKeyType STARTED_SIGNAL =
"started";
28 static const ::fwCom::Signals::SignalKeyType ENDED_SIGNAL =
"ended";
36 m_sigStarted = newSignal< StartedSignalType >( STARTED_SIGNAL );
37 m_sigEnded = newSignal< EndedSignalType >( ENDED_SIGNAL );
62 _sstream <<
"Starter editor" << std::endl;
81 ::fwGui::dialog::ProgressDialog::sptr progressDialog = ::fwGui::dialog::ProgressDialog::New();
82 progressDialog->setTitle(iJob->getName());
84 if(!iJob->isCancelable())
86 progressDialog->hideCancelButton();
89 iJob->addDoneWorkHook( [ = ](::
fwJobs::IJob& job, std::uint64_t oldDoneWork)
91 std::string msg = (job.
getLogs().empty()) ?
"" : job.
getLogs().back();
97 if(state == ::fwJobs::IJob::CANCELED || state == ::fwJobs::IJob::FINISHED )
102 m_progressDialogs.erase(progressDialog);
105 else if( state == ::fwJobs::IJob::RUNNING)
107 m_sigStarted->emit();
112 progressDialog->setCancelCallback( [ = ]
121 m_progressDialogs.insert(progressDialog);
This class is an interface for class managing job.
GUI_API void updating() override
This method emit a signal.
virtual FWJOBS_API SharedFuture cancel()
Cancel the current job and call all available cancel callbacks.
std::weak_ptr< ::fwJobs::IJob > wptr
Cancel request callback type.
The namespace gui contains the basic services to build the application IHM.
virtual GUI_API void stopping() override
Uninitialize the service activity. The stop() method is always invoked before destroying a service...
GUI_API void configuring() override
This method is used to configure the service.
GUI_API SJobBar() noexcept
Constructor. Do nothing.
std::shared_ptr< ::fwJobs::IJob > sptr
Cancel request callback type.
virtual GUI_API ~SJobBar() noexcept
Destructor. Do nothing.
FWJOBS_API std::uint64_t getDoneWorkUnits() const
Getter on the number of done work units.
virtual GUI_API void info(std::ostream &_sstream) override
This method gives information about the class. Do nothing.
Service displaying a progress bar.
FWJOBS_API Logs getLogs() const
Getter on the log container.
std::shared_ptr< ::fwThread::Worker > m_associatedWorker
Associated worker.
Defines the service interface managing the editor service which create their own container.
virtual GUI_API void starting() override
Initialize the service activity.
FWJOBS_API std::uint64_t getTotalWorkUnits() const
Getter on the total number of work units.
virtual GUI_API void showJob(::fwJobs::IJob::sptr iJob)
showJob slot's method