fix for service default data problem

This commit is contained in:
David Marsh 2024-07-18 16:06:23 +01:00
parent 89b887d8c9
commit fc2cc35ca0
2 changed files with 154 additions and 11 deletions

View File

@ -23,18 +23,34 @@ AudioTrack="Audio Track"
Server="Server"
Key="Key"
Stream="Stream"
# Errors and warnings
MainOutputNotActive="Unable to start output. \nThis output is configured to use your main encoder's output (Built-in stream), which is not currently active.\nPlease start your main encoder first."
NewVersion="New version (%1) available <a href='https://aitum.tv/download/multi/'>here</a>"
NoVerticalWarning="The Vertical plugin is not installed, or you are using an older version."
# Config dialog
SettingsMainCanvasTitle="Main Canvas"
SettingsMainCanvasDescription="You can manage your Main Canvas (the default canvas) settings here. \nPlease note that to change your Built-in Output settings, you need to do this from within the normal OBS settings."
# Output dialog
OutputName="Output Name"
NewOutputWindowTitle="Aitum Multistream: Add New Output"
NewOutputSelectService="Please select the service/site that your new output will use. If your new service isn't listed, please select \"other\"."
OtherService="Other Service"
# Twitch Output Dialog
TwitchOutput="Twitch Output"
TwitchServiceInfo="Please complete the following fields to add a new Twitch output."
TwitchServer="Twitch Server"
TwitchServerInfo="Pick your closest Twitch ingest server.\nYou can find your closest/recommended server by clicking <a href='https://help.twitch.tv/s/twitch-ingest-recommendation'>here</a>."
TwitchStreamKey="Twitch Stream Key"
TwitchStreamKeyInfo="Please enter your stream key, you can find this on your <a href='https://dashboard.twitch.tv/settings/stream'>Twitch Creator Dashboard</a>."
# YouTube Output Dialog
YouTubeOutput="YouTube Output"
YouTubeServiceInfo="Please complete the following fields to add a new YouTube output."
YouTubeServer="YouTube Server"
YouTubeServerInfo="Pick a YouTube live server. If you aren't sure which to pick, pick the first one."
YouTubeStreamKey="YouTube Stream Key"
YouTubeStreamKeyInfo="Please enter your stream key, you can find this on your <a href='https://www.youtube.com/live_dashboard'>YouTube Creator Dashboard</a>."

View File

@ -46,8 +46,8 @@ void OutputDialog::validateOutputs(QPushButton *confirmButton) {
QLabel *generateInfoLabel(std::string text) {
auto label = new QLabel;
label->setTextFormat(Qt::RichText);
label->setText(QString::fromUtf8(obs_module_text(text.c_str())));
label->setOpenExternalLinks(true);
label->setText(QString::fromUtf8(obs_module_text(text.c_str())));
label->setWordWrap(true);
label->setAlignment(Qt::AlignTop);
@ -116,6 +116,9 @@ OutputDialog::OutputDialog(QDialog *parent) : QDialog(parent) {
bfree(servicesPath);
bfree(absolutePath);
// Blank info
resetOutputs();
//
setModal(true);
setContentsMargins(0, 0, 0, 0);
@ -210,14 +213,130 @@ QWidget *OutputDialog::WizardInfoKick() {
QWidget *OutputDialog::WizardInfoYouTube() {
auto page = new QWidget(this);
auto pageLayout = new QVBoxLayout;
page->setStyleSheet("padding: 0px; margin: 0px;");
auto title = new QLabel(QString("YouTube Service page"));
// Layout
auto pageLayout = new QVBoxLayout;
pageLayout->setSpacing(12);
// Heading
auto title = new QLabel(QString::fromUtf8(obs_module_text("YouTubeServiceInfo")));
pageLayout->addWidget(title);
// Content
auto contentLayout = new QVBoxLayout;
// Confirm button - initialised here so we can set state in form input connects
auto confirmButton = generateButton(QString("Create Output"));
// Form
auto formLayout = new QFormLayout;
formLayout->setFieldGrowthPolicy(QFormLayout::AllNonFixedFieldsGrow);
formLayout->setLabelAlignment(Qt::AlignRight | Qt::AlignTrailing | Qt::AlignVCenter);
formLayout->setSpacing(12);
// Output name
auto outputNameField = new QLineEdit;
outputNameField->setText(QString::fromUtf8(obs_module_text("YouTubeOutput")));
outputNameField->setStyleSheet("padding: 4px 8px;");
connect(outputNameField, &QLineEdit::textEdited, [this, outputNameField, confirmButton] {
outputName = outputNameField->text();
validateOutputs(confirmButton);
});
formLayout->addRow(generateFormLabel("OutputName"), outputNameField);
// Server selection
auto serverSelection = new QComboBox;
serverSelection->setMinimumHeight(30);
serverSelection->setStyleSheet("padding: 4px 8px;");
connect(serverSelection, &QComboBox::currentIndexChanged, [this, serverSelection, confirmButton] {
outputServer = serverSelection->currentData().toString();
validateOutputs(confirmButton);
});
// Set default value for server
outputServer = serverSelection->currentData().toString();
auto rawOptions = getService("YouTube - RTMPS");
// turn raw options into actual selectable options
if (rawOptions != nullptr) {
auto servers = obs_data_get_array(rawOptions, "servers");
auto totalServers = obs_data_array_count(servers);
for (size_t idx = 0; idx < totalServers; idx++) {
auto item = obs_data_array_item(servers, idx);
serverSelection->addItem(obs_data_get_string(item, "name"), obs_data_get_string(item, "url"));
}
}
formLayout->addRow(generateFormLabel("YouTubeServer"), serverSelection);
// Server info
formLayout->addWidget(generateInfoLabel("YouTubeServerInfo"));
// Server key
auto outputKeyField = new QLineEdit;
outputKeyField->setStyleSheet("padding: 4px 8px;");
connect(outputKeyField, &QLineEdit::textEdited, [this, outputKeyField, confirmButton] {
outputKey = outputKeyField->text();
validateOutputs(confirmButton);
});
formLayout->addRow(generateFormLabel("YouTubeStreamKey"), outputKeyField);
// Server key info
formLayout->addWidget(generateInfoLabel("YouTubeStreamKeyInfo"));
contentLayout->addLayout(formLayout);
// spacing
auto spacer = new QSpacerItem(1, 20, QSizePolicy::Minimum, QSizePolicy::MinimumExpanding);
contentLayout->addSpacerItem(spacer);
pageLayout->addLayout(contentLayout);
// Controls
auto controlsLayout = new QHBoxLayout;
controlsLayout->setSpacing(12);
// back button
auto serviceButton = generateButton(QString("< Back"));
connect(serviceButton, &QPushButton::clicked, [this] {
stackedWidget->setCurrentIndex(0);
resetOutputs();
});
controlsLayout->addWidget(serviceButton, 0);
controlsLayout->addStretch(1);
// confirm button (initialised above so we can set state)
connect(confirmButton, &QPushButton::clicked, [this] {
acceptOutputs();
});
controlsLayout->addWidget(confirmButton, 0);
// Hook it all together
pageLayout->addLayout(controlsLayout);
page->setLayout(pageLayout);
// Defaults for when we're changed to
connect(stackedWidget, &QStackedWidget::currentChanged, [this, outputNameField, serverSelection, outputKeyField, confirmButton] {
if (stackedWidget->currentIndex() == 2) {
outputName = outputNameField->text();
outputServer = serverSelection->currentData().toString();
outputKey = outputKeyField->text();
validateOutputs(confirmButton);
}
});
return page;
}
@ -251,10 +370,6 @@ QWidget *OutputDialog::WizardInfoTwitch() {
auto page = new QWidget(this);
page->setStyleSheet("padding: 0px; margin: 0px;");
// Set defaults for this service
outputName = QString("Twitch Output");
// Layout
auto pageLayout = new QVBoxLayout;
pageLayout->setSpacing(12);
@ -277,7 +392,7 @@ QWidget *OutputDialog::WizardInfoTwitch() {
// Output name
auto outputNameField = new QLineEdit;
outputNameField->setText(outputName);
outputNameField->setText(QString::fromUtf8(obs_module_text("TwitchOutput")));
outputNameField->setStyleSheet("padding: 4px 8px;");
connect(outputNameField, &QLineEdit::textEdited, [this, outputNameField, confirmButton] {
@ -297,6 +412,7 @@ QWidget *OutputDialog::WizardInfoTwitch() {
validateOutputs(confirmButton);
});
auto rawOptions = getService("Twitch");
// turn raw options into actual selectable options
@ -310,6 +426,8 @@ QWidget *OutputDialog::WizardInfoTwitch() {
}
}
// Set default value for server
outputServer = serverSelection->currentData().toString();
formLayout->addRow(generateFormLabel("TwitchServer"), serverSelection);
@ -353,8 +471,6 @@ QWidget *OutputDialog::WizardInfoTwitch() {
controlsLayout->addStretch(1);
// confirm button (initialised above so we can set state)
validateOutputs(confirmButton);
connect(confirmButton, &QPushButton::clicked, [this] {
acceptOutputs();
});
@ -365,6 +481,17 @@ QWidget *OutputDialog::WizardInfoTwitch() {
pageLayout->addLayout(controlsLayout);
page->setLayout(pageLayout);
// Defaults for when we're changed to
connect(stackedWidget, &QStackedWidget::currentChanged, [this, outputNameField, serverSelection, outputKeyField, confirmButton] {
if (stackedWidget->currentIndex() == 5) {
blog(LOG_WARNING, "[Aitum Multistream] default outputname %s ", outputNameField->text().toUtf8().constData());
outputName = outputNameField->text();
outputServer = serverSelection->currentData().toString();
outputKey = outputKeyField->text();
validateOutputs(confirmButton);
}
});
return page;
}