Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Shortcut configuration #955

Open
wants to merge 2 commits into
base: dev
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
169 changes: 169 additions & 0 deletions resources/forms/preferences.ui
Original file line number Diff line number Diff line change
Expand Up @@ -1095,6 +1095,175 @@
</item>
</layout>
</widget>
<widget class="QWidget" name="shortcutTab">
<attribute name="title">
<string>Shortcut</string>
</attribute>
<layout class="QVBoxLayout" name="verticalLayout_4">
<item>
<widget class="QLineEdit" name="filter">
<property name="placeholderText">
<string>Filter</string>
</property>
</widget>
</item>
<item>
<widget class="QScrollArea" name="shortcutScrollArea">
<property name="widgetResizable">
<bool>true</bool>
</property>
<widget class="QWidget" name="scrollAreaWidgetContents">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>789</width>
<height>447</height>
</rect>
</property>
<layout class="QVBoxLayout" name="verticalLayout_41">
<item>
<widget class="QTableView" name="shortcutTableView">
<property name="editTriggers">
<set>QAbstractItemView::NoEditTriggers</set>
</property>
<property name="showDropIndicator" stdset="0">
<bool>false</bool>
</property>
<property name="selectionMode">
<enum>QAbstractItemView::SingleSelection</enum>
</property>
<property name="selectionBehavior">
<enum>QAbstractItemView::SelectRows</enum>
</property>
<property name="showGrid">
<bool>false</bool>
</property>
<property name="wordWrap">
<bool>false</bool>
</property>
<attribute name="horizontalHeaderCascadingSectionResizes">
<bool>true</bool>
</attribute>
<attribute name="verticalHeaderVisible">
<bool>false</bool>
</attribute>
<attribute name="verticalHeaderMinimumSectionSize">
<number>25</number>
</attribute>
<attribute name="verticalHeaderDefaultSectionSize">
<number>25</number>
</attribute>
</widget>
</item>
</layout>
</widget>
</widget>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_11">
<item>
<widget class="QCheckBox" name="noCtrl">
<property name="text">
<string>Active keyboard shortcuts without pressing Ctrl key</string>
</property>
</widget>
</item>
</layout>
</item>
<item>
<widget class="QGroupBox" name="shortcutsGroupBox">
<property name="enabled">
<bool>false</bool>
</property>
<property name="title">
<string>Shortcuts</string>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
<layout class="QGridLayout" name="gridLayout_20">
<item row="3" column="0" colspan="2">
<widget class="QLabel" name="report">
<property name="styleSheet">
<string notr="true">color: red;</string>
</property>
<property name="textFormat">
<enum>Qt::PlainText</enum>
</property>
</widget>
</item>
<item row="2" column="1">
<widget class="QLineEdit" name="stylusButton">
<property name="readOnly">
<bool>true</bool>
</property>
</widget>
</item>
<item row="1" column="2">
<widget class="QPushButton" name="abortButton">
<property name="text">
<string>Abort</string>
</property>
</widget>
</item>
<item row="0" column="2">
<widget class="QPushButton" name="recordButton">
<property name="text">
<string>Record</string>
</property>
<property name="checkable">
<bool>true</bool>
</property>
</widget>
</item>
<item row="2" column="0">
<widget class="QLabel" name="label_5">
<property name="text">
<string>Stylus Button</string>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QLabel" name="label_2">
<property name="text">
<string>Mouse Button</string>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QLineEdit" name="mouseButton">
<property name="readOnly">
<bool>true</bool>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QLineEdit" name="keySequence">
<property name="readOnly">
<bool>true</bool>
</property>
</widget>
</item>
<item row="2" column="2">
<widget class="QPushButton" name="resetButton">
<property name="text">
<string>Reset</string>
</property>
</widget>
</item>
<item row="0" column="0">
<widget class="QLabel" name="label_4">
<property name="text">
<string>Key Sequence</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>
</layout>
</widget>
<widget class="QWidget" name="thirdPartyLicence">
<property name="enabled">
<bool>true</bool>
Expand Down
70 changes: 66 additions & 4 deletions resources/i18n/OpenBoard_de.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3008,6 +3008,28 @@ Möchten Sie diese Fehler für diesen Computer ignorieren?</translation>
<source>Use all available displays</source>
<translation>Alle verfügbaren Bildschirme nutzen</translation>
</message>
<message>
<source>Key sequence already in use</source>
<translation>Tastenkombination wird bereits benutzt</translation>
</message>
<message>
<source>Mouse button already in use</source>
<translation>Maustaste wird bereits benutzt</translation>
</message>
<message>
<source>Stylus button already in use</source>
<translation>Stifttaste wird bereits benutzt</translation>
</message>
<message>
<source>Accept</source>
<comment>preferencesDialog</comment>
<translation>Übernehmen</translation>
</message>
<message>
<source>Record</source>
<comment>preferencesDialog</comment>
<translation>Aufnehmen</translation>
</message>
</context>
<context>
<name>UBSettings</name>
Expand Down Expand Up @@ -3079,7 +3101,7 @@ Möchten Sie diese Fehler für diesen Computer ignorieren?</translation>
<message>
<location filename="../../src/core/UBShortcutManager.cpp" line="260"/>
<source>Reset zoom factor</source>
<translation>Zoom zurücksetzen</translation>
<translation>Zoom-Faktor zurücksetzen</translation>
</message>
<message>
<location filename="../../src/core/UBShortcutManager.cpp" line="266"/>
Expand Down Expand Up @@ -3129,7 +3151,7 @@ Möchten Sie diese Fehler für diesen Computer ignorieren?</translation>
<message>
<location filename="../../src/core/UBShortcutManager.cpp" line="466"/>
<source>Command</source>
<translation>Kommando</translation>
<translation>Befehl</translation>
</message>
<message>
<location filename="../../src/core/UBShortcutManager.cpp" line="469"/>
Expand All @@ -3144,12 +3166,12 @@ Möchten Sie diese Fehler für diesen Computer ignorieren?</translation>
<message>
<location filename="../../src/core/UBShortcutManager.cpp" line="475"/>
<source>Mouse Button</source>
<translation>Mausknopf</translation>
<translation>Maustaste</translation>
</message>
<message>
<location filename="../../src/core/UBShortcutManager.cpp" line="478"/>
<source>Tablet Button</source>
<translation>Tablet Stiftknopf</translation>
<translation>Stifttaste</translation>
</message>
<message>
<location filename="../../src/core/UBShortcutManager.cpp" line="629"/>
Expand Down Expand Up @@ -4076,6 +4098,46 @@ p, li { white-space: pre-wrap; }
<source>List of screens used for Control, Display and Previous pages</source>
<translation>Liste der Bildschirme, die für die Hauptansicht, Erweiterte Ansicht und Vorherige Seiten verwendet werden</translation>
</message>
<message>
<source>Shortcut</source>
<translation>Kurzbefehl</translation>
</message>
<message>
<source>Filter</source>
<translation>Filter</translation>
</message>
<message>
<source>Active keyboard shortcuts without pressing Ctrl key</source>
<translation>Aktiviere Kurzbefehle auch ohne Strg Taste</translation>
</message>
<message>
<source>Shortcuts</source>
<translation>Kurzbefehle</translation>
</message>
<message>
<source>Abort</source>
<translation>Abbrechen</translation>
</message>
<message>
<source>Record</source>
<translation>Aufnehmen</translation>
</message>
<message>
<source>Stylus Button</source>
<translation>Stifttaste</translation>
</message>
<message>
<source>Mouse Button</source>
<translation>Maustaste</translation>
</message>
<message>
<source>Reset</source>
<translation>Zurücksetzen</translation>
</message>
<message>
<source>Key Sequence</source>
<translation>Tasten</translation>
</message>
</context>
<context>
<name>trapFlashDialog</name>
Expand Down
28 changes: 28 additions & 0 deletions src/core/UBApplication.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -704,6 +704,34 @@ bool UBApplication::eventFilter(QObject *obj, QEvent *event)
|| result;
}

else if (event->type() == QEvent::MouseButtonPress)
{
// intercept special mouse buttons for shortcut handler
QMouseEvent *mouseEvent = static_cast<QMouseEvent *>(event);
Qt::MouseButton button = mouseEvent->button();

if (button != Qt::LeftButton && button != Qt::RightButton)
{
return mPreferencesController->handleMouseEvent(mouseEvent)
|| UBShortcutManager::shortcutManager()->handleMouseEvent(mouseEvent)
|| result;
}
}

else if (event->type() == QEvent::TabletPress)
{
// intercept special tablet buttons for shortcut handler
QTabletEvent *tabletEvent = static_cast<QTabletEvent *>(event);
Qt::MouseButton button = tabletEvent->button();

if (button != Qt::LeftButton)
{
return mPreferencesController->handleTabletEvent(tabletEvent)
|| UBShortcutManager::shortcutManager()->handleTabletEvent(tabletEvent)
|| result;
}
}

return result;
}

Expand Down
Loading