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
22 changes: 20 additions & 2 deletions src/audiomixerboard.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,8 @@
\******************************************************************************/
CChannelFader::CChannelFader ( QWidget* pNW ) :
eDesign ( GD_STANDARD ),
BitmapMutedIcon ( QString::fromUtf8 ( ":/png/fader/res/mutediconorange.png" ) )
BitmapMutedIcon ( QString::fromUtf8 ( ":/png/fader/res/mutediconorange.png" ) ),
bMIDICtrlUsed ( false )
{
// create new GUI control objects and store pointers to them (note that
// QWidget takes the ownership of the pMainGrid so that this only has
Expand Down Expand Up @@ -676,7 +677,14 @@ void CChannelFader::SetChannelInfos ( const CChannelInfo& cChanInfo )

// Label text --------------------------------------------------------------

QString strModText = cChanInfo.strName;
QString strModText = cChanInfo.strName;

// show channel numbers if --ctrlmidich is used (#241, #95)
if ( bMIDICtrlUsed )
{
strModText.prepend ( QString().setNum ( cChanInfo.iChanID ) + ":" );
}

QTextBoundaryFinder tbfName ( QTextBoundaryFinder::Grapheme, cChanInfo.strName );
int iBreakPos;

Expand Down Expand Up @@ -1535,6 +1543,16 @@ void CAudioMixerBoard::AutoAdjustAllFaderLevels()
}
}

void CAudioMixerBoard::SetMIDICtrlUsed ( const bool bMIDICtrlUsed )
{
QMutexLocker locker ( &Mutex );

for ( int i = 0; i < MAX_NUM_CHANNELS; i++ )
{
vecpChanFader[i]->SetMIDICtrlUsed ( bMIDICtrlUsed );
}
}

void CAudioMixerBoard::StoreAllFaderSettings()
{
QMutexLocker locker ( &Mutex );
Expand Down
5 changes: 5 additions & 0 deletions src/audiomixerboard.h
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,8 @@ class CChannelFader : public QObject
bool GetIsMyOwnFader() { return bIsMyOwnFader; }
void UpdateSoloState ( const bool bNewOtherSoloState );

void SetMIDICtrlUsed ( const bool isMIDICtrlUsed ) { bMIDICtrlUsed = isMIDICtrlUsed; }

protected:
void UpdateGroupIDDependencies();
void SetMute ( const bool bState );
Expand Down Expand Up @@ -129,6 +131,7 @@ class CChannelFader : public QObject
EGUIDesign eDesign;
EMeterStyle eMeterStyle;
QPixmap BitmapMutedIcon;
bool bMIDICtrlUsed;

public slots:
void OnLevelValueChanged ( int value )
Expand Down Expand Up @@ -225,6 +228,8 @@ class CAudioMixerBoard : public QGroupBox, public CAudioMixerBoardSlots<MAX_NUM_

void MuteMyChannel();

void SetMIDICtrlUsed ( const bool bMIDICtrlUsed );

protected:
class CMixerBoardScrollArea : public QScrollArea
{
Expand Down
13 changes: 3 additions & 10 deletions src/clientdlg.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@ CClientDlg::CClientDlg ( CClient* pNCliP,
pClient ( pNCliP ),
pSettings ( pNSetP ),
bConnectDlgWasShown ( false ),
bMIDICtrlUsed ( !strMIDISetup.isEmpty() ),
bDetectFeedback ( false ),
bEnableIPv6 ( bNEnableIPv6 ),
eLastRecorderState ( RS_UNDEFINED ), // for SetMixerBoardDeco
Expand Down Expand Up @@ -219,6 +218,9 @@ CClientDlg::CClientDlg ( CClient* pNCliP,
MainMixerBoard->SetSettingsPointer ( pSettings );
MainMixerBoard->SetNumMixerPanelRows ( pSettings->iNumMixerPanelRows );

// Pass through flag for MIDICtrlUsed
MainMixerBoard->SetMIDICtrlUsed ( !strMIDISetup.isEmpty() );

// reset mixer board
MainMixerBoard->HideAll();

Expand Down Expand Up @@ -870,15 +872,6 @@ void CClientDlg::OnLicenceRequired ( ELicenceType eLicenceType )

void CClientDlg::OnConClientListMesReceived ( CVector<CChannelInfo> vecChanInfo )
{
// show channel numbers if --ctrlmidich is used (#241, #95)
if ( bMIDICtrlUsed )
{
for ( int i = 0; i < vecChanInfo.Size(); i++ )
{
vecChanInfo[i].strName.prepend ( QString().setNum ( vecChanInfo[i].iChanID ) + ":" );
}
}

// update mixer board with the additional client infos
MainMixerBoard->ApplyNewConClientList ( vecChanInfo );
}
Expand Down
1 change: 0 additions & 1 deletion src/clientdlg.h
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,6 @@ class CClientDlg : public CBaseDlg, private Ui_CClientDlgBase
int iClients;
bool bConnected;
bool bConnectDlgWasShown;
bool bMIDICtrlUsed;
bool bDetectFeedback;
bool bEnableIPv6;
ERecorderState eLastRecorderState;
Expand Down
14 changes: 14 additions & 0 deletions src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -572,6 +572,20 @@ int main ( int argc, char** argv )
continue;
}

// Clean up legacy fader settings --------------------------------------
// Undocumented temporary command line argument: Clean up fader settings
Copy link
Copy Markdown
Member

@ann0see ann0see Sep 13, 2022

Choose a reason for hiding this comment

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

Since we agreed to remove this soon, I'd prefer to document it in the help text, and remove it later on.

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.

It's going to be totally meaningless to most users. To those for whom it's applicable, they'll use it once and never again. I can't see the point of making the help text get even larger than it is now for this.

Copy link
Copy Markdown
Member

@ann0see ann0see Sep 13, 2022

Choose a reason for hiding this comment

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

As it's a short term feature, and if I wanted to use it, I'd like to know which version has it. If it shows up under --help, the version supports it, else not. It's much easier than going through the changelog on GH for end users.

Copy link
Copy Markdown
Collaborator Author

@pljones pljones Sep 13, 2022

Choose a reason for hiding this comment

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

If it shows up under --help, the version supports it,

If running the app with the option doesn't complain it's not recognised, that means it's supported, too.

Also, if it goes into help, that means we should update the website User Guide, too.

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.

If running the app with the option doesn't complain it's not recognised, that means it's supported, too.

Fair point.

I'd still like to have it prominently documented somewhere besides the release announcement. I assume most users don't read the announcement at all.

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.

Probably?
What about printing it to stdout if the --ctrlmidich option is set and to the website as long as it's in?

Copy link
Copy Markdown
Collaborator Author

@pljones pljones Sep 13, 2022

Choose a reason for hiding this comment

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

You mean in main.cpp when it parses --ctrlmidich, output a hint? Desktop client users generally won't see that (on Windows we launch without a terminal attached so output goes "nowhere") and most who use it will have edited their shortcuts, I'd expect.

The people it's likely relevant for are those who'll be searching the internet for a fix for the problem. I'm not sure how well our documentation gets picked up by search engines -- or how best to get new documentation into it so it's found in a timely manner.

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.

We could write a forum post with a how to?

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.

This all arose in https://github.com/orgs/jamulussoftware/discussions/2678 -- that could have a comment added with how to fix 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.

I've noted on the Reminders for the release announcement to comment on the original discussion, so going ahead with the merge here.

// corrupted by bug #2680. Only needs to be used once (per file).
if ( GetFlagArgument ( argv,
i,
"--cleanuplegacyfadersettings", // no short form
"--cleanuplegacyfadersettings" ) )
{
qInfo() << "- will clean up legacy fader settings on load";
CommandLineOptions << "--cleanuplegacyfadersettings";
ClientOnlyOptions << "--cleanuplegacyfadersettings";
continue;
}

// Unknown option ------------------------------------------------------
qCritical() << qUtf8Printable ( QString ( "%1: Unknown option '%2' -- use '--help' for help" ).arg ( argv[0] ).arg ( argv[i] ) );

Expand Down
64 changes: 61 additions & 3 deletions src/settings.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -226,12 +226,14 @@ void CClientSettings::SaveFaderSettings ( const QString& strCurFileName )
WriteToFile ( strCurFileName, IniXMLDocument );
}

void CClientSettings::ReadSettingsFromXML ( const QDomDocument& IniXMLDocument, const QList<QString>& )
void CClientSettings::ReadSettingsFromXML ( const QDomDocument& IniXMLDocument, const QList<QString>& CommandLineOptions )
{
int iIdx;
int iValue;
bool bValue;

bCleanUpLegacyFaderSettings = CommandLineOptions.contains ( "--cleanuplegacyfadersettings" );

// IP addresses
for ( iIdx = 0; iIdx < MAX_NUM_SERVER_ADDR_ITEMS; iIdx++ )
{
Expand Down Expand Up @@ -557,6 +559,53 @@ void CClientSettings::ReadSettingsFromXML ( const QDomDocument& IniXMLDocument,
ReadFaderSettingsFromXML ( IniXMLDocument );
}

QString CClientSettings::CleanUpLegacyFaderSetting ( QString strFaderTag, int iIdx )
{
bool ok;
int iIdy;
bool bDup;

if ( !bCleanUpLegacyFaderSettings || strFaderTag.isEmpty() )
{
return strFaderTag;
}

QStringList slChanFaderTag = strFaderTag.split ( ":" );
if ( slChanFaderTag.size() != 2 )
{
return strFaderTag;
}

const int iChan = slChanFaderTag[0].toInt ( &ok );
if ( ok && iChan >= 0 && iChan <= MAX_NUM_CHANNELS )
{
// *assumption*: legacy tag that needs cleaning up
strFaderTag = slChanFaderTag[1];
}

// duplicate detection
// this assumes the first entry into the vector is the newest one and skips any later ones.
// the alternative is to use iIdy for the vector entry, so overwriting the duplicate.
// (in both cases, this currently leaves holes in the vector.)
bDup = false;
for ( iIdy = 0; iIdy < iIdx; iIdy++ )
{
if ( strFaderTag == vecStoredFaderTags[iIdy] )
{
// duplicate entry
bDup = true;
break;
}
}
if ( bDup )
{
// so skip all settings for this iIdx (use iIdx here even if using iIdy and not doing continue below)
return QString();
}

return strFaderTag;
}

void CClientSettings::ReadFaderSettingsFromXML ( const QDomDocument& IniXMLDocument )
{
int iIdx;
Expand All @@ -566,8 +615,17 @@ void CClientSettings::ReadFaderSettingsFromXML ( const QDomDocument& IniXMLDocum
for ( iIdx = 0; iIdx < MAX_NUM_STORED_FADER_SETTINGS; iIdx++ )
{
// stored fader tags
vecStoredFaderTags[iIdx] =
FromBase64ToString ( GetIniSetting ( IniXMLDocument, "client", QString ( "storedfadertag%1_base64" ).arg ( iIdx ), "" ) );
QString strFaderTag = CleanUpLegacyFaderSetting (
FromBase64ToString ( GetIniSetting ( IniXMLDocument, "client", QString ( "storedfadertag%1_base64" ).arg ( iIdx ), "" ) ),
iIdx );

if ( strFaderTag.isEmpty() )
{
// duplicate from clean up code
continue;
}

vecStoredFaderTags[iIdx] = strFaderTag;

// stored fader levels
if ( GetNumericIniSet ( IniXMLDocument, "client", QString ( "storedfaderlevel%1" ).arg ( iIdx ), 0, AUD_MIX_FADER_MAX, iValue ) )
Expand Down
7 changes: 5 additions & 2 deletions src/settings.h
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,7 @@ class CClientSettings : public CSettings
int iCustomDirectoryIndex; // index of selected custom directory server
bool bEnableFeedbackDetection;
bool bEnableAudioAlerts;
bool bCleanUpLegacyFaderSettings;

// window position/state settings
QByteArray vecWindowPosSettings;
Expand All @@ -176,9 +177,11 @@ class CClientSettings : public CSettings
bool bOwnFaderFirst;

protected:
// No CommandLineOptions used when reading Client inifile
virtual void WriteSettingsToXML ( QDomDocument& IniXMLDocument ) override;
virtual void ReadSettingsFromXML ( const QDomDocument& IniXMLDocument, const QList<QString>& ) override;
virtual void ReadSettingsFromXML ( const QDomDocument& IniXMLDocument, const QList<QString>& CommandLineOptions ) override;

// Code for #2680 clean up
QString CleanUpLegacyFaderSetting ( QString strFaderTag, int iIdx );

void ReadFaderSettingsFromXML ( const QDomDocument& IniXMLDocument );
void WriteFaderSettingsToXML ( QDomDocument& IniXMLDocument );
Expand Down
Loading