Skip to content

Commit

Permalink
[Refactor] More foreach brackets
Browse files Browse the repository at this point in the history
  • Loading branch information
hexabits committed Mar 29, 2014
1 parent 7d53768 commit 662d37a
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 10 deletions.
3 changes: 2 additions & 1 deletion src/gl/glcontroller.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -126,10 +126,11 @@ void Controllable::update( const NifModel * nif, const QModelIndex & i )

void Controllable::transform()
{
if ( scene->animate )
if ( scene->animate ) {
foreach ( Controller * controller, controllers ) {
controller->update( scene->time );
}
}
}

void Controllable::timeBounds( float & tmin, float & tmax )
Expand Down
3 changes: 2 additions & 1 deletion src/gl/glnode.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -844,8 +844,9 @@ void Node::draw()
glVertex( b );
glEnd();

foreach ( Node * node, children.list() )
foreach ( Node * node, children.list() ) {
node->draw();
}
}

void Node::drawSelection() const
Expand Down
6 changes: 4 additions & 2 deletions src/glview.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -648,8 +648,9 @@ void GLView::paintGL()
{
QString stats = scene->textStats();
QStringList lines = stats.split( "\n" );
foreach ( QString line, lines )
foreach ( QString line, lines ) {
painter.drawText( 10, y++ * ls, line );
}
}
}

Expand Down Expand Up @@ -768,8 +769,9 @@ int indexAt( /*GLuint *buffer,*/ NifModel *model, Scene *scene, QList<DrawFunc>
glInitNames();
glPushName( 0 );
foreach ( DrawFunc df, drawFunc )
foreach ( DrawFunc df, drawFunc ) {
(scene->*df)();
}
GLint hits = glRenderMode( GL_RENDER );
if ( hits > 0 )
Expand Down
12 changes: 8 additions & 4 deletions src/spells/blocks.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -534,11 +534,12 @@ class spPasteBlock : public Spell
{
Q_UNUSED(index);
const QMimeData * mime = QApplication::clipboard()->mimeData();
if ( mime )
if ( mime ) {
foreach ( QString form, mime->formats() ) {
if ( ! acceptFormat( form, nif ).isEmpty() )
return true;
}
}

return false;
}
Expand Down Expand Up @@ -589,11 +590,12 @@ class spPasteOverBlock : public Spell
bool isApplicable( const NifModel * nif, const QModelIndex & index )
{
const QMimeData * mime = QApplication::clipboard()->mimeData();
if ( mime )
if ( mime ) {
foreach ( QString form, mime->formats() ) {
if ( ! acceptFormat( form, nif, index ).isEmpty() )
return true;
}
}

return false;
}
Expand Down Expand Up @@ -731,11 +733,12 @@ class spPasteBranch : public Spell
if ( index.isValid() && ! nif->isNiBlock( index ) && ! nif->isLink( index ) )
return false;
const QMimeData * mime = QApplication::clipboard()->mimeData();
if ( index.isValid() && mime )
if ( index.isValid() && mime ) {
foreach ( QString form, mime->formats() ) {
if ( nif->isVersionSupported( nif->version2number( acceptFormat( form, nif ) ) ) )
return true;
}
}

return false;
}
Expand Down Expand Up @@ -844,11 +847,12 @@ class spPasteBranch2 : public Spell
//if ( index.isValid() && ! nif->isNiBlock( index ) && ! nif->isLink( index ) )
// return false;
const QMimeData * mime = QApplication::clipboard()->mimeData();
if ( mime && ! index.isValid() )
if ( mime && ! index.isValid() ) {
foreach ( QString form, mime->formats() ) {
if ( nif->isVersionSupported( nif->version2number( acceptFormat( form, nif ) ) ) )
return true;
}
}

return false;
}
Expand Down
5 changes: 3 additions & 2 deletions src/spells/morphctrl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,12 +32,13 @@ class spMorphFrameSave : public Spell
QMenu menu;
QStringList frameList = listFrames( nif, index );

if ( nif->get<int>( iMeshData, "Num Vertices" ) != nif->get<int>( iMorphData, "Num Vertices" ) )
if ( nif->get<int>( iMeshData, "Num Vertices" ) != nif->get<int>( iMorphData, "Num Vertices" ) ) {
menu.addAction( frameList.first() );
else
} else {
foreach ( QString f, frameList ) {
menu.addAction( f );
}
}

QAction * act = menu.exec( QCursor::pos() );
if ( act )
Expand Down

0 comments on commit 662d37a

Please sign in to comment.