obs-studio/UI/ui-validation.hpp
JohannMG b78cdc910b UI: Add Start Streaming settings check on start
When we use the server error to respond to user's failing to start a
stream it is slow to return an error and unclear to the user what went
wrong. This diff introduces a simple settings check before attempting
to stream and catch and explain specific URL/key issues to the user.

In the case of preset services we check there is a Stream Key before
attempting to start a stream.

In the case of "custom" we only verify there is a URL since for some
services that's all that is required or the user may use user/password
authentication.
2019-12-11 01:50:41 -08:00

31 lines
851 B
C++

#pragma once
#include <QObject>
#include <QWidget>
#include <obs.hpp>
enum class StreamSettingsAction {
OpenSettings,
Cancel,
ContinueStream,
};
class UIValidation : public QObject {
Q_OBJECT
public:
/* Confirm video about to record or stream has sources. Shows alert
* box notifying there are no video sources Returns true if user clicks
* "Yes" Returns false if user clicks "No" */
static bool NoSourcesConfirmation(QWidget *parent);
/* Check streaming requirements, shows warning with options to open
* settings, cancel stream, or attempt connection anyways. If setup
* basics is missing in stream, explain missing fields and offer to
* open settings, cancel, or continue. Returns Continue if all
* settings are valid. */
static StreamSettingsAction
StreamSettingsConfirmation(QWidget *parent, OBSService service);
};