@@ -1092,39 +1092,47 @@ void CAudioMixerBoard::ChangeFaderOrder ( const EChSortType eChSortType )
10921092 iMyFader = static_cast <int > ( i );
10931093 }
10941094
1095- if ( eChSortType == ST_BY_NAME )
1095+ switch ( eChSortType )
10961096 {
1097+ case ST_BY_NAME:
10971098 PairList << QPair<QString, size_t > ( vecpChanFader[i]->GetReceivedName ().toLower (), i );
1098- }
1099- else if ( eChSortType == ST_BY_CITY )
1100- {
1101- PairList << QPair<QString, size_t > ( vecpChanFader[i]->GetReceivedCity ().toLower (), i );
1102- }
1103- else if ( eChSortType == ST_BY_INSTRUMENT )
1104- {
1099+ break ;
1100+ case ST_BY_CITY:
1101+ // sort first "by city" and second "by name" by adding the name after the city
1102+ PairList << QPair<QString, size_t > ( vecpChanFader[i]->GetReceivedCity ().toLower () + vecpChanFader[i]->GetReceivedName ().toLower (), i );
1103+ break ;
1104+ case ST_BY_INSTRUMENT:
11051105 // sort first "by instrument" and second "by name" by adding the name after the instrument
11061106 PairList << QPair<QString, size_t > ( CInstPictures::GetName ( vecpChanFader[i]->GetReceivedInstrument () ) +
11071107 vecpChanFader[i]->GetReceivedName ().toLower (),
11081108 i );
1109- }
1110- else if ( eChSortType == ST_BY_GROUPID )
1111- {
1109+ break ;
1110+ case ST_BY_GROUPID:
1111+ // sort first "by group" and second "by name" by adding the name after the group
11121112 if ( vecpChanFader[i]->GetGroupID () == INVALID_INDEX )
11131113 {
11141114 // put channels without a group at the end
1115- PairList << QPair<QString, size_t > ( " z" , i ); // group IDs are numbers, use letter to put it at the end
1115+ PairList << QPair<QString, size_t > ( " 999" + vecpChanFader[i]->GetReceivedName ().toLower (),
1116+ i ); // worst case is one group per channel (current max is 8)
11161117 }
11171118 else
11181119 {
1119- PairList << QPair<QString, size_t > ( QString::number ( vecpChanFader[i]->GetGroupID () ), i );
1120+ PairList << QPair<QString, size_t > ( QString ( " %1" ).arg ( vecpChanFader[i]->GetGroupID (), 3 , 10 , QLatin1Char ( ' 0' ) ) +
1121+ vecpChanFader[i]->GetReceivedName ().toLower (),
1122+ i );
11201123 }
1121- }
1122- else // ST_NO_SORT
1123- {
1124+ break ;
1125+ case ST_BY_SERVER_CHANNEL:
1126+ PairList << QPair<QString, size_t > ( QString ( " %1" ).arg ( vecpChanFader[i]->GetReceivedChID (), 3 , 10 , QLatin1Char ( ' 0' ) ) +
1127+ vecpChanFader[i]->GetReceivedName ().toLower (),
1128+ i );
1129+ break ;
1130+ default : // ST_NO_SORT
11241131 // per definition for no sort: faders are sorted in the order they appeared (note that we
11251132 // pad to a total of 11 characters with zeros to make sure the sorting is done correctly)
11261133 PairList << QPair<QString, size_t > ( QString ( " %1" ).arg ( vecpChanFader[i]->GetRunningNewClientCnt (), 11 , 10 , QLatin1Char ( ' 0' ) ),
11271134 i );
1135+ break ;
11281136 }
11291137
11301138 // count the number of visible faders
0 commit comments