Skip to content

Commit a192aca

Browse files
committed
better default settings file name handling
1 parent 31bae68 commit a192aca

3 files changed

Lines changed: 15 additions & 14 deletions

File tree

ChangeLog

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,14 @@
44

55
3.5.8git
66

7+
TODO bug fix: incorrect selection of UI language (#408)
8+
79
TODO improve settings management -> move settings class in client/server classes, move actual settings variables
810

911
TODO add new register message which contains version and, e.g., max number of clients
1012

13+
TODO bug fix: grouping faders in the client should be proportional (see discussion in #202)
14+
1115
TODO https://github.com/corrados/jamulus/issues/341#issuecomment-647172946
1216
- generate .qm on compile time with lrelease
1317

src/settings.cpp

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ void CSettings::Load()
3636
// prepare file name for loading initialization data from XML file and read
3737
// data from file if possible
3838
QFile file ( strFileName );
39+
3940
if ( file.open ( QIODevice::ReadOnly ) )
4041
{
4142
QTextStream in ( &file );
@@ -690,11 +691,13 @@ void CSettings::Save()
690691

691692

692693
// Help functions **************************************************************
693-
void CSettings::SetFileName ( const QString& sNFiName )
694+
void CSettings::SetFileName ( const QString& sNFiName,
695+
const QString& sDefaultFileName )
694696
{
695697
// return the file name with complete path, take care if given file name is
696698
// empty
697699
strFileName = sNFiName;
700+
698701
if ( strFileName.isEmpty() )
699702
{
700703
// we use the Qt default setting file paths for the different OSs by
@@ -713,14 +716,7 @@ void CSettings::SetFileName ( const QString& sNFiName )
713716
}
714717

715718
// append the actual file name
716-
if ( bIsClient )
717-
{
718-
strFileName = sConfigDir + "/" + DEFAULT_INI_FILE_NAME;
719-
}
720-
else
721-
{
722-
strFileName = sConfigDir + "/" + DEFAULT_INI_FILE_NAME_SERVER;
723-
}
719+
strFileName = sConfigDir + "/" + sDefaultFileName;
724720
}
725721
}
726722

src/settings.h

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -40,18 +40,19 @@ class CSettings
4040
{
4141
public:
4242
CSettings ( CClient* pNCliP, const QString& sNFiName ) :
43-
pClient ( pNCliP ), bIsClient ( true )
44-
{ SetFileName ( sNFiName ); }
43+
pClient ( pNCliP ), bIsClient ( true ), strFileName ( "" )
44+
{ SetFileName ( sNFiName, DEFAULT_INI_FILE_NAME ); }
4545

4646
CSettings ( CServer* pNSerP, const QString& sNFiName ) :
47-
pServer ( pNSerP ), bIsClient ( false )
48-
{ SetFileName ( sNFiName ); }
47+
pServer ( pNSerP ), bIsClient ( false ), strFileName ( "" )
48+
{ SetFileName ( sNFiName, DEFAULT_INI_FILE_NAME_SERVER); }
4949

5050
void Load();
5151
void Save();
5252

5353
protected:
54-
void SetFileName ( const QString& sNFiName );
54+
void SetFileName ( const QString& sNFiName,
55+
const QString& sDefaultFileName );
5556

5657
// The following functions implement the conversion from the general string
5758
// to base64 (which should be used for binary data in XML files). This

0 commit comments

Comments
 (0)