Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Store recording directory #513

Merged

Conversation

pljones
Copy link
Collaborator

@pljones pljones commented Aug 11, 2020

One problem. Once set, there's no way from the command line to say "clear the base recording dir". You can change it, but not clear it. (Same goes for some other strings.)

@corrados
Copy link
Contributor

corrados commented Aug 11, 2020

Please use recordingdir_base64 instead of recording_dir. I am only using _ to show that it is base 64.

You can change it, but not clear it.

Do you want to fix it before I merge it?

@pljones
Copy link
Collaborator Author

pljones commented Aug 11, 2020

Do you want to fix it before I merge it?

I'd need to be changing main.cpp, too. Should I change all the settings that say

  • "If the target value is not empty, use the inifile value"
    so they say
  • "If the target value is not empty and the command line did not set it to empty, use the inifile value"?

(I was thinking of first looping through the command line for an inifile setting, else using the default, then looping through the other known command line options, setting the target value if present else using the inifile value; then any other inifile settings - i.e. ones with no matching command line option - would get loaded. Cumbersome...)

@pljones
Copy link
Collaborator Author

pljones commented Aug 11, 2020

Alternative approach:

  • in main.cpp, when looping over the command line arguments, a "found" list is maintained (list of strings), with each matched entry being added by its long option name (e.g. --recording)
  • when calling Settings.Load(), you'd pass the list, and then through to ReadSettingsFromXML(), and not use the inifile value for anything overridden on the command line

(If you wanted to stop storing the command line value in the inifile, you could do the same thing when saving...)

@corrados
Copy link
Contributor

Good idea with the string list, thanks. I'll add some minor comments in your code now.

src/main.cpp Outdated
@@ -99,6 +100,7 @@ int main ( int argc, char** argv )
{
bIsClient = false;
tsConsole << "- server mode chosen" << endl;
CommandLineOptions += "--server";
Copy link
Contributor

Choose a reason for hiding this comment

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

Should we only set the strings for command line arguments which are actually used in the settings class? I actually prefer to add them all as you did but the other solution would give less code and would make clear that the string is actually used. What is your opinion?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I think there should be "greater equality" between command line and GUI - at the moment, there's a lot that the UI can do (particular the client) that can't be set on start up from the command line. I'd also like to see most if not all of what can be set from the command line available in the UI. And then the UI settings should all get loaded / saved to the inifile.

So it seemed logical to help that process by putting this in consistently, at least.

Copy link
Contributor

Choose a reason for hiding this comment

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

Ok, agreed.

src/main.cpp Outdated
@@ -111,6 +113,7 @@ int main ( int argc, char** argv )
{
bUseGUI = false;
tsConsole << "- no GUI mode chosen" << endl;
CommandLineOptions += "--nogui";
Copy link
Contributor

Choose a reason for hiding this comment

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

At the places in Jamulus where I have used the QStringList class, I have used the operator<< instead of the +=. Does the += give a different result? If not, for consistency, we should use << here, too.

Copy link
Collaborator Author

@pljones pljones Aug 16, 2020

Choose a reason for hiding this comment

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

Oh - I was actually surprised += worked. My C backgound -- << is very C++ ;). Yes, << as append seems much better! I'll fix that.

}

// licence type (command line overwrites setting file)
if ( pServer->GetLicenceType() == LT_NO_LICENCE )
//if ( pServer->GetLicenceType() == LT_NO_LICENCE )
// TODO: command line needs to become boolean, at least...
Copy link
Contributor

Choose a reason for hiding this comment

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

Why should the command line be a boolean value? It is actually a boolean value. Do you want the command line to not be a boolean value instead?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Maybe I misread it -- I thought it was only checking for presence, rather than value.

src/settings.cpp Outdated
{
pServer->SetWelcomeMessage ( FromBase64ToString ( GetIniSetting ( IniXMLDocument, "server", "welcome" ) ) );
}

// window position of the main window
vecWindowPosMain = FromBase64ToByteArray (
GetIniSetting ( IniXMLDocument, "server", "winposmain_base64" ) );

// base recording directory (command line overwrites setting file)
Copy link
Contributor

Choose a reason for hiding this comment

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

Since now all settings are overwritten by the command line, maybe we should remove all the "(command line overwrites setting file)", what do you think?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

It could go as a comment on the call in main.cpp - I think it needs mentioning.

Copy link
Contributor

Choose a reason for hiding this comment

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

Ok, let's do that later on. I'll now merge your code.

Copy link
Contributor

Choose a reason for hiding this comment

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

I just saw that you already put it in main.cpp -> done.

@pljones pljones force-pushed the feature/save-recorder-settings branch from 502d3fe to 428cc83 Compare August 16, 2020 17:40
@corrados corrados merged commit 73d7fa1 into jamulussoftware:master Aug 17, 2020
@pljones pljones deleted the feature/save-recorder-settings branch August 18, 2020 11:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants