Update recording logic to better reflect ConfigFile settings

ConfigFile doesn't distinguish between non-existent keys and keys with
an empty (string) value; therefore we default to treating an empty
SavePath as default save path (and warn the user when setting an empty
SavePath)

Recording is now always enabled (unless previewing)
This commit is contained in:
palana 2014-07-08 18:25:26 +02:00
parent 1fd11a3c1b
commit e541c5207d
3 changed files with 19 additions and 5 deletions

View File

@ -1327,7 +1327,7 @@ void OBS::RefreshStreamButtons(bool disable)
int networkMode = AppConfig->GetInt(TEXT("Publish"), TEXT("Mode"), 2); int networkMode = AppConfig->GetInt(TEXT("Publish"), TEXT("Mode"), 2);
bRecordingOnly = (networkMode == 1); bRecordingOnly = (networkMode == 1);
bool canStream = networkMode == 0 && !bTestStream; bool canStream = networkMode == 0 && !bTestStream;
canRecord = (bRecordingOnly || AppConfig->GetString(L"Publish", L"SavePath").IsValid()) && !bTestStream; canRecord = !bTestStream;
bool canTest = !bRecording && (!bStreaming || bTestStream); bool canTest = !bRecording && (!bStreaming || bTestStream);
EnableWindow(GetDlgItem(hwndMain, ID_STARTSTOP), !disable && canStream); EnableWindow(GetDlgItem(hwndMain, ID_STARTSTOP), !disable && canStream);

View File

@ -69,6 +69,22 @@ void SettingsPublish::DestroyPane()
void SettingsPublish::ApplySettings() void SettingsPublish::ApplySettings()
{ {
String strSavePath = GetEditText(GetDlgItem(hwnd, IDC_SAVEPATH));
String defaultPath = OSGetDefaultVideoSavePath(L"\\.flv");
if (!strSavePath.IsValid() && defaultPath.IsValid())
{
String text = Str("Settings.Publish.InvalidSavePath");
text.FindReplace(L"$1", defaultPath);
if (OBSMessageBox(nullptr, text, Str("Settings.Publish.InvalidSavePathCaption"), MB_ICONEXCLAMATION | MB_OKCANCEL) != IDOK)
{
SetAbortApplySettings(true);
return;
}
SetWindowText(GetDlgItem(hwnd, IDC_SAVEPATH), defaultPath.Array());
}
//------------------------------------------
int curSel = (int)SendMessage(GetDlgItem(hwnd, IDC_MODE), CB_GETCURSEL, 0, 0); int curSel = (int)SendMessage(GetDlgItem(hwnd, IDC_MODE), CB_GETCURSEL, 0, 0);
if(curSel != CB_ERR) if(curSel != CB_ERR)
AppConfig->SetInt(TEXT("Publish"), TEXT("Mode"), curSel); AppConfig->SetInt(TEXT("Publish"), TEXT("Mode"), curSel);
@ -126,12 +142,8 @@ void SettingsPublish::ApplySettings()
//------------------------------------------ //------------------------------------------
String strSavePath = GetEditText(GetDlgItem(hwnd, IDC_SAVEPATH));
BOOL bSaveToFile = SendMessage(GetDlgItem(hwnd, IDC_SAVETOFILE), BM_GETCHECK, 0, 0) != BST_UNCHECKED; BOOL bSaveToFile = SendMessage(GetDlgItem(hwnd, IDC_SAVETOFILE), BM_GETCHECK, 0, 0) != BST_UNCHECKED;
if(!strSavePath.IsValid())
bSaveToFile = FALSE;
AppConfig->SetInt (TEXT("Publish"), TEXT("SaveToFile"), bSaveToFile); AppConfig->SetInt (TEXT("Publish"), TEXT("SaveToFile"), bSaveToFile);
AppConfig->SetString(TEXT("Publish"), TEXT("SavePath"), strSavePath); AppConfig->SetString(TEXT("Publish"), TEXT("SavePath"), strSavePath);

View File

@ -247,6 +247,8 @@ Settings.Publish.StopStreamHotkey="Stop Stream Hotkey:"
Settings.Publish.StartRecordingHotkey="Start Recording Hotkey:" Settings.Publish.StartRecordingHotkey="Start Recording Hotkey:"
Settings.Publish.StopRecordingHotkey="Stop Recording Hotkey:" Settings.Publish.StopRecordingHotkey="Stop Recording Hotkey:"
Settings.Publish.Username="User Name (if any):" Settings.Publish.Username="User Name (if any):"
Settings.Publish.InvalidSavePath="The File Path is invalid, the default Path '$1' will be used instead"
Settings.Publish.InvalidSavePathCaption="Invalid File Path"
Settings.Publish.Mode.FileOnly="File Output Only" Settings.Publish.Mode.FileOnly="File Output Only"
Settings.Publish.Mode.LiveStream="Live Stream" Settings.Publish.Mode.LiveStream="Live Stream"