Skip to content

Commit 5414d37

Browse files
committed
UI: Pre-stream wizard show & hide button correctly
Show pre-stream wizard only when in simple mode since it only operates on simple mode for now. Later, will look into expanding capability. Additionally, fix a bug where was making a copy of a QPair instead of creating a reference so settings were not being written.
1 parent b191c7c commit 5414d37

File tree

6 files changed

+17
-40
lines changed

6 files changed

+17
-40
lines changed

UI/common-settings.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
#include "audio-encoders.hpp"
44

5-
static bool IsAdvancedMode(config_t *config)
5+
bool CommonSettings::IsAdvancedMode(config_t *config)
66
{
77
const char *outputMode = config_get_string(config, "Output", "Mode");
88
return (strcmp(outputMode, "Advanced") == 0);

UI/common-settings.hpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
class CommonSettings {
1111

1212
public:
13+
static bool IsAdvancedMode(config_t *config);
1314
/* Shared Utility Functions --------------------------*/
1415
static OBSData GetDataFromJsonFile(const char *jsonFile);
1516

UI/pre-stream-wizard/page-select-settings.cpp

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
#include <QSpacerItem>
44
#include <QPushButton>
55
#include <QDesktopServices>
6-
#include <QDebug>
76
#include <QVariant>
87
#include <QPair>
98

@@ -167,8 +166,7 @@ void SelectionPage::setSettingsMap(QSharedPointer<SettingsMap> settingsMap)
167166
QVariant data =
168167
mapInfo->value(SettingsResponseKeys.streamBufferSize)
169168
.first;
170-
QString bufferSizeString =
171-
QString::number(data.toInt()) + " Kb";
169+
QString bufferSizeString = QString::number(data.toInt()) + "Kb";
172170
addRow(QTStr("Basic.Settings.Output.Mode.StreamBuffer"),
173171
bufferSizeString, SettingsResponseKeys.streamBufferSize);
174172
}
@@ -192,12 +190,11 @@ void SelectionPage::checkboxRowChanged(const char *propertyKey, bool selected)
192190
}
193191

194192
SettingsMap *mapInfo = settingsMap_.data();
195-
196193
if (mapInfo == nullptr || !mapInfo->contains(propertyKey)) {
197194
return;
198195
}
199196

200-
QPair dataPair = mapInfo->value(propertyKey);
197+
QPair<QVariant, bool> &dataPair = (*mapInfo)[propertyKey];
201198
dataPair.second = selected;
202199
}
203200

UI/streaming-settings-util.cpp

Lines changed: 4 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -5,34 +5,6 @@
55

66
#include <QPair>
77

8-
/*
9-
We are detecting the stream settings so if they're using a large canvas but
10-
already have the rescaler on, they will be streaming correctly.
11-
*/
12-
void UpdateStreamingResolution(int *resolutionXY, bool isRescaled,
13-
config_t *config)
14-
{
15-
16-
// If scaled, that's the stream resolution sent to servers
17-
if (isRescaled) {
18-
// Only use if there is a resolution in text
19-
const char *rescaleRes =
20-
config_get_string(config, "AdvOut", "RescaleRes");
21-
if (rescaleRes && *rescaleRes) {
22-
int count = sscanf(rescaleRes, "%ux%u",
23-
&resolutionXY[0], &resolutionXY[1]);
24-
// If text was valid, exit
25-
if (count == 2) {
26-
return;
27-
}
28-
}
29-
}
30-
31-
// Resolution is not rescaled, use "output resolution" from video tab
32-
resolutionXY[0] = (int)config_get_uint(config, "Video", "OutputCX");
33-
resolutionXY[1] = (int)config_get_uint(config, "Video", "OutputCY");
34-
};
35-
368
QSharedPointer<StreamWizard::EncoderSettingsRequest>
379
StreamingSettingsUtility::makeEncoderSettingsFromCurrentState(config_t *config)
3810
{
@@ -45,11 +17,10 @@ StreamingSettingsUtility::makeEncoderSettingsFromCurrentState(config_t *config)
4517
// only live and rmpts is supported for now
4618
currentSettings->protocol = StreamWizard::StreamProtocol::rtmps;
4719
/* Video */
48-
bool isRescaled = config_get_bool(config, "AdvOut", "Rescale");
49-
int resolutionXY[2] = {0, 0};
50-
UpdateStreamingResolution(resolutionXY, isRescaled, config);
51-
currentSettings->videoWidth = resolutionXY[0];
52-
currentSettings->videoHeight = resolutionXY[1];
20+
currentSettings->videoWidth =
21+
(int)config_get_uint(config, "Video", "OutputCX");
22+
currentSettings->videoHeight =
23+
(int)config_get_uint(config, "Video", "OutputCY");
5324
currentSettings->framerate = CommonSettings::GetConfigFPSDouble(config);
5425

5526
currentSettings->videoBitrate =

UI/window-basic-settings-stream.cpp

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -249,6 +249,8 @@ void OBSBasicSettings::UpdateKeyLink()
249249
ui->getStreamKeyButton->setTargetUrl(QUrl(streamKeyLink));
250250
ui->getStreamKeyButton->show();
251251
}
252+
253+
hasStreamWizard &= ui->outputMode->currentText().contains("Simple");
252254
ui->settingWizardBtn->setHidden(!hasStreamWizard);
253255
}
254256

@@ -267,6 +269,9 @@ void OBSBasicSettings::preStreamWizardLaunch()
267269
return;
268270
}
269271

272+
// Save any changes so far since we'll refrence them from config files
273+
SaveSettings();
274+
270275
QSharedPointer<StreamWizard::EncoderSettingsRequest> currentSettings =
271276
StreamingSettingsUtility::makeEncoderSettingsFromCurrentState(
272277
main->Config());
@@ -287,10 +292,11 @@ void OBSBasicSettings::preStreamWizardApplySettings(
287292
{
288293
blog(LOG_INFO, "OBSBasicSettings::preStreamWizardApplySettings");
289294

290-
// Apply and reload
295+
// Apply
291296
StreamingSettingsUtility::applyWizardSettings(newSettings,
292297
main->Config());
293298

299+
// Reload
294300
LoadSettings(false);
295301
}
296302

UI/window-basic-settings.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -660,6 +660,8 @@ OBSBasicSettings::OBSBasicSettings(QWidget *parent)
660660
SLOT(UpdateStreamDelayEstimate()));
661661
connect(ui->outputMode, SIGNAL(currentIndexChanged(int)), this,
662662
SLOT(UpdateStreamDelayEstimate()));
663+
connect(ui->outputMode, SIGNAL(currentIndexChanged(int)), this,
664+
SLOT(UpdateKeyLink()));
663665
connect(ui->simpleOutputVBitrate, SIGNAL(valueChanged(int)), this,
664666
SLOT(UpdateStreamDelayEstimate()));
665667
connect(ui->simpleOutputABitrate, SIGNAL(currentIndexChanged(int)),

0 commit comments

Comments
 (0)