Skip to content

Commit

Permalink
Try with dynamic case idiom
Browse files Browse the repository at this point in the history
  • Loading branch information
pljones committed Oct 15, 2023
1 parent d3a4e16 commit 452d373
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 11 deletions.
4 changes: 2 additions & 2 deletions src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -934,7 +934,7 @@ int main ( int argc, char** argv )
bMuteMeInPersonalMix );

// load settings from init-file (command line options override)
CClientSettings Settings ( &Client, strIniFileName, pApp, bUseGUI );
CClientSettings Settings ( &Client, strIniFileName );
Settings.Load ( CommandLineOptions );

// load translation
Expand Down Expand Up @@ -1015,7 +1015,7 @@ int main ( int argc, char** argv )
if ( bUseGUI )
{
// load settings from init-file (command line options override)
CServerSettings Settings ( &Server, strIniFileName, pApp, bUseGUI );
CServerSettings Settings ( &Server, strIniFileName );
Settings.Load ( CommandLineOptions );

// load translation
Expand Down
16 changes: 7 additions & 9 deletions src/settings.h
Original file line number Diff line number Diff line change
Expand Up @@ -45,18 +45,18 @@ class CSettings : public QObject
Q_OBJECT

public:
CSettings ( const QCoreApplication* pApp, const bool bUseGUI ) :
CSettings() :
vecWindowPosMain(), // empty array
strLanguage ( "" ),
strFileName ( "" )
{
QObject::connect ( QCoreApplication::instance(), &QCoreApplication::aboutToQuit, this, &CSettings::OnAboutToQuit );

#ifndef HEADLESS
if ( bUseGUI )
{
const QGuiApplication* pGApp = static_cast<const QGuiApplication*> ( pApp );
const QGuiApplication* pGApp = dynamic_cast<const QGuiApplication*> ( QCoreApplication::instance() );

if ( pGApp != nullptr )
{
QObject::connect ( pGApp, &QGuiApplication::saveStateRequest, this, [=] ( QSessionManager& ) { Save(); } );

QObject::connect ( pGApp, &QGuiApplication::applicationStateChanged, this, [=] ( Qt::ApplicationState state ) {
Expand Down Expand Up @@ -129,8 +129,8 @@ public slots:
class CClientSettings : public CSettings
{
public:
CClientSettings ( CClient* pNCliP, const QString& sNFiName, const QCoreApplication* pApp, const bool bUseGUI ) :
CSettings ( pApp, bUseGUI ),
CClientSettings ( CClient* pNCliP, const QString& sNFiName ) :
CSettings(),
vecStoredFaderTags ( MAX_NUM_STORED_FADER_SETTINGS, "" ),
vecStoredFaderLevels ( MAX_NUM_STORED_FADER_SETTINGS, AUD_MIX_FADER_MAX ),
vecStoredPanValues ( MAX_NUM_STORED_FADER_SETTINGS, AUD_MIX_PAN_MAX / 2 ),
Expand Down Expand Up @@ -206,9 +206,7 @@ class CClientSettings : public CSettings
class CServerSettings : public CSettings
{
public:
CServerSettings ( CServer* pNSerP, const QString& sNFiName, const QCoreApplication* pApp, const bool bUseGUI ) :
CSettings ( pApp, bUseGUI ),
pServer ( pNSerP )
CServerSettings ( CServer* pNSerP, const QString& sNFiName ) : CSettings(), pServer ( pNSerP )
{
SetFileName ( sNFiName, DEFAULT_INI_FILE_NAME_SERVER );
}
Expand Down

0 comments on commit 452d373

Please sign in to comment.