Skip to content
Snippets Groups Projects
Commit 9b186aed authored by Sacha Percot-Tétu's avatar Sacha Percot-Tétu
Browse files

Compilation corrections, minor bug corrections

parent b1fddbba
No related branches found
No related tags found
No related merge requests found
......@@ -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; }
};
......
......@@ -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);
}
......@@ -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;
......
......@@ -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();
......
......@@ -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();
};
......
......@@ -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"
......
......@@ -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);
}
......
......@@ -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) {
......
......@@ -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:
/**
......
......@@ -30,7 +30,6 @@
#include "Plugin.h"
#include "ImgParam.h"
#include "IntParam.h"
#include "ImgOutput.h"
using namespace std;
using namespace imagein;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment