fix(cpn): QoL tweaks to joystick preferences (#3105)

* Add preference option to Companion to disable the 'Cannot open joystick, joystick disabled' popup warning when starting the simulator.

* Don't erase joystick settings if user opens preferences dialog while joystick is not connected.
Remove reference to "Ubuntu" font family for 'Radio Type' label in preferences dialog (generates warning on MacOS).
This commit is contained in:
philmoz
2023-03-17 12:09:38 +10:00
committed by GitHub
parent 0af86f657e
commit 9a898533d1
4 changed files with 18 additions and 6 deletions
+6 -2
View File
@@ -78,6 +78,7 @@ void AppPreferencesDialog::accept()
g.showSplash(ui->showSplash->isChecked());
g.promptProfile(ui->chkPromptProfile->isChecked());
g.simuSW(ui->simuSW->isChecked());
g.disableJoystickWarning(ui->joystickWarningCB->isChecked());
g.removeModelSlots(ui->opt_removeBlankSlots->isChecked());
g.newModelAction((AppData::NewModelAction)ui->cboNewModelAction->currentIndex());
g.historySize(ui->historySize->value());
@@ -93,9 +94,11 @@ void AppPreferencesDialog::accept()
g.appLogsDir(ui->appLogsDir->text());
g.runAppInstaller(ui->chkPromptInstall->isChecked());
if (ui->joystickChkB ->isChecked() && ui->joystickCB->isEnabled()) {
if (ui->joystickChkB ->isChecked()) {
g.jsSupport(ui->joystickChkB ->isChecked());
g.jsCtrl(ui->joystickCB ->currentIndex());
// Don't overwrite selected joystick if not connected. Avoid surprising the user.
if (ui->joystickCB->isEnabled())
g.jsCtrl(ui->joystickCB ->currentIndex());
}
else {
g.jsSupport(false);
@@ -237,6 +240,7 @@ void AppPreferencesDialog::initSettings()
}
ui->simuSW->setChecked(g.simuSW());
ui->joystickWarningCB->setChecked(g.disableJoystickWarning());
ui->opt_removeBlankSlots->setChecked(g.removeModelSlots());
ui->cboNewModelAction->addItems(AppData::newModelActionsList());
ui->cboNewModelAction->setCurrentIndex(g.newModelAction());
+9 -3
View File
@@ -7,7 +7,7 @@
<x>0</x>
<y>0</y>
<width>864</width>
<height>668</height>
<height>673</height>
</rect>
</property>
<property name="sizePolicy">
@@ -481,7 +481,6 @@ Mode 4:
</property>
<property name="font">
<font>
<family>Ubuntu</family>
<weight>75</weight>
<bold>true</bold>
</font>
@@ -1284,7 +1283,7 @@ Mode 4:
</property>
</widget>
</item>
<item row="12" column="1">
<item row="11" column="1">
<spacer name="verticalSpacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
@@ -1388,6 +1387,13 @@ Mode 4:
</property>
</widget>
</item>
<item row="3" column="1">
<widget class="QCheckBox" name="joystickWarningCB">
<property name="text">
<string>Disable 'Cannot open joystick, joystick disabled' warning</string>
</property>
</widget>
</item>
</layout>
</widget>
<widget class="QWidget" name="updateTab">
+2 -1
View File
@@ -691,7 +691,8 @@ void SimulatorWidget::setupJoysticks()
joysticksEnabled = true;
}
else {
QMessageBox::critical(this, CPN_STR_TTL_WARNING, tr("Cannot open joystick, joystick disabled"));
if (!g.disableJoystickWarning())
QMessageBox::critical(this, CPN_STR_TTL_WARNING, tr("Cannot open joystick, joystick disabled"));
}
}
else if (joystick) {
+1
View File
@@ -687,6 +687,7 @@ class AppData: public CompStoreObj
PROPERTY(int, backLight, 0)
PROPERTY(int, simuLastProfId, -1)
PROPERTY(bool, simuSW, true)
PROPERTY(bool, disableJoystickWarning, false)
// Message box confirmations
PROPERTY(bool, confirmWriteModelsAndSettings, true)