Skip to content

Commit

Permalink
[GRASS] fixed modules file filters
Browse files Browse the repository at this point in the history
  • Loading branch information
blazek committed Aug 31, 2015
1 parent 5326c6b commit dff2ed5
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 23 deletions.
2 changes: 1 addition & 1 deletion src/plugins/grass/modules/r.in.bin.qgm
Expand Up @@ -5,7 +5,7 @@
<file key="input" type="old" filters="Binary (*.bin)" />
<option key="bytes" />
<option key="anull" />
<option key="output" filters="(*.bin)"/>
<option key="output" />
<flag key="f" answer="off" />
<flag key="d" answer="off" />
<flag key="s" answer="off" />
Expand Down
2 changes: 1 addition & 1 deletion src/plugins/grass/modules/r.in.xyz.qgm
Expand Up @@ -2,7 +2,7 @@
<!DOCTYPE qgisgrassmodule SYSTEM "http://mrcc.com/qgisgrassmodule.dtd">

<qgisgrassmodule label="Import raster from coordinates using univariate statistics" module="r.in.xyz">
<file key="input" type="old" filters="TXT (*.txt), CSV (*.csv)"/>
<file key="input" type="old" filters="TXT (*.txt);;CSV (*.csv)"/>
<option key="method" />
<option key="type" />
<option key="fs" version_max="6.4" />
Expand Down
2 changes: 1 addition & 1 deletion src/plugins/grass/modules/r.recode.file.qgm
Expand Up @@ -3,6 +3,6 @@

<qgisgrassmodule label="Recode raster" module="r.recode.file">
<option key="input"/>
<file key="rules_file" type="new" fileoption="olayer" label="Text file" filters="Txt (*.txt), Csv (*.csv)" />
<file key="rules_file" type="new" fileoption="olayer" label="Text file" filters="Txt (*.txt);;Csv (*.csv)" />
<option key="output" />
</qgisgrassmodule>
19 changes: 3 additions & 16 deletions src/plugins/grass/qgsgrassmoduleparam.cpp
Expand Up @@ -1934,20 +1934,7 @@ QgsGrassModuleFile::QgsGrassModuleFile(
mType = Directory;
}

if ( !qdesc.attribute( "filters" ).isNull() )
{
mFilters = qdesc.attribute( "filters" ).split( ";;" );

if ( mFilters.size() > 0 )
{
QRegExp rx( ".*\\( *..([^ )]*).*" );
QString ext;
if ( rx.indexIn( mFilters.at( 0 ) ) == 0 )
{
mSuffix = rx.cap( 1 );
}
}
}
mFilters = qdesc.attribute( "filters" );

mFileOption = qdesc.attribute( "fileoption" );

Expand Down Expand Up @@ -1997,7 +1984,7 @@ void QgsGrassModuleFile::browse()
else
path = QFileInfo( path ).absolutePath();

QStringList files = QFileDialog::getOpenFileNames( this, 0, path );
QStringList files = QFileDialog::getOpenFileNames( this, 0, path, mFilters );
if ( files.isEmpty() )
return;

Expand All @@ -2016,7 +2003,7 @@ void QgsGrassModuleFile::browse()
else if ( mType == Directory )
selectedFile = QFileDialog::getExistingDirectory( this, 0, selectedFile );
else
selectedFile = QFileDialog::getOpenFileName( this, 0, selectedFile );
selectedFile = QFileDialog::getOpenFileName( this, 0, selectedFile, mFilters );

lastDir = QFileInfo( selectedFile ).absolutePath();

Expand Down
5 changes: 1 addition & 4 deletions src/plugins/grass/qgsgrassmoduleparam.h
Expand Up @@ -634,17 +634,14 @@ class QgsGrassModuleFile : public QgsGrassModuleGroupBoxItem
// ! Optionaly split file to dir and file path
QString mFileOption;

// ! Default suffix
QString mSuffix;

//! Line
QLineEdit *mLineEdit;

//! Browse button
QPushButton *mBrowseButton;

//! File filters
QStringList mFilters;
QString mFilters;
};

#endif // QGSGRASSMODULEPARAM_H

0 comments on commit dff2ed5

Please sign in to comment.