Commit 39ccb498 authored by Marina Bertolino's avatar Marina Bertolino

Merge remote-tracking branch 'origin/release-6.2' into release-6.2

parents 5b089793 9eb21ec8
......@@ -59,6 +59,8 @@
#include "otbWrapperQtWidgetOutputImageParameter.h"
#include "otbWrapperQtWidgetOutputProcessXMLParameter.h"
#include "otbWrapperQtWidgetOutputVectorDataParameter.h"
#include "otbWrapperQtWidgetComplexInputImageParameter.h"
#include "otbWrapperQtWidgetComplexOutputImageParameter.h"
#include "otbWrapperQtWidgetParameterFactory.h"
#endif //tag=QT4-boost-compatibility
......@@ -175,6 +177,23 @@ private:
QWidget * m_View;
};
/**
* \class ComplexInputImageInitializer
*
* \ingroup OTBMonteverdiGUI
*
* \brief WIP.
*/
class ComplexInputImageInitializer : public std::unary_function<
otb::Wrapper::QtWidgetComplexInputImageParameter*,
void
>
{
public:
inline ComplexInputImageInitializer();
inline result_type operator () ( argument_type widget ) const;
};
/**
* \class InputVectorDataInitializer
*
......@@ -281,6 +300,26 @@ private:
QString m_Prefix;
};
/**
* \class ComplexOutputImageInitializer
*
* \ingroup OTBMonteverdiGUI
*
* \brief WIP.
*/
class ComplexOutputImageInitializer : public std::unary_function<
otb::Wrapper::QtWidgetComplexOutputImageParameter*,
void
>
{
public:
inline ComplexOutputImageInitializer( const QString & prefix );
inline result_type operator () ( argument_type widget ) const;
private:
QString m_Prefix;
};
/**
* \class OutputVectorDataInitializer
*
......@@ -441,6 +480,24 @@ InputImageListInitializer
SetupWidget( widget, FileSelectionInitializer() );
}
/*****************************************************************************/
inline
ComplexInputImageInitializer
::ComplexInputImageInitializer()
{
}
/*****************************************************************************/
inline
ComplexInputImageInitializer::result_type
ComplexInputImageInitializer
::operator () ( argument_type widget ) const
{
assert( widget!=NULL );
SetupForFilenameDrop( widget, "You can drop filename here." );
}
/*****************************************************************************/
inline
InputFilenameInitializer::result_type
......@@ -576,6 +633,41 @@ OutputImageInitializer
);
}
/*****************************************************************************/
inline
ComplexOutputImageInitializer
::ComplexOutputImageInitializer( const QString& prefix) :
m_Prefix( prefix )
{
}
/*****************************************************************************/
inline
ComplexOutputImageInitializer::result_type
ComplexOutputImageInitializer
::operator () ( argument_type widget ) const
{
assert( widget!=NULL );
assert( I18nCoreApplication::ConstInstance()!=NULL );
if( m_Prefix.isEmpty() )
{
SetupForFilenameDrop( widget, "You can drop filename here." );
assert( qApp!=NULL );
assert( !qApp->arguments().empty() );
SetupOutputFilename( widget );
}
else
SetupOutputFilename(
widget,
I18nCoreApplication::ConstInstance()->GetResultsDir(),
m_Prefix,
".tif"
);
}
/*****************************************************************************/
inline
OutputVectorDataInitializer::result_type
......@@ -671,13 +763,29 @@ SetupForFilenameDrop( W* widget, const char* text )
lineEdit->installEventFilter( eventFilter );
QObject::connect(
eventFilter,
SIGNAL( FilenameDropped( const QString& ) ),
// to:
lineEdit,
SLOT( setText( const QString& ) )
);
// BUG : temporary fix for drag & drop in InputImageParameter
// in the future, all "filename" parameters should have the same behaviour
if (dynamic_cast<otb::Wrapper::QtWidgetInputImageParameter*>(widget) ||
dynamic_cast<otb::Wrapper::QtFileSelectionWidget*>(widget))
{
QObject::connect(
eventFilter,
SIGNAL( FilenameDropped( const QString& ) ),
// to:
widget,
SLOT( SetFileName( const QString& ) )
);
}
else
{
QObject::connect(
eventFilter,
SIGNAL( FilenameDropped( const QString& ) ),
// to:
lineEdit,
SLOT( setText( const QString& ) )
);
}
}
/*****************************************************************************/
......
......@@ -348,6 +348,7 @@ QtWidgetView
SetupWidget( widget, InputFilenameListInitializer( this ) );
SetupWidget( widget, InputImageInitializer() );
SetupWidget( widget, InputImageListInitializer( this ) );
SetupWidget( widget, ComplexInputImageInitializer() );
SetupWidget( widget, InputProcessXMLInitializer() );
SetupWidget( widget, InputVectorDataInitializer() );
SetupWidget( widget, InputVectorDataListInitializer( this ) );
......@@ -362,6 +363,10 @@ QtWidgetView
widget,
OutputImageInitializer( m_Application->GetName() )
);
SetupWidget(
widget,
ComplexOutputImageInitializer( m_Application->GetName() )
);
SetupWidget( widget, OutputVectorDataInitializer() );
}
......
......@@ -87,6 +87,7 @@ signals:
protected slots:
void SelectFile();
void CallFilenameChanged();
void SetFileName(const QString &);
private:
QtFileSelectionWidget(const QtFileSelectionWidget&); //purposely not implemented
......
......@@ -45,6 +45,9 @@ public:
QtWidgetComplexInputImageParameter(ComplexInputImageParameter*, QtWidgetModel*);
~QtWidgetComplexInputImageParameter() ITK_OVERRIDE;
inline const QLineEdit* GetInput() const;
inline QLineEdit* GetInput();
protected slots:
bool SetFileName( const QString& value );
void SelectFile();
......@@ -65,6 +68,21 @@ private:
QPushButton * m_Button;
};
inline
const QLineEdit*
QtWidgetComplexInputImageParameter
::GetInput() const
{
return m_Input;
}
inline
QLineEdit*
QtWidgetComplexInputImageParameter
::GetInput()
{
return m_Input;
}
}
}
......
......@@ -45,11 +45,16 @@ public:
QtWidgetComplexOutputImageParameter(ComplexOutputImageParameter*, QtWidgetModel*);
~QtWidgetComplexOutputImageParameter() ITK_OVERRIDE;
inline const QLineEdit* GetInput() const;
inline QLineEdit* GetInput();
/** Get the PixelType*/
//itkGetMacro(PixelType, int);
protected slots:
public slots:
void SetFileName( const QString& value );
protected slots:
void SelectFile();
void SetPixelType(int pixelType);
......@@ -72,6 +77,21 @@ private:
};
inline
const QLineEdit*
QtWidgetComplexOutputImageParameter
::GetInput() const
{
return m_Input;
}
inline
QLineEdit*
QtWidgetComplexOutputImageParameter
::GetInput()
{
return m_Input;
}
}
}
......
......@@ -52,9 +52,12 @@ signals:
void FileNameIsSet();
protected slots:
bool SetFileName();
bool SetFileName(const QString& value);
void SelectFile();
private slots:
void OnEditingFinished();
private:
QtWidgetInputImageParameter(const QtWidgetInputImageParameter&); //purposely not implemented
void operator=(const QtWidgetInputImageParameter&); //purposely not implemented
......
......@@ -116,15 +116,22 @@ QtFileSelectionWidget
if( filename.isEmpty() )
return;
m_Input->setText( filename );
SetFileName(filename);
}
void
QtFileSelectionWidget
::CallFilenameChanged()
{
emit FilenameChanged();
}
void
QtFileSelectionWidget
::CallFilenameChanged()
::SetFileName(const QString & filename)
{
m_Input->setText( filename );
emit FilenameChanged();
}
......
......@@ -69,7 +69,7 @@ void QtWidgetInputImageParameter::DoCreateWidget()
m_HLayout->setContentsMargins(0, 0, 0, 0);
m_Input = new QLineEdit;
m_Input->setToolTip( m_InputImageParam->GetDescription() );
connect( m_Input, SIGNAL(editingFinished()), this, SLOT(SetFileName()) );
connect( m_Input, SIGNAL(editingFinished()), this, SLOT(OnEditingFinished()) );
connect( this, SIGNAL(FileNameIsSet()), GetModel(), SLOT(NotifyUpdate()) );
m_HLayout->addWidget(m_Input);
......@@ -105,9 +105,7 @@ QtWidgetInputImageParameter
if( filename.isEmpty() )
return;
m_Input->setText( filename );
if( !SetFileName() )
if( !SetFileName(filename) )
{
std::ostringstream oss;
......@@ -123,13 +121,14 @@ QtWidgetInputImageParameter
}
}
bool QtWidgetInputImageParameter::SetFileName()
bool QtWidgetInputImageParameter::SetFileName(const QString& value)
{
bool res = true;
// save value
if( m_InputImageParam->SetFromFileName(
QFile::encodeName( m_Input->text() ).constData() ) == true )
QFile::encodeName( value ).constData() ) == true )
{
m_Input->setText( value );
// notify of value change
QString key( m_InputImageParam->GetKey() );
......@@ -142,5 +141,10 @@ bool QtWidgetInputImageParameter::SetFileName()
return res;
}
void QtWidgetInputImageParameter::OnEditingFinished()
{
SetFileName( m_Input->text() );
}
}
}
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