7 #include "guiQt/editor/SActivityView.hpp" 9 #include <fwCom/Signal.hpp> 10 #include <fwCom/Signal.hxx> 11 #include <fwCom/Signals.hpp> 13 #include <fwGui/dialog/MessageDialog.hpp> 14 #include <fwGui/GuiRegistry.hpp> 16 #include <fwGuiQt/container/QtContainer.hpp> 18 #include <fwServices/macros.hpp> 19 #include <fwServices/registry/AppConfig.hpp> 21 #include <QVBoxLayout> 31 const fwCom::Signals::SignalKeyType s_ACTIVITY_LAUNCHED_SIG =
"activityLaunched";
37 m_sigActivityLaunched = newSignal< ActivityLaunchedSignalType >(s_ACTIVITY_LAUNCHED_SIG);
52 ::fwGuiQt::container::QtContainer::sptr parentContainer
53 = ::fwGuiQt::container::QtContainer::dynamicCast( this->getContainer() );
55 QVBoxLayout* layout =
new QVBoxLayout();
56 QWidget* widget =
new QWidget();
57 layout->addWidget( widget );
59 ::fwGuiQt::container::QtContainer::sptr subContainer = ::fwGuiQt::container::QtContainer::New();
61 subContainer->setQtContainer(widget);
62 m_wid = this->
getID() +
"_container";
65 parentContainer->setLayout(layout);
74 this->launchActivity(activity);
83 if (m_configManager && m_configManager->isStarted())
85 m_configManager->stopAndDestroy();
91 subContainer->destroyContainer();
104 void SActivityView::launchActivity(::fwMedData::ActivitySeries::sptr activitySeries)
108 if (m_configManager->isStarted())
110 m_configManager->stopAndDestroy();
115 ReplaceMapType replaceMap;
117 this->
translateParameters(activitySeries->getData(), info.appConfig.parameters, replaceMap);
118 replaceMap[
"AS_UID"] = activitySeries->getID();
119 replaceMap[
"WID_PARENT" ] = m_wid;
121 replaceMap[
"GENERIC_UID"] = genericUidAdaptor;
124 m_configManager->setConfig( info.appConfig.id, replaceMap );
125 m_configManager->launch();
127 m_sigActivityLaunched->asyncEmit(activitySeries);
129 catch( std::exception& e )
133 ::fwGui::dialog::IMessageDialog::CRITICAL);
static FWGUI_API::fwGui::container::fwContainer::sptr getWIDContainer(std::string wid)
Returns fwContainer associate with window ID, null if not found.
static FWGUI_API void unregisterWIDContainer(std::string wid)
Unregisters container associate with window ID.
Holds Activities configuration.
static FWGUI_API IMessageDialog::Buttons showMessageDialog(const std::string &title, const std::string &message,::fwGui::dialog::IMessageDialog::Icons icon=INFO)
static FWACTIVITIES_API Activities::sptr getDefault()
Return the default global instance of Activities.
FWGUI_API void destroy()
Stops sub-views and toobar services. Destroys view, sub-views and toolbar containers.
std::string m_mainActivityId
configuration id of the main activity
ParametersType m_parameters
parameters given in configuration
virtual FWGUI_API bool validateActivity(::fwMedData::ActivitySeries::sptr activitySeries) const
Check if the activity is valid by calling the activity validator.
virtual void updating() override
Do nothing.
virtual FWGUI_API::fwMedData::ActivitySeries::sptr createMainActivity() const
Create the activity series given in 'mainActivity' configuration.
static FWGUI_API void registerWIDContainer(std::string wid,::fwGui::container::fwContainer::sptr container)
Registers container associate with window ID.
GUIQT_API SActivityView()
Constructor. Do nothing.
#define OSLM_ERROR(message)
This editor displays activities in a single view (when a new activity is launched, it replaces the previous one).
FWGUI_API void create()
Creates view, sub-views and toolbar containers. Manages sub-views and toobar services.
virtual GUIQT_API ~SActivityView()
Destructor. Do nothing.
static FWSERVICES_API std::shared_ptr< IAppConfigManager > New()
Defines the base class for services displaying activity view.
static FWSERVICES_API std::string getUniqueIdentifier(const std::string &serviceUid="")
Create an unique identifier.
virtual void starting() override
Install the container.
The namespace guiQt contains the basic services to build the application IHM with Qt...
virtual void stopping() override
Destroy the container.
virtual FWGUI_API void translateParameters(::fwData::Object::sptr sourceObj, const ParametersType ¶meters, ReplaceMapType &replaceMap)
Translate parameters from source object.
virtual FWSERVICES_API void info(std::ostream &_sstream)
Write information in a stream.