7 #include "uiGenericQt/action/LaunchBrowserActionService.hpp" 9 #include <fwCore/base.hpp> 11 #include <fwServices/macros.hpp> 13 #include <boost/filesystem/operations.hpp> 14 #include <boost/filesystem/path.hpp> 16 #include <QCoreApplication> 17 #include <QDesktopServices> 47 _sstream <<
"Action for manage url" << std::endl;
58 if(!urlConfig.empty())
60 m_url = urlConfig.at(0)->getValue();
71 QUrl url(QString::fromStdString(m_url), QUrl::TolerantMode);
75 ::boost::filesystem::path path(QCoreApplication::applicationDirPath().toStdString());
76 path = path.parent_path();
77 path /= url.path().toStdString();
79 QString urlStr = QString::fromStdString(
"file:///" + path.string());
80 url = QUrl(urlStr, QUrl::TolerantMode);
83 bool isSuccess = QDesktopServices::openUrl(url);
84 SLM_WARN_IF(
"Browser wasn't successfully launched.", !isSuccess);
This action launch a browser on the url given in configuration.
void stopping() override
Stops action.
void configuring() override
configure the action.
FWGUI_API void actionServiceStarting()
Method called when the action service is starting.
The namespace uiGenericQt contains actions to show help, acknowledgments and about frame...
#define SLM_TRACE_FUNC()
Trace contextual function signature.
virtual UIGENERICQT_API ~LaunchBrowserActionService() noexcept
Destructor. Do nothing.
FWGUI_API void actionServiceStopping()
Method called when the action service is stopping.
Defines the service interface managing the menu items.
void starting() override
Starts action.
void updating() override
Launch a browser on the url given in the configuration.
FWGUI_API void initialize()
Initialize the action.
UIGENERICQT_API LaunchBrowserActionService() noexcept
Constructor. Do nothing.
Base class for each data object.
::fwRuntime::ConfigurationElement::sptr m_configuration
Configuration element used to configure service internal state using a generic XML like structure TOD...
#define SLM_WARN_IF(message, cond)
void info(std::ostream &_sstream) override
Write information in a stream.