UI: Fix mixer dock widget minSize being too big

When the vertical volume meter was introduced it set in the OBSBasic.ui
mixer dock definition a min width/height that was valid for both
widgets. QStackedWidget hints the minimum size as the higher w/h
of its children so this workaround is necessary.
This commit is contained in:
Shaolin
2018-06-12 22:52:08 -03:00
parent 0bd2e23d14
commit d7fd29351f
3 changed files with 15 additions and 10 deletions

View File

@@ -1560,9 +1560,8 @@ void OBSBasic::OBSInit()
}
}
bool vertical = config_get_bool(App()->GlobalConfig(), "BasicWindow",
"VerticalVolControl");
ui->stackedMixerArea->setCurrentIndex(vertical);
ToggleMixerLayout(config_get_bool(App()->GlobalConfig(), "BasicWindow",
"VerticalVolControl"));
if (config_get_bool(basicConfig, "General", "OpenStatsOnStartup"))
on_stats_triggered();
@@ -2524,13 +2523,24 @@ void OBSBasic::StackedMixerAreaContextMenuRequested()
popup.exec(QCursor::pos());
}
void OBSBasic::ToggleMixerLayout(bool vertical)
{
if (vertical) {
ui->stackedMixerArea->setMinimumSize(180, 220);
ui->stackedMixerArea->setCurrentIndex(1);
} else {
ui->stackedMixerArea->setMinimumSize(220, 0);
ui->stackedMixerArea->setCurrentIndex(0);
}
}
void OBSBasic::ToggleVolControlLayout()
{
bool vertical = !config_get_bool(GetGlobalConfig(), "BasicWindow",
"VerticalVolControl");
config_set_bool(GetGlobalConfig(), "BasicWindow", "VerticalVolControl",
vertical);
ui->stackedMixerArea->setCurrentIndex(vertical);
ToggleMixerLayout(vertical);
// We need to store it so we can delete current and then add
// at the right order