86 changes: 43 additions & 43 deletions src/core/symbology-ng/qgsstylev2.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ bool QgsStyleV2::saveSymbol( QString name, QgsSymbolV2* symbol, int groupid, QSt
symEl.save( stream, 4 );
QByteArray nameArray = name.toUtf8();
char *query = sqlite3_mprintf( "INSERT INTO symbol VALUES (NULL, '%q', '%q', %d);",
nameArray.constData(), xmlArray->constData(), groupid );
nameArray.constData(), xmlArray->constData(), groupid );

if ( !runEmptyQuery( query ) )
{
Expand Down Expand Up @@ -204,7 +204,7 @@ bool QgsStyleV2::saveColorRamp( QString name, QgsVectorColorRampV2* ramp, int gr
rampEl.save( stream, 4 );
QByteArray nameArray = name.toUtf8();
char *query = sqlite3_mprintf( "INSERT INTO colorramp VALUES (NULL, '%q', '%q', %d);",
nameArray.constData(), xmlArray->constData(), groupid );
nameArray.constData(), xmlArray->constData(), groupid );

if ( !runEmptyQuery( query ) )
{
Expand Down Expand Up @@ -311,7 +311,7 @@ bool QgsStyleV2::load( QString filename )
QDomDocument doc;
QString ramp_name = QString( reinterpret_cast<const char*>( sqlite3_column_text( ppStmt, ColorrampName ) ) );
QString xmlstring = QString( reinterpret_cast<const char*>( sqlite3_column_text( ppStmt, ColorrampXML ) ) );
if( !doc.setContent( xmlstring ) )
if ( !doc.setContent( xmlstring ) )
{
QgsDebugMsg( "Cannot open symbol" + ramp_name );
continue;
Expand Down Expand Up @@ -437,7 +437,7 @@ QStringList QgsStyleV2::groupNames()
QgsSymbolGroupMap QgsStyleV2::childGroupNames( QString parent )
{
// get the name list from the sqlite database and return as a QStringList
if( mCurrentDB == NULL )
if ( mCurrentDB == NULL )
{
QgsDebugMsg( "Cannot open database for listing groups" );
return QgsSymbolGroupMap();
Expand Down Expand Up @@ -478,7 +478,7 @@ QgsSymbolGroupMap QgsStyleV2::childGroupNames( QString parent )

QStringList QgsStyleV2::symbolsOfGroup( StyleEntity type, int groupid )
{
if( mCurrentDB == NULL )
if ( mCurrentDB == NULL )
{
QgsDebugMsg( "Cannot Open database for getting group symbols of groupid: " + groupid );
return QStringList();
Expand All @@ -490,12 +490,12 @@ QStringList QgsStyleV2::symbolsOfGroup( StyleEntity type, int groupid )
if ( type == SymbolEntity )
{
query = groupid ? sqlite3_mprintf( "SELECT name FROM symbol WHERE groupid=%d;", groupid ) :
sqlite3_mprintf( "SELECT name FROM symbol WHERE groupid IS NULL;");
sqlite3_mprintf( "SELECT name FROM symbol WHERE groupid IS NULL;" );
}
else if ( type == ColorrampEntity )
{
query = groupid ? sqlite3_mprintf( "SELECT name FROM colorramp WHERE groupid=%d;", groupid ) :
sqlite3_mprintf( "SELECT name FROM colorramp WHERE groupid IS NULL;");
sqlite3_mprintf( "SELECT name FROM colorramp WHERE groupid IS NULL;" );
}
else
{
Expand Down Expand Up @@ -587,7 +587,7 @@ int QgsStyleV2::addGroup( QString groupName, int parentid )
sqlite3_step( ppStmt );
sqlite3_finalize( ppStmt );

return (int)sqlite3_last_insert_rowid( mCurrentDB );
return ( int )sqlite3_last_insert_rowid( mCurrentDB );
}

int QgsStyleV2::addTag( QString tagname )
Expand All @@ -603,7 +603,7 @@ int QgsStyleV2::addTag( QString tagname )
sqlite3_step( ppStmt );
sqlite3_finalize( ppStmt );

return (int)sqlite3_last_insert_rowid( mCurrentDB );
return ( int )sqlite3_last_insert_rowid( mCurrentDB );
}

void QgsStyleV2::rename( StyleEntity type, int id, QString newName )
Expand All @@ -613,17 +613,17 @@ void QgsStyleV2::rename( StyleEntity type, int id, QString newName )
switch ( type )
{
case SymbolEntity : query = sqlite3_mprintf( "UPDATE symbol SET name='%q' WHERE id=%d;", nameArray.constData(), id );
break;
break;
case GroupEntity : query = sqlite3_mprintf( "UPDATE symgroup SET name='%q' WHERE id=%d;", nameArray.constData(), id );
break;
break;
case TagEntity : query = sqlite3_mprintf( "UPDATE tag SET name='%q' WHERE id=%d;", nameArray.constData(), id );
break;
break;
case ColorrampEntity : query = sqlite3_mprintf( "UPDATE colorramp SET name='%q' WHERE id=%d;", nameArray.constData(), id );
break;
break;
case SmartgroupEntity : query = sqlite3_mprintf( "UPDATE smartgroup SET name='%q' WHERE id=%d;", nameArray.constData(), id );
break;
break;
default : QgsDebugMsg( "Invalid Style Entity indicated" );
return;
return;
}
if ( !runEmptyQuery( query ) )
mErrorString = "Could not rename!";
Expand All @@ -641,14 +641,14 @@ char* QgsStyleV2::getGroupRemoveQuery( int id )
if ( parentid )
{
query = sqlite3_mprintf( "UPDATE symbol SET groupid=%d WHERE groupid=%d;"
"UPDATE symgroup SET parent=%d WHERE parent=%d;"
"DELETE FROM symgroup WHERE id=%d;", parentid, id, parentid, id, id );
"UPDATE symgroup SET parent=%d WHERE parent=%d;"
"DELETE FROM symgroup WHERE id=%d;", parentid, id, parentid, id, id );
}
else
{
query = sqlite3_mprintf( "UPDATE symbol SET groupid=NULL WHERE groupid=%d;"
"UPDATE symgroup SET parent=NULL WHERE parent=%d;"
"DELETE FROM symgroup WHERE id=%d;", id, id, id );
"UPDATE symgroup SET parent=NULL WHERE parent=%d;"
"DELETE FROM symgroup WHERE id=%d;", id, id, id );
}
return query;
}
Expand All @@ -659,17 +659,17 @@ void QgsStyleV2::remove( StyleEntity type, int id )
switch ( type )
{
case SymbolEntity : query = sqlite3_mprintf( "DELETE FROM symbol WHERE id=%d; DELETE FROM tagmap WHERE symbol_id=%d;", id, id );
break;
break;
case GroupEntity : query = getGroupRemoveQuery( id );
break;
break;
case TagEntity : query = sqlite3_mprintf( "DELETE FROM tag WHERE id=%d; DELETE FROM tagmap WHERE tag_id=%d;", id, id );
break;
break;
case ColorrampEntity : query = sqlite3_mprintf( "DELETE FROM colorramp WHERE id=%d;", id );
break;
break;
case SmartgroupEntity : query = sqlite3_mprintf( "DELETE FROM smartgroup WHERE id=%d;", id );
break;
break;
default : QgsDebugMsg( "Invalid Style Entity indicated" );
return;
return;
}
if ( !runEmptyQuery( query ) )
QgsDebugMsg( "Could not delete entity!" );
Expand Down Expand Up @@ -698,14 +698,14 @@ bool QgsStyleV2::group( StyleEntity type, QString name, int groupid )
switch ( type )
{
case SymbolEntity : query = groupid ? sqlite3_mprintf( "UPDATE symbol SET groupid=%d WHERE name='%q';", groupid, array.constData() ) : sqlite3_mprintf( "UPDATE symbol SET groupid=NULL WHERE name='%q';", array.constData() );
break;
break;
case ColorrampEntity : query = groupid ? sqlite3_mprintf( "UPDATE colorramp SET groupid=%d WHERE name='%q';", groupid, array.constData() ) : sqlite3_mprintf( "UPDATE colorramp SET groupid=NULL WHERE name='%q';", array.constData() );
break;
break;
default : QgsDebugMsg( "Wrong entity value. cannot apply group" );
break;
break;

}
return runEmptyQuery( query );
return runEmptyQuery( query );
}

QStringList QgsStyleV2::findSymbols( QString qword )
Expand Down Expand Up @@ -822,7 +822,7 @@ bool QgsStyleV2::detagSymbol( StyleEntity type, QString symbol, QStringList tags
QgsDebugMsg( "Sorry! Cannot open database for detgging." );
return false;
}
query = ( type == SymbolEntity) ? sqlite3_mprintf( "SELECT id FROM symbol WHERE name='%q';", array.constData() ) : sqlite3_mprintf( "SELECT id FROM colorramp WHERE name='%q';", array.constData() );
query = ( type == SymbolEntity ) ? sqlite3_mprintf( "SELECT id FROM symbol WHERE name='%q';", array.constData() ) : sqlite3_mprintf( "SELECT id FROM colorramp WHERE name='%q';", array.constData() );
sqlite3_stmt *ppStmt;
int nErr = sqlite3_prepare_v2( mCurrentDB, query, -1, &ppStmt, NULL );
if ( nErr == SQLITE_OK && sqlite3_step( ppStmt ) == SQLITE_ROW )
Expand Down Expand Up @@ -852,7 +852,7 @@ bool QgsStyleV2::detagSymbol( StyleEntity type, QString symbol, QStringList tags
}
}

// TODO Perform tag cleanup
// TODO Perform tag cleanup
// check the number of entries for a given tag in the tagmap
// if the count is 0, then remove( TagEntity, tagid )
return true;
Expand Down Expand Up @@ -955,7 +955,7 @@ int QgsStyleV2::addSmartgroup( QString name, QString op, QgsSmartConditionMap co
foreach ( const QString &param, parameters )
{
QDomElement condEl = doc.createElement( "condition" );
condEl.setAttribute( "constraint", constraint);
condEl.setAttribute( "constraint", constraint );
condEl.setAttribute( "param", param );
smartEl.appendChild( condEl );
}
Expand All @@ -966,22 +966,22 @@ int QgsStyleV2::addSmartgroup( QString name, QString op, QgsSmartConditionMap co
smartEl.save( stream, 4 );
QByteArray nameArray = name.toUtf8();
char *query = sqlite3_mprintf( "INSERT INTO smartgroup VALUES (NULL, '%q', '%q');",
nameArray.constData(), xmlArray->constData() );
nameArray.constData(), xmlArray->constData() );

if ( !runEmptyQuery( query ) )
{
QgsDebugMsg( "Couldnot insert symbol into the Database!" );
}
else
{
sgId = (int)sqlite3_last_insert_rowid( mCurrentDB );
sgId = ( int )sqlite3_last_insert_rowid( mCurrentDB );
}
return sgId;
}

QgsSymbolGroupMap QgsStyleV2::smartgroupsListMap()
{
if( mCurrentDB == NULL )
if ( mCurrentDB == NULL )
{
QgsDebugMsg( "Cannot open database for listing groups" );
return QgsSymbolGroupMap();
Expand All @@ -1008,7 +1008,7 @@ QStringList QgsStyleV2::smartgroupNames()
{
QStringList groups;

if( mCurrentDB == NULL )
if ( mCurrentDB == NULL )
{
QgsDebugMsg( "Cannot open database for listing groups" );
return QStringList();
Expand Down Expand Up @@ -1088,7 +1088,7 @@ QStringList QgsStyleV2::symbolsOfSmartgroup( StyleEntity type, int id )
{
resultNames = ( type == SymbolEntity ) ? symbolNames() : colorRampNames();
QStringList unwanted = symbolsWithTag( type, tagId( param ) );
foreach( QString name, unwanted )
foreach ( QString name, unwanted )
{
resultNames.removeAll( name );
}
Expand All @@ -1097,7 +1097,7 @@ QStringList QgsStyleV2::symbolsOfSmartgroup( StyleEntity type, int id )
{
resultNames = ( type == SymbolEntity ) ? symbolNames() : colorRampNames();
QStringList unwanted = symbolsOfGroup( type, groupId( param ) );
foreach( QString name, unwanted )
foreach ( QString name, unwanted )
{
resultNames.removeAll( name );
}
Expand Down Expand Up @@ -1143,7 +1143,7 @@ QStringList QgsStyleV2::symbolsOfSmartgroup( StyleEntity type, int id )

QgsSmartConditionMap QgsStyleV2::smartgroup( int id )
{
if( mCurrentDB == NULL )
if ( mCurrentDB == NULL )
{
QgsDebugMsg( "Cannot open database for listing groups" );
return QgsSmartConditionMap();
Expand Down Expand Up @@ -1184,7 +1184,7 @@ QgsSmartConditionMap QgsStyleV2::smartgroup( int id )

QString QgsStyleV2::smartgroupOperator( int id )
{
if( mCurrentDB == NULL )
if ( mCurrentDB == NULL )
{
QgsDebugMsg( "Cannot open database for listing groups" );
return QString();
Expand Down Expand Up @@ -1242,7 +1242,7 @@ bool QgsStyleV2::exportXML( QString filename )
root.appendChild( symbolsElem );
root.appendChild( rampsElem );

// save
// save
QFile f( filename );
if ( !f.open( QFile::WriteOnly ) )
{
Expand All @@ -1266,11 +1266,11 @@ bool QgsStyleV2::importXML( QString filename )
if ( !f.open( QFile::ReadOnly ) )
{
mErrorString = "Unable to open the specified file";
QgsDebugMsg( "Error opening the style XML file.");
QgsDebugMsg( "Error opening the style XML file." );
return false;
}

if( !doc.setContent( &f ) )
if ( !doc.setContent( &f ) )
{
mErrorString = QString( "Unable to understand the style file: %1" ).arg( filename );
QgsDebugMsg( "XML Parsing error" );
Expand Down
2 changes: 1 addition & 1 deletion src/gui/symbology-ng/qgslayerpropertieswidget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ static void _initWidgetFunctions()


QgsLayerPropertiesWidget::QgsLayerPropertiesWidget( QgsSymbolLayerV2* layer, const QgsSymbolV2* symbol, const QgsVectorLayer* vl, QWidget* parent )
: QWidget( parent )
: QWidget( parent )
{

mLayer = layer;
Expand Down
8 changes: 4 additions & 4 deletions src/gui/symbology-ng/qgssmartgroupeditordialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ void QgsSmartGroupCondition::hideRemoveButton( bool hide )
// Editor Dialog Functions //
// ------------------------ //
QgsSmartGroupEditorDialog::QgsSmartGroupEditorDialog( QgsStyleV2* style, QWidget* parent )
: QDialog( parent ), mStyle( style )
: QDialog( parent ), mStyle( style )
{
setupUi( this );

Expand Down Expand Up @@ -128,7 +128,7 @@ void QgsSmartGroupEditorDialog::removeCondition( int id )
// hide the remove button of the last condition when 2nd last is removed
if ( mConditionMap.count() == 2 )
{
foreach( QgsSmartGroupCondition* condition, mConditionMap.values() )
foreach ( QgsSmartGroupCondition* condition, mConditionMap.values() )
{
condition->hideRemoveButton( true );
}
Expand All @@ -142,7 +142,7 @@ QgsSmartConditionMap QgsSmartGroupEditorDialog::conditionMap()
{
QgsSmartConditionMap conditions;

foreach( QgsSmartGroupCondition* condition, mConditionMap.values() )
foreach ( QgsSmartGroupCondition* condition, mConditionMap.values() )
{
conditions.insert( condition->constraint(), condition->parameter() );
}
Expand All @@ -161,7 +161,7 @@ void QgsSmartGroupEditorDialog::setConditionMap( QgsSmartConditionMap map )
constraints << "tag" << "group" << "name" << "!tag" << "!group" << "!name" ;

// clear any defaults
foreach( int id, mConditionMap.keys() )
foreach ( int id, mConditionMap.keys() )
{
QgsSmartGroupCondition *cond = mConditionMap.take( id );
delete cond;
Expand Down
2 changes: 1 addition & 1 deletion src/gui/symbology-ng/qgssmartgroupeditordialog.h
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ class GUI_EXPORT QgsSmartGroupEditorDialog : public QDialog, private Ui::QgsSmar
// counter for the number of conditions
int mCondCount;
// map tracking the condition widget and the ids
QMap<int,QgsSmartGroupCondition*> mConditionMap;
QMap<int, QgsSmartGroupCondition*> mConditionMap;
};

#endif // QGSSMARTGROUPEDITORDIALOG_H
Expand Down
22 changes: 11 additions & 11 deletions src/gui/symbology-ng/qgsstylev2exportimportdialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -222,22 +222,22 @@ void QgsStyleV2ExportImportDialog::moveStyles( QModelIndexList* selection, QgsSt
while ( nameInvalid )
{
bool ok;
name = QInputDialog::getText( this, tr( "Group Name"),
tr( "Please enter a name for new group:" ),
QLineEdit::Normal,
tr( "imported" ),
&ok );
name = QInputDialog::getText( this, tr( "Group Name" ),
tr( "Please enter a name for new group:" ),
QLineEdit::Normal,
tr( "imported" ),
&ok );
if ( !ok )
{
QMessageBox::warning( this, tr( "New Group"),
QMessageBox::warning( this, tr( "New Group" ),
tr( "New group cannot be without a name. Kindly enter a name." ) );
continue;
}
// validate name
if ( name.isEmpty() )
{
QMessageBox::warning( this, tr( "New group" ),
tr( "Cannot create a group without name. Enter a name." ) );
tr( "Cannot create a group without name. Enter a name." ) );
}
else
{
Expand Down Expand Up @@ -410,7 +410,7 @@ void QgsStyleV2ExportImportDialog::browse()
if ( type == "file" )
{
mFileName = QFileDialog::getOpenFileName( this, tr( "Load styles" ), ".",
tr( "XML files (*.xml *XML)" ) );
tr( "XML files (*.xml *XML)" ) );
if ( mFileName.isEmpty() )
{
return;
Expand All @@ -434,8 +434,8 @@ void QgsStyleV2ExportImportDialog::browse()

void QgsStyleV2ExportImportDialog::downloadStyleXML( QUrl url )
{
// XXX Try to move this code to some core Network interface,
// HTTP downloading is a generic functionality that might be used elsewhere
// XXX Try to move this code to some core Network interface,
// HTTP downloading is a generic functionality that might be used elsewhere

mTempFile = new QTemporaryFile();
if ( mTempFile->open() )
Expand Down Expand Up @@ -477,7 +477,7 @@ void QgsStyleV2ExportImportDialog::httpFinished()
mFileName = "";
mProgressDlg->hide();
QMessageBox::information( this, tr( "HTTP Error!" ),
tr( "Download failed: %1." ).arg( mNetReply->errorString() ) );
tr( "Download failed: %1." ).arg( mNetReply->errorString() ) );
return;
}
else
Expand Down
100 changes: 50 additions & 50 deletions src/gui/symbology-ng/qgsstylev2managerdialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ QgsStyleV2ManagerDialog::QgsStyleV2ManagerDialog( QgsStyleV2* style, QWidget* pa

connect( model, SIGNAL( itemChanged( QStandardItem* ) ), this, SLOT( itemChanged( QStandardItem* ) ) );
connect( listItems->selectionModel(), SIGNAL( currentChanged( const QModelIndex&, const QModelIndex& ) ),
this, SLOT( symbolSelected( const QModelIndex& ) ) );
this, SLOT( symbolSelected( const QModelIndex& ) ) );

populateTypes();

Expand All @@ -92,9 +92,9 @@ QgsStyleV2ManagerDialog::QgsStyleV2ManagerDialog( QgsStyleV2* style, QWidget* pa
groupTree->setHeaderHidden( true );
populateGroups();
connect( groupTree->selectionModel(), SIGNAL( currentChanged( const QModelIndex&, const QModelIndex& ) ),
this, SLOT( groupChanged( const QModelIndex& ) ) );
this, SLOT( groupChanged( const QModelIndex& ) ) );
connect( groupModel, SIGNAL( itemChanged( QStandardItem* ) ),
this, SLOT( groupRenamed( QStandardItem* ) ) );
this, SLOT( groupRenamed( QStandardItem* ) ) );

QMenu *groupMenu = new QMenu( "Group Actions", this );
QAction *groupSymbols = groupMenu->addAction( "Group Symbols" );
Expand All @@ -116,12 +116,12 @@ QgsStyleV2ManagerDialog::QgsStyleV2ManagerDialog( QgsStyleV2* style, QWidget* pa
// Context menu for groupTree
groupTree->setContextMenuPolicy( Qt::CustomContextMenu );
connect( groupTree, SIGNAL( customContextMenuRequested( const QPoint& ) ),
this, SLOT( grouptreeContextMenu( const QPoint& ) ) );
this, SLOT( grouptreeContextMenu( const QPoint& ) ) );

// Context menu for listItems
listItems->setContextMenuPolicy( Qt::CustomContextMenu );
connect( listItems, SIGNAL( customContextMenuRequested( const QPoint& ) ),
this, SLOT( listitemsContextMenu( const QPoint& ) ) );
this, SLOT( listitemsContextMenu( const QPoint& ) ) );

}

Expand Down Expand Up @@ -311,7 +311,7 @@ bool QgsStyleV2ManagerDialog::addSymbol()
while ( nameInvalid )
{
bool ok;
name = QInputDialog::getText( this, tr( "Symbol Name"),
name = QInputDialog::getText( this, tr( "Symbol Name" ),
tr( "Please enter a name for new symbol:" ),
QLineEdit::Normal,
tr( "new symbol" ),
Expand All @@ -330,9 +330,9 @@ bool QgsStyleV2ManagerDialog::addSymbol()
else if ( mStyle->symbolNames().contains( name ) )
{
int res = QMessageBox::warning( this, tr( "Save symbol" ),
tr( "Symbol with name '%1' already exists. Overwrite?" )
.arg( name ),
QMessageBox::Yes | QMessageBox::No );
tr( "Symbol with name '%1' already exists. Overwrite?" )
.arg( name ),
QMessageBox::Yes | QMessageBox::No );
if ( res == QMessageBox::Yes )
{
nameInvalid = false;
Expand Down Expand Up @@ -699,7 +699,7 @@ void QgsStyleV2ManagerDialog::buildGroupTree( QStandardItem* &parent )
}
}

void QgsStyleV2ManagerDialog::groupChanged( const QModelIndex& index )
void QgsStyleV2ManagerDialog::groupChanged( const QModelIndex& index )
{
QStringList symbolNames;
QStringList groupSymbols;
Expand All @@ -721,7 +721,7 @@ void QgsStyleV2ManagerDialog::groupChanged( const QModelIndex& index )
}
symbolNames = currentItemType() < 3 ? mStyle->symbolNames() : mStyle->colorRampNames();
}
else
else
{
//determine groups and tags
if ( index.parent().data( Qt::UserRole + 1 ) == "smartgroups" )
Expand All @@ -734,7 +734,7 @@ void QgsStyleV2ManagerDialog::groupChanged( const QModelIndex& index )
}
else // then it must be a group
{
if ( ( !index.data( Qt::UserRole + 1 ).toInt() && ( index.data() == "Ungrouped" ) ) || mGrouppingMode )
if (( !index.data( Qt::UserRole + 1 ).toInt() && ( index.data() == "Ungrouped" ) ) || mGrouppingMode )
enableGroupInputs( false );
else
enableGroupInputs( true );
Expand All @@ -756,7 +756,7 @@ void QgsStyleV2ManagerDialog::groupChanged( const QModelIndex& index )
{
populateColorRamps( symbolNames, mGrouppingMode );
}
if( mGrouppingMode )
if ( mGrouppingMode )
setSymbolsChecked( groupSymbols );
}

Expand All @@ -770,8 +770,8 @@ void QgsStyleV2ManagerDialog::addGroup()
if ( parentData == "all" || ( parentIndex.data() == "Ungrouped" && parentData == "0" ) )
{
int err = QMessageBox::critical( this, tr( "Invalid Selection" ),
tr( "The parent group you have selected is not user editable.\n"
"Kindly select a user defined Group."));
tr( "The parent group you have selected is not user editable.\n"
"Kindly select a user defined Group." ) );
if ( err )
return;
}
Expand All @@ -780,8 +780,8 @@ void QgsStyleV2ManagerDialog::addGroup()
if ( parentIndex.parent().data( Qt::UserRole + 1 ).toString() == "smartgroups" )
{
int err = QMessageBox::critical( this, tr( "Operation Not Allowed" ),
tr( "Creation of nested Smart Groups are not allowed\n"
"Select the 'Smart Group' to create a new group." ) );
tr( "Creation of nested Smart Groups are not allowed\n"
"Select the 'Smart Group' to create a new group." ) );
if ( err )
return;
}
Expand Down Expand Up @@ -832,8 +832,8 @@ void QgsStyleV2ManagerDialog::removeGroup()
if ( data == "all" || data == "groups" || data == "smartgroups" || index.data() == "Ungrouped" )
{
int err = QMessageBox::critical( this, tr( "Invalid slection" ),
tr( "Cannot delete system defined categories.\n"
"Kindly select a group or smart group you might want to delete."));
tr( "Cannot delete system defined categories.\n"
"Kindly select a group or smart group you might want to delete." ) );
if ( err )
return;
}
Expand All @@ -850,7 +850,7 @@ void QgsStyleV2ManagerDialog::removeGroup()
if ( item->hasChildren() )
{
QStandardItem *parent = item->parent();
for( int i = 0; i < item->rowCount(); i++ )
for ( int i = 0; i < item->rowCount(); i++ )
{
parent->appendRow( item->takeChild( i ) );
}
Expand Down Expand Up @@ -878,8 +878,8 @@ void QgsStyleV2ManagerDialog::groupRenamed( QStandardItem * item )
if ( !id )
{
QMessageBox::critical( this, tr( "Error!" ),
tr( "New group could not be created.\n"
"There was a problem with your symbol database." ) );
tr( "New group could not be created.\n"
"There was a problem with your symbol database." ) );
item->parent()->removeRow( item->row() );
return;
}
Expand Down Expand Up @@ -915,18 +915,18 @@ void QgsStyleV2ManagerDialog::groupSymbolsAction()
mGrouppingMode = false;
senderAction->setText( "Group Symbols" );
// disconnect slot which handles regrouping
disconnect( model, SIGNAL( itemChanged( QStandardItem* )),
this, SLOT( regrouped( QStandardItem* ) ) );
disconnect( model, SIGNAL( itemChanged( QStandardItem* ) ),
this, SLOT( regrouped( QStandardItem* ) ) );

// disabel all items except groups in groupTree
enableItemsForGroupingMode( true );
groupChanged( groupTree->currentIndex() );

// Finally: Reconnect all Symbol editing functionalities
// Finally: Reconnect all Symbol editing functionalities
connect( treeModel, SIGNAL( itemChanged( QStandardItem* ) ),
this, SLOT( groupRenamed( QStandardItem* ) ) );
this, SLOT( groupRenamed( QStandardItem* ) ) );
connect( model, SIGNAL( itemChanged( QStandardItem* ) ),
this, SLOT( itemChanged( QStandardItem* ) ) );
this, SLOT( itemChanged( QStandardItem* ) ) );
// Reset the selection mode
listItems->setSelectionMode( QAbstractItemView::ExtendedSelection );
}
Expand All @@ -935,7 +935,7 @@ void QgsStyleV2ManagerDialog::groupSymbolsAction()
bool validGroup = false;
// determine whether it is a valid group
QModelIndex present = groupTree->currentIndex();
while( present.parent().isValid() )
while ( present.parent().isValid() )
{
if ( present.parent().data() == "Groups" )
{
Expand All @@ -953,9 +953,9 @@ void QgsStyleV2ManagerDialog::groupSymbolsAction()
senderAction->setText( "Finish Grouping" );
// Remove all Symbol editing functionalities
disconnect( treeModel, SIGNAL( itemChanged( QStandardItem* ) ),
this, SLOT( groupRenamed( QStandardItem* ) ) );
this, SLOT( groupRenamed( QStandardItem* ) ) );
disconnect( model, SIGNAL( itemChanged( QStandardItem* ) ),
this, SLOT( itemChanged( QStandardItem* ) ) );
this, SLOT( itemChanged( QStandardItem* ) ) );

// disabel all items except groups in groupTree
enableItemsForGroupingMode( false );
Expand All @@ -964,8 +964,8 @@ void QgsStyleV2ManagerDialog::groupSymbolsAction()


// Connect to slot which handles regrouping
connect( model, SIGNAL( itemChanged( QStandardItem* )),
this, SLOT( regrouped( QStandardItem* ) ) );
connect( model, SIGNAL( itemChanged( QStandardItem* ) ),
this, SLOT( regrouped( QStandardItem* ) ) );

// No selection should be possible
listItems->setSelectionMode( QAbstractItemView::NoSelection );
Expand All @@ -989,8 +989,8 @@ void QgsStyleV2ManagerDialog::regrouped( QStandardItem *item )
regrouped = mStyle->group( type, symbolName, 0 );
if ( !regrouped )
{
int er = QMessageBox::critical( this, tr( "Database Error"),
tr( "There was a problem with the Symbols database while regrouping." ) );
int er = QMessageBox::critical( this, tr( "Database Error" ),
tr( "There was a problem with the Symbols database while regrouping." ) );
// call the slot again to get back to normal
if ( er )
groupSymbolsAction();
Expand All @@ -1000,10 +1000,10 @@ void QgsStyleV2ManagerDialog::regrouped( QStandardItem *item )
void QgsStyleV2ManagerDialog::setSymbolsChecked( QStringList symbols )
{
QStandardItemModel *model = qobject_cast<QStandardItemModel*>( listItems->model() );
foreach( const QString symbol, symbols )
foreach ( const QString symbol, symbols )
{
QList<QStandardItem*> items = model->findItems( symbol );
foreach( QStandardItem* item, items )
foreach ( QStandardItem* item, items )
item->setCheckState( Qt::Checked );
}
}
Expand Down Expand Up @@ -1038,27 +1038,27 @@ void QgsStyleV2ManagerDialog::tagsChanged()
return;
}
// compare old with new to find removed tags
foreach( const QString &tag, oldtags )
foreach ( const QString &tag, oldtags )
{
if ( !newtags.contains( tag ) )
removetags.append( tag );
}
if ( removetags.size() > 0 )
{
foreach( QModelIndex index, indexes )
foreach ( QModelIndex index, indexes )
{
mStyle->detagSymbol( type, index.data().toString(), removetags );
}
}
// compare new with old to find added tags
foreach( const QString &tag, newtags )
foreach ( const QString &tag, newtags )
{
if( !oldtags.contains( tag ) )
if ( !oldtags.contains( tag ) )
addtags.append( tag );
}
if ( addtags.size() > 0 )
{
foreach( QModelIndex index, indexes )
foreach ( QModelIndex index, indexes )
{
mStyle->tagSymbol( type, index.data().toString(), addtags );
}
Expand Down Expand Up @@ -1095,7 +1095,7 @@ void QgsStyleV2ManagerDialog::enableGroupInputs( bool enable )
void QgsStyleV2ManagerDialog::enableItemsForGroupingMode( bool enable )
{
QStandardItemModel *treeModel = qobject_cast<QStandardItemModel*>( groupTree->model() );
for( int i = 0; i < treeModel->rowCount(); i++ )
for ( int i = 0; i < treeModel->rowCount(); i++ )
{
if ( treeModel->item( i )->data() != "groups" )
{
Expand All @@ -1110,9 +1110,9 @@ void QgsStyleV2ManagerDialog::enableItemsForGroupingMode( bool enable )
treeModel->item( i )->child( k )->setEnabled( enable );
}
}
if( treeModel->item( i )->data() == "smartgroups" )
if ( treeModel->item( i )->data() == "smartgroups" )
{
for( int j = 0; j < treeModel->item( i )->rowCount(); j++ )
for ( int j = 0; j < treeModel->item( i )->rowCount(); j++ )
{
treeModel->item( i )->child( j )->setEnabled( enable );
}
Expand Down Expand Up @@ -1177,7 +1177,7 @@ void QgsStyleV2ManagerDialog::listitemsContextMenu( const QPoint& point )
groupList->setTitle( "Apply Group" );

QStringList groups = mStyle->groupNames();
foreach( QString group, groups )
foreach ( QString group, groups )
{
groupList->addAction( group );
}
Expand All @@ -1200,7 +1200,7 @@ void QgsStyleV2ManagerDialog::listitemsContextMenu( const QPoint& point )
groupId = mStyle->groupId( selectedItem->text() );
}
QModelIndexList indexes = listItems->selectionModel()->selection().indexes();
foreach( QModelIndex index, indexes )
foreach ( QModelIndex index, indexes )
{
mStyle->group( type, index.data().toString(), groupId );
}
Expand All @@ -1219,7 +1219,7 @@ void QgsStyleV2ManagerDialog::editSmartgroupAction()
if ( present.parent().data( Qt::UserRole + 1 ) != "smartgroups" )
{
QMessageBox::critical( this, tr( "Invalid Selection" ),
tr( "You have not selected a Smart Group. Kindly select a Smart Group to edit." ) );
tr( "You have not selected a Smart Group. Kindly select a Smart Group to edit." ) );
return;
}
QStandardItem* item = treeModel->itemFromIndex( present );
Expand All @@ -1237,8 +1237,8 @@ void QgsStyleV2ManagerDialog::editSmartgroupAction()
int id = mStyle->addSmartgroup( dlg.smartgroupName(), dlg.conditionOperator(), dlg.conditionMap() );
if ( !id )
{
QMessageBox::critical( this, tr( "Database Error!"),
tr( "There was some error in editing the smart group." ) );
QMessageBox::critical( this, tr( "Database Error!" ),
tr( "There was some error in editing the smart group." ) );
return;
}
item->setText( dlg.smartgroupName() );
Expand All @@ -1250,7 +1250,7 @@ void QgsStyleV2ManagerDialog::editSmartgroupAction()
bool QgsStyleV2ManagerDialog::eventFilter( QObject *obj, QEvent *event )
{

if ( ( obj == tagsLineEdit ) && ( event->type() == QEvent::FocusOut ) )
if (( obj == tagsLineEdit ) && ( event->type() == QEvent::FocusOut ) )
{
tagsChanged();
return true;
Expand Down
2 changes: 1 addition & 1 deletion src/gui/symbology-ng/qgsstylev2managerdialog.h
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ class GUI_EXPORT QgsStyleV2ManagerDialog : public QDialog, private Ui::QgsStyleV
//! edit the selected smart group
void editSmartgroupAction();

//! symbol changed from one group
//! symbol changed from one group
void regrouped( QStandardItem* );

//! filter the symbols based on input search term
Expand Down
2 changes: 1 addition & 1 deletion src/gui/symbology-ng/qgssymbollayerv2widget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -614,7 +614,7 @@ class QgsSvgGroupsModel : public QStandardItemModel
void createTree( QStandardItem* &parentGroup )
{
QDir parentDir( parentGroup->data().toString() );
foreach( QString item, parentDir.entryList( QDir::Dirs | QDir::NoDotAndDotDot ) )
foreach ( QString item, parentDir.entryList( QDir::Dirs | QDir::NoDotAndDotDot ) )
{
QStandardItem* group = new QStandardItem( item );
group->setData( QVariant( parentDir.path() + "/" + item ) );
Expand Down
14 changes: 7 additions & 7 deletions src/gui/symbology-ng/qgssymbolv2selectordialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ class SymbolLayerItem : public QStandardItem
return QgsSymbolLayerV2Registry::instance()->symbolLayerMetadata( mLayer->layerType() )->visibleName();
else
{
switch( mSymbol->type() )
switch ( mSymbol->type() )
{
case QgsSymbolV2::Marker : return "Symbol: Marker";
case QgsSymbolV2::Fill : return "Symbol: Fill";
Expand Down Expand Up @@ -230,7 +230,7 @@ void QgsSymbolV2SelectorDialog::loadSymbol( QgsSymbolV2* symbol, SymbolLayerItem
loadSymbol( symbol->symbolLayer( i )->subSymbol(), layerItem );
}
}
layersTree->setExpanded( symbolItem->index(), true);
layersTree->setExpanded( symbolItem->index(), true );
}


Expand All @@ -254,7 +254,7 @@ void QgsSymbolV2SelectorDialog::updateUi()
btnRemoveLayer->setEnabled( false );
btnLock->setEnabled( false );
btnAddLayer->setEnabled( true );
return;
return;
}

int rowCount = item->parent()->rowCount();
Expand Down Expand Up @@ -322,15 +322,15 @@ void QgsSymbolV2SelectorDialog::layerChanged()
if ( currentItem->isLayer() )
{
SymbolLayerItem *parent = static_cast<SymbolLayerItem*>( currentItem->parent() );
QWidget *layerProp = new QgsLayerPropertiesWidget( currentItem->layer(), parent->symbol(), mVectorLayer);
QWidget *layerProp = new QgsLayerPropertiesWidget( currentItem->layer(), parent->symbol(), mVectorLayer );
setWidget( layerProp );
connect( layerProp, SIGNAL( changed() ), this, SLOT( updateLayerPreview() ) );
// This connection when layer type is changed
connect( layerProp, SIGNAL( changeLayer( QgsSymbolLayerV2* ) ), this, SLOT( changeLayer( QgsSymbolLayerV2* ) ) );
}
else
{
// then it must be a symbol
// then it must be a symbol
// Now populate symbols of that type using the symbols list widget:
QWidget *symbolsList = new QgsSymbolsListWidget( currentItem->symbol(), mStyle, mAdvancedMenu );
setWidget( symbolsList );
Expand Down Expand Up @@ -398,7 +398,7 @@ void QgsSymbolV2SelectorDialog::addLayer()
SymbolLayerItem *item = static_cast<SymbolLayerItem*>( model->itemFromIndex( idx ) );
if ( item->isLayer() )
{
QMessageBox::critical( this, tr( "Invalid Selection!" ), tr( "Kindly select a symbol to add layer.") );
QMessageBox::critical( this, tr( "Invalid Selection!" ), tr( "Kindly select a symbol to add layer." ) );
return;
}

Expand Down Expand Up @@ -450,7 +450,7 @@ void QgsSymbolV2SelectorDialog::moveLayerUp()
void QgsSymbolV2SelectorDialog::moveLayerByOffset( int offset )
{
SymbolLayerItem *item = currentLayerItem();
if( item == NULL )
if ( item == NULL )
return;
int row = item->row();

Expand Down
26 changes: 13 additions & 13 deletions src/providers/wms/qgswmsprovider.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ void QgsWmsProvider::parseUri( QString uriString )
if ( uri.hasParam( "tileDimensions" ) )
{
mTiled = true;
foreach( QString param, uri.params( "tileDimensions" ) )
foreach ( QString param, uri.params( "tileDimensions" ) )
{
QStringList kv = param.split( "=" );
if ( kv.size() == 1 )
Expand Down Expand Up @@ -344,7 +344,7 @@ void QgsWmsProvider::addLayers( QStringList const &layers,
mActiveSubStyles += styles;

// Set the visibility of these new layers on by default
foreach( const QString &layer, layers )
foreach ( const QString &layer, layers )
{
mActiveSubLayerVisibility[ layer ] = true;
QgsDebugMsg( "set visibility of layer '" + layer + "' to true." );
Expand Down Expand Up @@ -465,7 +465,7 @@ void QgsWmsProvider::setImageCrs( QString const & crs )
mTileMatrixSet = &mTileMatrixSets[ mTileMatrixSetId ];
QList<double> keys = mTileMatrixSet->tileMatrices.keys();
qSort( keys );
foreach( double key, keys )
foreach ( double key, keys )
{
resolutions << key;
}
Expand Down Expand Up @@ -953,7 +953,7 @@ void QgsWmsProvider::tileReplyFinished()
#endif
#if defined(QGISDEBUG) && (QT_VERSION >= 0x40700)
QgsDebugMsgLevel( "raw headers:", 3 );
foreach( const QNetworkReply::RawHeaderPair &pair, reply->rawHeaderPairs() )
foreach ( const QNetworkReply::RawHeaderPair &pair, reply->rawHeaderPairs() )
{
QgsDebugMsgLevel( QString( " %1:%2" )
.arg( QString::fromUtf8( pair.first ) )
Expand All @@ -964,7 +964,7 @@ void QgsWmsProvider::tileReplyFinished()
QNetworkCacheMetaData cmd = QgsNetworkAccessManager::instance()->cache()->metaData( reply->request().url() );

QNetworkCacheMetaData::RawHeaderList hl;
foreach( const QNetworkCacheMetaData::RawHeader &h, cmd.rawHeaders() )
foreach ( const QNetworkCacheMetaData::RawHeader &h, cmd.rawHeaders() )
{
if ( h.first != "Cache-Control" )
hl.append( h );
Expand Down Expand Up @@ -2132,7 +2132,7 @@ void QgsWmsProvider::parseLayer( QDomElement const & e, QgsWmsLayerProperty& lay
{
// CRS can contain several definitions separated by whitespace
// though this was deprecated in WMS 1.1.1
foreach( QString srs, e1.text().split( QRegExp( "\\s+" ) ) )
foreach ( QString srs, e1.text().split( QRegExp( "\\s+" ) ) )
{
layerProperty.crs.push_back( srs );
}
Expand Down Expand Up @@ -2423,7 +2423,7 @@ void QgsWmsProvider::parseTileSetProfile( QDomElement const &e )
m.topLeft = QgsPoint( l.boundingBox.box.xMinimum(), l.boundingBox.box.yMaximum() );

int i = 0;
foreach( QString rS, resolutions )
foreach ( QString rS, resolutions )
{
double r = rS.toDouble();
m.identifier = QString::number( i );
Expand Down Expand Up @@ -2712,7 +2712,7 @@ void QgsWmsProvider::parseWMTSContents( QDomElement const &e )

bool isValid = false;
int matrixWidth = -1, matrixHeight = -1;
foreach( const QgsWmtsTileMatrix &m, tms.tileMatrices )
foreach ( const QgsWmtsTileMatrix &m, tms.tileMatrices )
{
isValid = m.identifier == id;
if ( isValid )
Expand Down Expand Up @@ -3145,7 +3145,7 @@ int QgsWmsProvider::capabilities() const

if ( canIdentify )
{
foreach( QString f, mCapabilities.capability.request.getFeatureInfo.format )
foreach ( QString f, mCapabilities.capability.request.getFeatureInfo.format )
{
if ( mSupportedGetFeatureFormats.contains( f ) )
{
Expand Down Expand Up @@ -3586,7 +3586,7 @@ QString QgsWmsProvider::metadata()
metadata += "<tr><td>";
metadata += "<table width=\"100%\">";

foreach( const QgsWmtsTileLayer &l, mTileLayersSupported )
foreach ( const QgsWmtsTileLayer &l, mTileLayersSupported )
{
metadata += "<tr><td colspan=\"2\">";
metadata += l.identifier;
Expand Down Expand Up @@ -3629,7 +3629,7 @@ QString QgsWmsProvider::metadata()
metadata += "</td>";
metadata += "<td class=\"glossy\">";
QStringList styles;
foreach( const QgsWmtsStyle &style, l.styles )
foreach ( const QgsWmtsStyle &style, l.styles )
{
styles << style.identifier;
}
Expand All @@ -3655,7 +3655,7 @@ QString QgsWmsProvider::metadata()
metadata += tr( "Available Tilesets" );
metadata += "</td><td class=\"glossy\">";

foreach( const QgsWmtsTileMatrixSetLink &setLink, l.setLinks )
foreach ( const QgsWmtsTileMatrixSetLink &setLink, l.setLinks )
{
metadata += setLink.tileMatrixSet + "<br>";
}
Expand Down Expand Up @@ -3838,7 +3838,7 @@ QString QgsWmsProvider::identifyAsHtml( const QgsPoint &point )
{
QString format;

foreach( QString f, mSupportedGetFeatureFormats )
foreach ( QString f, mSupportedGetFeatureFormats )
{
if ( mCapabilities.capability.request.getFeatureInfo.format.contains( f ) )
{
Expand Down