mirror of
https://github.com/Aitum/obs-aitum-multistream.git
synced 2024-11-22 02:12:40 +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
|
// 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;
|
auto combo = new QComboBox;
|
||||||
combo->setMinimumHeight(30);
|
combo->setMinimumHeight(30);
|
||||||
combo->setStyleSheet("padding: 4px 8px;");
|
combo->setStyleSheet("padding: 4px 8px;");
|
||||||
|
|
||||||
connect(combo, &QComboBox::currentIndexChanged, [this, combo, confirmButton] {
|
|
||||||
outputServer = combo->currentData().toString();
|
|
||||||
validateOutputs(confirmButton);
|
|
||||||
});
|
|
||||||
|
|
||||||
|
|
||||||
auto rawOptions = getService(service);
|
auto rawOptions = getService(service);
|
||||||
|
|
||||||
// turn raw options into actual selectable options
|
// 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
|
// Set default value for server
|
||||||
outputServer = combo->currentData().toString();
|
// outputServer = combo->currentData().toString();
|
||||||
|
|
||||||
return combo;
|
return combo;
|
||||||
}
|
}
|
||||||
@ -525,12 +535,6 @@ QWidget *OutputDialog::WizardInfoYouTube(bool edit) {
|
|||||||
// Edit changes
|
// Edit changes
|
||||||
if (edit) {
|
if (edit) {
|
||||||
outputNameField->setText(outputName);
|
outputNameField->setText(outputName);
|
||||||
|
|
||||||
auto selectionIndex = serverSelection->findData(outputServer);
|
|
||||||
if (selectionIndex != -1) {
|
|
||||||
serverSelection->setCurrentIndex(selectionIndex);
|
|
||||||
}
|
|
||||||
|
|
||||||
outputKeyField->setText(outputKey);
|
outputKeyField->setText(outputKey);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -630,12 +634,6 @@ QWidget *OutputDialog::WizardInfoTwitter(bool edit) {
|
|||||||
// Edit changes
|
// Edit changes
|
||||||
if (edit) {
|
if (edit) {
|
||||||
outputNameField->setText(outputName);
|
outputNameField->setText(outputName);
|
||||||
|
|
||||||
auto selectionIndex = serverSelection->findData(outputServer);
|
|
||||||
if (selectionIndex != -1) {
|
|
||||||
serverSelection->setCurrentIndex(selectionIndex);
|
|
||||||
}
|
|
||||||
|
|
||||||
outputKeyField->setText(outputKey);
|
outputKeyField->setText(outputKey);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -773,7 +771,7 @@ QWidget *OutputDialog::WizardInfoTwitch(bool edit) {
|
|||||||
formLayout->addRow(generateFormLabel("OutputName"), outputNameField);
|
formLayout->addRow(generateFormLabel("OutputName"), outputNameField);
|
||||||
|
|
||||||
// Server selection
|
// Server selection
|
||||||
auto serverSelection = generateOutputServerCombo("Twitch", confirmButton);
|
auto serverSelection = generateOutputServerCombo("Twitch", confirmButton, edit);
|
||||||
formLayout->addRow(generateFormLabel("TwitchServer"), serverSelection);
|
formLayout->addRow(generateFormLabel("TwitchServer"), serverSelection);
|
||||||
|
|
||||||
// Server info
|
// Server info
|
||||||
@ -838,12 +836,6 @@ QWidget *OutputDialog::WizardInfoTwitch(bool edit) {
|
|||||||
// Edit changes
|
// Edit changes
|
||||||
if (edit) {
|
if (edit) {
|
||||||
outputNameField->setText(outputName);
|
outputNameField->setText(outputName);
|
||||||
|
|
||||||
auto selectionIndex = serverSelection->findData(outputServer);
|
|
||||||
if (selectionIndex != -1) {
|
|
||||||
serverSelection->setCurrentIndex(selectionIndex);
|
|
||||||
}
|
|
||||||
|
|
||||||
outputKeyField->setText(outputKey);
|
outputKeyField->setText(outputKey);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -45,7 +45,7 @@ private:
|
|||||||
// Generators
|
// Generators
|
||||||
QLineEdit *generateOutputNameField(std::string text, QPushButton *confirmButton);
|
QLineEdit *generateOutputNameField(std::string text, QPushButton *confirmButton);
|
||||||
QLineEdit *generateOutputServerField(QPushButton *confirmButton, bool locked);
|
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);
|
QLineEdit *generateOutputKeyField(QPushButton *confirmButton);
|
||||||
|
|
||||||
obs_data_t *getService(std::string serviceName);
|
obs_data_t *getService(std::string serviceName);
|
||||||
|
Loading…
Reference in New Issue
Block a user