Sort by instrument, new sortby function with parameter to set order

Sort by instrument added, using the same function for sorting by name or instrument
This commit is contained in:
Alberstein8 2020-06-13 14:07:09 +02:00
parent 3dbddc5568
commit 8de92ed5f7
2 changed files with 1 additions and 24 deletions

View file

@ -813,29 +813,6 @@ void CAudioMixerBoard::ChangeFaderOrder ( const bool bDoSort,
}
}
void CAudioMixerBoard::ChangeFaderOrderByInstrument ( const bool bDoSort )
{
// create a pair list of instruments ID and fader ID for each channel
QList<QPair<int, int> > PairList;
for ( int i = 0; i < MAX_NUM_CHANNELS; i++ )
{
PairList << QPair<int, int> ( vecpChanFader[i]->GetReceivedInstrument(), i );
}
// if requested, sort the channels
if ( bDoSort )
{
qStableSort ( PairList.begin(), PairList.end() );
}
// add channels to the layout in the new order
for ( int i = 0; i < MAX_NUM_CHANNELS; i++ )
{
pMainLayout->insertWidget ( 0, vecpChanFader[PairList[i].second]->GetMainWidget() );
}
}
void CAudioMixerBoard::ApplyNewConClientList ( CVector<CChannelInfo>& vecChanInfo )
{
// we want to set the server name only if the very first faders appear

View file

@ -153,7 +153,7 @@ public slots:
void OnOpenChatDialog() { ShowChatWindow(); }
void OnOpenAnalyzerConsole() { ShowAnalyzerConsole(); }
void OnSortChannelsByName() { MainMixerBoard->ChangeFaderOrder ( true, ST_BY_NAME ); }
void OnSortChannelsByInstrument() { MainMixerBoard->ChangeFaderOrder ( true, ST_BY_INSTRUMENT ); }
void OnSettingsStateChanged ( int value );
void OnChatStateChanged ( int value );