diff --git a/src/audiomixerboard.cpp b/src/audiomixerboard.cpp index 1ff376d794..db6cab14e4 100644 --- a/src/audiomixerboard.cpp +++ b/src/audiomixerboard.cpp @@ -1092,39 +1092,47 @@ void CAudioMixerBoard::ChangeFaderOrder ( const EChSortType eChSortType ) iMyFader = static_cast ( i ); } - if ( eChSortType == ST_BY_NAME ) + switch ( eChSortType ) { + case ST_BY_NAME: PairList << QPair ( vecpChanFader[i]->GetReceivedName().toLower(), i ); - } - else if ( eChSortType == ST_BY_CITY ) - { - PairList << QPair ( vecpChanFader[i]->GetReceivedCity().toLower(), i ); - } - else if ( eChSortType == ST_BY_INSTRUMENT ) - { + break; + case ST_BY_CITY: + // sort first "by city" and second "by name" by adding the name after the city + PairList << QPair ( vecpChanFader[i]->GetReceivedCity().toLower() + vecpChanFader[i]->GetReceivedName().toLower(), i ); + break; + case ST_BY_INSTRUMENT: // sort first "by instrument" and second "by name" by adding the name after the instrument PairList << QPair ( CInstPictures::GetName ( vecpChanFader[i]->GetReceivedInstrument() ) + vecpChanFader[i]->GetReceivedName().toLower(), i ); - } - else if ( eChSortType == ST_BY_GROUPID ) - { + break; + case ST_BY_GROUPID: + // sort first "by group" and second "by name" by adding the name after the group if ( vecpChanFader[i]->GetGroupID() == INVALID_INDEX ) { // put channels without a group at the end - PairList << QPair ( "z", i ); // group IDs are numbers, use letter to put it at the end + PairList << QPair ( "999" + vecpChanFader[i]->GetReceivedName().toLower(), + i ); // worst case is one group per channel (current max is 8) } else { - PairList << QPair ( QString::number ( vecpChanFader[i]->GetGroupID() ), i ); + PairList << QPair ( QString ( "%1" ).arg ( vecpChanFader[i]->GetGroupID(), 3, 10, QLatin1Char ( '0' ) ) + + vecpChanFader[i]->GetReceivedName().toLower(), + i ); } - } - else // ST_NO_SORT - { + break; + case ST_BY_SERVER_CHANNEL: + PairList << QPair ( QString ( "%1" ).arg ( vecpChanFader[i]->GetReceivedChID(), 3, 10, QLatin1Char ( '0' ) ) + + vecpChanFader[i]->GetReceivedName().toLower(), + i ); + break; + default: // ST_NO_SORT // per definition for no sort: faders are sorted in the order they appeared (note that we // pad to a total of 11 characters with zeros to make sure the sorting is done correctly) PairList << QPair ( QString ( "%1" ).arg ( vecpChanFader[i]->GetRunningNewClientCnt(), 11, 10, QLatin1Char ( '0' ) ), i ); + break; } // count the number of visible faders diff --git a/src/audiomixerboard.h b/src/audiomixerboard.h index ea4fbf59df..6b42d35085 100644 --- a/src/audiomixerboard.h +++ b/src/audiomixerboard.h @@ -55,6 +55,7 @@ class CChannelFader : public QObject QString GetReceivedName() { return cReceivedChanInfo.strName; } int GetReceivedInstrument() { return cReceivedChanInfo.iInstrument; } QString GetReceivedCity() { return cReceivedChanInfo.strCity; } + int GetReceivedChID() { return cReceivedChanInfo.iChanID; } void SetChannelInfos ( const CChannelInfo& cChanInfo ); void Show() { pFrame->show(); } void Hide() { pFrame->hide(); } diff --git a/src/clientdlg.cpp b/src/clientdlg.cpp index 99b9fa6433..cb6b134bf7 100644 --- a/src/clientdlg.cpp +++ b/src/clientdlg.cpp @@ -333,6 +333,11 @@ CClientDlg::CClientDlg ( CClient* pNCliP, QAction* ByCityAction = pViewMenu->addAction ( tr ( "Sort Users by &City" ), this, SLOT ( OnSortChannelsByCity() ), QKeySequence ( Qt::CTRL + Qt::Key_T ) ); + QAction* ByServerChannelAction = pViewMenu->addAction ( tr ( "Sort Users by Se&rver Channel" ), + this, + SLOT ( OnSortChannelsByChannel() ), + QKeySequence ( Qt::CTRL + Qt::Key_R ) ); + OwnFaderFirstAction->setCheckable ( true ); OwnFaderFirstAction->setChecked ( pSettings->bOwnFaderFirst ); @@ -349,13 +354,12 @@ CClientDlg::CClientDlg ( CClient* pNCliP, SortActionGroup->addAction ( ByGroupAction ); ByCityAction->setCheckable ( true ); SortActionGroup->addAction ( ByCityAction ); + ByServerChannelAction->setCheckable ( true ); + SortActionGroup->addAction ( ByServerChannelAction ); // initialize sort type setting (i.e., recover stored setting) switch ( pSettings->eChannelSortType ) { - case ST_NO_SORT: - NoSortAction->setChecked ( true ); - break; case ST_BY_NAME: ByNameAction->setChecked ( true ); break; @@ -368,6 +372,12 @@ CClientDlg::CClientDlg ( CClient* pNCliP, case ST_BY_CITY: ByCityAction->setChecked ( true ); break; + case ST_BY_SERVER_CHANNEL: + ByServerChannelAction->setChecked ( true ); + break; + default: // ST_NO_SORT + NoSortAction->setChecked ( true ); + break; } MainMixerBoard->SetFaderSorting ( pSettings->eChannelSortType ); diff --git a/src/clientdlg.h b/src/clientdlg.h index 9737bcd2ca..2a9062a58d 100644 --- a/src/clientdlg.h +++ b/src/clientdlg.h @@ -171,6 +171,7 @@ public slots: void OnSortChannelsByInstrument() { MainMixerBoard->SetFaderSorting ( ST_BY_INSTRUMENT ); } void OnSortChannelsByGroupID() { MainMixerBoard->SetFaderSorting ( ST_BY_GROUPID ); } void OnSortChannelsByCity() { MainMixerBoard->SetFaderSorting ( ST_BY_CITY ); } + void OnSortChannelsByChannel() { MainMixerBoard->SetFaderSorting ( ST_BY_SERVER_CHANNEL ); } void OnClearAllStoredSoloMuteSettings(); void OnSetAllFadersToNewClientLevel() { MainMixerBoard->SetAllFaderLevelsToNewClientLevel(); } void OnAutoAdjustAllFaderLevels() { MainMixerBoard->AutoAdjustAllFaderLevels(); } diff --git a/src/settings.cpp b/src/settings.cpp index ab54422a19..20a89b2ad4 100644 --- a/src/settings.cpp +++ b/src/settings.cpp @@ -266,7 +266,7 @@ void CClientSettings::ReadSettingsFromXML ( const QDomDocument& IniXMLDocument, GetIniSetting ( IniXMLDocument, "client", "language", CLocale::FindSysLangTransFileName ( CLocale::GetAvailableTranslations() ).first ); // fader channel sorting - if ( GetNumericIniSet ( IniXMLDocument, "client", "channelsort", 0, 4 /* ST_BY_CITY */, iValue ) ) + if ( GetNumericIniSet ( IniXMLDocument, "client", "channelsort", 0, 5 /* ST_BY_SERVER_CHANNEL */, iValue ) ) { eChannelSortType = static_cast ( iValue ); } diff --git a/src/util.h b/src/util.h index 5e863b930a..8628d5596f 100644 --- a/src/util.h +++ b/src/util.h @@ -558,11 +558,12 @@ enum ERecorderState enum EChSortType { // used for settings -> enum values should be fixed - ST_NO_SORT = 0, - ST_BY_NAME = 1, - ST_BY_INSTRUMENT = 2, - ST_BY_GROUPID = 3, - ST_BY_CITY = 4 + ST_NO_SORT = 0, + ST_BY_NAME = 1, + ST_BY_INSTRUMENT = 2, + ST_BY_GROUPID = 3, + ST_BY_CITY = 4, + ST_BY_SERVER_CHANNEL = 5 }; // Directory type --------------------------------------------------------------