Add force reset driver action to Breezy Desktop (#147)
This commit is contained in:
parent
35da226988
commit
3c13552198
|
|
@ -444,6 +444,27 @@ BreezyDesktopEffectConfig::BreezyDesktopEffectConfig(QObject *parent, const KPlu
|
|||
}
|
||||
});
|
||||
}
|
||||
|
||||
// Advanced tab: Force reset xr-driver (matches the Python UI's reset action)
|
||||
if (auto btnResetDriver = widget()->findChild<QPushButton*>(QStringLiteral("buttonResetDriver"))) {
|
||||
connect(btnResetDriver, &QPushButton::clicked, this, [this]() {
|
||||
auto labelStatus = widget()->findChild<QLabel*>(QStringLiteral("labelResetDriverStatus"));
|
||||
if (labelStatus) {
|
||||
labelStatus->setVisible(false);
|
||||
}
|
||||
|
||||
setRequestInProgress({sender()}, true);
|
||||
|
||||
const bool ok = XRDriverIPC::instance().resetDriver();
|
||||
if (ok) {
|
||||
showStatus(labelStatus, true, tr("Driver restarted."));
|
||||
} else {
|
||||
showStatus(labelStatus, false, tr("Failed to restart driver."));
|
||||
}
|
||||
|
||||
setRequestInProgress({sender()}, false);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
BreezyDesktopEffectConfig::~BreezyDesktopEffectConfig()
|
||||
|
|
|
|||
|
|
@ -208,14 +208,72 @@
|
|||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="5" column="0">
|
||||
<item row="5" column="0">
|
||||
<widget class="QLabel" name="labelDisplayHorizontalOffset">
|
||||
<property name="text">
|
||||
<string>Display Horizontal Offset:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="5" column="1">
|
||||
<widget class="LabeledSlider" name="kcfg_DisplayHorizontalOffset">
|
||||
<property name="decimalShift">
|
||||
<double>2</double>
|
||||
</property>
|
||||
<property name="tickPosition">
|
||||
<enum>QSlider::NoTicks</enum>
|
||||
</property>
|
||||
<property name="tickStartOffset">
|
||||
<double>50</double>
|
||||
</property>
|
||||
<property name="tickInterval">
|
||||
<double>100</double>
|
||||
</property>
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="tracking">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="6" column="0">
|
||||
<widget class="QLabel" name="labelDisplayVerticalOffset">
|
||||
<property name="text">
|
||||
<string>Display Vertical Offset:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="6" column="1">
|
||||
<widget class="LabeledSlider" name="kcfg_DisplayVerticalOffset">
|
||||
<property name="decimalShift">
|
||||
<double>2</double>
|
||||
</property>
|
||||
<property name="tickPosition">
|
||||
<enum>QSlider::NoTicks</enum>
|
||||
</property>
|
||||
<property name="tickStartOffset">
|
||||
<double>50</double>
|
||||
</property>
|
||||
<property name="tickInterval">
|
||||
<double>100</double>
|
||||
</property>
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="tracking">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="7" column="0">
|
||||
<widget class="QLabel" name="labelFollowThreshold">
|
||||
<property name="text">
|
||||
<string>Follow threshold:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="5" column="1">
|
||||
<item row="7" column="1">
|
||||
<widget class="LabeledSlider" name="kcfg_SmoothFollowThreshold">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
|
|
@ -237,7 +295,7 @@
|
|||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="6" column="0">
|
||||
<item row="8" column="0">
|
||||
<widget class="QLabel" name="labelVirtualDisplays">
|
||||
<property name="text">
|
||||
<string>Add Virtual Display:</string>
|
||||
|
|
@ -250,7 +308,7 @@
|
|||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="6" column="1">
|
||||
<item row="8" column="1">
|
||||
<widget class="QWidget" name="widgetVirtualDisplayButtons">
|
||||
<property name="visible">
|
||||
<bool>false</bool>
|
||||
|
|
@ -313,7 +371,7 @@
|
|||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="7" column="0" colspan="2">
|
||||
<item row="9" column="0" colspan="2">
|
||||
<widget class="QWidget" name="widgetVirtualDisplayList">
|
||||
<property name="visible"><bool>false</bool></property>
|
||||
<property name="enabled"><bool>false</bool></property>
|
||||
|
|
@ -469,62 +527,34 @@
|
|||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="5" column="0">
|
||||
<widget class="QLabel" name="labelDisplayHorizontalOffset">
|
||||
<property name="text">
|
||||
<string>Display Horizontal Offset:</string>
|
||||
</property>
|
||||
<item row="4" column="0" colspan="2">
|
||||
<widget class="QCheckBox" name="kcfg_RemoveVirtualDisplaysOnDisable">
|
||||
<property name="visible">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Remove virtual displays on disable</string>
|
||||
</property>
|
||||
<property name="checked"><bool>true</bool></property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="5" column="1">
|
||||
<widget class="LabeledSlider" name="kcfg_DisplayHorizontalOffset">
|
||||
<property name="decimalShift">
|
||||
<double>2</double>
|
||||
</property>
|
||||
<property name="tickPosition">
|
||||
<enum>QSlider::NoTicks</enum>
|
||||
</property>
|
||||
<property name="tickStartOffset">
|
||||
<double>50</double>
|
||||
</property>
|
||||
<property name="tickInterval">
|
||||
<double>100</double>
|
||||
</property>
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="tracking">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<item row="5" column="0" colspan="2">
|
||||
<widget class="QCheckBox" name="kcfg_MirrorPhysicalDisplays">
|
||||
<property name="text">
|
||||
<string>Mirror physical displays (may impact performance)</string>
|
||||
</property>
|
||||
<property name="checked"><bool>false</bool></property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="6" column="0">
|
||||
<widget class="QLabel" name="labelDisplayVerticalOffset">
|
||||
<property name="text">
|
||||
<string>Display Vertical Offset:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="6" column="1">
|
||||
<widget class="LabeledSlider" name="kcfg_DisplayVerticalOffset">
|
||||
<property name="decimalShift">
|
||||
<double>2</double>
|
||||
</property>
|
||||
<property name="tickPosition">
|
||||
<enum>QSlider::NoTicks</enum>
|
||||
</property>
|
||||
<property name="tickStartOffset">
|
||||
<double>50</double>
|
||||
</property>
|
||||
<property name="tickInterval">
|
||||
<double>100</double>
|
||||
</property>
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="tracking">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<item row="6" column="0" colspan="2">
|
||||
<widget class="QCheckBox" name="EnableMultitap">
|
||||
<property name="text">
|
||||
<string>Enable multi-tap detection</string>
|
||||
</property>
|
||||
<property name="checked"><bool>false</bool></property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="7" column="0">
|
||||
|
|
@ -553,44 +583,14 @@
|
|||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="8" column="0" colspan="2">
|
||||
<widget class="QCheckBox" name="kcfg_RemoveVirtualDisplaysOnDisable">
|
||||
<property name="visible">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Remove virtual displays on disable</string>
|
||||
</property>
|
||||
<property name="checked"><bool>true</bool></property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="9" column="0" colspan="2">
|
||||
<widget class="QCheckBox" name="kcfg_MirrorPhysicalDisplays">
|
||||
<property name="text">
|
||||
<string>Mirror physical displays (may impact performance)</string>
|
||||
</property>
|
||||
<property name="checked"><bool>false</bool></property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="10" column="0" colspan="2">
|
||||
<widget class="QCheckBox" name="EnableMultitap">
|
||||
<property name="text">
|
||||
<string>Enable multi-tap detection</string>
|
||||
</property>
|
||||
<property name="checked"><bool>false</bool></property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="11" column="0">
|
||||
<item row="8" column="0">
|
||||
<widget class="QLabel" name="labelNeckSaverHorizontal">
|
||||
<property name="text">
|
||||
<string>Neck-saver horizontal:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="11" column="1">
|
||||
<item row="8" column="1">
|
||||
<widget class="LabeledSlider" name="NeckSaverHorizontalMultiplier">
|
||||
<property name="decimalShift">
|
||||
<double>2</double>
|
||||
|
|
@ -618,14 +618,14 @@
|
|||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="12" column="0">
|
||||
<item row="9" column="0">
|
||||
<widget class="QLabel" name="labelNeckSaverVertical">
|
||||
<property name="text">
|
||||
<string>Neck-saver vertical:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="12" column="1">
|
||||
<item row="9" column="1">
|
||||
<widget class="LabeledSlider" name="NeckSaverVerticalMultiplier">
|
||||
<property name="decimalShift">
|
||||
<double>2</double>
|
||||
|
|
@ -653,14 +653,14 @@
|
|||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="13" column="0">
|
||||
<item row="10" column="0">
|
||||
<widget class="QLabel" name="labelDeadZoneThresholdDeg">
|
||||
<property name="text">
|
||||
<string>Dead-zone threshold (deg):</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="13" column="1">
|
||||
<item row="10" column="1">
|
||||
<widget class="LabeledSlider" name="DeadZoneThresholdDeg">
|
||||
<property name="decimalShift">
|
||||
<double>1</double>
|
||||
|
|
@ -688,16 +688,43 @@
|
|||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="14" column="0">
|
||||
<item row="11" column="0">
|
||||
<widget class="QLabel" name="labelMeasurementUnits">
|
||||
<property name="text">
|
||||
<string>Measurement units:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="14" column="1">
|
||||
<item row="11" column="1">
|
||||
<widget class="QComboBox" name="comboMeasurementUnits"/>
|
||||
</item>
|
||||
<item row="12" column="0">
|
||||
<widget class="QLabel" name="labelResetDriver">
|
||||
<property name="text">
|
||||
<string>Reset driver:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="12" column="1">
|
||||
<widget class="QPushButton" name="buttonResetDriver">
|
||||
<property name="text">
|
||||
<string>Force reset driver</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="13" column="1">
|
||||
<widget class="QLabel" name="labelResetDriverStatus">
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
<property name="visible">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="wordWrap">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<widget class="QWidget" name="tabLicenseDetails">
|
||||
|
|
|
|||
|
|
@ -108,3 +108,10 @@ bool XRDriverIPC::verifyToken(const std::string &token) {
|
|||
QString result = QString::fromUtf8(out).trimmed().toLower();
|
||||
return result == QStringLiteral("true");
|
||||
}
|
||||
|
||||
bool XRDriverIPC::resetDriver() {
|
||||
QByteArray out = invokePython(QStringLiteral("reset_driver"), {}, {});
|
||||
if (out.isEmpty()) return false;
|
||||
QString result = QString::fromUtf8(out).trimmed().toLower();
|
||||
return result == QStringLiteral("true");
|
||||
}
|
||||
|
|
@ -85,6 +85,7 @@ public:
|
|||
bool writeControlFlags(const QJsonObject &flags);
|
||||
bool requestToken(const std::string &email);
|
||||
bool verifyToken(const std::string &token);
|
||||
bool resetDriver();
|
||||
|
||||
|
||||
private:
|
||||
|
|
|
|||
|
|
@ -1 +1 @@
|
|||
Subproject commit 6f1844829e11fcc7664398d4c95d8fbdb6341669
|
||||
Subproject commit 60b417baa5721496a3a39d4929460575f2479838
|
||||
|
|
@ -103,7 +103,7 @@ class BreezydesktopApplication(Adw.Application):
|
|||
logo_icon_name='com.xronlinux.BreezyDesktop',
|
||||
version=self.version,
|
||||
authors=['Wayne Heaney'],
|
||||
copyright='© 2025 Wayne Heaney',
|
||||
copyright='© 2026 Wayne Heaney',
|
||||
license_type=Gtk.License.GPL_3_0,
|
||||
wrap_license=True)
|
||||
about.present()
|
||||
|
|
@ -114,9 +114,7 @@ class BreezydesktopApplication(Adw.Application):
|
|||
dialog.present()
|
||||
|
||||
def on_reset_driver_action(self, widget, _):
|
||||
XRDriverIPC.get_instance().write_control_flags({
|
||||
'force_quit': True
|
||||
})
|
||||
XRDriverIPC.get_instance().reset_driver(as_user=None)
|
||||
|
||||
def create_action(self, name, callback, shortcuts=None):
|
||||
"""Add an application action.
|
||||
|
|
|
|||
Loading…
Reference in New Issue