Commit 9d23a4ab authored by SZPYRKA Jean-Luc's avatar SZPYRKA Jean-Luc

merged with develop

parents 51b42199 32dbe2ae
......@@ -80,6 +80,8 @@ set(${PROJECT_NAME}_HEADERS
dtkWidgetsParameterFactory.h
dtkWidgetsParameterFileBrowse
dtkWidgetsParameterFileBrowse.h
dtkWidgetsParameterFileSave
dtkWidgetsParameterFileSave.h
dtkWidgetsParameterIntSlider
dtkWidgetsParameterIntSlider.h
dtkWidgetsParameterIntSpinBox
......@@ -88,6 +90,8 @@ set(${PROJECT_NAME}_HEADERS
dtkWidgetsParameterMenuBarGenerator.h
dtkWidgetsParameterScientificSpinBox
dtkWidgetsParameterScientificSpinBox.h
dtkWidgetsParameterStringLineEdit
dtkWidgetsParameterStringLineEdit.h
dtkWidgetsParameterStringListComboBox
dtkWidgetsParameterStringListComboBox.h
dtkWidgetsSettings
......@@ -135,8 +139,10 @@ set(${PROJECT_NAME}_SOURCES
dtkWidgetsParameterIntSpinBox.cpp
dtkWidgetsParameterFactory.cpp
dtkWidgetsParameterFileBrowse.cpp
dtkWidgetsParameterFileSave.cpp
dtkWidgetsParameterMenuBarGenerator.cpp
dtkWidgetsParameterScientificSpinBox.cpp
dtkWidgetsParameterStringLineEdit.cpp
dtkWidgetsParameterStringListComboBox.cpp
dtkWidgetsSettings.cpp
dtkWidgetsWidget.cpp
......
......@@ -2,6 +2,12 @@
#include "dtkWidgets.h"
#include "dtkWidgetsColorButton.h"
#include "dtkWidgetsController.h"
#include "dtkWidgetsLayout.h"
#include "dtkWidgetsLayoutItem.h"
#include "dtkWidgetsLayoutReader.h"
#include "dtkWidgetsLayoutWriter.h"
#include "dtkWidgetsList.h"
#include "dtkWidgetsListControl.h"
#include "dtkWidgetsHUD.h"
#include "dtkWidgetsHUDInfo.h"
#include "dtkWidgetsHUDItem.h"
......@@ -15,16 +21,23 @@
#include "dtkWidgetsMenuBar.h"
#include "dtkWidgetsMenu.h"
#include "dtkWidgetsMenuItem.h"
#include "dtkWidgetsMenuSpy.h"
#include "dtkWidgetsOverlayPane.h"
#include "dtkWidgetsOverlayPaneItem.h"
#include "dtkWidgetsOverlayPaneSlider.h"
#include "dtkWidgetsOverlayRope.h"
#include "dtkWidgetsParameter.h"
#include "dtkWidgetsParameterBoolCheckBox.h"
#include "dtkWidgetsParameterBoolPushButton.h"
#include "dtkWidgetsParameterDirBrowse.h"
#include "dtkWidgetsParameterDoubleSpinBox.h"
#include "dtkWidgetsParameterFactory.h"
#include "dtkWidgetsParameterFileBrowse.h"
#include "dtkWidgetsParameterFileSave.h"
#include "dtkWidgetsParameterIntSlider.h"
#include "dtkWidgetsParameterIntSpinBox.h"
#include "dtkWidgetsParameterMenuBarGenerator.h"
#include "dtkWidgetsParameterStringLineEdit.h"
#include "dtkWidgetsParameterStringListComboBox.h"
#include "dtkWidgetsParameterScientificSpinBox.h"
#include "dtkWidgetsSettings.h"
......
......@@ -26,8 +26,10 @@
#include "dtkWidgetsParameterScientificSpinBox.h"
#include "dtkWidgetsParameterDirBrowse.h"
#include "dtkWidgetsParameterFileBrowse.h"
#include "dtkWidgetsParameterFileSave.h"
#include "dtkWidgetsParameterIntSlider.h"
#include "dtkWidgetsParameterIntSpinBox.h"
#include "dtkWidgetsParameterStringLineEdit.h"
#include "dtkWidgetsParameterStringListComboBox.h"
#include "dtkWidgetsParameterFactory.h"
......@@ -77,6 +79,8 @@ namespace dtk {
dtk::widgets::parameters::pluginFactory().record("dtkWidgetsParameterIntSlider", dtkWidgetsParameterIntSliderCreator);
dtk::widgets::parameters::pluginFactory().record("dtkWidgetsParameterIntSpinBox", dtkWidgetsParameterIntSpinBoxCreator);
dtk::widgets::parameters::pluginFactory().record("dtkWidgetsParameterFileBrowse", dtkWidgetsParameterFileBrowseCreator);
dtk::widgets::parameters::pluginFactory().record("dtkWidgetsParameterFileSave", dtkWidgetsParameterFileSaveCreator);
dtk::widgets::parameters::pluginFactory().record("dtkWidgetsParameterStringLineEdit", dtkWidgetsParameterStringLineEditCreator);
dtk::widgets::parameters::pluginFactory().record("dtkWidgetsParameterStringListComboBox", dtkWidgetsParameterStringListComboBoxCreator);
}
void setVerboseLoading(bool b)
......
#include "dtkWidgetsParameterFileSave.h"
\ No newline at end of file
// Version: $Id$
//
//
// Commentary:
//
//
// Change Log:
//
//
// Code:
#include "dtkWidgetsParameterFileSave.h"
#include <dtkLog>
// ///////////////////////////////////////////////////////////////////
// dtkWidgetsParameterFileSavePrivate declaration
// ///////////////////////////////////////////////////////////////////
class dtkWidgetsParameterFileSavePrivate
{
public:
QPushButton *push_button = nullptr;
};
// ///////////////////////////////////////////////////////////////////
// dtkWidgetsParameterFileSave implementation
// ///////////////////////////////////////////////////////////////////
dtkWidgetsParameterFileSave::dtkWidgetsParameterFileSave(QWidget* parent) : dtkWidgetsParameterBase<dtk::d_path>(parent), d(new dtkWidgetsParameterFileSavePrivate)
{
d->push_button = new QPushButton;
QHBoxLayout *layout = new QHBoxLayout;
layout->addWidget(d->push_button);
this->setLayout(layout);
}
dtkWidgetsParameterFileSave::~dtkWidgetsParameterFileSave(void)
{
delete d;
}
bool dtkWidgetsParameterFileSave::connect(dtkCoreParameter *p)
{
if (!p) {
qWarning() << Q_FUNC_INFO << "The input parameter is null. Nothing is done.";
return false;
}
m_parameter = dynamic_cast<dtk::d_path *>(p);
if(!m_parameter) {
qWarning() << Q_FUNC_INFO << "The type of the parameter is not compatible with the widget dtkWidgetsParameterFileSave.";
return false;
}
d->push_button->setText("Save");
m_parameter->connect([=] (QVariant v) {
d->push_button->blockSignals(true);
QString value = v.value<dtk::d_path>().baseName();
if (value.isEmpty()) {
value = "Save";
}
d->push_button->setText(value);
d->push_button->blockSignals(false);
});
QObject::connect(d->push_button, &QPushButton::clicked, [=] ()
{
m_parameter->setValue(QFileDialog::getSaveFileName(this, "Save file", m_parameter->dirName(), m_parameter->filters().join("; ")));
});
return true;
}
//
// dtkWidgetsParameterFileSave.cpp ends here
// Version: $Id$
//
//
// Commentary:
//
//
// Change Log:
//
//
// Code:
#pragma once
#include <dtkWidgetsExport>
#include <QtWidgets>
#include "dtkWidgetsParameter.h"
#include <dtkCore/dtkCoreParameter>
#include <dtkCore/dtkCoreParameterPath>
class DTKWIDGETS_EXPORT dtkWidgetsParameterFileSave : public dtkWidgetsParameterBase<dtk::d_path>
{
Q_OBJECT
public:
dtkWidgetsParameterFileSave(QWidget* parent = 0);
~dtkWidgetsParameterFileSave(void);
public:
bool connect(dtkCoreParameter *) override;
private:
using dtkWidgetsParameterBase<dtk::d_path>::m_parameter;
class dtkWidgetsParameterFileSavePrivate *d;
};
// ///////////////////////////////////////////////////////////////////
inline dtkWidgetsParameter *dtkWidgetsParameterFileSaveCreator(void)
{
return new dtkWidgetsParameterFileSave();
}
//
// dtkWidgetsParameterFileSave.h ends here
#include "dtkWidgetsParameterStringLineEdit.h"
\ No newline at end of file
// Version: $Id$
//
//
// Commentary:
//
//
// Change Log:
//
//
// Code:
#include "dtkWidgetsParameterStringLineEdit.h"
#include <dtkLog>
// ///////////////////////////////////////////////////////////////////
// dtkWidgetsParameterStringLineEditPrivate declaration
// ///////////////////////////////////////////////////////////////////
class dtkWidgetsParameterStringLineEditPrivate
{
public:
QLineEdit *line_edit = nullptr;
};
// ///////////////////////////////////////////////////////////////////
// dtkWidgetsParameterStringLineEdit implementation
// ///////////////////////////////////////////////////////////////////
dtkWidgetsParameterStringLineEdit::dtkWidgetsParameterStringLineEdit(QWidget* parent) : dtkWidgetsParameterBase<dtk::d_string>(parent), d(new dtkWidgetsParameterStringLineEditPrivate)
{
d->line_edit = new QLineEdit;
QHBoxLayout *layout = new QHBoxLayout;
layout->addWidget(d->line_edit);
this->setLayout(layout);
}
dtkWidgetsParameterStringLineEdit::~dtkWidgetsParameterStringLineEdit(void)
{
delete d;
}
bool dtkWidgetsParameterStringLineEdit::connect(dtkCoreParameter *p)
{
if (!p) {
qWarning() << Q_FUNC_INFO << "The input parameter is null. Nothing is done.";
return false;
}
m_parameter = dynamic_cast<dtk::d_string *>(p);
if(!m_parameter) {
qWarning() << Q_FUNC_INFO << "The type of the parameter is not compatible with the widget dtkWidgetsParameterStringLineEdit.";
return false;
}
d->line_edit->setText(m_parameter->value());
d->line_edit->setToolTip(m_parameter->documentation());
m_parameter->connect([=] (QVariant v) {
QString value = v.value<dtk::d_string>().value();
d->line_edit->blockSignals(true);
d->line_edit->setText(value);
d->line_edit->blockSignals(false);
});
QObject::connect(d->line_edit, &QLineEdit::textChanged, [=] (const QString& v)
{
m_parameter->setValue(v);
});
return true;
}
//
// dtkWidgetsParameterStringLineEdit.cpp ends here
// Version: $Id$
//
//
// Commentary:
//
//
// Change Log:
//
//
// Code:
#pragma once
#include <dtkWidgetsExport>
#include <QtWidgets>
#include "dtkWidgetsParameter.h"
#include <dtkCore/dtkCoreParameter>
class DTKWIDGETS_EXPORT dtkWidgetsParameterStringLineEdit : public dtkWidgetsParameterBase<dtk::d_string>
{
Q_OBJECT
public:
dtkWidgetsParameterStringLineEdit(QWidget* parent = 0);
~dtkWidgetsParameterStringLineEdit(void);
public:
bool connect(dtkCoreParameter *) override;
private:
using dtkWidgetsParameterBase<dtk::d_string>::m_parameter;
class dtkWidgetsParameterStringLineEditPrivate *d;
};
// ///////////////////////////////////////////////////////////////////
inline dtkWidgetsParameter *dtkWidgetsParameterStringLineEditCreator(void)
{
return new dtkWidgetsParameterStringLineEdit();
}
//
// dtkWidgetsParameterStringLineEdit.h ends here
\ No newline at end of file
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