Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
40 changes: 24 additions & 16 deletions src/audiomixerboard.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1092,39 +1092,47 @@ void CAudioMixerBoard::ChangeFaderOrder ( const EChSortType eChSortType )
iMyFader = static_cast<int> ( i );
}

if ( eChSortType == ST_BY_NAME )
switch ( eChSortType )
Comment thread
pljones marked this conversation as resolved.
{
case ST_BY_NAME:
PairList << QPair<QString, size_t> ( vecpChanFader[i]->GetReceivedName().toLower(), i );
}
else if ( eChSortType == ST_BY_CITY )
{
PairList << QPair<QString, size_t> ( 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<QString, size_t> ( 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<QString, size_t> ( 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<QString, size_t> ( "z", i ); // group IDs are numbers, use letter to put it at the end
PairList << QPair<QString, size_t> ( "999" + vecpChanFader[i]->GetReceivedName().toLower(),
Comment thread
ann0see marked this conversation as resolved.
i ); // worst case is one group per channel (current max is 8)
}
else
{
PairList << QPair<QString, size_t> ( QString::number ( vecpChanFader[i]->GetGroupID() ), i );
PairList << QPair<QString, size_t> ( 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, size_t> ( 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, size_t> ( QString ( "%1" ).arg ( vecpChanFader[i]->GetRunningNewClientCnt(), 11, 10, QLatin1Char ( '0' ) ),
i );
break;
}

// count the number of visible faders
Expand Down
1 change: 1 addition & 0 deletions src/audiomixerboard.h
Original file line number Diff line number Diff line change
Expand Up @@ -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(); }
Expand Down
16 changes: 13 additions & 3 deletions src/clientdlg.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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 );

Expand All @@ -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;
Expand All @@ -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 );

Expand Down
1 change: 1 addition & 0 deletions src/clientdlg.h
Original file line number Diff line number Diff line change
Expand Up @@ -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(); }
Expand Down
2 changes: 1 addition & 1 deletion src/settings.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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<EChSortType> ( iValue );
}
Expand Down
11 changes: 6 additions & 5 deletions src/util.h
Original file line number Diff line number Diff line change
Expand Up @@ -558,11 +558,12 @@ enum ERecorderState
enum EChSortType
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not part of this PR, but having this enum in utils looks unorganized.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah. I'll look to move it.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK it's in util.h because it's used in CSettings as well as the mixer board, I think -- all of the static_cast<ENUM> enums that CSettings does get shared with somewhere else and CSettings doesn't want to be fishing through lots of headers, so they get dumped into util.h.

(Ideally, CSettings wouldn't work like that: each component would have its own settings and read or write them to the XML that CSettings simply read from a file or wrote to a file... But that is definitely a different PR!)

{
// 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 --------------------------------------------------------------
Expand Down