Skip to content
Permalink
Browse files

[GRASS] field option without layer

  • Loading branch information
blazek committed Sep 9, 2015
1 parent ef1be5c commit fc0843c5bffd17121ac5f1d92238015f4f4f3a3f
@@ -254,11 +254,22 @@ QgsGrassModuleStandardOptions::QgsGrassModuleStandardOptions(
}
else if ( optionType == "field" )
{
QgsGrassModuleField *mi = new QgsGrassModuleField(
mModule, this, key, confDomElement,
descDocElem, gnode, mDirect, this );
layout->addWidget( mi );
mParams.append( mi );
if ( confDomElement.hasAttribute( "layer" ) )
{
QgsGrassModuleVectorField *mi = new QgsGrassModuleVectorField(
mModule, this, key, confDomElement,
descDocElem, gnode, mDirect, this );
layout->addWidget( mi );
mParams.append( mi );
}
else
{
QgsGrassModuleField *mi = new QgsGrassModuleField(
mModule, key, confDomElement,
descDocElem, gnode, mDirect, this );
layout->addWidget( mi );
mParams.append( mi );
}
}
else if ( optionType == "selection" )
{
@@ -1070,8 +1070,24 @@ QgsGrassModuleGdalInput::~QgsGrassModuleGdalInput()
}

/***************** QgsGrassModuleField *********************/
QgsGrassModuleField::QgsGrassModuleField( QgsGrassModule *module, QString key,
QDomElement &qdesc, QDomElement &gdesc, QDomNode &gnode, bool direct, QWidget * parent )
: QgsGrassModuleOption( module, key, qdesc, gdesc, gnode, direct, parent )
{
QRegExp rx( "^[a-zA-Z_][a-zA-Z0-9_]*$" );
foreach ( QLineEdit *lineEdit, mLineEdits )
{
lineEdit->setValidator( new QRegExpValidator( rx, this ) );
}
}

QgsGrassModuleField::~QgsGrassModuleField()
{
}

QgsGrassModuleField::QgsGrassModuleField(
/***************** QgsGrassModuleVectorField *********************/

QgsGrassModuleVectorField::QgsGrassModuleVectorField(
QgsGrassModule *module, QgsGrassModuleStandardOptions *options,
QString key, QDomElement &qdesc,
QDomElement &gdesc, QDomNode &gnode, bool direct, QWidget * parent )
@@ -1114,7 +1130,7 @@ QgsGrassModuleField::QgsGrassModuleField(
updateFields();
}

void QgsGrassModuleField::updateFields()
void QgsGrassModuleVectorField::updateFields()
{
QgsDebugMsg( "entered" );

@@ -1141,7 +1157,7 @@ void QgsGrassModuleField::updateFields()
}
}

QStringList QgsGrassModuleField::options()
QStringList QgsGrassModuleVectorField::options()
{
QStringList list;

@@ -1154,7 +1170,7 @@ QStringList QgsGrassModuleField::options()
return list;
}

QgsGrassModuleField::~QgsGrassModuleField()
QgsGrassModuleVectorField::~QgsGrassModuleVectorField()
{
}

@@ -257,6 +257,10 @@ class QgsGrassModuleOption : public QgsGrassModuleGroupBoxItem
// Browse output
void browse( bool checked );

protected:
//! Line
QList<QLineEdit*> mLineEdits;

private:
//! Control type
ControlType mControlType;
@@ -280,9 +284,6 @@ class QgsGrassModuleOption : public QgsGrassModuleGroupBoxItem
//! Check boxes
QList<QgsGrassModuleCheckBox*> mCheckBoxes;

//! Line
QList<QLineEdit*> mLineEdits;

//! True if this option is GRASS output
bool mIsOutput;

@@ -385,12 +386,13 @@ class QgsGrassModuleGdalInput : public QgsGrassModuleGroupBoxItem
bool mRequired;
};


/*********************** QgsGrassModuleField **********************/

/** \class QgsGrassModuleField
* \brief GRASS vector attribute column.
* \brief GRASS column, not existing column of input vector, may be output column or input column from a table not linked to layer
*/
class QgsGrassModuleField : public QgsGrassModuleGroupBoxItem
class QgsGrassModuleField : public QgsGrassModuleOption
{
Q_OBJECT

@@ -399,14 +401,36 @@ class QgsGrassModuleField : public QgsGrassModuleGroupBoxItem
* \param qdesc option element in QGIS module description XML file
* \param gdesc GRASS module XML description file
*/
QgsGrassModuleField( QgsGrassModule *module,
QgsGrassModuleStandardOptions *options,
QString key,
QgsGrassModuleField( QgsGrassModule *module, QString key,
QDomElement &qdesc, QDomElement &gdesc, QDomNode &gnode,
bool direct, QWidget * parent = 0 );

//! Destructor
~QgsGrassModuleField();
};

/*********************** QgsGrassModuleVectorField **********************/

/** \class QgsGrassModuleVectorField
* \brief GRASS vector attribute column.
*/
class QgsGrassModuleVectorField : public QgsGrassModuleGroupBoxItem
{
Q_OBJECT

public:
/** \brief Constructor
* \param qdesc option element in QGIS module description XML file
* \param gdesc GRASS module XML description file
*/
QgsGrassModuleVectorField( QgsGrassModule *module,
QgsGrassModuleStandardOptions *options,
QString key,
QDomElement &qdesc, QDomElement &gdesc, QDomNode &gnode,
bool direct, QWidget * parent = 0 );

//! Destructor
~QgsGrassModuleVectorField();

//! Retruns list of options which will be passed to module
virtual QStringList options() override;

0 comments on commit fc0843c

Please sign in to comment.
You can’t perform that action at this time.