mirror of
https://github.com/obsproject/obs-studio.git
synced 2026-01-22 05:08:37 -05:00
UI: Separate controls dock from the main window
This commit is contained in:
@@ -47,6 +47,7 @@
|
||||
#include "platform.hpp"
|
||||
#include "visibility-item-widget.hpp"
|
||||
#include "item-widget-helpers.hpp"
|
||||
#include "basic-controls.hpp"
|
||||
#include "window-basic-settings.hpp"
|
||||
#include "window-namedialog.hpp"
|
||||
#include "window-basic-auto-config.hpp"
|
||||
@@ -332,13 +333,6 @@ OBSBasic::OBSBasic(QWidget *parent)
|
||||
|
||||
ui->setupUi(this);
|
||||
ui->previewDisabledWidget->setVisible(false);
|
||||
ui->broadcastButton->setVisible(false);
|
||||
|
||||
/* Setup Studio Mode button connections */
|
||||
connect(this, &OBSBasic::PreviewProgramModeChanged, ui->modeSwitch,
|
||||
&QAbstractButton::setChecked);
|
||||
connect(ui->modeSwitch, &QAbstractButton::clicked, this,
|
||||
&OBSBasic::TogglePreviewProgramMode);
|
||||
|
||||
/* Set up streaming connections */
|
||||
connect(
|
||||
@@ -378,6 +372,52 @@ OBSBasic::OBSBasic(QWidget *parent)
|
||||
},
|
||||
Qt::DirectConnection);
|
||||
|
||||
/* Add controls dock */
|
||||
OBSBasicControls *controls = new OBSBasicControls(this);
|
||||
controlsDock = new OBSDock(this);
|
||||
controlsDock->setObjectName(QString::fromUtf8("controlsDock"));
|
||||
controlsDock->setWindowTitle(QTStr("Basic.Main.Controls"));
|
||||
/* Parenting is done there so controls will be deleted alongside controlsDock */
|
||||
controlsDock->setWidget(controls);
|
||||
addDockWidget(Qt::BottomDockWidgetArea, controlsDock);
|
||||
|
||||
connect(controls, &OBSBasicControls::StreamButtonClicked, this,
|
||||
&OBSBasic::StreamActionTriggered);
|
||||
|
||||
connect(controls, &OBSBasicControls::StartStreamMenuActionClicked, this,
|
||||
&OBSBasic::StartStreaming);
|
||||
connect(controls, &OBSBasicControls::StopStreamMenuActionClicked, this,
|
||||
&OBSBasic::StopStreaming);
|
||||
connect(controls, &OBSBasicControls::ForceStopStreamMenuActionClicked,
|
||||
this, &OBSBasic::ForceStopStreaming);
|
||||
|
||||
connect(controls, &OBSBasicControls::BroadcastButtonClicked, this,
|
||||
&OBSBasic::BroadcastButtonClicked);
|
||||
|
||||
connect(controls, &OBSBasicControls::RecordButtonClicked, this,
|
||||
&OBSBasic::RecordActionTriggered);
|
||||
connect(controls, &OBSBasicControls::PauseRecordButtonClicked, this,
|
||||
&OBSBasic::RecordPauseToggled);
|
||||
|
||||
connect(controls, &OBSBasicControls::ReplayBufferButtonClicked, this,
|
||||
&OBSBasic::ReplayBufferActionTriggered);
|
||||
connect(controls, &OBSBasicControls::SaveReplayBufferButtonClicked,
|
||||
this, &OBSBasic::ReplayBufferSave);
|
||||
|
||||
connect(controls, &OBSBasicControls::VirtualCamButtonClicked, this,
|
||||
&OBSBasic::VirtualCamActionTriggered);
|
||||
connect(controls, &OBSBasicControls::VirtualCamConfigButtonClicked,
|
||||
this, &OBSBasic::OpenVirtualCamConfig);
|
||||
|
||||
connect(controls, &OBSBasicControls::StudioModeButtonClicked, this,
|
||||
&OBSBasic::TogglePreviewProgramMode);
|
||||
|
||||
connect(controls, &OBSBasicControls::SettingsButtonClicked, this,
|
||||
&OBSBasic::on_action_Settings_triggered);
|
||||
|
||||
connect(controls, &OBSBasicControls::ExitButtonClicked, this,
|
||||
&QMainWindow::close);
|
||||
|
||||
startingDockLayout = saveState();
|
||||
|
||||
statsDock = new OBSDock();
|
||||
@@ -518,7 +558,7 @@ OBSBasic::OBSBasic(QWidget *parent)
|
||||
SETUP_DOCK(ui->sourcesDock);
|
||||
SETUP_DOCK(ui->mixerDock);
|
||||
SETUP_DOCK(ui->transitionsDock);
|
||||
SETUP_DOCK(ui->controlsDock);
|
||||
SETUP_DOCK(controlsDock);
|
||||
SETUP_DOCK(statsDock);
|
||||
#undef SETUP_DOCK
|
||||
|
||||
@@ -577,9 +617,6 @@ OBSBasic::OBSBasic(QWidget *parent)
|
||||
connect(ui->scenes, &SceneTree::scenesReordered,
|
||||
[]() { OBSProjector::UpdateMultiviewProjectors(); });
|
||||
|
||||
connect(ui->broadcastButton, &QPushButton::clicked, this,
|
||||
&OBSBasic::BroadcastButtonClicked);
|
||||
|
||||
connect(App(), &OBSApp::StyleChanged, this, [this]() {
|
||||
if (api)
|
||||
api->on_event(OBS_FRONTEND_EVENT_THEME_CHANGED);
|
||||
@@ -1985,7 +2022,7 @@ void OBSBasic::InitPrimitives()
|
||||
obs_leave_graphics();
|
||||
}
|
||||
|
||||
void OBSBasic::ReplayBufferClicked()
|
||||
void OBSBasic::ReplayBufferActionTriggered()
|
||||
{
|
||||
if (outputHandler->ReplayBufferActive())
|
||||
StopReplayBuffer();
|
||||
@@ -1993,19 +2030,6 @@ void OBSBasic::ReplayBufferClicked()
|
||||
StartReplayBuffer();
|
||||
};
|
||||
|
||||
void OBSBasic::AddVCamButton()
|
||||
{
|
||||
vcamButton = new ControlsSplitButton(
|
||||
QTStr("Basic.Main.StartVirtualCam"), "vcamButton",
|
||||
&OBSBasic::VCamButtonClicked);
|
||||
vcamButton->addIcon(QTStr("Basic.Main.VirtualCamConfig"),
|
||||
QStringLiteral("configIconSmall"),
|
||||
&OBSBasic::VCamConfigButtonClicked);
|
||||
vcamButton->insert(2);
|
||||
vcamButton->first()->setSizePolicy(QSizePolicy::Minimum,
|
||||
QSizePolicy::Minimum);
|
||||
}
|
||||
|
||||
void OBSBasic::ResetOutputs()
|
||||
{
|
||||
ProfileScope("OBSBasic::ResetOutputs");
|
||||
@@ -2019,15 +2043,7 @@ void OBSBasic::ResetOutputs()
|
||||
outputHandler.reset(advOut ? CreateAdvancedOutputHandler(this)
|
||||
: CreateSimpleOutputHandler(this));
|
||||
|
||||
delete replayBufferButton;
|
||||
|
||||
if (outputHandler->replayBuffer) {
|
||||
replayBufferButton = new ControlsSplitButton(
|
||||
QTStr("Basic.Main.StartReplayBuffer"),
|
||||
"replayBufferButton",
|
||||
&OBSBasic::ReplayBufferClicked);
|
||||
replayBufferButton->insert(2);
|
||||
}
|
||||
emit ReplayBufEnabled(outputHandler->replayBuffer);
|
||||
|
||||
if (sysTrayReplayBuffer)
|
||||
sysTrayReplayBuffer->setEnabled(
|
||||
@@ -2169,7 +2185,7 @@ void OBSBasic::OBSInit()
|
||||
vcamEnabled =
|
||||
(obs_get_output_flags(VIRTUAL_CAM_ID) & OBS_OUTPUT_VIDEO) != 0;
|
||||
if (vcamEnabled) {
|
||||
AddVCamButton();
|
||||
emit VirtualCamEnabled();
|
||||
}
|
||||
|
||||
InitBasicConfigDefaults2();
|
||||
@@ -6945,9 +6961,6 @@ void OBSBasic::DisplayStreamStartError()
|
||||
: QTStr("Output.StartFailedGeneric");
|
||||
|
||||
emit StreamingStopped();
|
||||
ui->streamButton->setText(QTStr("Basic.Main.StartStreaming"));
|
||||
ui->streamButton->setEnabled(true);
|
||||
ui->streamButton->setChecked(false);
|
||||
|
||||
if (sysTrayStream) {
|
||||
sysTrayStream->setText(QTStr("Basic.Main.StartStreaming"));
|
||||
@@ -6981,6 +6994,8 @@ void OBSBasic::YouTubeActionDialogOk(const QString &broadcast_id,
|
||||
autoStopBroadcast = autostop;
|
||||
broadcastReady = true;
|
||||
|
||||
emit BroadcastStreamReady(broadcastReady);
|
||||
|
||||
if (start_now)
|
||||
QMetaObject::invokeMethod(this, "StartStreaming");
|
||||
}
|
||||
@@ -7023,9 +7038,7 @@ void OBSBasic::YoutubeStreamCheck(const std::string &key)
|
||||
auto item = json["items"][0];
|
||||
auto status = item["status"]["streamStatus"].string_value();
|
||||
if (status == "active") {
|
||||
QMetaObject::invokeMethod(ui->broadcastButton,
|
||||
"setEnabled",
|
||||
Q_ARG(bool, true));
|
||||
emit BroadcastStreamActive();
|
||||
break;
|
||||
} else {
|
||||
QThread::sleep(1);
|
||||
@@ -7077,8 +7090,6 @@ void OBSBasic::StartStreaming()
|
||||
|
||||
if (auth && auth->broadcastFlow()) {
|
||||
if (!broadcastActive && !broadcastReady) {
|
||||
ui->streamButton->setChecked(false);
|
||||
|
||||
QMessageBox no_broadcast(this);
|
||||
no_broadcast.setText(QTStr("Output.NoBroadcast.Text"));
|
||||
QPushButton *SetupBroadcast = no_broadcast.addButton(
|
||||
@@ -7099,16 +7110,12 @@ void OBSBasic::StartStreaming()
|
||||
}
|
||||
}
|
||||
|
||||
emit StreamingStarting();
|
||||
ui->streamButton->setEnabled(false);
|
||||
ui->streamButton->setChecked(false);
|
||||
ui->broadcastButton->setChecked(false);
|
||||
if (sysTrayStream)
|
||||
sysTrayStream->setEnabled(false);
|
||||
emit StreamingPreparing();
|
||||
|
||||
ui->streamButton->setText("Basic.Main.PreparingStream");
|
||||
if (sysTrayStream)
|
||||
if (sysTrayStream) {
|
||||
sysTrayStream->setEnabled(false);
|
||||
sysTrayStream->setText("Basic.Main.PreparingStream");
|
||||
}
|
||||
|
||||
auto holder = outputHandler->SetupStreaming(service);
|
||||
auto future = holder.future.then(this, [&](bool setupStreamingResult) {
|
||||
@@ -7122,7 +7129,8 @@ void OBSBasic::StartStreaming()
|
||||
|
||||
SaveProject();
|
||||
|
||||
ui->streamButton->setText("Basic.Main.Connecting");
|
||||
emit StreamingStarting(autoStartBroadcast);
|
||||
|
||||
if (sysTrayStream)
|
||||
sysTrayStream->setText("Basic.Main.Connecting");
|
||||
|
||||
@@ -7131,32 +7139,8 @@ void OBSBasic::StartStreaming()
|
||||
return;
|
||||
}
|
||||
|
||||
if (!autoStartBroadcast) {
|
||||
ui->broadcastButton->setText(
|
||||
QTStr("Basic.Main.StartBroadcast"));
|
||||
ui->broadcastButton->setProperty("broadcastState",
|
||||
"ready");
|
||||
ui->broadcastButton->style()->unpolish(
|
||||
ui->broadcastButton);
|
||||
ui->broadcastButton->style()->polish(
|
||||
ui->broadcastButton);
|
||||
// well, we need to disable button while stream is not active
|
||||
ui->broadcastButton->setEnabled(false);
|
||||
} else {
|
||||
if (!autoStopBroadcast) {
|
||||
ui->broadcastButton->setText(
|
||||
QTStr("Basic.Main.StopBroadcast"));
|
||||
} else {
|
||||
ui->broadcastButton->setText(
|
||||
QTStr("Basic.Main.AutoStopEnabled"));
|
||||
ui->broadcastButton->setEnabled(false);
|
||||
}
|
||||
ui->broadcastButton->setProperty("broadcastState",
|
||||
"active");
|
||||
ui->broadcastButton->style()->unpolish(
|
||||
ui->broadcastButton);
|
||||
ui->broadcastButton->style()->polish(
|
||||
ui->broadcastButton);
|
||||
if (autoStartBroadcast) {
|
||||
emit BroadcastStreamStarted(autoStopBroadcast);
|
||||
broadcastActive = true;
|
||||
}
|
||||
|
||||
@@ -7185,8 +7169,6 @@ void OBSBasic::BroadcastButtonClicked()
|
||||
if (!broadcastReady ||
|
||||
(!broadcastActive && !outputHandler->StreamingActive())) {
|
||||
SetupBroadcast();
|
||||
if (broadcastReady)
|
||||
ui->broadcastButton->setChecked(true);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -7210,7 +7192,6 @@ void OBSBasic::BroadcastButtonClicked()
|
||||
this,
|
||||
QTStr("Output.BroadcastStartFailed"),
|
||||
last_error, true);
|
||||
ui->broadcastButton->setChecked(false);
|
||||
return;
|
||||
}
|
||||
}
|
||||
@@ -7218,18 +7199,7 @@ void OBSBasic::BroadcastButtonClicked()
|
||||
broadcastActive = true;
|
||||
autoStartBroadcast = true; // and clear the flag
|
||||
|
||||
if (!autoStopBroadcast) {
|
||||
ui->broadcastButton->setText(
|
||||
QTStr("Basic.Main.StopBroadcast"));
|
||||
} else {
|
||||
ui->broadcastButton->setText(
|
||||
QTStr("Basic.Main.AutoStopEnabled"));
|
||||
ui->broadcastButton->setEnabled(false);
|
||||
}
|
||||
|
||||
ui->broadcastButton->setProperty("broadcastState", "active");
|
||||
ui->broadcastButton->style()->unpolish(ui->broadcastButton);
|
||||
ui->broadcastButton->style()->polish(ui->broadcastButton);
|
||||
emit BroadcastStreamStarted(autoStopBroadcast);
|
||||
} else if (!autoStopBroadcast) {
|
||||
#ifdef YOUTUBE_ENABLED
|
||||
bool confirm = config_get_bool(GetGlobalConfig(), "BasicWindow",
|
||||
@@ -7241,10 +7211,8 @@ void OBSBasic::BroadcastButtonClicked()
|
||||
QMessageBox::Yes | QMessageBox::No,
|
||||
QMessageBox::No);
|
||||
|
||||
if (button == QMessageBox::No) {
|
||||
ui->broadcastButton->setChecked(true);
|
||||
if (button == QMessageBox::No)
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
std::shared_ptr<YoutubeApiWrappers> ytAuth =
|
||||
@@ -7273,19 +7241,14 @@ void OBSBasic::BroadcastButtonClicked()
|
||||
|
||||
autoStopBroadcast = true;
|
||||
QMetaObject::invokeMethod(this, "StopStreaming");
|
||||
emit BroadcastStreamReady(broadcastReady);
|
||||
SetBroadcastFlowEnabled(true);
|
||||
}
|
||||
}
|
||||
|
||||
void OBSBasic::SetBroadcastFlowEnabled(bool enabled)
|
||||
{
|
||||
ui->broadcastButton->setEnabled(enabled);
|
||||
ui->broadcastButton->setVisible(enabled);
|
||||
ui->broadcastButton->setChecked(broadcastReady);
|
||||
ui->broadcastButton->setProperty("broadcastState", "idle");
|
||||
ui->broadcastButton->style()->unpolish(ui->broadcastButton);
|
||||
ui->broadcastButton->style()->polish(ui->broadcastButton);
|
||||
ui->broadcastButton->setText(QTStr("Basic.Main.SetupBroadcast"));
|
||||
emit BroadcastFlowEnabled(enabled);
|
||||
}
|
||||
|
||||
void OBSBasic::SetupBroadcast()
|
||||
@@ -7296,11 +7259,7 @@ void OBSBasic::SetupBroadcast()
|
||||
OBSYoutubeActions dialog(this, auth, broadcastReady);
|
||||
connect(&dialog, &OBSYoutubeActions::ok, this,
|
||||
&OBSBasic::YouTubeActionDialogOk);
|
||||
int result = dialog.Valid() ? dialog.exec() : QDialog::Rejected;
|
||||
if (result != QDialog::Accepted) {
|
||||
if (!broadcastReady)
|
||||
ui->broadcastButton->setChecked(false);
|
||||
}
|
||||
dialog.exec();
|
||||
}
|
||||
#endif
|
||||
}
|
||||
@@ -7433,6 +7392,8 @@ void OBSBasic::StopStreaming()
|
||||
broadcastReady = false;
|
||||
}
|
||||
|
||||
emit BroadcastStreamReady(broadcastReady);
|
||||
|
||||
OnDeactivate();
|
||||
|
||||
bool recordWhenStreaming = config_get_bool(
|
||||
@@ -7473,6 +7434,8 @@ void OBSBasic::ForceStopStreaming()
|
||||
broadcastReady = false;
|
||||
}
|
||||
|
||||
emit BroadcastStreamReady(broadcastReady);
|
||||
|
||||
OnDeactivate();
|
||||
|
||||
bool recordWhenStreaming = config_get_bool(
|
||||
@@ -7494,26 +7457,13 @@ void OBSBasic::ForceStopStreaming()
|
||||
|
||||
void OBSBasic::StreamDelayStarting(int sec)
|
||||
{
|
||||
emit StreamingStarted();
|
||||
ui->streamButton->setText(QTStr("Basic.Main.StopStreaming"));
|
||||
ui->streamButton->setEnabled(true);
|
||||
ui->streamButton->setChecked(true);
|
||||
emit StreamingStarted(true);
|
||||
|
||||
if (sysTrayStream) {
|
||||
sysTrayStream->setText(QTStr("Basic.Main.StopStreaming"));
|
||||
sysTrayStream->setEnabled(true);
|
||||
}
|
||||
|
||||
if (!startStreamMenu.isNull())
|
||||
startStreamMenu->deleteLater();
|
||||
|
||||
startStreamMenu = new QMenu();
|
||||
startStreamMenu->addAction(QTStr("Basic.Main.StopStreaming"), this,
|
||||
&OBSBasic::StopStreaming);
|
||||
startStreamMenu->addAction(QTStr("Basic.Main.ForceStopStreaming"), this,
|
||||
&OBSBasic::ForceStopStreaming);
|
||||
ui->streamButton->setMenu(startStreamMenu);
|
||||
|
||||
ui->statusbar->StreamDelayStarting(sec);
|
||||
|
||||
OnActivate();
|
||||
@@ -7521,26 +7471,13 @@ void OBSBasic::StreamDelayStarting(int sec)
|
||||
|
||||
void OBSBasic::StreamDelayStopping(int sec)
|
||||
{
|
||||
emit StreamingStopped();
|
||||
ui->streamButton->setText(QTStr("Basic.Main.StartStreaming"));
|
||||
ui->streamButton->setEnabled(true);
|
||||
ui->streamButton->setChecked(false);
|
||||
emit StreamingStopped(true);
|
||||
|
||||
if (sysTrayStream) {
|
||||
sysTrayStream->setText(QTStr("Basic.Main.StartStreaming"));
|
||||
sysTrayStream->setEnabled(true);
|
||||
}
|
||||
|
||||
if (!startStreamMenu.isNull())
|
||||
startStreamMenu->deleteLater();
|
||||
|
||||
startStreamMenu = new QMenu();
|
||||
startStreamMenu->addAction(QTStr("Basic.Main.StartStreaming"), this,
|
||||
&OBSBasic::StartStreaming);
|
||||
startStreamMenu->addAction(QTStr("Basic.Main.ForceStopStreaming"), this,
|
||||
&OBSBasic::ForceStopStreaming);
|
||||
ui->streamButton->setMenu(startStreamMenu);
|
||||
|
||||
ui->statusbar->StreamDelayStopping(sec);
|
||||
|
||||
if (api)
|
||||
@@ -7551,10 +7488,6 @@ void OBSBasic::StreamingStart()
|
||||
{
|
||||
emit StreamingStarted();
|
||||
OBSOutputAutoRelease output = obs_frontend_get_streaming_output();
|
||||
|
||||
ui->streamButton->setText(QTStr("Basic.Main.StopStreaming"));
|
||||
ui->streamButton->setEnabled(true);
|
||||
ui->streamButton->setChecked(true);
|
||||
ui->statusbar->StreamStarted(output);
|
||||
|
||||
if (sysTrayStream) {
|
||||
@@ -7594,7 +7527,7 @@ void OBSBasic::StreamingStart()
|
||||
|
||||
void OBSBasic::StreamStopping()
|
||||
{
|
||||
ui->streamButton->setText(QTStr("Basic.Main.StoppingStreaming"));
|
||||
emit StreamingStopping();
|
||||
|
||||
if (sysTrayStream)
|
||||
sysTrayStream->setText(QTStr("Basic.Main.StoppingStreaming"));
|
||||
@@ -7655,9 +7588,6 @@ void OBSBasic::StreamingStop(int code, QString last_error)
|
||||
ui->statusbar->StreamStopped();
|
||||
|
||||
emit StreamingStopped();
|
||||
ui->streamButton->setText(QTStr("Basic.Main.StartStreaming"));
|
||||
ui->streamButton->setEnabled(true);
|
||||
ui->streamButton->setChecked(false);
|
||||
|
||||
if (sysTrayStream) {
|
||||
sysTrayStream->setText(QTStr("Basic.Main.StartStreaming"));
|
||||
@@ -7696,12 +7626,6 @@ void OBSBasic::StreamingStop(int code, QString last_error)
|
||||
QSystemTrayIcon::Warning);
|
||||
}
|
||||
|
||||
if (!startStreamMenu.isNull()) {
|
||||
ui->streamButton->setMenu(nullptr);
|
||||
startStreamMenu->deleteLater();
|
||||
startStreamMenu = nullptr;
|
||||
}
|
||||
|
||||
// Reset broadcast button state/text
|
||||
if (!broadcastActive)
|
||||
SetBroadcastFlowEnabled(auth && auth->broadcastFlow());
|
||||
@@ -7796,13 +7720,11 @@ void OBSBasic::StartRecording()
|
||||
|
||||
if (!OutputPathValid()) {
|
||||
OutputPathInvalidMessage();
|
||||
ui->recordButton->setChecked(false);
|
||||
return;
|
||||
}
|
||||
|
||||
if (!IsFFmpegOutputToURL() && LowDiskSpace()) {
|
||||
DiskSpaceMessage();
|
||||
ui->recordButton->setChecked(false);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -7811,13 +7733,12 @@ void OBSBasic::StartRecording()
|
||||
|
||||
SaveProject();
|
||||
|
||||
if (!outputHandler->StartRecording())
|
||||
ui->recordButton->setChecked(false);
|
||||
outputHandler->StartRecording();
|
||||
}
|
||||
|
||||
void OBSBasic::RecordStopping()
|
||||
{
|
||||
ui->recordButton->setText(QTStr("Basic.Main.StoppingRecording"));
|
||||
emit RecordingStopping();
|
||||
|
||||
if (sysTrayRecord)
|
||||
sysTrayRecord->setText(QTStr("Basic.Main.StoppingRecording"));
|
||||
@@ -7840,9 +7761,7 @@ void OBSBasic::StopRecording()
|
||||
void OBSBasic::RecordingStart()
|
||||
{
|
||||
ui->statusbar->RecordingStarted(outputHandler->fileOutput);
|
||||
emit RecordingStarted();
|
||||
ui->recordButton->setText(QTStr("Basic.Main.StopRecording"));
|
||||
ui->recordButton->setChecked(true);
|
||||
emit RecordingStarted(isRecordingPausable);
|
||||
|
||||
if (sysTrayRecord)
|
||||
sysTrayRecord->setText(QTStr("Basic.Main.StopRecording"));
|
||||
@@ -7855,7 +7774,6 @@ void OBSBasic::RecordingStart()
|
||||
diskFullTimer->start(1000);
|
||||
|
||||
OnActivate();
|
||||
UpdatePause();
|
||||
|
||||
blog(LOG_INFO, RECORDING_START);
|
||||
}
|
||||
@@ -7864,8 +7782,6 @@ void OBSBasic::RecordingStop(int code, QString last_error)
|
||||
{
|
||||
ui->statusbar->RecordingStopped();
|
||||
emit RecordingStopped();
|
||||
ui->recordButton->setText(QTStr("Basic.Main.StartRecording"));
|
||||
ui->recordButton->setChecked(false);
|
||||
|
||||
if (sysTrayRecord)
|
||||
sysTrayRecord->setText(QTStr("Basic.Main.StartRecording"));
|
||||
@@ -7935,7 +7851,6 @@ void OBSBasic::RecordingStop(int code, QString last_error)
|
||||
AutoRemux(outputHandler->lastRecordingPath.c_str());
|
||||
|
||||
OnDeactivate();
|
||||
UpdatePause(false);
|
||||
}
|
||||
|
||||
void OBSBasic::RecordingFileChanged(QString lastRecordingPath)
|
||||
@@ -7986,20 +7901,16 @@ void OBSBasic::StartReplayBuffer()
|
||||
if (disableOutputsRef)
|
||||
return;
|
||||
|
||||
if (!UIValidation::NoSourcesConfirmation(this)) {
|
||||
replayBufferButton->first()->setChecked(false);
|
||||
if (!UIValidation::NoSourcesConfirmation(this))
|
||||
return;
|
||||
}
|
||||
|
||||
if (!OutputPathValid()) {
|
||||
OutputPathInvalidMessage();
|
||||
replayBufferButton->first()->setChecked(false);
|
||||
return;
|
||||
}
|
||||
|
||||
if (LowDiskSpace()) {
|
||||
DiskSpaceMessage();
|
||||
replayBufferButton->first()->setChecked(false);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -8008,9 +7919,8 @@ void OBSBasic::StartReplayBuffer()
|
||||
|
||||
SaveProject();
|
||||
|
||||
if (!outputHandler->StartReplayBuffer()) {
|
||||
replayBufferButton->first()->setChecked(false);
|
||||
} else if (os_atomic_load_bool(&recording_paused)) {
|
||||
if (outputHandler->StartReplayBuffer() &&
|
||||
os_atomic_load_bool(&recording_paused)) {
|
||||
ShowReplayBufferPauseWarning();
|
||||
}
|
||||
}
|
||||
@@ -8020,8 +7930,7 @@ void OBSBasic::ReplayBufferStopping()
|
||||
if (!outputHandler || !outputHandler->replayBuffer)
|
||||
return;
|
||||
|
||||
replayBufferButton->first()->setText(
|
||||
QTStr("Basic.Main.StoppingReplayBuffer"));
|
||||
emit ReplayBufStopping();
|
||||
|
||||
if (sysTrayReplayBuffer)
|
||||
sysTrayReplayBuffer->setText(
|
||||
@@ -8050,9 +7959,7 @@ void OBSBasic::ReplayBufferStart()
|
||||
if (!outputHandler || !outputHandler->replayBuffer)
|
||||
return;
|
||||
|
||||
replayBufferButton->first()->setText(
|
||||
QTStr("Basic.Main.StopReplayBuffer"));
|
||||
replayBufferButton->first()->setChecked(true);
|
||||
emit ReplayBufStarted();
|
||||
|
||||
if (sysTrayReplayBuffer)
|
||||
sysTrayReplayBuffer->setText(
|
||||
@@ -8063,7 +7970,6 @@ void OBSBasic::ReplayBufferStart()
|
||||
api->on_event(OBS_FRONTEND_EVENT_REPLAY_BUFFER_STARTED);
|
||||
|
||||
OnActivate();
|
||||
UpdateReplayBuffer();
|
||||
|
||||
blog(LOG_INFO, REPLAY_BUFFER_START);
|
||||
}
|
||||
@@ -8111,9 +8017,7 @@ void OBSBasic::ReplayBufferStop(int code)
|
||||
if (!outputHandler || !outputHandler->replayBuffer)
|
||||
return;
|
||||
|
||||
replayBufferButton->first()->setText(
|
||||
QTStr("Basic.Main.StartReplayBuffer"));
|
||||
replayBufferButton->first()->setChecked(false);
|
||||
emit ReplayBufStopped();
|
||||
|
||||
if (sysTrayReplayBuffer)
|
||||
sysTrayReplayBuffer->setText(
|
||||
@@ -8151,7 +8055,6 @@ void OBSBasic::ReplayBufferStop(int code)
|
||||
api->on_event(OBS_FRONTEND_EVENT_REPLAY_BUFFER_STOPPED);
|
||||
|
||||
OnDeactivate();
|
||||
UpdateReplayBuffer(false);
|
||||
}
|
||||
|
||||
void OBSBasic::StartVirtualCam()
|
||||
@@ -8165,9 +8068,7 @@ void OBSBasic::StartVirtualCam()
|
||||
|
||||
SaveProject();
|
||||
|
||||
if (!outputHandler->StartVirtualCam()) {
|
||||
vcamButton->first()->setChecked(false);
|
||||
}
|
||||
outputHandler->StartVirtualCam();
|
||||
}
|
||||
|
||||
void OBSBasic::StopVirtualCam()
|
||||
@@ -8188,10 +8089,10 @@ void OBSBasic::OnVirtualCamStart()
|
||||
if (!outputHandler || !outputHandler->virtualCam)
|
||||
return;
|
||||
|
||||
vcamButton->first()->setText(QTStr("Basic.Main.StopVirtualCam"));
|
||||
emit VirtualCamStarted();
|
||||
|
||||
if (sysTrayVirtualCam)
|
||||
sysTrayVirtualCam->setText(QTStr("Basic.Main.StopVirtualCam"));
|
||||
vcamButton->first()->setChecked(true);
|
||||
|
||||
if (api)
|
||||
api->on_event(OBS_FRONTEND_EVENT_VIRTUALCAM_STARTED);
|
||||
@@ -8206,10 +8107,10 @@ void OBSBasic::OnVirtualCamStop(int)
|
||||
if (!outputHandler || !outputHandler->virtualCam)
|
||||
return;
|
||||
|
||||
vcamButton->first()->setText(QTStr("Basic.Main.StartVirtualCam"));
|
||||
emit VirtualCamStopped();
|
||||
|
||||
if (sysTrayVirtualCam)
|
||||
sysTrayVirtualCam->setText(QTStr("Basic.Main.StartVirtualCam"));
|
||||
vcamButton->first()->setChecked(false);
|
||||
|
||||
if (api)
|
||||
api->on_event(OBS_FRONTEND_EVENT_VIRTUALCAM_STOPPED);
|
||||
@@ -8226,7 +8127,7 @@ void OBSBasic::OnVirtualCamStop(int)
|
||||
QTimer::singleShot(100, this, &OBSBasic::RestartingVirtualCam);
|
||||
}
|
||||
|
||||
void OBSBasic::on_streamButton_clicked()
|
||||
void OBSBasic::StreamActionTriggered()
|
||||
{
|
||||
if (outputHandler->StreamingActive()) {
|
||||
bool confirm = config_get_bool(GetGlobalConfig(), "BasicWindow",
|
||||
@@ -8241,10 +8142,8 @@ void OBSBasic::on_streamButton_clicked()
|
||||
QMessageBox::Yes | QMessageBox::No,
|
||||
QMessageBox::No);
|
||||
|
||||
if (button == QMessageBox::No) {
|
||||
ui->streamButton->setChecked(true);
|
||||
if (button == QMessageBox::No)
|
||||
return;
|
||||
}
|
||||
|
||||
confirm = false;
|
||||
}
|
||||
@@ -8257,18 +8156,14 @@ void OBSBasic::on_streamButton_clicked()
|
||||
QMessageBox::Yes | QMessageBox::No,
|
||||
QMessageBox::No);
|
||||
|
||||
if (button == QMessageBox::No) {
|
||||
ui->streamButton->setChecked(true);
|
||||
if (button == QMessageBox::No)
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
StopStreaming();
|
||||
} else {
|
||||
if (!UIValidation::NoSourcesConfirmation(this)) {
|
||||
ui->streamButton->setChecked(false);
|
||||
if (!UIValidation::NoSourcesConfirmation(this))
|
||||
return;
|
||||
}
|
||||
|
||||
Auth *auth = GetAuth();
|
||||
|
||||
@@ -8282,10 +8177,8 @@ void OBSBasic::on_streamButton_clicked()
|
||||
break;
|
||||
case StreamSettingsAction::OpenSettings:
|
||||
on_action_Settings_triggered();
|
||||
ui->streamButton->setChecked(false);
|
||||
return;
|
||||
case StreamSettingsAction::Cancel:
|
||||
ui->streamButton->setChecked(false);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -8310,10 +8203,8 @@ void OBSBasic::on_streamButton_clicked()
|
||||
this, QTStr("ConfirmBWTest.Title"),
|
||||
QTStr("ConfirmBWTest.Text"));
|
||||
|
||||
if (button == QMessageBox::No) {
|
||||
ui->streamButton->setChecked(false);
|
||||
if (button == QMessageBox::No)
|
||||
return;
|
||||
}
|
||||
} else if (confirm && isVisible()) {
|
||||
QMessageBox::StandardButton button =
|
||||
OBSMessageBox::question(
|
||||
@@ -8322,17 +8213,15 @@ void OBSBasic::on_streamButton_clicked()
|
||||
QMessageBox::Yes | QMessageBox::No,
|
||||
QMessageBox::No);
|
||||
|
||||
if (button == QMessageBox::No) {
|
||||
ui->streamButton->setChecked(false);
|
||||
if (button == QMessageBox::No)
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
StartStreaming();
|
||||
}
|
||||
}
|
||||
|
||||
void OBSBasic::on_recordButton_clicked()
|
||||
void OBSBasic::RecordActionTriggered()
|
||||
{
|
||||
if (outputHandler->RecordingActive()) {
|
||||
bool confirm = config_get_bool(GetGlobalConfig(), "BasicWindow",
|
||||
@@ -8346,37 +8235,31 @@ void OBSBasic::on_recordButton_clicked()
|
||||
QMessageBox::Yes | QMessageBox::No,
|
||||
QMessageBox::No);
|
||||
|
||||
if (button == QMessageBox::No) {
|
||||
ui->recordButton->setChecked(true);
|
||||
if (button == QMessageBox::No)
|
||||
return;
|
||||
}
|
||||
}
|
||||
StopRecording();
|
||||
} else {
|
||||
if (!UIValidation::NoSourcesConfirmation(this)) {
|
||||
ui->recordButton->setChecked(false);
|
||||
if (!UIValidation::NoSourcesConfirmation(this))
|
||||
return;
|
||||
}
|
||||
|
||||
StartRecording();
|
||||
}
|
||||
}
|
||||
|
||||
void OBSBasic::VCamButtonClicked()
|
||||
void OBSBasic::VirtualCamActionTriggered()
|
||||
{
|
||||
if (outputHandler->VirtualCamActive()) {
|
||||
StopVirtualCam();
|
||||
} else {
|
||||
if (!UIValidation::NoSourcesConfirmation(this)) {
|
||||
vcamButton->first()->setChecked(false);
|
||||
if (!UIValidation::NoSourcesConfirmation(this))
|
||||
return;
|
||||
}
|
||||
|
||||
StartVirtualCam();
|
||||
}
|
||||
}
|
||||
|
||||
void OBSBasic::VCamConfigButtonClicked()
|
||||
void OBSBasic::OpenVirtualCamConfig()
|
||||
{
|
||||
OBSBasicVCamConfig dialog(vcamConfig, outputHandler->VirtualCamActive(),
|
||||
this);
|
||||
@@ -8440,11 +8323,6 @@ void OBSBasic::RestartingVirtualCam()
|
||||
restartingVCam = false;
|
||||
}
|
||||
|
||||
void OBSBasic::on_settingsButton_clicked()
|
||||
{
|
||||
on_action_Settings_triggered();
|
||||
}
|
||||
|
||||
void OBSBasic::on_actionHelpPortal_triggered()
|
||||
{
|
||||
QUrl url = QUrl("https://obsproject.com/help", QUrl::TolerantMode);
|
||||
@@ -9735,7 +9613,7 @@ void OBSBasic::on_resetDocks_triggered(bool force)
|
||||
|
||||
QList<QDockWidget *> docks{ui->scenesDock, ui->sourcesDock,
|
||||
ui->mixerDock, ui->transitionsDock,
|
||||
ui->controlsDock};
|
||||
controlsDock};
|
||||
|
||||
QList<int> sizes{cx22_5, cx22_5, mixerSize, cx5, cx21};
|
||||
|
||||
@@ -9743,7 +9621,7 @@ void OBSBasic::on_resetDocks_triggered(bool force)
|
||||
ui->sourcesDock->setVisible(true);
|
||||
ui->mixerDock->setVisible(true);
|
||||
ui->transitionsDock->setVisible(true);
|
||||
ui->controlsDock->setVisible(true);
|
||||
controlsDock->setVisible(true);
|
||||
statsDock->setVisible(false);
|
||||
statsDock->setFloating(true);
|
||||
|
||||
@@ -9768,7 +9646,7 @@ void OBSBasic::on_lockDocks_toggled(bool lock)
|
||||
ui->sourcesDock->setFeatures(mainFeatures);
|
||||
ui->mixerDock->setFeatures(mainFeatures);
|
||||
ui->transitionsDock->setFeatures(mainFeatures);
|
||||
ui->controlsDock->setFeatures(mainFeatures);
|
||||
controlsDock->setFeatures(mainFeatures);
|
||||
statsDock->setFeatures(features);
|
||||
|
||||
for (int i = extraDocks.size() - 1; i >= 0; i--)
|
||||
@@ -10071,13 +9949,13 @@ void OBSBasic::SystemTrayInit()
|
||||
&OBSBasic::IconActivated);
|
||||
connect(showHide, &QAction::triggered, this, &OBSBasic::ToggleShowHide);
|
||||
connect(sysTrayStream, &QAction::triggered, this,
|
||||
&OBSBasic::on_streamButton_clicked);
|
||||
&OBSBasic::StreamActionTriggered);
|
||||
connect(sysTrayRecord, &QAction::triggered, this,
|
||||
&OBSBasic::on_recordButton_clicked);
|
||||
&OBSBasic::RecordActionTriggered);
|
||||
connect(sysTrayReplayBuffer.data(), &QAction::triggered, this,
|
||||
&OBSBasic::ReplayBufferClicked);
|
||||
&OBSBasic::ReplayBufferActionTriggered);
|
||||
connect(sysTrayVirtualCam.data(), &QAction::triggered, this,
|
||||
&OBSBasic::VCamButtonClicked);
|
||||
&OBSBasic::VirtualCamActionTriggered);
|
||||
connect(exit, &QAction::triggered, this, &OBSBasic::close);
|
||||
}
|
||||
|
||||
@@ -10851,11 +10729,6 @@ void OBSBasic::PauseRecording()
|
||||
os_atomic_set_bool(&recording_paused, true);
|
||||
|
||||
emit RecordingPaused();
|
||||
pause->setAccessibleName(QTStr("Basic.Main.UnpauseRecording"));
|
||||
pause->setToolTip(QTStr("Basic.Main.UnpauseRecording"));
|
||||
pause->blockSignals(true);
|
||||
pause->setChecked(true);
|
||||
pause->blockSignals(false);
|
||||
|
||||
ui->statusbar->RecordingPaused();
|
||||
|
||||
@@ -10873,11 +10746,6 @@ void OBSBasic::PauseRecording()
|
||||
trayIconFile));
|
||||
}
|
||||
|
||||
auto replay = replayBufferButton ? replayBufferButton->second()
|
||||
: nullptr;
|
||||
if (replay)
|
||||
replay->setEnabled(false);
|
||||
|
||||
if (api)
|
||||
api->on_event(OBS_FRONTEND_EVENT_RECORDING_PAUSED);
|
||||
|
||||
@@ -10899,11 +10767,6 @@ void OBSBasic::UnpauseRecording()
|
||||
os_atomic_set_bool(&recording_paused, false);
|
||||
|
||||
emit RecordingUnpaused();
|
||||
pause->setAccessibleName(QTStr("Basic.Main.PauseRecording"));
|
||||
pause->setToolTip(QTStr("Basic.Main.PauseRecording"));
|
||||
pause->blockSignals(true);
|
||||
pause->setChecked(false);
|
||||
pause->blockSignals(false);
|
||||
|
||||
ui->statusbar->RecordingUnpaused();
|
||||
|
||||
@@ -10921,17 +10784,12 @@ void OBSBasic::UnpauseRecording()
|
||||
trayIconFile));
|
||||
}
|
||||
|
||||
auto replay = replayBufferButton ? replayBufferButton->second()
|
||||
: nullptr;
|
||||
if (replay)
|
||||
replay->setEnabled(true);
|
||||
|
||||
if (api)
|
||||
api->on_event(OBS_FRONTEND_EVENT_RECORDING_UNPAUSED);
|
||||
}
|
||||
}
|
||||
|
||||
void OBSBasic::PauseToggled()
|
||||
void OBSBasic::RecordPauseToggled()
|
||||
{
|
||||
if (!isRecordingPausable || !outputHandler ||
|
||||
!outputHandler->fileOutput)
|
||||
@@ -10973,47 +10831,6 @@ void OBSBasic::UpdateIsRecordingPausable()
|
||||
isRecordingPausable = !shared;
|
||||
}
|
||||
|
||||
void OBSBasic::UpdatePause(bool activate)
|
||||
{
|
||||
if (!activate || !outputHandler || !outputHandler->RecordingActive()) {
|
||||
pause.reset();
|
||||
return;
|
||||
}
|
||||
|
||||
if (isRecordingPausable) {
|
||||
pause.reset(new QPushButton());
|
||||
pause->setAccessibleName(QTStr("Basic.Main.PauseRecording"));
|
||||
pause->setToolTip(QTStr("Basic.Main.PauseRecording"));
|
||||
pause->setCheckable(true);
|
||||
pause->setChecked(false);
|
||||
pause->setProperty("themeID",
|
||||
QVariant(QStringLiteral("pauseIconSmall")));
|
||||
|
||||
QSizePolicy sp;
|
||||
sp.setHeightForWidth(true);
|
||||
pause->setSizePolicy(sp);
|
||||
|
||||
connect(pause.data(), &QAbstractButton::clicked, this,
|
||||
&OBSBasic::PauseToggled);
|
||||
ui->recordingLayout->addWidget(pause.data());
|
||||
} else {
|
||||
pause.reset();
|
||||
}
|
||||
}
|
||||
|
||||
void OBSBasic::UpdateReplayBuffer(bool activate)
|
||||
{
|
||||
if (!activate || !outputHandler ||
|
||||
!outputHandler->ReplayBufferActive()) {
|
||||
replayBufferButton->removeIcon();
|
||||
return;
|
||||
}
|
||||
|
||||
replayBufferButton->addIcon(QTStr("Basic.Main.SaveReplay"),
|
||||
QStringLiteral("replayIconSmall"),
|
||||
&OBSBasic::ReplayBufferSave);
|
||||
}
|
||||
|
||||
#define MBYTE (1024ULL * 1024ULL)
|
||||
#define MBYTES_LEFT_STOP_REC 50ULL
|
||||
#define MAX_BYTES_LEFT (MBYTES_LEFT_STOP_REC * MBYTE)
|
||||
|
||||
Reference in New Issue
Block a user