Skip to content

Commit

Permalink
Only allow one sync selection at a time; disable Apply button if prev…
Browse files Browse the repository at this point in the history
…iously selected driver options change prior to applying
  • Loading branch information
remutro committed Dec 6, 2024
1 parent 431aba5 commit 713a38a
Showing 1 changed file with 39 additions and 0 deletions.
39 changes: 39 additions & 0 deletions desktop-ui/settings/drivers.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,30 @@ auto DriverSettings::construct() -> void {
videoBlockingToggle.setText("Synchronize").onToggle([&] {
settings.video.blocking = videoBlockingToggle.checked();
ruby::video.setBlocking(settings.video.blocking);
if(settings.video.flush) {
videoFlushToggle.setChecked(false);
settings.video.flush = false;
ruby::video.setFlush(settings.video.flush);
}
if(settings.audio.blocking) {
audioBlockingToggle.setChecked(false);
settings.audio.blocking = false;
ruby::audio.setBlocking(settings.audio.blocking);
}
});
videoFlushToggle.setText("GPU sync").onToggle([&] {
settings.video.flush = videoFlushToggle.checked();
ruby::video.setFlush(settings.video.flush);
if(settings.video.blocking) {
videoBlockingToggle.setChecked(false);
settings.video.blocking = false;
ruby::video.setBlocking(settings.video.blocking);
}
if(settings.audio.blocking) {
audioBlockingToggle.setChecked(false);
settings.audio.blocking = false;
ruby::audio.setBlocking(settings.audio.blocking);
}
});
#if defined(PLATFORM_MACOS)
videoColorSpaceToggle.setText("Force sRGB").onToggle([&] {
Expand Down Expand Up @@ -95,6 +115,16 @@ auto DriverSettings::construct() -> void {
audioBlockingToggle.setText("Synchronize").onToggle([&] {
settings.audio.blocking = audioBlockingToggle.checked();
ruby::audio.setBlocking(settings.audio.blocking);
if(settings.video.blocking) {
videoBlockingToggle.setChecked(false);
settings.video.blocking = false;
ruby::video.setBlocking(settings.video.blocking);
}
if(settings.video.flush) {
videoFlushToggle.setChecked(false);
settings.video.flush = false;
ruby::video.setFlush(settings.video.flush);
}
});
audioDynamicToggle.setText("Dynamic rate").onToggle([&] {
settings.audio.dynamic = audioDynamicToggle.checked();
Expand Down Expand Up @@ -147,6 +177,9 @@ auto DriverSettings::videoRefresh() -> void {
ComboButtonItem item{&videoDriverList};
item.setText(driver);
if(driver == ruby::video.driver()) item.setSelected();
if (settings.video.driver == ruby::video.driver()) {
videoDriverAssign.setEnabled(false);
}
}
videoMonitorList.reset();
for(auto& monitor : ruby::video.hasMonitors()) {
Expand Down Expand Up @@ -191,6 +224,9 @@ auto DriverSettings::audioRefresh() -> void {
ComboButtonItem item{&audioDriverList};
item.setText(driver);
if(driver == ruby::audio.driver()) item.setSelected();
if (settings.audio.driver == ruby::audio.driver()) {
audioDriverAssign.setEnabled(false);
}
}
audioDeviceList.reset();
for(auto& device : ruby::audio.hasDevices()) {
Expand Down Expand Up @@ -233,6 +269,9 @@ auto DriverSettings::inputRefresh() -> void {
ComboButtonItem item{&inputDriverList};
item.setText(driver);
if(driver == ruby::input.driver()) item.setSelected();
if (settings.input.driver == ruby::input.driver()) {
inputDriverAssign.setEnabled(false);
}
}
VerticalLayout::resize();
}
Expand Down

0 comments on commit 713a38a

Please sign in to comment.