UI: Add auto-start replay buf. opt. when stream starts

Closes jp9000/obs-studio#748
This commit is contained in:
dennis 2017-01-04 16:11:52 -05:00 committed by jp9000
parent 29f22e72a8
commit 21584fa2c0
5 changed files with 165 additions and 73 deletions

View File

@ -412,6 +412,8 @@ Basic.Settings.General.SourceSnapping="Snap Sources to other sources"
Basic.Settings.General.SnapDistance="Snap Sensitivity" Basic.Settings.General.SnapDistance="Snap Sensitivity"
Basic.Settings.General.RecordWhenStreaming="Automatically record when streaming" Basic.Settings.General.RecordWhenStreaming="Automatically record when streaming"
Basic.Settings.General.KeepRecordingWhenStreamStops="Keep recording when stream stops" Basic.Settings.General.KeepRecordingWhenStreamStops="Keep recording when stream stops"
Basic.Settings.General.ReplayBufferWhileStreaming="Automatically start replay buffer when streaming"
Basic.Settings.General.KeepReplayBufferStreamStops="Keep replay buffer active when stream stops"
Basic.Settings.General.SysTrayEnabled="Enable system tray icon" Basic.Settings.General.SysTrayEnabled="Enable system tray icon"
Basic.Settings.General.SysTrayWhenStarted="Minimize to system tray when started" Basic.Settings.General.SysTrayWhenStarted="Minimize to system tray when started"
Basic.Settings.General.SystemTrayHideMinimize="Hide to system tray instead of minimize to task bar" Basic.Settings.General.SystemTrayHideMinimize="Hide to system tray instead of minimize to task bar"

View File

@ -192,14 +192,14 @@
</property> </property>
</widget> </widget>
</item> </item>
<item row="10" column="1"> <item row="12" column="1">
<widget class="QCheckBox" name="systemTrayEnabled"> <widget class="QCheckBox" name="systemTrayEnabled">
<property name="text"> <property name="text">
<string>Basic.Settings.General.SysTrayEnabled</string> <string>Basic.Settings.General.SysTrayEnabled</string>
</property> </property>
</widget> </widget>
</item> </item>
<item row="11" column="1"> <item row="13" column="1">
<widget class="QCheckBox" name="systemTrayWhenStarted"> <widget class="QCheckBox" name="systemTrayWhenStarted">
<property name="enabled"> <property name="enabled">
<bool>false</bool> <bool>false</bool>
@ -209,7 +209,7 @@
</property> </property>
</widget> </widget>
</item> </item>
<item row="12" column="1"> <item row="14" column="1">
<widget class="QCheckBox" name="systemTrayAlways"> <widget class="QCheckBox" name="systemTrayAlways">
<property name="enabled"> <property name="enabled">
<bool>false</bool> <bool>false</bool>
@ -219,14 +219,14 @@
</property> </property>
</widget> </widget>
</item> </item>
<item row="13" column="0" colspan="2"> <item row="15" column="0" colspan="2">
<widget class="Line" name="line_4"> <widget class="Line" name="line_4">
<property name="orientation"> <property name="orientation">
<enum>Qt::Horizontal</enum> <enum>Qt::Horizontal</enum>
</property> </property>
</widget> </widget>
</item> </item>
<item row="14" column="0" colspan="2"> <item row="16" column="0" colspan="2">
<widget class="QGroupBox" name="groupBox_10"> <widget class="QGroupBox" name="groupBox_10">
<property name="enabled"> <property name="enabled">
<bool>true</bool> <bool>true</bool>
@ -350,6 +350,23 @@
</property> </property>
</widget> </widget>
</item> </item>
<item row="11" column="1">
<widget class="QCheckBox" name="keepReplayStreamStops">
<property name="enabled">
<bool>false</bool>
</property>
<property name="text">
<string>Basic.Settings.General.KeepReplayBufferStreamStops</string>
</property>
</widget>
</item>
<item row="10" column="1">
<widget class="QCheckBox" name="replayWhileStreaming">
<property name="text">
<string>Basic.Settings.General.ReplayBufferWhileStreaming</string>
</property>
</widget>
</item>
</layout> </layout>
</widget> </widget>
<widget class="QWidget" name="streamPage"> <widget class="QWidget" name="streamPage">
@ -2919,8 +2936,8 @@
<rect> <rect>
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>98</width> <width>80</width>
<height>28</height> <height>16</height>
</rect> </rect>
</property> </property>
</widget> </widget>
@ -3813,12 +3830,12 @@
<slot>setCurrentIndex(int)</slot> <slot>setCurrentIndex(int)</slot>
<hints> <hints>
<hint type="sourcelabel"> <hint type="sourcelabel">
<x>586</x> <x>241</x>
<y>38</y> <y>16</y>
</hint> </hint>
<hint type="destinationlabel"> <hint type="destinationlabel">
<x>401</x> <x>250</x>
<y>102</y> <y>40</y>
</hint> </hint>
</hints> </hints>
</connection> </connection>
@ -3829,12 +3846,12 @@
<slot>setVisible(bool)</slot> <slot>setVisible(bool)</slot>
<hints> <hints>
<hint type="sourcelabel"> <hint type="sourcelabel">
<x>640</x> <x>240</x>
<y>180</y> <y>46</y>
</hint> </hint>
<hint type="destinationlabel"> <hint type="destinationlabel">
<x>640</x> <x>240</x>
<y>229</y> <y>44</y>
</hint> </hint>
</hints> </hints>
</connection> </connection>
@ -3845,12 +3862,12 @@
<slot>setVisible(bool)</slot> <slot>setVisible(bool)</slot>
<hints> <hints>
<hint type="sourcelabel"> <hint type="sourcelabel">
<x>640</x> <x>240</x>
<y>180</y> <y>46</y>
</hint> </hint>
<hint type="destinationlabel"> <hint type="destinationlabel">
<x>383</x> <x>160</x>
<y>229</y> <y>44</y>
</hint> </hint>
</hints> </hints>
</connection> </connection>
@ -3861,12 +3878,12 @@
<slot>setVisible(bool)</slot> <slot>setVisible(bool)</slot>
<hints> <hints>
<hint type="sourcelabel"> <hint type="sourcelabel">
<x>640</x> <x>240</x>
<y>180</y> <y>46</y>
</hint> </hint>
<hint type="destinationlabel"> <hint type="destinationlabel">
<x>640</x> <x>240</x>
<y>255</y> <y>43</y>
</hint> </hint>
</hints> </hints>
</connection> </connection>
@ -3877,12 +3894,12 @@
<slot>setVisible(bool)</slot> <slot>setVisible(bool)</slot>
<hints> <hints>
<hint type="sourcelabel"> <hint type="sourcelabel">
<x>640</x> <x>240</x>
<y>180</y> <y>46</y>
</hint> </hint>
<hint type="destinationlabel"> <hint type="destinationlabel">
<x>383</x> <x>160</x>
<y>255</y> <y>43</y>
</hint> </hint>
</hints> </hints>
</connection> </connection>
@ -3893,12 +3910,12 @@
<slot>setCurrentIndex(int)</slot> <slot>setCurrentIndex(int)</slot>
<hints> <hints>
<hint type="sourcelabel"> <hint type="sourcelabel">
<x>606</x> <x>232</x>
<y>113</y> <y>41</y>
</hint> </hint>
<hint type="destinationlabel"> <hint type="destinationlabel">
<x>394</x> <x>241</x>
<y>191</y> <y>53</y>
</hint> </hint>
</hints> </hints>
</connection> </connection>
@ -3909,12 +3926,12 @@
<slot>setEnabled(bool)</slot> <slot>setEnabled(bool)</slot>
<hints> <hints>
<hint type="sourcelabel"> <hint type="sourcelabel">
<x>397</x> <x>168</x>
<y>323</y> <y>67</y>
</hint> </hint>
<hint type="destinationlabel"> <hint type="destinationlabel">
<x>676</x> <x>250</x>
<y>323</y> <y>67</y>
</hint> </hint>
</hints> </hints>
</connection> </connection>
@ -3925,12 +3942,12 @@
<slot>setEnabled(bool)</slot> <slot>setEnabled(bool)</slot>
<hints> <hints>
<hint type="sourcelabel"> <hint type="sourcelabel">
<x>330</x> <x>168</x>
<y>191</y> <y>52</y>
</hint> </hint>
<hint type="destinationlabel"> <hint type="destinationlabel">
<x>591</x> <x>232</x>
<y>191</y> <y>52</y>
</hint> </hint>
</hints> </hints>
</connection> </connection>
@ -3941,12 +3958,12 @@
<slot>setEnabled(bool)</slot> <slot>setEnabled(bool)</slot>
<hints> <hints>
<hint type="sourcelabel"> <hint type="sourcelabel">
<x>353</x> <x>168</x>
<y>277</y> <y>56</y>
</hint> </hint>
<hint type="destinationlabel"> <hint type="destinationlabel">
<x>614</x> <x>232</x>
<y>277</y> <y>56</y>
</hint> </hint>
</hints> </hints>
</connection> </connection>
@ -3957,12 +3974,12 @@
<slot>setCurrentIndex(int)</slot> <slot>setCurrentIndex(int)</slot>
<hints> <hints>
<hint type="sourcelabel"> <hint type="sourcelabel">
<x>676</x> <x>250</x>
<y>148</y> <y>50</y>
</hint> </hint>
<hint type="destinationlabel"> <hint type="destinationlabel">
<x>676</x> <x>250</x>
<y>177</y> <y>52</y>
</hint> </hint>
</hints> </hints>
</connection> </connection>
@ -4086,11 +4103,11 @@
<hints> <hints>
<hint type="sourcelabel"> <hint type="sourcelabel">
<x>951</x> <x>951</x>
<y>349</y> <y>441</y>
</hint> </hint>
<hint type="destinationlabel"> <hint type="destinationlabel">
<x>346</x> <x>346</x>
<y>375</y> <y>467</y>
</hint> </hint>
</hints> </hints>
</connection> </connection>
@ -4102,11 +4119,11 @@
<hints> <hints>
<hint type="sourcelabel"> <hint type="sourcelabel">
<x>951</x> <x>951</x>
<y>349</y> <y>441</y>
</hint> </hint>
<hint type="destinationlabel"> <hint type="destinationlabel">
<x>951</x> <x>951</x>
<y>375</y> <y>467</y>
</hint> </hint>
</hints> </hints>
</connection> </connection>
@ -4118,11 +4135,11 @@
<hints> <hints>
<hint type="sourcelabel"> <hint type="sourcelabel">
<x>951</x> <x>951</x>
<y>349</y> <y>441</y>
</hint> </hint>
<hint type="destinationlabel"> <hint type="destinationlabel">
<x>951</x> <x>951</x>
<y>398</y> <y>490</y>
</hint> </hint>
</hints> </hints>
</connection> </connection>
@ -4134,11 +4151,11 @@
<hints> <hints>
<hint type="sourcelabel"> <hint type="sourcelabel">
<x>951</x> <x>951</x>
<y>349</y> <y>441</y>
</hint> </hint>
<hint type="destinationlabel"> <hint type="destinationlabel">
<x>951</x> <x>951</x>
<y>421</y> <y>513</y>
</hint> </hint>
</hints> </hints>
</connection> </connection>
@ -4150,11 +4167,11 @@
<hints> <hints>
<hint type="sourcelabel"> <hint type="sourcelabel">
<x>951</x> <x>951</x>
<y>349</y> <y>441</y>
</hint> </hint>
<hint type="destinationlabel"> <hint type="destinationlabel">
<x>951</x> <x>951</x>
<y>444</y> <y>536</y>
</hint> </hint>
</hints> </hints>
</connection> </connection>
@ -4165,12 +4182,12 @@
<slot>setVisible(bool)</slot> <slot>setVisible(bool)</slot>
<hints> <hints>
<hint type="sourcelabel"> <hint type="sourcelabel">
<x>640</x> <x>240</x>
<y>180</y> <y>46</y>
</hint> </hint>
<hint type="destinationlabel"> <hint type="destinationlabel">
<x>640</x> <x>240</x>
<y>203</y> <y>45</y>
</hint> </hint>
</hints> </hints>
</connection> </connection>
@ -4181,12 +4198,12 @@
<slot>setEnabled(bool)</slot> <slot>setEnabled(bool)</slot>
<hints> <hints>
<hint type="sourcelabel"> <hint type="sourcelabel">
<x>705</x> <x>961</x>
<y>225</y> <y>248</y>
</hint> </hint>
<hint type="destinationlabel"> <hint type="destinationlabel">
<x>705</x> <x>961</x>
<y>248</y> <y>271</y>
</hint> </hint>
</hints> </hints>
</connection> </connection>
@ -4197,12 +4214,12 @@
<slot>setEnabled(bool)</slot> <slot>setEnabled(bool)</slot>
<hints> <hints>
<hint type="sourcelabel"> <hint type="sourcelabel">
<x>705</x> <x>961</x>
<y>271</y> <y>340</y>
</hint> </hint>
<hint type="destinationlabel"> <hint type="destinationlabel">
<x>705</x> <x>961</x>
<y>294</y> <y>363</y>
</hint> </hint>
</hints> </hints>
</connection> </connection>
@ -4213,12 +4230,28 @@
<slot>setEnabled(bool)</slot> <slot>setEnabled(bool)</slot>
<hints> <hints>
<hint type="sourcelabel"> <hint type="sourcelabel">
<x>20</x> <x>336</x>
<y>20</y> <y>324</y>
</hint> </hint>
<hint type="destinationlabel"> <hint type="destinationlabel">
<x>20</x> <x>336</x>
<y>20</y> <y>370</y>
</hint>
</hints>
</connection>
<connection>
<sender>replayWhileStreaming</sender>
<signal>toggled(bool)</signal>
<receiver>keepReplayStreamStops</receiver>
<slot>setEnabled(bool)</slot>
<hints>
<hint type="sourcelabel">
<x>497</x>
<y>288</y>
</hint>
<hint type="destinationlabel">
<x>513</x>
<y>304</y>
</hint> </hint>
</hints> </hints>
</connection> </connection>

View File

@ -3864,6 +3864,12 @@ void OBSBasic::StartStreaming()
"BasicWindow", "RecordWhenStreaming"); "BasicWindow", "RecordWhenStreaming");
if (recordWhenStreaming) if (recordWhenStreaming)
StartRecording(); StartRecording();
bool replayBufferWhileStreaming = config_get_bool(GetGlobalConfig(),
"BasicWindow", "ReplayBufferWhileStreaming");
if (replayBufferWhileStreaming)
StartReplayBuffer();
} }
#ifdef _WIN32 #ifdef _WIN32
@ -3926,6 +3932,13 @@ void OBSBasic::StopStreaming()
"BasicWindow", "KeepRecordingWhenStreamStops"); "BasicWindow", "KeepRecordingWhenStreamStops");
if (recordWhenStreaming && !keepRecordingWhenStreamStops) if (recordWhenStreaming && !keepRecordingWhenStreamStops)
StopRecording(); StopRecording();
bool replayBufferWhileStreaming = config_get_bool(GetGlobalConfig(),
"BasicWindow", "ReplayBufferWhileStreaming");
bool keepReplayBufferStreamStops = config_get_bool(GetGlobalConfig(),
"BasicWindow", "KeepReplayBufferStreamStops");
if (replayBufferWhileStreaming && !keepReplayBufferStreamStops)
StopReplayBuffer();
} }
void OBSBasic::ForceStopStreaming() void OBSBasic::ForceStopStreaming()
@ -3943,6 +3956,13 @@ void OBSBasic::ForceStopStreaming()
"BasicWindow", "KeepRecordingWhenStreamStops"); "BasicWindow", "KeepRecordingWhenStreamStops");
if (recordWhenStreaming && !keepRecordingWhenStreamStops) if (recordWhenStreaming && !keepRecordingWhenStreamStops)
StopRecording(); StopRecording();
bool replayBufferWhileStreaming = config_get_bool(GetGlobalConfig(),
"BasicWindow", "ReplayBufferWhileStreaming");
bool keepReplayBufferStreamStops = config_get_bool(GetGlobalConfig(),
"BasicWindow", "KeepReplayBufferStreamStops");
if (replayBufferWhileStreaming && !keepReplayBufferStreamStops)
StopReplayBuffer();
} }
void OBSBasic::StreamDelayStarting(int sec) void OBSBasic::StreamDelayStarting(int sec)

View File

@ -279,6 +279,8 @@ OBSBasicSettings::OBSBasicSettings(QWidget *parent)
HookWidget(ui->projectorAlwaysOnTop, CHECK_CHANGED, GENERAL_CHANGED); HookWidget(ui->projectorAlwaysOnTop, CHECK_CHANGED, GENERAL_CHANGED);
HookWidget(ui->recordWhenStreaming, CHECK_CHANGED, GENERAL_CHANGED); HookWidget(ui->recordWhenStreaming, CHECK_CHANGED, GENERAL_CHANGED);
HookWidget(ui->keepRecordStreamStops,CHECK_CHANGED, GENERAL_CHANGED); HookWidget(ui->keepRecordStreamStops,CHECK_CHANGED, GENERAL_CHANGED);
HookWidget(ui->replayWhileStreaming, CHECK_CHANGED, GENERAL_CHANGED);
HookWidget(ui->keepReplayStreamStops,CHECK_CHANGED, GENERAL_CHANGED);
HookWidget(ui->systemTrayEnabled, CHECK_CHANGED, GENERAL_CHANGED); HookWidget(ui->systemTrayEnabled, CHECK_CHANGED, GENERAL_CHANGED);
HookWidget(ui->systemTrayWhenStarted,CHECK_CHANGED, GENERAL_CHANGED); HookWidget(ui->systemTrayWhenStarted,CHECK_CHANGED, GENERAL_CHANGED);
HookWidget(ui->systemTrayAlways, CHECK_CHANGED, GENERAL_CHANGED); HookWidget(ui->systemTrayAlways, CHECK_CHANGED, GENERAL_CHANGED);
@ -591,6 +593,8 @@ OBSBasicSettings::OBSBasicSettings(QWidget *parent)
AdvOutRecCheckWarnings(); AdvOutRecCheckWarnings();
SimpleRecordingQualityChanged(); SimpleRecordingQualityChanged();
UpdateAutomaticReplayBufferCheckboxes();
} }
void OBSBasicSettings::SaveCombo(QComboBox *widget, const char *section, void OBSBasicSettings::SaveCombo(QComboBox *widget, const char *section,
@ -885,6 +889,14 @@ void OBSBasicSettings::LoadGeneralSettings()
"BasicWindow", "KeepRecordingWhenStreamStops"); "BasicWindow", "KeepRecordingWhenStreamStops");
ui->keepRecordStreamStops->setChecked(keepRecordStreamStops); ui->keepRecordStreamStops->setChecked(keepRecordStreamStops);
bool replayWhileStreaming = config_get_bool(GetGlobalConfig(),
"BasicWindow", "ReplayBufferWhileStreaming");
ui->replayWhileStreaming->setChecked(replayWhileStreaming);
bool keepReplayStreamStops = config_get_bool(GetGlobalConfig(),
"BasicWindow", "KeepReplayBufferStreamStops");
ui->keepReplayStreamStops->setChecked(keepReplayStreamStops);
bool systemTrayEnabled = config_get_bool(GetGlobalConfig(), bool systemTrayEnabled = config_get_bool(GetGlobalConfig(),
"BasicWindow", "SysTrayEnabled"); "BasicWindow", "SysTrayEnabled");
ui->systemTrayEnabled->setChecked(systemTrayEnabled); ui->systemTrayEnabled->setChecked(systemTrayEnabled);
@ -2342,6 +2354,15 @@ void OBSBasicSettings::SaveGeneralSettings()
"KeepRecordingWhenStreamStops", "KeepRecordingWhenStreamStops",
ui->keepRecordStreamStops->isChecked()); ui->keepRecordStreamStops->isChecked());
if (WidgetChanged(ui->replayWhileStreaming))
config_set_bool(GetGlobalConfig(), "BasicWindow",
"ReplayBufferWhileStreaming",
ui->replayWhileStreaming->isChecked());
if (WidgetChanged(ui->keepReplayStreamStops))
config_set_bool(GetGlobalConfig(), "BasicWindow",
"KeepReplayBufferStreamStops",
ui->keepReplayStreamStops->isChecked());
if (WidgetChanged(ui->systemTrayEnabled)) if (WidgetChanged(ui->systemTrayEnabled))
config_set_bool(GetGlobalConfig(), "BasicWindow", config_set_bool(GetGlobalConfig(), "BasicWindow",
"SysTrayEnabled", "SysTrayEnabled",
@ -3337,6 +3358,8 @@ void OBSBasicSettings::UpdateStreamDelayEstimate()
UpdateSimpleOutStreamDelayEstimate(); UpdateSimpleOutStreamDelayEstimate();
else else
UpdateAdvOutStreamDelayEstimate(); UpdateAdvOutStreamDelayEstimate();
UpdateAutomaticReplayBufferCheckboxes();
} }
static bool EncoderAvailable(const char *encoder) static bool EncoderAvailable(const char *encoder)
@ -3496,6 +3519,15 @@ void OBSBasicSettings::SimpleStreamingEncoderChanged()
#define ESTIMATE_UNKNOWN_STR \ #define ESTIMATE_UNKNOWN_STR \
"Basic.Settings.Output.ReplayBuffer.EstimateUnknown" "Basic.Settings.Output.ReplayBuffer.EstimateUnknown"
void OBSBasicSettings::UpdateAutomaticReplayBufferCheckboxes()
{
bool state = ui->simpleReplayBuf->isChecked() &&
ui->outputMode->currentIndex() == 0;
ui->replayWhileStreaming->setEnabled(state);
ui->keepReplayStreamStops->setEnabled(state &&
ui->replayWhileStreaming->isChecked());
}
void OBSBasicSettings::SimpleReplayBufferChanged() void OBSBasicSettings::SimpleReplayBufferChanged()
{ {
QString qual = ui->simpleOutRecQuality->currentData().toString(); QString qual = ui->simpleOutRecQuality->currentData().toString();
@ -3523,6 +3555,9 @@ void OBSBasicSettings::SimpleReplayBufferChanged()
ui->replayBufferGroupBox->setVisible(!lossless && replayBufferEnabled); ui->replayBufferGroupBox->setVisible(!lossless && replayBufferEnabled);
ui->simpleReplayBuf->setVisible(!lossless); ui->simpleReplayBuf->setVisible(!lossless);
UpdateAutomaticReplayBufferCheckboxes();
} }
#define SIMPLE_OUTPUT_WARNING(str) \ #define SIMPLE_OUTPUT_WARNING(str) \

View File

@ -284,6 +284,8 @@ private slots:
void UpdateStreamDelayEstimate(); void UpdateStreamDelayEstimate();
void UpdateAutomaticReplayBufferCheckboxes();
void AdvOutRecCheckWarnings(); void AdvOutRecCheckWarnings();
void SimpleRecordingQualityChanged(); void SimpleRecordingQualityChanged();