Skip to content
Snippets Groups Projects
Commit 4d108462 authored by Cyrille Valladeau's avatar Cyrille Valladeau
Browse files

ADD: add FilenameParameter widget

parent 414731b6
No related branches found
No related tags found
No related merge requests found
/*=========================================================================
Program: ORFEO Toolbox
Language: C++
Date: $Date$
Version: $Revision$
Copyright (c) Centre National d'Etudes Spatiales. All rights reserved.
See OTBCopyright.txt for details.
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the above copyright notices for more information.
=========================================================================*/
#include "otbWrapperQtWidgetFilenameParameter.h"
namespace otb
{
namespace Wrapper
{
QtWidgetFilenameParameter::QtWidgetFilenameParameter(FilenameParameter* param, QtWidgetModel* m)
: QtWidgetParameterBase(param, m),
m_FilenameParam(param)
{
}
QtWidgetFilenameParameter::~QtWidgetFilenameParameter()
{
}
void QtWidgetFilenameParameter::DoUpdateGUI()
{
}
void QtWidgetFilenameParameter::DoCreateWidget()
{
// Set up input text edit
m_HLayout = new QHBoxLayout;
m_HLayout->setSpacing(0);
m_HLayout->setContentsMargins(0, 0, 0, 0);
m_Input = new QLineEdit;
m_Input->setToolTip( m_FilenameParam->GetDescription() );
connect( m_Input, SIGNAL(textChanged(const QString&)), this, SLOT(SetFileName(const QString&)) );
connect( m_Input, SIGNAL(textChanged(const QString&)), GetModel(), SLOT(NotifyUpdate()) );
m_HLayout->addWidget(m_Input);
// Set up input text edit
m_Button = new QPushButton;
m_Button->setText("...");
m_Button->setToolTip("Select file...");
m_Button->setMaximumWidth(m_Button->width());
connect( m_Button, SIGNAL(clicked()), this, SLOT(SelectFile()) );
m_HLayout->addWidget(m_Button);
this->setLayout(m_HLayout);
}
void QtWidgetFilenameParameter::SelectFile()
{
QFileDialog fileDialog;
fileDialog.setConfirmOverwrite(true);
fileDialog.setFileMode(QFileDialog::ExistingFile);
fileDialog.setNameFilter("File (*)");
if (fileDialog.exec())
{
this->SetFileName(fileDialog.selectedFiles().at(0));
m_Input->setText(fileDialog.selectedFiles().at(0));
}
}
void QtWidgetFilenameParameter::SetFileName(const QString& value)
{
// save value
m_FilenameParam->SetValue(value.toStdString());
// notify of value change
QString key( QString::fromStdString(m_FilenameParam->GetKey()) );
emit ParameterChanged(key);
}
}
}
/*=========================================================================
Program: ORFEO Toolbox
Language: C++
Date: $Date$
Version: $Revision$
Copyright (c) Centre National d'Etudes Spatiales. All rights reserved.
See OTBCopyright.txt for details.
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the above copyright notices for more information.
=========================================================================*/
#ifndef __otbWrapperQtWidgetFilenameParameter_h
#define __otbWrapperQtWidgetFilenameParameter_h
#include <QtGui>
#include "otbWrapperFilenameParameter.h"
#include "otbWrapperQtWidgetParameterBase.h"
namespace otb
{
namespace Wrapper
{
/** \class
* \brief
*/
class QtWidgetFilenameParameter : public QtWidgetParameterBase
{
Q_OBJECT
public:
QtWidgetFilenameParameter(FilenameParameter*, QtWidgetModel*);
virtual ~QtWidgetFilenameParameter();
protected slots:
void SetFileName( const QString& value );
void SelectFile();
private:
QtWidgetFilenameParameter(const QtWidgetFilenameParameter&); //purposely not implemented
void operator=(const QtWidgetFilenameParameter&); //purposely not implemented
virtual void DoCreateWidget();
virtual void DoUpdateGUI();
FilenameParameter::Pointer m_FilenameParam;
QHBoxLayout * m_HLayout;
QLineEdit* m_Input;
QPushButton * m_Button;
};
}
}
#endif
......@@ -89,3 +89,23 @@ add_test(NAME apTvUtExtractROISizeTooBig
--in ${INPUTDATA}/couleurs_extrait.png
--out ${TEMP}/utExtractROISizeNULL.tif
--sizex 1000000 )
add_test(NAME apTvUtConcatenateImages_1Image
COMMAND otbTestDriver --compare-image ${NOTOL}
${INPUTDATA}/poupees_c1
${TEMP}/apTvUtConcatenateImages_1Image.tif
Execute $<TARGET_FILE:otbApplicationLauncherCommandLine>
ConcatenateImages
--modulePath $<TARGET_FILE_DIR:otbapp_ExtractROI>
--il ${INPUTDATA}/poupees_c1
--out ${TEMP}/apTvUtConcatenateImages_1Image.tif)
add_test(NAME apTvUtConcatenateImages
COMMAND otbTestDriver --compare-image ${NOTOL}
${INPUTDATA}/poupees.lum
${TEMP}/apTvUtConcatenateImages.tif
Execute $<TARGET_FILE:otbApplicationLauncherCommandLine>
ConcatenateImages
--modulePath $<TARGET_FILE_DIR:otbapp_ExtractROI>
--il ${INPUTDATA}/poupees_I1.lum ${INPUTDATA}/poupees_I2.lun ${INPUTDATA}/poupees_I3.lum ${INPUTDATA}/poupees_I4.lum
--out ${TEMP}/apTvUtConcatenateImages.tif )
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