Small refactor on FxMixerView.cpp and FxMixer.cpp

The code on FxMixerView.cpp and FxMixer.cpp were using the types TrackContainer::TrackList and QVector<Track *> unconsistently. TrackContainer::TrackList is just a typedef for QVector<Track *> so it makes sense that we use it, specially in terms of readability.

Places where QVector<Track *> were used are now replaced with TrackContainer::TrackList.

Also, we were not including "TrackContainer.h" directly (the typedef was likely being included indirectly through one of the other include files), so we also include this header on both source codes.
This commit is contained in:
IanCaio
2020-07-12 10:37:39 -03:00
parent d0ef87543d
commit 3795fdff64
2 changed files with 10 additions and 8 deletions

View File

@@ -34,6 +34,7 @@
#include "InstrumentTrack.h"
#include "SampleTrack.h"
#include "BBTrackContainer.h"
#include "TrackContainer.h" // For TrackContainer::TrackList typedef
FxRoute::FxRoute( FxChannel * from, FxChannel * to, float amount ) :
m_from( from ),
@@ -383,13 +384,13 @@ void FxMixer::moveChannelLeft( int index )
else if (m_lastSoloed == b) { m_lastSoloed = a; }
// go through every instrument and adjust for the channel index change
QVector<Track *> songTrackList = Engine::getSong()->tracks();
QVector<Track *> bbTrackList = Engine::getBBTrackContainer()->tracks();
TrackContainer::TrackList songTrackList = Engine::getSong()->tracks();
TrackContainer::TrackList bbTrackList = Engine::getBBTrackContainer()->tracks();
QVector<Track *> trackLists[] = {songTrackList, bbTrackList};
TrackContainer::TrackList trackLists[] = {songTrackList, bbTrackList};
for(int tl=0; tl<2; ++tl)
{
QVector<Track *> trackList = trackLists[tl];
TrackContainer::TrackList trackList = trackLists[tl];
for(int i=0; i<trackList.size(); ++i)
{
if( trackList[i]->type() == Track::InstrumentTrack )

View File

@@ -50,6 +50,7 @@
#include "SampleTrack.h"
#include "Song.h"
#include "BBTrackContainer.h"
#include "TrackContainer.h" // For TrackContainer::TrackList typedef
FxMixerView::FxMixerView() :
QWidget(),
@@ -237,13 +238,13 @@ void FxMixerView::refreshDisplay()
// update the and max. channel number for every instrument
void FxMixerView::updateMaxChannelSelector()
{
QVector<Track *> songTrackList = Engine::getSong()->tracks();
QVector<Track *> bbTrackList = Engine::getBBTrackContainer()->tracks();
TrackContainer::TrackList songTrackList = Engine::getSong()->tracks();
TrackContainer::TrackList bbTrackList = Engine::getBBTrackContainer()->tracks();
QVector<Track *> trackLists[] = {songTrackList, bbTrackList};
TrackContainer::TrackList trackLists[] = {songTrackList, bbTrackList};
for(int tl=0; tl<2; ++tl)
{
QVector<Track *> trackList = trackLists[tl];
TrackContainer::TrackList trackList = trackLists[tl];
for(int i=0; i<trackList.size(); ++i)
{
if( trackList[i]->type() == Track::InstrumentTrack )