Skip to content

Commit

Permalink
Reduce private member accesses
Browse files Browse the repository at this point in the history
Reduce direct accesses to `m_simpleSerializingMode` by using
the method `isSimpleSerializing` and extending `setSimpleSerializing`
with a parameter.
  • Loading branch information
michaelgregorius committed Aug 11, 2024
1 parent b1134d1 commit 3f8bef6
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 7 deletions.
4 changes: 2 additions & 2 deletions include/Track.h
Original file line number Diff line number Diff line change
Expand Up @@ -115,9 +115,9 @@ class LMMS_EXPORT Track : public Model, public JournallingObject
void saveSettings( QDomDocument & doc, QDomElement & element ) override;
void loadSettings( const QDomElement & element ) override;

void setSimpleSerializing()
void setSimpleSerializing(bool simpleSerializing = true)
{
m_simpleSerializingMode = true;
m_simpleSerializingMode = simpleSerializing;
}

// -- for usage by Clip only ---------------
Expand Down
12 changes: 7 additions & 5 deletions src/core/Track.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,7 @@ Track* Track::clone()
*/
void Track::saveSettings( QDomDocument & doc, QDomElement & element )
{
if( !m_simpleSerializingMode )
if (!isSimpleSerializing())
{
element.setTagName( "track" );
}
Expand All @@ -217,9 +217,9 @@ void Track::saveSettings( QDomDocument & doc, QDomElement & element )
element.appendChild( tsDe );
saveTrackSpecificSettings( doc, tsDe );

if( m_simpleSerializingMode )
if (isSimpleSerializing())
{
m_simpleSerializingMode = false;
setSimpleSerializing(false);
return;
}

Expand Down Expand Up @@ -267,7 +267,7 @@ void Track::loadSettings( const QDomElement & element )
setColor(QColor{element.attribute("color")});
}

if( m_simpleSerializingMode )
if (isSimpleSerializing())
{
QDomNode node = element.firstChild();
while( !node.isNull() )
Expand All @@ -279,7 +279,9 @@ void Track::loadSettings( const QDomElement & element )
}
node = node.nextSibling();
}
m_simpleSerializingMode = false;

setSimpleSerializing(false);

return;
}

Expand Down

0 comments on commit 3f8bef6

Please sign in to comment.