Gui: Add runtime check to choose between modern and legacy space mouse devices

This commit is contained in:
wmayer
2024-12-02 13:26:08 +01:00
parent 578640381a
commit 7a044e7dcd
3 changed files with 52 additions and 12 deletions

View File

@@ -559,8 +559,15 @@ Application::Application(bool GUIenabled)
_pcWorkbenchDictionary = PyDict_New();
#ifdef USE_3DCONNEXION_NAVLIB
// Instantiate the 3Dconnexion controller
pNavlibInterface = new NavlibInterface();
ParameterGrp::handle hViewGrp = App::GetApplication().GetParameterGroupByPath(
"User parameter:BaseApp/Preferences/View");
if (!hViewGrp->GetBool("LegacySpaceMouseDevices", false)) {
// Instantiate the 3Dconnexion controller
pNavlibInterface = new NavlibInterface();
}
else {
pNavlibInterface = nullptr;
}
#endif
if (GUIenabled) {
@@ -2293,7 +2300,9 @@ void Application::runApplication()
Gui::getMainWindow()->setProperty("eventLoop", true);
#ifdef USE_3DCONNEXION_NAVLIB
Instance->pNavlibInterface->enableNavigation();
if (Instance->pNavlibInterface) {
Instance->pNavlibInterface->enableNavigation();
}
#endif
runEventLoop(mainApp);

View File

@@ -60,6 +60,9 @@ DlgSettingsNavigation::DlgSettingsNavigation(QWidget* parent)
ui->naviCubeBaseColor->setAllowTransparency(true);
ui->rotationCenterColor->setAllowTransparency(true);
retranslate();
#if !defined(_USE_3DCONNEXION_SDK) && !defined(SPNAV_FOUND)
ui->legacySpaceMouseDevices->setDisabled(true);
#endif
}
/**
@@ -97,6 +100,10 @@ void DlgSettingsNavigation::saveSettings()
ui->prefCubeSize->onSave();
ui->naviCubeBaseColor->onSave();
ui->naviCubeInactiveOpacity->onSave();
ui->legacySpaceMouseDevices->onSave();
if (property("LegacySpaceMouse").toBool() != ui->legacySpaceMouseDevices->isChecked()) {
requireRestart();
}
bool showNaviCube = ui->groupBoxNaviCube->isChecked();
hGrp->SetBool("ShowNaviCube", showNaviCube);
@@ -143,6 +150,8 @@ void DlgSettingsNavigation::loadSettings()
ui->prefCubeSize->onRestore();
ui->naviCubeBaseColor->onRestore();
ui->naviCubeInactiveOpacity->onRestore();
ui->legacySpaceMouseDevices->onRestore();
setProperty("LegacySpaceMouse", ui->legacySpaceMouseDevices->isChecked());
ParameterGrp::handle hGrp = App::GetApplication().GetParameterGroupByPath
("User parameter:BaseApp/Preferences/View");

View File

@@ -7,7 +7,7 @@
<x>0</x>
<y>0</y>
<width>548</width>
<height>762</height>
<height>795</height>
</rect>
</property>
<property name="windowTitle">
@@ -255,7 +255,7 @@
<property name="toolTip">
<string>Base color for all elements</string>
</property>
<property name="color" stdset="0">
<property name="color">
<color alpha="128">
<red>226</red>
<green>232</green>
@@ -335,7 +335,7 @@
<property name="toolTip">
<string>The color of the rotation center indicator</string>
</property>
<property name="color" stdset="0">
<property name="color">
<color alpha="51">
<red>255</red>
<green>0</green>
@@ -572,7 +572,7 @@ Free Turntable: the part will be rotated around the z-axis.</string>
</widget>
</item>
<item row="4" column="2">
<widget class="Gui::PrefUnitSpinBox" name="qspinNewDocScale" native="true">
<widget class="Gui::PrefUnitSpinBox" name="qspinNewDocScale">
<property name="toolTip">
<string>Sets camera zoom for new documents.
The value is the diameter of the sphere to fit on the screen.</string>
@@ -580,21 +580,21 @@ The value is the diameter of the sphere to fit on the screen.</string>
<property name="unit" stdset="0">
<string>mm</string>
</property>
<property name="minimum" stdset="0">
<property name="minimum">
<double>0.000010000000000</double>
</property>
<property name="maximum" stdset="0">
<property name="maximum">
<double>10000000.000000000000000</double>
</property>
<property name="rawValue" stdset="0">
<double>100.000000000000000</double>
</property>
<property name="prefEntry" stdset="0">
<cstring>NewDocumentCameraScale</cstring>
</property>
<property name="prefPath" stdset="0">
<cstring>View</cstring>
</property>
<property name="rawValue" stdset="0">
<double>100.000000000000000</double>
</property>
</widget>
</item>
<item row="6" column="0">
@@ -721,6 +721,28 @@ Mouse tilting is not disabled by this setting.</string>
</layout>
</widget>
</item>
<item>
<widget class="QGroupBox" name="spaceMouseDevice">
<property name="title">
<string>Space mouse</string>
</property>
<layout class="QGridLayout" name="gridLayout_5">
<item row="0" column="0">
<widget class="Gui::PrefCheckBox" name="legacySpaceMouseDevices">
<property name="text">
<string>Enable support of legacy space mouse devices</string>
</property>
<property name="prefEntry" stdset="0">
<cstring>LegacySpaceMouseDevices</cstring>
</property>
<property name="prefPath" stdset="0">
<cstring>View</cstring>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item>
<widget class="QGroupBox" name="groupBoxAnimations">
<property name="title">