mirror of
https://git.eden-emu.dev/eden-emu/eden
synced 2026-06-27 18:36:35 +02:00
[qt] fix various crashes due to invalid/corrupted/outdated settings (#4070)
lots of "out of index" errors :) Signed-off-by: lizzie <lizzie@eden-emu.dev> Reviewed-on: https://git.eden-emu.dev/eden-emu/eden/pulls/4070 Reviewed-by: crueter <crueter@eden-emu.dev> Reviewed-by: MaranBr <maranbr@eden-emu.dev>
This commit is contained in:
parent
1071353291
commit
60e1032771
13 changed files with 149 additions and 71 deletions
|
|
@ -94,11 +94,10 @@ void ConfigureMotionTouch::SetConfiguration() {
|
|||
const Common::ParamPackage touch_param(Settings::values.touch_device.GetValue());
|
||||
|
||||
touch_from_button_maps = Settings::values.touch_from_button_maps;
|
||||
for (const auto& touch_map : touch_from_button_maps) {
|
||||
for (const auto& touch_map : touch_from_button_maps)
|
||||
ui->touch_from_button_map->addItem(QString::fromStdString(touch_map.name));
|
||||
}
|
||||
ui->touch_from_button_map->setCurrentIndex(
|
||||
Settings::values.touch_from_button_map_index.GetValue());
|
||||
if (auto const index = Settings::values.touch_from_button_map_index.GetValue(); int(index) < ui->touch_from_button_map->count())
|
||||
ui->touch_from_button_map->setCurrentIndex(index);
|
||||
|
||||
min_x = touch_param.Get("min_x", 100);
|
||||
min_y = touch_param.Get("min_y", 50);
|
||||
|
|
|
|||
|
|
@ -183,7 +183,7 @@ void GameList::ResetViewMode() {
|
|||
tree_view->setVisible(false);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
UNREACHABLE();
|
||||
}
|
||||
|
||||
auto view = m_currentView->viewport();
|
||||
|
|
@ -196,10 +196,8 @@ void GameList::ResetViewMode() {
|
|||
|
||||
auto scroller = QScroller::scroller(view);
|
||||
QScrollerProperties props;
|
||||
props.setScrollMetric(QScrollerProperties::HorizontalOvershootPolicy,
|
||||
QScrollerProperties::OvershootAlwaysOff);
|
||||
props.setScrollMetric(QScrollerProperties::VerticalOvershootPolicy,
|
||||
QScrollerProperties::OvershootAlwaysOff);
|
||||
props.setScrollMetric(QScrollerProperties::HorizontalOvershootPolicy, QScrollerProperties::OvershootAlwaysOff);
|
||||
props.setScrollMetric(QScrollerProperties::VerticalOvershootPolicy, QScrollerProperties::OvershootAlwaysOff);
|
||||
scroller->setScrollerProperties(props);
|
||||
|
||||
if (m_isTreeMode != newTreeMode) {
|
||||
|
|
|
|||
|
|
@ -1088,10 +1088,9 @@ void MainWindow::InitializeWidgets() {
|
|||
aa_status_button->setFocusPolicy(Qt::NoFocus);
|
||||
connect(aa_status_button, &QPushButton::clicked, [&] {
|
||||
auto aa_mode = Settings::values.anti_aliasing.GetValue();
|
||||
aa_mode = static_cast<Settings::AntiAliasing>(static_cast<u32>(aa_mode) + 1);
|
||||
if (aa_mode == Settings::AntiAliasing::MaxEnum) {
|
||||
aa_mode = Settings::AntiAliasing::None;
|
||||
}
|
||||
aa_mode = Settings::AntiAliasing(u32(aa_mode) + 1);
|
||||
if (u32(aa_mode) > u32(Settings::EnumMetadata<Settings::AntiAliasing>::GetLast()))
|
||||
aa_mode = Settings::EnumMetadata<Settings::AntiAliasing>::GetFirst();
|
||||
Settings::values.anti_aliasing.SetValue(aa_mode);
|
||||
aa_status_button->setChecked(true);
|
||||
UpdateAAText();
|
||||
|
|
@ -3623,10 +3622,9 @@ void MainWindow::OnIncreaseVolume() {
|
|||
|
||||
void MainWindow::OnToggleAdaptingFilter() {
|
||||
auto filter = Settings::values.scaling_filter.GetValue();
|
||||
filter = static_cast<Settings::ScalingFilter>(static_cast<u32>(filter) + 1);
|
||||
if (filter == Settings::ScalingFilter::MaxEnum) {
|
||||
filter = Settings::ScalingFilter::NearestNeighbor;
|
||||
}
|
||||
filter = Settings::ScalingFilter(u32(filter) + 1);
|
||||
if (u32(filter) > u32(Settings::EnumMetadata<Settings::ScalingFilter>::GetLast()))
|
||||
filter = Settings::EnumMetadata<Settings::ScalingFilter>::GetFirst();
|
||||
Settings::values.scaling_filter.SetValue(filter);
|
||||
filter_status_button->setChecked(true);
|
||||
UpdateFilterText();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue