/usr/include/CLAM/qtmonitors/EmbededWidgets.hxx is in libclam-qtmonitors-dev 1.4.0-3.1build1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 | #ifndef EmbededWidgets_hxx
#define EmbededWidgets_hxx
#include <CLAM/Processing.hxx>
#include <QtGui/QWidget>
#include <map>
namespace CLAM
{
class EmbededWidgetCreatorBase
{
public:
typedef std::string Key;
private:
typedef std::map<Key, EmbededWidgetCreatorBase*> Creators;
static Creators & creators();
protected:
EmbededWidgetCreatorBase(const Key & processingTypeName)
{
creators().insert(std::make_pair(processingTypeName, this));
}
virtual ~EmbededWidgetCreatorBase() {} // TODO: to the cxx
virtual QWidget * concreteCreate(CLAM::Processing * processing, QWidget * parent) = 0;
public:
static QWidget * create(CLAM::Processing * processing, QWidget * parent)
{
Key type = processing->GetClassName();
Creators::iterator it = creators().find(type);
if (it==creators().end()) return 0;
return it->second->concreteCreate(processing, parent);
}
};
template <typename WidgetType>
class EmbededWidgetCreator : public EmbededWidgetCreatorBase
{
public:
EmbededWidgetCreator(const Key & type)
: EmbededWidgetCreatorBase(type)
{}
virtual QWidget * concreteCreate(CLAM::Processing * processing, QWidget * parent)
{
return new WidgetType(processing);
}
};
template <typename WidgetType, typename MonitorType>
class EmbededMonitorCreator : public EmbededWidgetCreatorBase
{
public:
EmbededMonitorCreator(const Key & type)
: EmbededWidgetCreatorBase(type)
{}
virtual QWidget * concreteCreate(CLAM::Processing * processing, QWidget * parent)
{
MonitorType * monitor = dynamic_cast<MonitorType*>(processing);
if (not monitor) return 0;
WidgetType * widget = new WidgetType(parent);
widget->setDataSource(*monitor);
return widget;
}
};
}
#endif//EmbededWidgets_hxx
|