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
9933b084
Commit
9933b084
authored
Feb 10, 2015
by
Don Gagne
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #1225 from DonLakeFlyer/SetupViewMVC
Change SetupView to MVC model
parents
a21bd1d9
e47267e2
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
17 additions
and
34 deletions
+17
-34
SetupView.cc
src/VehicleSetup/SetupView.cc
+7
-20
SetupView.h
src/VehicleSetup/SetupView.h
+5
-4
SetupViewButtons.qml
src/VehicleSetup/SetupViewButtons.qml
+5
-10
No files found.
src/VehicleSetup/SetupView.cc
View file @
9933b084
...
...
@@ -59,20 +59,7 @@ SetupView::SetupView(QWidget* parent) :
_ui
->
buttonHolder
->
setAutoPilot
(
NULL
);
_ui
->
buttonHolder
->
setSource
(
QUrl
::
fromUserInput
(
"qrc:/qml/SetupViewButtons.qml"
));
QObject
*
rootObject
=
(
QObject
*
)
_ui
->
buttonHolder
->
rootObject
();
Q_ASSERT
(
rootObject
);
fSucceeded
=
connect
(
rootObject
,
SIGNAL
(
setupButtonClicked
(
QVariant
)),
this
,
SLOT
(
_setupButtonClicked
(
QVariant
)));
Q_ASSERT
(
fSucceeded
);
fSucceeded
=
connect
(
rootObject
,
SIGNAL
(
firmwareButtonClicked
()),
this
,
SLOT
(
_firmwareButtonClicked
()));
Q_ASSERT
(
fSucceeded
);
fSucceeded
=
connect
(
rootObject
,
SIGNAL
(
parametersButtonClicked
()),
this
,
SLOT
(
_parametersButtonClicked
()));
Q_ASSERT
(
fSucceeded
);
fSucceeded
=
connect
(
rootObject
,
SIGNAL
(
summaryButtonClicked
()),
this
,
SLOT
(
_summaryButtonClicked
()));
Q_ASSERT
(
fSucceeded
);
_ui
->
buttonHolder
->
rootContext
()
->
setContextProperty
(
"controller"
,
this
);
_setActiveUAS
(
UASManager
::
instance
()
->
getActiveUAS
());
}
...
...
@@ -91,7 +78,7 @@ void SetupView::_setActiveUAS(UASInterface* uas)
_autoPilotPlugin
=
NULL
;
_ui
->
buttonHolder
->
setAutoPilot
(
NULL
);
_
firmwareButtonClicked
();
firmwareButtonClicked
();
QObject
*
button
=
_ui
->
buttonHolder
->
rootObject
()
->
findChild
<
QObject
*>
(
"firmwareButton"
);
Q_ASSERT
(
button
);
button
->
setProperty
(
"checked"
,
true
);
...
...
@@ -111,7 +98,7 @@ void SetupView::_setActiveUAS(UASInterface* uas)
void
SetupView
::
_pluginReady
(
void
)
{
_ui
->
buttonHolder
->
setAutoPilot
(
_autoPilotPlugin
);
_
summaryButtonClicked
();
summaryButtonClicked
();
QObject
*
button
=
_ui
->
buttonHolder
->
rootObject
()
->
findChild
<
QObject
*>
(
"summaryButton"
);
Q_ASSERT
(
button
);
button
->
setProperty
(
"checked"
,
true
);
...
...
@@ -126,7 +113,7 @@ void SetupView::_changeSetupWidget(QWidget* newWidget)
_ui
->
setupWidgetLayout
->
addWidget
(
newWidget
);
}
void
SetupView
::
_
firmwareButtonClicked
(
void
)
void
SetupView
::
firmwareButtonClicked
(
void
)
{
if
(
_uasCurrent
&&
_uasCurrent
->
isArmed
())
{
QGCMessageBox
::
warning
(
"Setup"
,
"Firmware Update cannot be performed while vehicle is armed."
);
...
...
@@ -146,13 +133,13 @@ void SetupView::_firmwareButtonClicked(void)
_changeSetupWidget
(
setup
);
}
void
SetupView
::
_
parametersButtonClicked
(
void
)
void
SetupView
::
parametersButtonClicked
(
void
)
{
ParameterEditor
*
setup
=
new
ParameterEditor
(
_uasCurrent
,
QStringList
(),
this
);
_changeSetupWidget
(
setup
);
}
void
SetupView
::
_
summaryButtonClicked
(
void
)
void
SetupView
::
summaryButtonClicked
(
void
)
{
Q_ASSERT
(
_autoPilotPlugin
);
...
...
@@ -165,7 +152,7 @@ void SetupView::_summaryButtonClicked(void)
_changeSetupWidget
(
summary
);
}
void
SetupView
::
_
setupButtonClicked
(
const
QVariant
&
component
)
void
SetupView
::
setupButtonClicked
(
const
QVariant
&
component
)
{
if
(
_uasCurrent
->
isArmed
())
{
QGCMessageBox
::
warning
(
"Setup"
,
"Setup cannot be performed while vehicle is armed."
);
...
...
src/VehicleSetup/SetupView.h
View file @
9933b084
...
...
@@ -47,13 +47,14 @@ public:
explicit
SetupView
(
QWidget
*
parent
=
0
);
~
SetupView
();
Q_INVOKABLE
void
firmwareButtonClicked
(
void
);
Q_INVOKABLE
void
parametersButtonClicked
(
void
);
Q_INVOKABLE
void
summaryButtonClicked
(
void
);
Q_INVOKABLE
void
setupButtonClicked
(
const
QVariant
&
component
);
private
slots
:
void
_setActiveUAS
(
UASInterface
*
uas
);
void
_pluginReady
(
void
);
void
_firmwareButtonClicked
(
void
);
void
_parametersButtonClicked
(
void
);
void
_summaryButtonClicked
(
void
);
void
_setupButtonClicked
(
const
QVariant
&
component
);
private:
void
_changeSetupWidget
(
QWidget
*
newWidget
);
...
...
src/VehicleSetup/SetupViewButtons.qml
View file @
9933b084
...
...
@@ -13,11 +13,6 @@ Rectangle {
QGCPalette
{
id
:
palette
;
colorGroup
:
QGCPalette
.
Active
}
color
:
palette
.
window
signal
firmwareButtonClicked
;
signal
summaryButtonClicked
;
signal
parametersButtonClicked
;
signal
setupButtonClicked
(
variant
component
);
ExclusiveGroup
{
id
:
setupButtonGroup
}
Component
{
...
...
@@ -34,7 +29,7 @@ Rectangle {
text
:
"
FIRMWARE
"
setupIndicator
:
false
exclusiveGroup
:
setupButtonGroup
onClicked
:
topLevel
.
firmwareButtonClicked
()
onClicked
:
controller
.
firmwareButtonClicked
()
}
}
}
...
...
@@ -53,7 +48,7 @@ Rectangle {
text
:
"
SUMMARY
"
setupIndicator
:
false
exclusiveGroup
:
setupButtonGroup
onClicked
:
topLevel
.
summaryButtonClicked
()
onClicked
:
controller
.
summaryButtonClicked
()
}
SetupButton
{
...
...
@@ -62,7 +57,7 @@ Rectangle {
text
:
"
FIRMWARE
"
setupIndicator
:
false
exclusiveGroup
:
setupButtonGroup
onClicked
:
topLevel
.
firmwareButtonClicked
()
onClicked
:
controller
.
firmwareButtonClicked
()
}
Repeater
{
...
...
@@ -73,7 +68,7 @@ Rectangle {
text
:
modelData
.
name
.
toUpperCase
()
setupComplete
:
modelData
.
setupComplete
exclusiveGroup
:
setupButtonGroup
onClicked
:
topLevel
.
setupButtonClicked
(
modelData
)
onClicked
:
controller
.
setupButtonClicked
(
modelData
)
}
}
...
...
@@ -82,7 +77,7 @@ Rectangle {
text
:
"
PARAMETERS
"
setupIndicator
:
false
exclusiveGroup
:
setupButtonGroup
onClicked
:
topLevel
.
parametersButtonClicked
()
onClicked
:
controller
.
parametersButtonClicked
()
}
}
}
...
...
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