mirror of
https://github.com/Aitum/obs-aitum-multistream.git
synced 2024-11-21 18:02:33 +01:00
Fix issue with server combo not picking on edit mode
This commit is contained in:
parent
c7d4dfd30d
commit
3dd93d7572
@ -93,17 +93,11 @@ QLineEdit *OutputDialog::generateOutputServerField(QPushButton *confirmButton, b
|
||||
}
|
||||
|
||||
// Helper for generating QComboBoxes for server selection
|
||||
QComboBox *OutputDialog::generateOutputServerCombo(std::string service, QPushButton *confirmButton) {
|
||||
QComboBox *OutputDialog::generateOutputServerCombo(std::string service, QPushButton *confirmButton, bool edit) {
|
||||
auto combo = new QComboBox;
|
||||
combo->setMinimumHeight(30);
|
||||
combo->setStyleSheet("padding: 4px 8px;");
|
||||
|
||||
connect(combo, &QComboBox::currentIndexChanged, [this, combo, confirmButton] {
|
||||
outputServer = combo->currentData().toString();
|
||||
validateOutputs(confirmButton);
|
||||
});
|
||||
|
||||
|
||||
auto rawOptions = getService(service);
|
||||
|
||||
// turn raw options into actual selectable options
|
||||
@ -117,8 +111,24 @@ QComboBox *OutputDialog::generateOutputServerCombo(std::string service, QPushBut
|
||||
}
|
||||
}
|
||||
|
||||
// If we're edit, look up the current value for outputServer and try to set the index
|
||||
if (edit) {
|
||||
auto selectionIndex = combo->findData(outputServer);
|
||||
// blog(LOG_WARNING, "[Aitum Multistream] edit selection %i for value %s", selectionIndex, outputServer.toStdString().c_str());
|
||||
if (selectionIndex != -1) {
|
||||
combo->setCurrentIndex(selectionIndex);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// Hook event up after
|
||||
connect(combo, &QComboBox::currentIndexChanged, [this, combo, confirmButton] {
|
||||
outputServer = combo->currentData().toString();
|
||||
validateOutputs(confirmButton);
|
||||
});
|
||||
|
||||
// Set default value for server
|
||||
outputServer = combo->currentData().toString();
|
||||
// outputServer = combo->currentData().toString();
|
||||
|
||||
return combo;
|
||||
}
|
||||
@ -525,12 +535,6 @@ QWidget *OutputDialog::WizardInfoYouTube(bool edit) {
|
||||
// Edit changes
|
||||
if (edit) {
|
||||
outputNameField->setText(outputName);
|
||||
|
||||
auto selectionIndex = serverSelection->findData(outputServer);
|
||||
if (selectionIndex != -1) {
|
||||
serverSelection->setCurrentIndex(selectionIndex);
|
||||
}
|
||||
|
||||
outputKeyField->setText(outputKey);
|
||||
}
|
||||
|
||||
@ -630,12 +634,6 @@ QWidget *OutputDialog::WizardInfoTwitter(bool edit) {
|
||||
// Edit changes
|
||||
if (edit) {
|
||||
outputNameField->setText(outputName);
|
||||
|
||||
auto selectionIndex = serverSelection->findData(outputServer);
|
||||
if (selectionIndex != -1) {
|
||||
serverSelection->setCurrentIndex(selectionIndex);
|
||||
}
|
||||
|
||||
outputKeyField->setText(outputKey);
|
||||
}
|
||||
|
||||
@ -773,7 +771,7 @@ QWidget *OutputDialog::WizardInfoTwitch(bool edit) {
|
||||
formLayout->addRow(generateFormLabel("OutputName"), outputNameField);
|
||||
|
||||
// Server selection
|
||||
auto serverSelection = generateOutputServerCombo("Twitch", confirmButton);
|
||||
auto serverSelection = generateOutputServerCombo("Twitch", confirmButton, edit);
|
||||
formLayout->addRow(generateFormLabel("TwitchServer"), serverSelection);
|
||||
|
||||
// Server info
|
||||
@ -838,12 +836,6 @@ QWidget *OutputDialog::WizardInfoTwitch(bool edit) {
|
||||
// Edit changes
|
||||
if (edit) {
|
||||
outputNameField->setText(outputName);
|
||||
|
||||
auto selectionIndex = serverSelection->findData(outputServer);
|
||||
if (selectionIndex != -1) {
|
||||
serverSelection->setCurrentIndex(selectionIndex);
|
||||
}
|
||||
|
||||
outputKeyField->setText(outputKey);
|
||||
}
|
||||
|
||||
|
@ -45,7 +45,7 @@ private:
|
||||
// Generators
|
||||
QLineEdit *generateOutputNameField(std::string text, QPushButton *confirmButton);
|
||||
QLineEdit *generateOutputServerField(QPushButton *confirmButton, bool locked);
|
||||
QComboBox *generateOutputServerCombo(std::string service, QPushButton *confirmButton);
|
||||
QComboBox *generateOutputServerCombo(std::string service, QPushButton *confirmButton, bool edit = false);
|
||||
QLineEdit *generateOutputKeyField(QPushButton *confirmButton);
|
||||
|
||||
obs_data_t *getService(std::string serviceName);
|
||||
|
Loading…
Reference in New Issue
Block a user