Commit cb4e1f96 authored by Stéphane Albert's avatar Stéphane Albert

ENH: OTB-applications wrappers: initialized directory of file-dialog openend...

ENH: OTB-applications wrappers: initialized directory of file-dialog openend when using browse button with edited text.
parent ceed24d7
......@@ -70,6 +70,14 @@ void QtFileSelectionWidget::SelectFile()
fileDialog.setFileMode(QFileDialog::ExistingFile);
fileDialog.setNameFilter("All files (*)");
QFileInfo finfo( QString::fromStdString( GetFilename() ) );
fileDialog.setDirectory(
finfo.isDir()
? finfo.absoluteFilePath()
: finfo.absoluteDir()
);
if (fileDialog.exec())
{
QString filemane(fileDialog.selectedFiles().at(0));
......
......@@ -71,7 +71,9 @@ void QtWidgetInputFilenameParameter::DoCreateWidget()
void QtWidgetInputFilenameParameter::SelectFile()
{
QFileDialog fileDialog;
fileDialog.setConfirmOverwrite(true);
switch(m_FilenameParam->GetRole())
{
case Role_Input:
......@@ -90,6 +92,18 @@ void QtWidgetInputFilenameParameter::SelectFile()
fileDialog.setNameFilter("File (*)");
assert( m_Input!=NULL );
QFileInfo finfo( m_Input->text() );
fileDialog.setDirectory(
finfo.isDir()
? finfo.absoluteFilePath()
: finfo.absoluteDir()
);
if (fileDialog.exec())
{
this->SetFileName(fileDialog.selectedFiles().at(0));
......
......@@ -78,6 +78,16 @@ void QtWidgetInputImageParameter::SelectFile()
fileDialog.setFileMode(QFileDialog::ExistingFile);
fileDialog.setNameFilter("Raster files (*)");
assert( m_Input!=NULL );
QFileInfo finfo( m_Input->text() );
fileDialog.setDirectory(
finfo.isDir()
? finfo.absoluteFilePath()
: finfo.absoluteDir()
);
if (fileDialog.exec())
{
if ( this->SetFileName(fileDialog.selectedFiles().at(0)) == true )
......
......@@ -71,6 +71,16 @@ void QtWidgetInputProcessXMLParameter::SelectFile()
fileDialog.setFileMode(QFileDialog::AnyFile);
fileDialog.setNameFilter("XML File (*.xml)");
assert( m_Input!=NULL );
QFileInfo finfo( m_Input->text() );
fileDialog.setDirectory(
finfo.isDir()
? finfo.absoluteFilePath()
: finfo.absoluteDir()
);
if (fileDialog.exec())
{
QString name = fileDialog.selectedFiles().at(0);
......
......@@ -74,6 +74,16 @@ void QtWidgetInputVectorDataParameter::SelectFile()
fileDialog.setFileMode(QFileDialog::ExistingFile);
fileDialog.setNameFilter("Vector data files (*)");
assert( m_Input!=NULL );
QFileInfo finfo( m_Input->text() );
fileDialog.setDirectory(
finfo.isDir()
? finfo.absoluteFilePath()
: finfo.absoluteDir()
);
if (fileDialog.exec())
{
if ( this->SetFileName(fileDialog.selectedFiles().at(0)) == true )
......
......@@ -86,6 +86,18 @@ void QtWidgetOutputFilenameParameter::SelectFile()
fileDialog.setNameFilter("File (*)");
assert( m_Input!=NULL );
QFileInfo finfo( m_Input->text() );
fileDialog.setDirectory(
finfo.isDir()
? finfo.absoluteFilePath()
: finfo.absoluteDir()
);
if (fileDialog.exec())
{
this->SetFileName(fileDialog.selectedFiles().at(0));
......
......@@ -84,10 +84,23 @@ void QtWidgetOutputImageParameter::DoCreateWidget()
void QtWidgetOutputImageParameter::SelectFile()
{
QFileDialog fileDialog;
fileDialog.setConfirmOverwrite(true);
fileDialog.setFileMode(QFileDialog::AnyFile);
fileDialog.setNameFilter("Raster files (*)");
assert( m_Input!=NULL );
QFileInfo finfo( m_Input->text() );
fileDialog.setDirectory(
finfo.isDir()
? finfo.absoluteFilePath()
: finfo.absoluteDir()
);
if (fileDialog.exec())
{
//this->SetFileName(fileDialog.selectedFiles().at(0));
......
......@@ -72,6 +72,16 @@ void QtWidgetOutputProcessXMLParameter::SelectFile()
fileDialog.setNameFilter("XML File (*.xml)");
assert( m_Input!=NULL );
QFileInfo finfo( m_Input->text() );
fileDialog.setDirectory(
finfo.isDir()
? finfo.absoluteFilePath()
: finfo.absoluteDir()
);
if (fileDialog.exec())
{
this->SetFileName(fileDialog.selectedFiles().at(0));
......
......@@ -66,10 +66,21 @@ void QtWidgetOutputVectorDataParameter::DoCreateWidget()
void QtWidgetOutputVectorDataParameter::SelectFile()
{
QFileDialog fileDialog;
fileDialog.setConfirmOverwrite(true);
fileDialog.setFileMode(QFileDialog::AnyFile);
fileDialog.setNameFilter("Vector data files (*)");
assert( m_Input!=NULL );
QFileInfo finfo( m_Input->text() );
fileDialog.setDirectory(
finfo.isDir()
? finfo.absoluteFilePath()
: finfo.absoluteDir()
);
if (fileDialog.exec())
{
//this->SetFileName(fileDialog.selectedFiles().at(0));
......
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