forked from Boria138/PortProtonQt
chore: remove DPAD left/right navigation for tabs
Signed-off-by: Boris Yumankulov <boria138@altlinux.org>
This commit is contained in:
@@ -664,17 +664,6 @@ class InputManager(QObject):
|
|||||||
table.setCurrentCell(new_row, 0)
|
table.setCurrentCell(new_row, 0)
|
||||||
table.setFocus(Qt.FocusReason.OtherFocusReason)
|
table.setFocus(Qt.FocusReason.OtherFocusReason)
|
||||||
|
|
||||||
elif code == ecodes.ABS_HAT0X: # Left/Right (Tabs)
|
|
||||||
current_index = self.winetricks_dialog.tab_widget.currentIndex()
|
|
||||||
if value < 0: # Left
|
|
||||||
new_index = max(0, current_index - 1)
|
|
||||||
else: # Right
|
|
||||||
new_index = min(self.winetricks_dialog.tab_widget.count() - 1, current_index + 1)
|
|
||||||
|
|
||||||
if new_index != current_index:
|
|
||||||
self.winetricks_dialog.tab_widget.setCurrentIndex(new_index)
|
|
||||||
self._focus_first_row_in_current_table()
|
|
||||||
|
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
logger.error(f"Error in handle_winetricks_dpad: {e}")
|
logger.error(f"Error in handle_winetricks_dpad: {e}")
|
||||||
|
|
||||||
@@ -1036,17 +1025,6 @@ class InputManager(QObject):
|
|||||||
table.setCurrentCell(new_row, 0)
|
table.setCurrentCell(new_row, 0)
|
||||||
table.setFocus(Qt.FocusReason.OtherFocusReason)
|
table.setFocus(Qt.FocusReason.OtherFocusReason)
|
||||||
|
|
||||||
elif code == ecodes.ABS_HAT0X: # Left/Right (Tabs)
|
|
||||||
current_index = self.proton_manager_dialog.tab_widget.currentIndex()
|
|
||||||
if value < 0: # Left
|
|
||||||
new_index = max(0, current_index - 1)
|
|
||||||
else: # Right
|
|
||||||
new_index = min(self.proton_manager_dialog.tab_widget.count() - 1, current_index + 1)
|
|
||||||
|
|
||||||
if new_index != current_index:
|
|
||||||
self.proton_manager_dialog.tab_widget.setCurrentIndex(new_index)
|
|
||||||
self._focus_first_row_in_current_proton_manager_table()
|
|
||||||
|
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
logger.error(f"Error in handle_proton_manager_dpad: {e}")
|
logger.error(f"Error in handle_proton_manager_dpad: {e}")
|
||||||
|
|
||||||
@@ -1294,17 +1272,9 @@ class InputManager(QObject):
|
|||||||
if value < 0: # Left
|
if value < 0: # Left
|
||||||
if current_col > 0:
|
if current_col > 0:
|
||||||
table.setCurrentCell(current_row, max(0, current_col - 1))
|
table.setCurrentCell(current_row, max(0, current_col - 1))
|
||||||
else:
|
|
||||||
idx = max(0, self.settings_dialog.tab_widget.currentIndex() - 1)
|
|
||||||
self.settings_dialog.tab_widget.setCurrentIndex(idx)
|
|
||||||
self._focus_first_row_in_current_settings_table()
|
|
||||||
else: # Right
|
else: # Right
|
||||||
if current_col < table.columnCount() - 1:
|
if current_col < table.columnCount() - 1:
|
||||||
table.setCurrentCell(current_row, min(table.columnCount() - 1, current_col + 1))
|
table.setCurrentCell(current_row, min(table.columnCount() - 1, current_col + 1))
|
||||||
else:
|
|
||||||
idx = min(self.settings_dialog.tab_widget.count() - 1, self.settings_dialog.tab_widget.currentIndex() + 1)
|
|
||||||
self.settings_dialog.tab_widget.setCurrentIndex(idx)
|
|
||||||
self._focus_first_row_in_current_settings_table()
|
|
||||||
|
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
logger.error(f"Error in handle_settings_dpad: {e}")
|
logger.error(f"Error in handle_settings_dpad: {e}")
|
||||||
@@ -2258,18 +2228,20 @@ class InputManager(QObject):
|
|||||||
if (key in (Qt.Key.Key_Left, Qt.Key.Key_Right) and
|
if (key in (Qt.Key.Key_Left, Qt.Key.Key_Right) and
|
||||||
not isinstance(focused, GameCard | QLineEdit | QTableWidget | AutoSizeButton) and
|
not isinstance(focused, GameCard | QLineEdit | QTableWidget | AutoSizeButton) and
|
||||||
not self.file_explorer):
|
not self.file_explorer):
|
||||||
idx = self._parent.stackedWidget.currentIndex()
|
active = QApplication.activeWindow()
|
||||||
total = len(self._parent.tabButtons)
|
if not isinstance(active, QDialog) or not hasattr(active, 'tab_widget'):
|
||||||
if key == Qt.Key.Key_Left:
|
idx = self._parent.stackedWidget.currentIndex()
|
||||||
new_idx = (idx - 1) % total
|
total = len(self._parent.tabButtons)
|
||||||
self._parent.switchTab(new_idx)
|
if key == Qt.Key.Key_Left:
|
||||||
self._parent.tabButtons[new_idx].setFocus(Qt.FocusReason.OtherFocusReason)
|
new_idx = (idx - 1) % total
|
||||||
return True
|
self._parent.switchTab(new_idx)
|
||||||
elif key == Qt.Key.Key_Right:
|
self._parent.tabButtons[new_idx].setFocus(Qt.FocusReason.OtherFocusReason)
|
||||||
new_idx = (idx + 1) % total
|
return True
|
||||||
self._parent.switchTab(new_idx)
|
elif key == Qt.Key.Key_Right:
|
||||||
self._parent.tabButtons[new_idx].setFocus(Qt.FocusReason.OtherFocusReason)
|
new_idx = (idx + 1) % total
|
||||||
return True
|
self._parent.switchTab(new_idx)
|
||||||
|
self._parent.tabButtons[new_idx].setFocus(Qt.FocusReason.OtherFocusReason)
|
||||||
|
return True
|
||||||
|
|
||||||
# Map arrow keys to D-pad press events for other contexts
|
# Map arrow keys to D-pad press events for other contexts
|
||||||
if key in (Qt.Key.Key_Up, Qt.Key.Key_Down, Qt.Key.Key_Left, Qt.Key.Key_Right):
|
if key in (Qt.Key.Key_Up, Qt.Key.Key_Down, Qt.Key.Key_Left, Qt.Key.Key_Right):
|
||||||
|
|||||||
Reference in New Issue
Block a user