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
f62d9073
Commit
f62d9073
authored
Dec 09, 2014
by
Don Gagne
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Use can disconnect links on window close prompt
parent
e7d85710
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
17 additions
and
5 deletions
+17
-5
MainWindowTest.cc
src/qgcunittest/MainWindowTest.cc
+2
-2
MainWindow.cc
src/ui/MainWindow.cc
+15
-3
No files found.
src/qgcunittest/MainWindowTest.cc
View file @
f62d9073
...
...
@@ -81,8 +81,8 @@ void MainWindowTest::_connectWindowClose_test(void)
linkMgr
->
connectLink
(
link
);
QTest
::
qWait
(
5000
);
// Give enough time for UI to settle and heartbeats to go through
// On MainWindow close we should get a message box telling the user to disconnect first
setExpectedMessageBox
(
QGCMessageBox
::
Ok
);
// On MainWindow close we should get a message box telling the user to disconnect first
. Cancel should do nothing.
setExpectedMessageBox
(
QGCMessageBox
::
Cancel
);
_mainWindow
->
close
();
QTest
::
qWait
(
1000
);
// Need to allow signals to move between threads
checkExpectedMessageBox
();
...
...
src/ui/MainWindow.cc
View file @
f62d9073
...
...
@@ -787,11 +787,23 @@ void MainWindow::closeEvent(QCloseEvent *event)
}
if
(
foundConnections
)
{
QGCMessageBox
::
warning
(
tr
(
"QGroundControl close"
),
tr
(
"There are still active connections to vehicles. Please disconnect all connections before closing QGroundControl."
));
event
->
ignore
();
return
;
QGCMessageBox
::
StandardButton
button
=
QGCMessageBox
::
warning
(
tr
(
"QGroundControl close"
),
tr
(
"There are still active connections to vehicles. Do you want to disconnect these before closing?"
),
QMessageBox
::
Yes
|
QMessageBox
::
Cancel
,
QMessageBox
::
Cancel
);
if
(
button
==
QMessageBox
::
Yes
)
{
foreach
(
LinkInterface
*
link
,
LinkManager
::
instance
()
->
getLinks
())
{
LinkManager
::
instance
()
->
disconnectLink
(
link
);
}
}
else
{
event
->
ignore
();
return
;
}
}
// This will process any remaining flight log save dialogs
qgcApp
()
->
processEvents
(
QEventLoop
::
ExcludeUserInputEvents
);
// Should not be any active connections
foreach
(
LinkInterface
*
link
,
LinkManager
::
instance
()
->
getLinks
())
{
Q_UNUSED
(
link
);
...
...
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