Commit fbdb249b authored by LE BRETON Come's avatar LE BRETON Come

Renames the plugin.

parent 985db507
......@@ -2,10 +2,10 @@
## Dependencies - internal
## #################### ################################################
include_directories(dtkWidgetsSpinBox)
include_directories(dtkWidgetsParameterDoubleSpinBox)
## #################################################################
## Inputs
## #################################################################
add_subdirectory(dtkWidgetsSpinBox)
add_subdirectory(dtkWidgetsParameterDoubleSpinBox)
......@@ -16,15 +16,15 @@
## Build rules
## ###################################################################
project(dtkWidgetsSpinBox)
project(dtkWidgetsParameterDoubleSpinBox)
add_definitions(-DQT_PLUGIN)
add_library(${PROJECT_NAME} SHARED
dtkWidgetsSpinBoxPlugin.h
dtkWidgetsSpinBoxPlugin.cpp
dtkWidgetsSpinBox.h
dtkWidgetsSpinBox.cpp)
dtkWidgetsParameterDoubleSpinBoxPlugin.h
dtkWidgetsParameterDoubleSpinBoxPlugin.cpp
dtkWidgetsParameterDoubleSpinBox.h
dtkWidgetsParameterDoubleSpinBox.cpp)
## ###################################################################
## Link rules
......
// Version: $Id$
//
//
// Commentary:
//
//
// Change Log:
//
//
// Code:
#include "dtkWidgetsParameterDoubleSpinBox.h"
#include <dtkLog>
#include <dtkCoreParameter>
class dtkWidgetsParameterDoubleSpinBoxPrivate
{
public:
QDoubleSpinBox *spin_box = nullptr;
};
// ///////////////////////////////////////////////////////////////////
dtkWidgetsParameterDoubleSpinBox::dtkWidgetsParameterDoubleSpinBox(QWidget* parent) : dtkWidgetsParameterDouble(parent), d(new dtkWidgetsParameterDoubleSpinBoxPrivate)
{
d->spin_box = new QDoubleSpinBox;
QHBoxLayout *layout = new QHBoxLayout;
layout->addWidget(d->spin_box);
this->setLayout(layout);
}
dtkWidgetsParameterDoubleSpinBox::~dtkWidgetsParameterDoubleSpinBox(void)
{
delete d;
}
void dtkWidgetsParameterDoubleSpinBox::connect(dtk::d_real *parameter)
{
d->spin_box->setMinimum(parameter->min());
d->spin_box->setMaximum(parameter->max());
d->spin_box->setToolTip(parameter->documentation());
QObject::connect(parameter, &dtk::d_real::valueChanged, [=] (QVariant v) {
double value = v.value<dtk::d_real>().value();
d->spin_box->setValue(value);
});
QObject::connect(d->spin_box, QOverload<double>::of(&QDoubleSpinBox::valueChanged), [=] (double v) {
parameter->setValue(v);
});
}
//
// dtkWidgetsParameterDoubleSpinBoxWidget.cpp ends here
......@@ -17,27 +17,27 @@
#include <QtWidgets>
#include <dtkWidgets/dtkWidgetsParameter>
class dtkWidgetsSpinBox : public dtkWidgetsParameterDouble
class dtkWidgetsParameterDoubleSpinBox : public dtkWidgetsParameterDouble
{
Q_OBJECT
public:
dtkWidgetsSpinBox(QWidget* parent = 0);
virtual ~dtkWidgetsSpinBox(void);
dtkWidgetsParameterDoubleSpinBox(QWidget* parent = 0);
virtual ~dtkWidgetsParameterDoubleSpinBox(void);
/* public: */
/* virtual void connect(dtkCoreParameter<double> *parameter); */
public:
virtual void connect(dtk::d_real *);
private:
class dtkWidgetsSpinBoxPrivate *d;
class dtkWidgetsParameterDoubleSpinBoxPrivate *d;
};
// ///////////////////////////////////////////////////////////////////
inline dtkWidgetsParameterDouble *dtkWidgetsSpinBoxCreator(void)
inline dtkWidgetsParameterDouble *dtkWidgetsParameterDoubleSpinBoxCreator(void)
{
qDebug() << Q_FUNC_INFO;
return new dtkWidgetsSpinBox();
return new dtkWidgetsParameterDoubleSpinBox();
}
//
// dtkWidgetsSpinBox.h ends here
// dtkWidgetsParameterDoubleSpinBox.h ends here
......@@ -12,22 +12,22 @@
// Code:
#include "dtkWidgetsSpinBoxPlugin.h"
#include "dtkWidgetsSpinBox.h"
#include "dtkWidgetsParameterDoubleSpinBoxPlugin.h"
#include "dtkWidgetsParameterDoubleSpinBox.h"
#include <dtkCoreWidgets/dtkCoreWidgets>
// ///////////////////////////////////////////////////////////////////
// dtkWidgetsSpinBoxPlugin
// dtkWidgetsParameterDoubleSpinBoxPlugin
// ///////////////////////////////////////////////////////////////////
void dtkWidgetsSpinBoxPlugin::initialize(void)
void dtkWidgetsParameterDoubleSpinBoxPlugin::initialize(void)
{
qDebug() << Q_FUNC_INFO;
dtk::widgets::parameterDouble::pluginFactory().record("dtkWidgetsSpinBoxPlugin", dtkWidgetsSpinBoxCreator);
dtk::widgets::parameterDouble::pluginFactory().record("dtkWidgetsParameterDoubleSpinBoxPlugin", dtkWidgetsParameterDoubleSpinBoxCreator);
}
void dtkWidgetsSpinBoxPlugin::uninitialize(void)
void dtkWidgetsParameterDoubleSpinBoxPlugin::uninitialize(void)
{
}
......@@ -36,7 +36,7 @@ void dtkWidgetsSpinBoxPlugin::uninitialize(void)
// Plugin meta data
// ///////////////////////////////////////////////////////////////////
DTK_DEFINE_PLUGIN(dtkWidgetsSpinBox)
DTK_DEFINE_PLUGIN(dtkWidgetsParameterDoubleSpinBox)
//
// dtkWidgetsSpinBoxPlugin.cpp ends here
// dtkWidgetsParameterDoubleSpinBoxPlugin.cpp ends here
......@@ -18,15 +18,15 @@
#include <dtkWidgets/dtkWidgetsParameter>
class dtkWidgetsSpinBoxPlugin : public dtkWidgetsParameterDoublePlugin
class dtkWidgetsParameterDoubleSpinBoxPlugin : public dtkWidgetsParameterDoublePlugin
{
Q_OBJECT
Q_INTERFACES(dtkWidgetsParameterDoublePlugin);
Q_PLUGIN_METADATA(IID "fr.inria.dtkWidgetsSpinBoxPlugin" FILE "dtkWidgetsSpinBoxPlugin.json")
Q_PLUGIN_METADATA(IID "fr.inria.dtkWidgetsParameterDoubleSpinBoxPlugin" FILE "dtkWidgetsParameterDoubleSpinBoxPlugin.json")
public:
dtkWidgetsSpinBoxPlugin(void) {}
~dtkWidgetsSpinBoxPlugin(void) {}
dtkWidgetsParameterDoubleSpinBoxPlugin(void) {}
~dtkWidgetsParameterDoubleSpinBoxPlugin(void) {}
public:
void initialize(void);
......@@ -34,4 +34,4 @@ public:
};
//
// dtkWidgetsSpinBoxPlugin.h ends here
// dtkWidgetsParameterDoubleSpinBoxPlugin.h ends here
{
"name" : "dtkWidgetsSpinBoxPlugin",
"name" : "dtkWidgetsParameterDoubleSpinBoxPlugin",
"concept" : "dtkWidgetsParameterDouble",
"version" : "0.0.1",
"dependencies" : []
......
// Version: $Id$
//
//
// Commentary:
//
//
// Change Log:
//
//
// Code:
#include "dtkWidgetsSpinBox.h"
#include <dtkLog>
#include <dtkCoreParameter>
class dtkWidgetsSpinBoxPrivate
{
public:
QMetaObject::Connection connection;
dtkCoreParameter<double> *parameter = nullptr;
public:
QDoubleSpinBox *spin_box = nullptr;
public:
void connect(void);
};
void dtkWidgetsSpinBoxPrivate::connect(void)
{
QObject::connect(parameter, &dtk::d_real::valueChanged, [=] (QVariant v) {
double value = v.value<dtk::d_real>().value();
spin_box->setValue(value);
});
QObject::connect(spin_box, QOverload<double>::of(&QDoubleSpinBox::valueChanged), [=] (double v) {
parameter->setValue(v);
});
}
// ///////////////////////////////////////////////////////////////////
dtkWidgetsSpinBox::dtkWidgetsSpinBox(QWidget* parent) : dtkWidgetsParameterDouble(parent), d(new dtkWidgetsSpinBoxPrivate)
{
// d->connection = connect(&dtk::widgets::factory(), &dtkCorePluginWidgetManager::added, [=] (const QVariant& v, QWidget *w) {
// if (w != this) {
// dtkTrace() << Q_FUNC_INFO << "Mismatch widget";
// return;
// }
// dtkBrepVolumeMesher *m = v.value<dtkBrepVolumeMesher *>();
// if (!m) {
// dtkTrace() << Q_FUNC_INFO << "Wrong concept";
// return;
// }
// d->mesher = dynamic_cast<dtkWidgetsSpinBox *>(m);
// if (!d->mesher) {
// dtkTrace() << Q_FUNC_INFO << "Wrong implementation";
// return;
// }
d->connect();
// });
}
dtkWidgetsSpinBox::~dtkWidgetsSpinBox(void)
{
// QObject::disconnect(d->connection);
delete d;
}
//
// dtkWidgetsSpinBoxWidget.cpp ends here
......@@ -25,7 +25,7 @@
class DTKWIDGETS_EXPORT dtkWidgetsParameterInt : public QWidget
{
public:
virtual void connect(dtkCoreParameter<int> *) = 0;
virtual void connect(dtk::d_int *) = 0;
};
......@@ -34,8 +34,8 @@ class DTKWIDGETS_EXPORT dtkWidgetsParameterDouble : public QWidget
public:
dtkWidgetsParameterDouble(QWidget *parent) : QWidget(parent) {};
/* public: */
/* virtual void connect(dtkCoreParameter<double> *) = 0; */
public:
virtual void connect(dtk::d_real *) = 0;
};
......@@ -54,5 +54,6 @@ namespace dtk {
DTK_DECLARE_CONCEPT(dtkWidgetsParameterDouble, DTKWIDGETS_EXPORT, parameterDouble);
}
}
//
// dtkWidgetsParameter.h ends here
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment