mirror of
https://github.com/obsproject/obs-studio.git
synced 2024-09-20 04:42:18 +02:00
Merge pull request #2342 from cg2121/aspect-ratio-fix
UI: Fix aspect ratio triggering settings change
This commit is contained in:
commit
83df7d1635
@ -247,6 +247,25 @@ static void PopulateAACBitrates(initializer_list<QComboBox *> boxes)
|
||||
}
|
||||
}
|
||||
|
||||
static int gcd(int a, int b)
|
||||
{
|
||||
return b == 0 ? a : gcd(b, a % b);
|
||||
}
|
||||
|
||||
static std::tuple<int, int> aspect_ratio(int cx, int cy)
|
||||
{
|
||||
int common = gcd(cx, cy);
|
||||
int newCX = cx / common;
|
||||
int newCY = cy / common;
|
||||
|
||||
if (newCX == 8 && newCY == 5) {
|
||||
newCX = 16;
|
||||
newCY = 10;
|
||||
}
|
||||
|
||||
return std::make_tuple(newCX, newCY);
|
||||
}
|
||||
|
||||
void RestrictResetBitrates(initializer_list<QComboBox *> boxes, int maxbitrate);
|
||||
|
||||
void OBSBasicSettings::HookWidget(QWidget *widget, const char *signal,
|
||||
@ -760,8 +779,6 @@ OBSBasicSettings::OBSBasicSettings(QWidget *parent)
|
||||
|
||||
UpdateAutomaticReplayBufferCheckboxes();
|
||||
|
||||
on_baseResolution_editTextChanged(ui->baseResolution->currentText());
|
||||
|
||||
App()->DisableHotkeys();
|
||||
|
||||
channelIndex = ui->channelSetup->currentIndex();
|
||||
@ -1406,6 +1423,13 @@ void OBSBasicSettings::LoadResolutionLists()
|
||||
ResetDownscales(cx, cy);
|
||||
|
||||
ui->outputResolution->lineEdit()->setText(outputResString.c_str());
|
||||
|
||||
std::tuple<int, int> aspect = aspect_ratio(cx, cy);
|
||||
|
||||
ui->baseAspect->setText(
|
||||
QTStr("AspectRatio")
|
||||
.arg(QString::number(std::get<0>(aspect)),
|
||||
QString::number(std::get<1>(aspect))));
|
||||
}
|
||||
|
||||
static inline void LoadFPSCommon(OBSBasic *main, Ui::OBSBasicSettings *ui)
|
||||
@ -3753,25 +3777,6 @@ static bool ValidResolutions(Ui::OBSBasicSettings *ui)
|
||||
return true;
|
||||
}
|
||||
|
||||
static int gcd(int a, int b)
|
||||
{
|
||||
return b == 0 ? a : gcd(b, a % b);
|
||||
}
|
||||
|
||||
static std::tuple<int, int> aspect_ratio(int cx, int cy)
|
||||
{
|
||||
int common = gcd(cx, cy);
|
||||
int newCX = cx / common;
|
||||
int newCY = cy / common;
|
||||
|
||||
if (newCX == 8 && newCY == 5) {
|
||||
newCX = 16;
|
||||
newCY = 10;
|
||||
}
|
||||
|
||||
return std::make_tuple(newCX, newCY);
|
||||
}
|
||||
|
||||
void OBSBasicSettings::RecalcOutputResPixels(const char *resText)
|
||||
{
|
||||
uint32_t newCX;
|
||||
|
Loading…
Reference in New Issue
Block a user