Skip to content

Commit

Permalink
Merge pull request #3116 from pljones/patch/2850-remove-cleanuplegacy…
Browse files Browse the repository at this point in the history
…fadersettings

#2850 Remove --cleanuplegacyfadersettings command line option
  • Loading branch information
pljones authored Oct 2, 2023
2 parents a9b5475 + 0f89d2d commit d1dfe64
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 70 deletions.
14 changes: 0 additions & 14 deletions src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -582,20 +582,6 @@ int main ( int argc, char** argv )
continue;
}

// Clean up legacy fader settings --------------------------------------
// Undocumented temporary command line argument: Clean up fader settings
// 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
54 changes: 2 additions & 52 deletions src/settings.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -232,8 +232,6 @@ void CClientSettings::ReadSettingsFromXML ( const QDomDocument& IniXMLDocument,
int iValue;
bool bValue;

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

// IP addresses
for ( iIdx = 0; iIdx < MAX_NUM_SERVER_ADDR_ITEMS; iIdx++ )
{
Expand Down Expand Up @@ -559,53 +557,6 @@ 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 @@ -615,9 +566,8 @@ void CClientSettings::ReadFaderSettingsFromXML ( const QDomDocument& IniXMLDocum
for ( iIdx = 0; iIdx < MAX_NUM_STORED_FADER_SETTINGS; iIdx++ )
{
// stored fader tags
QString strFaderTag = CleanUpLegacyFaderSetting (
FromBase64ToString ( GetIniSetting ( IniXMLDocument, "client", QString ( "storedfadertag%1_base64" ).arg ( iIdx ), "" ) ),
iIdx );
QString strFaderTag =
FromBase64ToString ( GetIniSetting ( IniXMLDocument, "client", QString ( "storedfadertag%1_base64" ).arg ( iIdx ), "" ) );

if ( strFaderTag.isEmpty() )
{
Expand Down
4 changes: 0 additions & 4 deletions src/settings.h
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,6 @@ class CClientSettings : public CSettings
int iCustomDirectoryIndex; // index of selected custom directory
bool bEnableFeedbackDetection;
bool bEnableAudioAlerts;
bool bCleanUpLegacyFaderSettings;

// window position/state settings
QByteArray vecWindowPosSettings;
Expand All @@ -180,9 +179,6 @@ class CClientSettings : public CSettings
virtual void WriteSettingsToXML ( QDomDocument& IniXMLDocument ) 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

0 comments on commit d1dfe64

Please sign in to comment.