Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Q
qgroundcontrol
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Valentin Platzgummer
qgroundcontrol
Commits
124f9ec9
Unverified
Commit
124f9ec9
authored
Jul 26, 2019
by
Gus Grubba
Committed by
GitHub
Jul 26, 2019
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #7622 from mavlink/joystickButtons
Joystick Work
parents
e71da845
4d3620dc
Changes
8
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
504 additions
and
262 deletions
+504
-262
ChangeLog.md
ChangeLog.md
+1
-0
Joystick.cc
src/Joystick/Joystick.cc
+301
-153
Joystick.h
src/Joystick/Joystick.h
+130
-86
QmlObjectListModel.cc
src/QmlControls/QmlObjectListModel.cc
+15
-9
QmlObjectListModel.h
src/QmlControls/QmlObjectListModel.h
+1
-1
JoystickConfig.qml
src/VehicleSetup/JoystickConfig.qml
+3
-0
JoystickConfigAdvanced.qml
src/VehicleSetup/JoystickConfigAdvanced.qml
+23
-5
JoystickConfigButtons.qml
src/VehicleSetup/JoystickConfigButtons.qml
+30
-8
No files found.
ChangeLog.md
View file @
124f9ec9
...
@@ -6,6 +6,7 @@ Note: This file only contains high level features or important fixes.
...
@@ -6,6 +6,7 @@ Note: This file only contains high level features or important fixes.
### 3.6.0 - Daily Build
### 3.6.0 - Daily Build
*
Added ability to set a joystick button to be single action or repeated action while the button is held down.
*
Rework joysticks. Fixed several issues and updated setup UI.
*
Rework joysticks. Fixed several issues and updated setup UI.
*
Adding support for UDP RTP h.265 video streams
*
Adding support for UDP RTP h.265 video streams
*
For text to speech engine on Linux to English (all messages are in English)
*
For text to speech engine on Linux to English (all messages are in English)
...
...
src/Joystick/Joystick.cc
View file @
124f9ec9
This diff is collapsed.
Click to expand it.
src/Joystick/Joystick.h
View file @
124f9ec9
This diff is collapsed.
Click to expand it.
src/QmlControls/QmlObjectListModel.cc
View file @
124f9ec9
...
@@ -32,6 +32,14 @@ QmlObjectListModel::~QmlObjectListModel()
...
@@ -32,6 +32,14 @@ QmlObjectListModel::~QmlObjectListModel()
}
}
QObject
*
QmlObjectListModel
::
get
(
int
index
)
{
if
(
index
<
0
||
index
>=
_objectList
.
count
())
{
return
nullptr
;
}
return
_objectList
[
index
];
}
int
QmlObjectListModel
::
rowCount
(
const
QModelIndex
&
parent
)
const
int
QmlObjectListModel
::
rowCount
(
const
QModelIndex
&
parent
)
const
{
{
Q_UNUSED
(
parent
);
Q_UNUSED
(
parent
);
...
@@ -160,19 +168,17 @@ void QmlObjectListModel::insert(int i, QObject* object)
...
@@ -160,19 +168,17 @@ void QmlObjectListModel::insert(int i, QObject* object)
if
(
i
<
0
||
i
>
_objectList
.
count
())
{
if
(
i
<
0
||
i
>
_objectList
.
count
())
{
qWarning
()
<<
"Invalid index index:count"
<<
i
<<
_objectList
.
count
();
qWarning
()
<<
"Invalid index index:count"
<<
i
<<
_objectList
.
count
();
}
}
if
(
object
)
{
QQmlEngine
::
setObjectOwnership
(
object
,
QQmlEngine
::
CppOwnership
);
QQmlEngine
::
setObjectOwnership
(
object
,
QQmlEngine
::
CppOwnership
);
// Look for a dirtyChanged signal on the object
// Look for a dirtyChanged signal on the object
if
(
object
->
metaObject
()
->
indexOfSignal
(
QMetaObject
::
normalizedSignature
(
"dirtyChanged(bool)"
))
!=
-
1
)
{
if
(
object
->
metaObject
()
->
indexOfSignal
(
QMetaObject
::
normalizedSignature
(
"dirtyChanged(bool)"
))
!=
-
1
)
{
if
(
!
_skipDirtyFirstItem
||
i
!=
0
)
{
if
(
!
_skipDirtyFirstItem
||
i
!=
0
)
{
QObject
::
connect
(
object
,
SIGNAL
(
dirtyChanged
(
bool
)),
this
,
SLOT
(
_childDirtyChanged
(
bool
)));
QObject
::
connect
(
object
,
SIGNAL
(
dirtyChanged
(
bool
)),
this
,
SLOT
(
_childDirtyChanged
(
bool
)));
}
}
}
}
}
_objectList
.
insert
(
i
,
object
);
_objectList
.
insert
(
i
,
object
);
insertRows
(
i
,
1
);
insertRows
(
i
,
1
);
setDirty
(
true
);
setDirty
(
true
);
}
}
...
...
src/QmlControls/QmlObjectListModel.h
View file @
124f9ec9
...
@@ -27,7 +27,7 @@ public:
...
@@ -27,7 +27,7 @@ public:
/// a dirty property and dirtyChanged signal.
/// a dirty property and dirtyChanged signal.
Q_PROPERTY
(
bool
dirty
READ
dirty
WRITE
setDirty
NOTIFY
dirtyChanged
)
Q_PROPERTY
(
bool
dirty
READ
dirty
WRITE
setDirty
NOTIFY
dirtyChanged
)
Q_INVOKABLE
QObject
*
get
(
int
index
)
{
return
_objectList
[
index
];
}
Q_INVOKABLE
QObject
*
get
(
int
index
)
;
// Property accessors
// Property accessors
...
...
src/VehicleSetup/JoystickConfig.qml
View file @
124f9ec9
...
@@ -61,6 +61,9 @@ SetupPage {
...
@@ -61,6 +61,9 @@ SetupPage {
QGCTabBar
{
QGCTabBar
{
id
:
bar
id
:
bar
width
:
parent
.
width
width
:
parent
.
width
Component.onCompleted
:
{
currentIndex
=
_activeJoystick
&&
_activeJoystick
.
calibrated
?
0
:
2
}
anchors.top
:
parent
.
top
anchors.top
:
parent
.
top
QGCTabButton
{
QGCTabButton
{
text
:
qsTr
(
"
General
"
)
text
:
qsTr
(
"
General
"
)
...
...
src/VehicleSetup/JoystickConfigAdvanced.qml
View file @
124f9ec9
...
@@ -144,20 +144,38 @@ Item {
...
@@ -144,20 +144,38 @@ Item {
visible
:
advancedSettings
.
checked
visible
:
advancedSettings
.
checked
}
}
//-----------------------------------------------------------------
//-----------------------------------------------------------------
//-- Message Frequency
//--
Axis
Message Frequency
QGCLabel
{
QGCLabel
{
text
:
qsTr
(
"
Message
frequency (Hz):
"
)
text
:
qsTr
(
"
Axis
frequency (Hz):
"
)
Layout.alignment
:
Qt
.
AlignVCenter
Layout.alignment
:
Qt
.
AlignVCenter
visible
:
advancedSettings
.
checked
visible
:
advancedSettings
.
checked
}
}
QGCTextField
{
QGCTextField
{
text
:
_activeJoystick
.
f
requency
text
:
_activeJoystick
.
axisF
requency
enabled
:
advancedSettings
.
checked
enabled
:
advancedSettings
.
checked
validator
:
DoubleValidator
{
bottom
:
0.25
;
top
:
10
0.0
;
}
validator
:
DoubleValidator
{
bottom
:
0.25
;
top
:
5
0.0
;
}
inputMethodHints
:
Qt
.
ImhFormattedNumbersOnly
inputMethodHints
:
Qt
.
ImhFormattedNumbersOnly
Layout.alignment
:
Qt
.
AlignVCenter
Layout.alignment
:
Qt
.
AlignVCenter
onEditingFinished
:
{
onEditingFinished
:
{
_activeJoystick
.
frequency
=
parseFloat
(
text
)
_activeJoystick
.
axisFrequency
=
parseFloat
(
text
)
}
visible
:
advancedSettings
.
checked
}
//-----------------------------------------------------------------
//-- Button Repeat Frequency
QGCLabel
{
text
:
qsTr
(
"
Button repeat frequency (Hz):
"
)
Layout.alignment
:
Qt
.
AlignVCenter
visible
:
advancedSettings
.
checked
}
QGCTextField
{
text
:
_activeJoystick
.
buttonFrequency
enabled
:
advancedSettings
.
checked
validator
:
DoubleValidator
{
bottom
:
0.25
;
top
:
50.0
;
}
inputMethodHints
:
Qt
.
ImhFormattedNumbersOnly
Layout.alignment
:
Qt
.
AlignVCenter
onEditingFinished
:
{
_activeJoystick
.
buttonFrequency
=
parseFloat
(
text
)
}
}
visible
:
advancedSettings
.
checked
visible
:
advancedSettings
.
checked
}
}
...
...
src/VehicleSetup/JoystickConfigButtons.qml
View file @
124f9ec9
...
@@ -46,11 +46,7 @@ Item {
...
@@ -46,11 +46,7 @@ Item {
Row
{
Row
{
spacing
:
ScreenTools
.
defaultFontPixelWidth
spacing
:
ScreenTools
.
defaultFontPixelWidth
property
bool
pressed
property
bool
pressed
QGCCheckBox
{
property
var
currentAssignableAction
:
_activeJoystick
?
_activeJoystick
.
assignableActions
.
get
(
buttonActionCombo
.
currentIndex
)
:
null
anchors.verticalCenter
:
parent
.
verticalCenter
checked
:
_activeJoystick
?
_activeJoystick
.
buttonActions
[
modelData
]
!==
""
:
false
onClicked
:
_activeJoystick
.
setButtonAction
(
modelData
,
checked
?
buttonActionCombo
.
textAt
(
buttonActionCombo
.
currentIndex
)
:
""
)
}
Rectangle
{
Rectangle
{
anchors.verticalCenter
:
parent
.
verticalCenter
anchors.verticalCenter
:
parent
.
verticalCenter
width
:
ScreenTools
.
defaultFontPixelHeight
*
1.5
width
:
ScreenTools
.
defaultFontPixelHeight
*
1.5
...
@@ -69,9 +65,35 @@ Item {
...
@@ -69,9 +65,35 @@ Item {
QGCComboBox
{
QGCComboBox
{
id
:
buttonActionCombo
id
:
buttonActionCombo
width
:
ScreenTools
.
defaultFontPixelWidth
*
26
width
:
ScreenTools
.
defaultFontPixelWidth
*
26
model
:
_activeJoystick
?
_activeJoystick
.
actions
:
0
model
:
_activeJoystick
?
_activeJoystick
.
assignableActionTitles
:
[]
onActivated
:
_activeJoystick
.
setButtonAction
(
modelData
,
textAt
(
index
))
onActivated
:
{
Component.onCompleted
:
currentIndex
=
find
(
_activeJoystick
.
buttonActions
[
modelData
])
_activeJoystick
.
setButtonAction
(
modelData
,
textAt
(
index
))
}
Component.onCompleted
:
{
if
(
_activeJoystick
)
{
var
i
=
find
(
_activeJoystick
.
buttonActions
[
modelData
])
if
(
i
<
0
)
i
=
0
currentIndex
=
i
}
}
}
QGCCheckBox
{
id
:
repeatCheck
text
:
qsTr
(
"
Repeat
"
)
enabled
:
currentAssignableAction
&&
_activeJoystick
.
calibrated
&&
currentAssignableAction
.
canRepeat
onClicked
:
{
_activeJoystick
.
setButtonRepeat
(
modelData
,
checked
)
}
Component.onCompleted
:
{
if
(
_activeJoystick
)
{
checked
=
_activeJoystick
.
getButtonRepeat
(
modelData
)
}
}
anchors
.
verticalCenter
:
parent
.
verticalCenter
}
Item
{
width
:
ScreenTools
.
defaultFontPixelWidth
*
2
height
:
1
}
}
}
}
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment