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
10d9e376
Commit
10d9e376
authored
Dec 08, 2014
by
Don Gagne
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #1088 from DonLakeFlyer/BugFixes
Bug fixes
parents
c27191b0
fbe79303
Changes
6
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
61 additions
and
41 deletions
+61
-41
MAVLinkProtocol.cc
src/comm/MAVLinkProtocol.cc
+5
-1
MainWindowTest.cc
src/qgcunittest/MainWindowTest.cc
+27
-0
MainWindowTest.h
src/qgcunittest/MainWindowTest.h
+1
-0
MavlinkLogTest.cc
src/qgcunittest/MavlinkLogTest.cc
+0
-29
MavlinkLogTest.h
src/qgcunittest/MavlinkLogTest.h
+0
-1
MainWindow.cc
src/ui/MainWindow.cc
+28
-10
No files found.
src/comm/MAVLinkProtocol.cc
View file @
10d9e376
...
...
@@ -694,7 +694,11 @@ void MAVLinkProtocol::_startLogging(void)
void
MAVLinkProtocol
::
_stopLogging
(
void
)
{
if
(
_closeLogFile
())
{
if
(
qgcApp
()
->
promptFlightDataSave
())
{
emit
saveTempFlightDataLog
(
_tempLogFile
.
fileName
());
}
else
{
QFile
::
remove
(
_tempLogFile
.
fileName
());
}
}
}
...
...
src/qgcunittest/MainWindowTest.cc
View file @
10d9e376
...
...
@@ -28,6 +28,8 @@
#include "MainWindowTest.h"
#include "QGCToolBar.h"
#include "MockLink.h"
#include "QGCMessageBox.h"
UT_REGISTER_TEST
(
MainWindowTest
)
...
...
@@ -66,3 +68,28 @@ void MainWindowTest::_clickThrough_test(void)
}
}
void
MainWindowTest
::
_connectWindowClose_test
(
void
)
{
LinkManager
*
linkMgr
=
LinkManager
::
instance
();
Q_CHECK_PTR
(
linkMgr
);
MockLink
*
link
=
new
MockLink
();
Q_CHECK_PTR
(
link
);
// FIXME: LinkManager/MainWindow needs to be re-architected so that you don't have to addLink to MainWindow to get things to work
_mainWindow
->
addLink
(
link
);
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
);
_mainWindow
->
close
();
QTest
::
qWait
(
1000
);
// Need to allow signals to move between threads
checkExpectedMessageBox
();
// We are going to disconnect the link which is going to pop a save file dialog
setExpectedFileDialog
(
getSaveFileName
,
QStringList
());
linkMgr
->
disconnectLink
(
link
);
QTest
::
qWait
(
1000
);
// Need to allow signals to move between threads
checkExpectedFileDialog
();
}
src/qgcunittest/MainWindowTest.h
View file @
10d9e376
...
...
@@ -44,6 +44,7 @@ private slots:
void
cleanup
(
void
);
void
_clickThrough_test
(
void
);
void
_connectWindowClose_test
(
void
);
private:
MainWindow
*
_mainWindow
;
...
...
src/qgcunittest/MavlinkLogTest.cc
View file @
10d9e376
...
...
@@ -170,32 +170,3 @@ void MavlinkLogTest::_connectLog_test(void)
QTest
::
qWait
(
1000
);
// Need to allow signals to move between threads to shutdown MainWindow
}
void
MavlinkLogTest
::
_connectLogWindowClose_test
(
void
)
{
MainWindow
*
mainWindow
=
MainWindow
::
_create
(
NULL
,
MainWindow
::
CUSTOM_MODE_PX4
);
Q_CHECK_PTR
(
mainWindow
);
LinkManager
*
linkMgr
=
LinkManager
::
instance
();
Q_CHECK_PTR
(
linkMgr
);
MockLink
*
link
=
new
MockLink
();
Q_CHECK_PTR
(
link
);
// FIXME: LinkManager/MainWindow needs to be re-architected so that you don't have to addLink to MainWindow to get things to work
mainWindow
->
addLink
(
link
);
linkMgr
->
connectLink
(
link
);
QTest
::
qWait
(
5000
);
// Give enough time for UI to settle and heartbeats to go through
// On Disconnect: We should get a getSaveFileName dialog.
QDir
logSaveDir
(
QStandardPaths
::
writableLocation
(
QStandardPaths
::
DocumentsLocation
));
QString
logSaveFile
(
logSaveDir
.
filePath
(
_saveLogFilename
));
setExpectedFileDialog
(
getSaveFileName
,
QStringList
(
logSaveFile
));
// MainWindow deletes itself on close
mainWindow
->
close
();
QTest
::
qWait
(
1000
);
// Need to allow signals to move between threads
checkExpectedFileDialog
();
// Make sure the file is there and delete it
QCOMPARE
(
logSaveDir
.
remove
(
_saveLogFilename
),
true
);
}
src/qgcunittest/MavlinkLogTest.h
View file @
10d9e376
...
...
@@ -46,7 +46,6 @@ private slots:
void
_bootLogDetectionSave_test
(
void
);
void
_bootLogDetectionZeroLength_test
(
void
);
void
_connectLog_test
(
void
);
void
_connectLogWindowClose_test
(
void
);
private:
void
_createTempLogFile
(
bool
zeroLength
);
...
...
src/ui/MainWindow.cc
View file @
10d9e376
...
...
@@ -778,12 +778,32 @@ void MainWindow::showHILConfigurationWidget(UASInterface* uas)
void
MainWindow
::
closeEvent
(
QCloseEvent
*
event
)
{
// Disallow window close if there are active connections
bool
foundConnections
=
false
;
foreach
(
LinkInterface
*
link
,
LinkManager
::
instance
()
->
getLinks
())
{
if
(
link
->
isConnected
())
{
foundConnections
=
true
;
break
;
}
}
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
;
}
// Should not be any active connections
foreach
(
LinkInterface
*
link
,
LinkManager
::
instance
()
->
getLinks
())
{
Q_UNUSED
(
link
);
Q_ASSERT
(
!
link
->
isConnected
());
}
storeViewState
();
storeSettings
();
mavlink
->
storeSettings
();
UASManager
::
instance
()
->
storeSettings
();
// FIXME: If connected links, should prompt before close
LinkManager
::
instance
()
->
disconnectAll
();
event
->
accept
();
}
...
...
@@ -1734,7 +1754,6 @@ bool MainWindow::dockWidgetTitleBarsEnabled() const
void
MainWindow
::
_saveTempFlightDataLog
(
QString
tempLogfile
)
{
if
(
qgcApp
()
->
promptFlightDataSave
())
{
QString
saveFilename
=
QGCFileDialog
::
getSaveFileName
(
this
,
tr
(
"Select file to save Flight Data Log"
),
qgcApp
()
->
mavlinkLogFilesLocation
(),
...
...
@@ -1742,7 +1761,6 @@ void MainWindow::_saveTempFlightDataLog(QString tempLogfile)
if
(
!
saveFilename
.
isEmpty
())
{
QFile
::
copy
(
tempLogfile
,
saveFilename
);
}
}
QFile
::
remove
(
tempLogfile
);
}
...
...
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