diff --git a/app/Operations/PointOp.h b/app/Operations/PointOp.h index dec846e7b8ae8b4819be55301f929344bb23d34d..8ba7acd3ff81e6b52c16147854f26be3c57b9aec 100644 --- a/app/Operations/PointOp.h +++ b/app/Operations/PointOp.h @@ -84,7 +84,7 @@ class PointOp : public GenericOperation { }; struct PixAdd : PixOp_t<int> { - PixAdd(int value_) : PixOp_t(value_) {} + PixAdd(int value_) : PixOp_t<int>(value_) {} intmax_t op(depth_t pixel) { return pixel + value; } }; struct DoublePixAdd : DoublePixelOp { @@ -93,7 +93,7 @@ class PointOp : public GenericOperation { }; struct PixMul : PixOp_t<double> { - PixMul(double value_) : PixOp_t(value_) {} + PixMul(double value_) : PixOp_t<double>(value_) {} intmax_t op(depth_t pixel) { return pixel * value + 0.5; } }; struct DoublePixMul : DoublePixelOp { @@ -102,27 +102,27 @@ class PointOp : public GenericOperation { }; struct PixAnd : PixOp_t<depth_t> { - PixAnd(depth_t value_) : PixOp_t(value_) {} + PixAnd(depth_t value_) : PixOp_t<depth_t>(value_) {} intmax_t op(depth_t pixel) { return pixel & value; } }; struct PixOr : PixOp_t<depth_t> { - PixOr(depth_t value_) : PixOp_t(value_) {} + PixOr(depth_t value_) : PixOp_t<depth_t>(value_) {} intmax_t op(depth_t pixel) { return pixel | value; } }; struct PixXor : PixOp_t<depth_t> { - PixXor(depth_t value_) : PixOp_t(value_) {} + PixXor(depth_t value_) : PixOp_t<depth_t>(value_) {} intmax_t op(depth_t pixel) { return pixel ^ value; } }; struct PixLshift : PixOp_t<unsigned int> { - PixLshift(unsigned int value_) : PixOp_t(value_) {} + PixLshift(unsigned int value_) : PixOp_t<unsigned int>(value_) {} intmax_t op(depth_t pixel) { return pixel << value; } }; struct PixRshift : PixOp_t<unsigned int> { - PixRshift(unsigned int value_) : PixOp_t(value_) {} + PixRshift(unsigned int value_) : PixOp_t<unsigned int>(value_) {} intmax_t op(depth_t pixel) { return pixel >> value; } }; diff --git a/app/Services/EIImageService.cpp b/app/Services/EIImageService.cpp index 1a1b2d0fb9d984557bbc07b0c01251041ceb47b5..20c430b8c16c255c0d78489ccd0ee12d0609d987 100644 --- a/app/Services/EIImageService.cpp +++ b/app/Services/EIImageService.cpp @@ -69,9 +69,8 @@ void EIImageService::addOpSet(OpSet* opSet) { void EIImageService::removeOpSet(OpSet* opSet) { for(vector<OpSetService*>::iterator it = _opSetServices.begin(); it != _opSetServices.end(); ++it) { if((*it)->getOpSet() == opSet) { - _opSetServices.erase(it); _gi->removeService(*it); - delete *it; + _opSetServices.erase(it); return; } } @@ -83,3 +82,9 @@ void EIImageService::outputText(QString text) { if(_statusEdit->minimumHeight() < 92) _statusEdit->setMinimumHeight(_statusEdit->minimumHeight()+24); // _statusEdit->setMinimumHeight(32); } + +void EIImageService::addText(std::string s) { + _statusEdit->append(QString::fromStdString(s)); + _statusEdit->show(); + if(_statusEdit->minimumHeight() < 92) _statusEdit->setMinimumHeight(_statusEdit->minimumHeight()+24); +} diff --git a/app/Services/EIImageService.h b/app/Services/EIImageService.h index dfc0fcefbf182162fd8542444b8590e5b04a9353..18de689f2b703323682cdc8e205deffaea521335 100644 --- a/app/Services/EIImageService.h +++ b/app/Services/EIImageService.h @@ -42,6 +42,7 @@ class EIImageService : public genericinterface::WindowService void addOpSet(OpSet* opSet); void removeOpSet(OpSet* opSet); void outputText(QString text); + virtual void addText(std::string); private: genericinterface::GenericInterface* _gi; diff --git a/app/Services/PluginManager.cpp b/app/Services/PluginManager.cpp index d5063afde5fa643f7c2b8b56bab065914289bbdc..bda6322a74cbde598589dba1d2cdf0413bd7b406 100644 --- a/app/Services/PluginManager.cpp +++ b/app/Services/PluginManager.cpp @@ -128,7 +128,14 @@ void PluginManager::choosePlugin() { } void PluginManager::unloadAllPlugins() { for(std::map<string, Plugin*>::iterator it = _plugins.begin(); it != _plugins.end(); ++it) { - emit removePlugin(it->second); + Plugin* plugin = it->second; + map<Plugin*,QLibrary*>::iterator lit = _libraries.find(plugin); + if(lit != _libraries.end()) { + bool res = lit->second->unload(); + std::cout << "Unloading " << lit->second->fileName().toStdString() << "..." << res << std::endl; + _libraries.erase(lit); + } + emit removePlugin(plugin); } _plugins.clear(); checkActionsValid(); @@ -140,8 +147,14 @@ void PluginManager::unloadPlugin(Plugin* plugin) { //delete it->second; //_pluginServices.erase(it); ////it = _pluginServices.begin(); - _plugins.erase(it->first); + map<Plugin*,QLibrary*>::iterator lit = _libraries.find(plugin); + if(lit != _libraries.end()) { + bool res = lit->second->unload(); + std::cout << "Unloading " << lit->second->fileName().toStdString() << "..." << res << std::endl; + _libraries.erase(lit); + } emit removePlugin(plugin); + _plugins.erase(it); checkActionsValid(); return; } @@ -191,6 +204,7 @@ bool PluginManager::loadPlugin(QString file, bool silent) { //PluginService* pluginService = new PluginService(plugin); _plugins.insert(pair<string,Plugin*>(file.toStdString(), plugin)); + _libraries.insert(pair<Plugin*,QLibrary*>(plugin, library)); //_gi->addService(pluginService); emit addPlugin(plugin); checkActionsValid(); diff --git a/app/Services/PluginManager.h b/app/Services/PluginManager.h index b88b7ea0eaba798341cb5b5d140c5a360eb6c00f..6837c45261e83c1a379b4cf813b2fa9b95b4648b 100644 --- a/app/Services/PluginManager.h +++ b/app/Services/PluginManager.h @@ -26,6 +26,7 @@ #include <Services/AlgorithmService.h> #include <QToolBar> +class QLibrary; #include "OpSetService.h" @@ -52,6 +53,7 @@ class PluginManager : public QObject, public genericinterface::Service QAction* _loadPluginAction; QAction* _unloadPluginsAction; std::map<std::string, Plugin*> _plugins; + std::map<Plugin*, QLibrary*> _libraries; void checkActionsValid(); }; diff --git a/app/main.cpp b/app/main.cpp index f379c58f54590201276df78fd49878f920836ef2..38015a41ba2b5f3108e276df98bb62682e58e967 100644 --- a/app/main.cpp +++ b/app/main.cpp @@ -30,7 +30,6 @@ #include "Services/PluginManager.h" #include "Services/EIImageService.h" -#include "Operations/TestOp.h" #include "Operations/PointOp.h" #include "Operations/ThresholdOp.h" #include "Operations/TranslateOp.h" diff --git a/core/IntParam.cpp b/core/IntParam.cpp index 4566388f1b8f793624cdf5f665aaba4479424b35..c7134a0a8fb877f3de1ff380bbf69d61d7c77201 100644 --- a/core/IntParam.cpp +++ b/core/IntParam.cpp @@ -29,7 +29,7 @@ using namespace imagein; using namespace std; using namespace genericinterface; -IntParam::IntParam(std::string name, int min, int max, int def) : Parameter(name), _min(min), _max(max) { +IntParam::IntParam(std::string name, int min, int max, int def) : Parameter<int>(name), _min(min), _max(max) { _def = std::min(def, _max); _def = std::max(def, _min); } diff --git a/core/Operation.cpp b/core/Operation.cpp index 698bc4e2130e15ce13978cfd588f0df652c9414d..129e2658cd05b83ead8360c9df7735fb20e1a6ae 100644 --- a/core/Operation.cpp +++ b/core/Operation.cpp @@ -20,6 +20,7 @@ #include "Operation.h" #include <Widgets/ImageWidgets/StandardImageWindow.h> #include <Widgets/ImageWidgets/DoubleImageWindow.h> +#include <Services/WindowService.h> using namespace std; using namespace imagein; @@ -33,7 +34,7 @@ class EIImageService : public genericinterface::WindowService void outputText(QString text); }; -void GenericOperation::operator()(EIImageService* ws) { +void GenericOperation::operator()(WindowService* ws) { _ws = ws; _curImgWnd = ws->getCurrentImageWindow(); vector<const ImageWindow*> wndList = ws->getImageWindows(); @@ -74,7 +75,7 @@ void GenericOperation::outDoubleImage(imagein::Image_t<double>* img, string titl void GenericOperation::outText(std::string text) { if(_ws == NULL) return; - _ws->outputText(QString(text.c_str())); + _ws->addText(text); } void Operation::operator()(const ImageWindow* currentWnd, const vector<const ImageWindow*>& wndList) { diff --git a/core/Operation.h b/core/Operation.h index bc98465761658078fdb15309af5ce3bf2e9bae0d..148a194161baae8f8d9f168211c19f26e9a93662 100644 --- a/core/Operation.h +++ b/core/Operation.h @@ -26,9 +26,9 @@ #include "Image.h" class QWidget; -class EIImageService; namespace genericinterface { class ImageWindow; + class WindowService; } /** @@ -68,7 +68,7 @@ class GenericOperation { * * @param ws The eiimage implementation of the genericinterface::WindowService */ - virtual void operator()(EIImageService* ws); + virtual void operator()(genericinterface::WindowService* ws); /** * @brief This method should return wether this Operation need the currentWnd parameter. @@ -131,7 +131,7 @@ class GenericOperation { void outText(std::string); std::string _name; /**< The name of the operation */ - EIImageService* _ws; /**< A pointer to the eiimage window service, only valid inside the function call operator */ + genericinterface::WindowService* _ws; /**< A pointer to the eiimage window service, only valid inside the function call operator */ genericinterface::ImageWindow* _curImgWnd; /**< A pointer to the current image window, only valid inside the function call operator */ private: /** diff --git a/plugins/Segmentation/segmentation.cpp b/plugins/Segmentation/segmentation.cpp index 3cfe55bbc9a2cbde668db5d3dea7b5632e5891de..36b8a3f8a5b211daf116d9b2f652a2c95b43c23c 100644 --- a/plugins/Segmentation/segmentation.cpp +++ b/plugins/Segmentation/segmentation.cpp @@ -30,7 +30,6 @@ #include "Plugin.h" #include "ImgParam.h" #include "IntParam.h" -#include "ImgOutput.h" using namespace std; using namespace imagein;