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
3332ec2f
Commit
3332ec2f
authored
Nov 30, 2014
by
Don Gagne
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #1030 from DonLakeFlyer/MainWindowTest
Simple MainWindow Unit Test
parents
a494d27b
c7e17869
Changes
11
Show whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
193 additions
and
60 deletions
+193
-60
qgroundcontrol.pro
qgroundcontrol.pro
+4
-2
QGCApplication.cc
src/QGCApplication.cc
+34
-38
TCPLink.cc
src/comm/TCPLink.cc
+0
-2
MainWindowTest.cc
src/qgcunittest/MainWindowTest.cc
+57
-0
MainWindowTest.h
src/qgcunittest/MainWindowTest.h
+50
-0
MessageBoxTest.cc
src/qgcunittest/MessageBoxTest.cc
+1
-1
MessageBoxTest.h
src/qgcunittest/MessageBoxTest.h
+1
-1
MockLink.cc
src/qgcunittest/MockLink.cc
+40
-5
MockLink.h
src/qgcunittest/MockLink.h
+2
-1
MainWindow.cc
src/ui/MainWindow.cc
+3
-4
MainWindow.h
src/ui/MainWindow.h
+1
-6
No files found.
qgroundcontrol.pro
View file @
3332ec2f
...
@@ -650,7 +650,8 @@ HEADERS += \
...
@@ -650,7 +650,8 @@ HEADERS += \
src
/
qgcunittest
/
TCPLoopBackServer
.
h
\
src
/
qgcunittest
/
TCPLoopBackServer
.
h
\
src
/
qgcunittest
/
QGCUASFileManagerTest
.
h
\
src
/
qgcunittest
/
QGCUASFileManagerTest
.
h
\
src
/
qgcunittest
/
PX4RCCalibrationTest
.
h
\
src
/
qgcunittest
/
PX4RCCalibrationTest
.
h
\
src
/
qgcunittest
/
LinkManagerTest
.
h
src
/
qgcunittest
/
LinkManagerTest
.
h
\
src
/
qgcunittest
/
MainWindowTest
.
h
SOURCES
+=
\
SOURCES
+=
\
src
/
qgcunittest
/
UnitTest
.
cc
\
src
/
qgcunittest
/
UnitTest
.
cc
\
...
@@ -668,7 +669,8 @@ SOURCES += \
...
@@ -668,7 +669,8 @@ SOURCES += \
src
/
qgcunittest
/
TCPLoopBackServer
.
cc
\
src
/
qgcunittest
/
TCPLoopBackServer
.
cc
\
src
/
qgcunittest
/
QGCUASFileManagerTest
.
cc
\
src
/
qgcunittest
/
QGCUASFileManagerTest
.
cc
\
src
/
qgcunittest
/
PX4RCCalibrationTest
.
cc
\
src
/
qgcunittest
/
PX4RCCalibrationTest
.
cc
\
src
/
qgcunittest
/
LinkManagerTest
.
cc
src
/
qgcunittest
/
LinkManagerTest
.
cc
\
src
/
qgcunittest
/
MainWindowTest
.
cc
}
}
#
#
...
...
src/QGCApplication.cc
View file @
3332ec2f
...
@@ -143,22 +143,13 @@ QGCApplication::~QGCApplication()
...
@@ -143,22 +143,13 @@ QGCApplication::~QGCApplication()
}
}
void
QGCApplication
::
_initCommon
(
void
)
void
QGCApplication
::
_initCommon
(
void
)
{
}
bool
QGCApplication
::
_initForNormalAppBoot
(
void
)
{
{
QSettings
settings
;
QSettings
settings
;
_createSingletons
();
_createSingletons
();
// Exit main application when last window is closed
connect
(
this
,
SIGNAL
(
lastWindowClosed
()),
this
,
SLOT
(
quit
()));
// Show user an upgrade message if the settings version has been bumped up
// Show user an upgrade message if the settings version has been bumped up
bool
settingsUpgraded
=
false
;
bool
settingsUpgraded
=
false
;
enum
MainWindow
::
CUSTOM_MODE
mode
=
MainWindow
::
CUSTOM_MODE_PX4
;
if
(
settings
.
contains
(
_settingsVersionKey
))
{
if
(
settings
.
contains
(
_settingsVersionKey
))
{
if
(
settings
.
value
(
_settingsVersionKey
).
toInt
()
!=
QGC_SETTINGS_VERSION
)
{
if
(
settings
.
value
(
_settingsVersionKey
).
toInt
()
!=
QGC_SETTINGS_VERSION
)
{
settingsUpgraded
=
true
;
settingsUpgraded
=
true
;
...
@@ -171,6 +162,9 @@ bool QGCApplication::_initForNormalAppBoot(void)
...
@@ -171,6 +162,9 @@ bool QGCApplication::_initForNormalAppBoot(void)
if
(
settingsUpgraded
)
{
if
(
settingsUpgraded
)
{
settings
.
clear
();
settings
.
clear
();
settings
.
setValue
(
_settingsVersionKey
,
QGC_SETTINGS_VERSION
);
settings
.
setValue
(
_settingsVersionKey
,
QGC_SETTINGS_VERSION
);
QGCMessageBox
::
information
(
tr
(
"Settings Cleared"
),
tr
(
"The format for QGroundControl saved settings has been modified. "
"Your saved settings have been reset to defaults."
));
}
}
// Load saved files location and validate
// Load saved files location and validate
...
@@ -190,7 +184,6 @@ bool QGCApplication::_initForNormalAppBoot(void)
...
@@ -190,7 +184,6 @@ bool QGCApplication::_initForNormalAppBoot(void)
Q_UNUSED
(
pathCreated
);
Q_UNUSED
(
pathCreated
);
Q_ASSERT
(
pathCreated
);
Q_ASSERT
(
pathCreated
);
savedFilesLocation
=
documentsDir
.
filePath
(
_defaultSavedFileDirectoryName
);
savedFilesLocation
=
documentsDir
.
filePath
(
_defaultSavedFileDirectoryName
);
settings
.
setValue
(
_savedFilesLocationKey
,
savedFilesLocation
);
}
}
if
(
!
savedFilesLocation
.
isEmpty
())
{
if
(
!
savedFilesLocation
.
isEmpty
())
{
...
@@ -198,10 +191,24 @@ bool QGCApplication::_initForNormalAppBoot(void)
...
@@ -198,10 +191,24 @@ bool QGCApplication::_initForNormalAppBoot(void)
savedFilesLocation
.
clear
();
savedFilesLocation
.
clear
();
}
}
}
}
settings
.
setValue
(
_savedFilesLocationKey
,
savedFilesLocation
);
// Load application font
QFontDatabase
fontDatabase
=
QFontDatabase
();
const
QString
fontFileName
=
":/general/vera.ttf"
;
///< Font file is part of the QRC file and compiled into the app
//const QString fontFamilyName = "Bitstream Vera Sans";
if
(
!
QFile
::
exists
(
fontFileName
))
printf
(
"ERROR! font file: %s DOES NOT EXIST!
\n
"
,
fontFileName
.
toStdString
().
c_str
());
fontDatabase
.
addApplicationFont
(
fontFileName
);
// Avoid Using setFont(). In the Qt docu you can read the following:
// "Warning: Do not use this function in conjunction with Qt Style Sheets."
// setFont(fontDatabase.font(fontFamilyName, "Roman", 12));
}
mode
=
(
enum
MainWindow
::
CUSTOM_MODE
)
settings
.
value
(
"QGC_CUSTOM_MODE"
,
(
int
)
MainWindow
::
CUSTOM_MODE_PX4
).
toInt
();
bool
QGCApplication
::
_initForNormalAppBoot
(
void
)
{
QSettings
settings
;
settings
.
sync
();
enum
MainWindow
::
CUSTOM_MODE
mode
=
(
enum
MainWindow
::
CUSTOM_MODE
)
settings
.
value
(
"QGC_CUSTOM_MODE"
,
(
int
)
MainWindow
::
CUSTOM_MODE_PX4
).
toInt
();
// Show splash screen
// Show splash screen
QPixmap
splashImage
(
":/files/images/splash.png"
);
QPixmap
splashImage
(
":/files/images/splash.png"
);
...
@@ -212,21 +219,24 @@ bool QGCApplication::_initForNormalAppBoot(void)
...
@@ -212,21 +219,24 @@ bool QGCApplication::_initForNormalAppBoot(void)
processEvents
();
processEvents
();
splashScreen
->
showMessage
(
tr
(
"Loading application fonts"
),
Qt
::
AlignLeft
|
Qt
::
AlignBottom
,
QColor
(
62
,
93
,
141
));
splashScreen
->
showMessage
(
tr
(
"Loading application fonts"
),
Qt
::
AlignLeft
|
Qt
::
AlignBottom
,
QColor
(
62
,
93
,
141
));
// Load application font
// Exit main application when last window is closed
QFontDatabase
fontDatabase
=
QFontDatabase
();
connect
(
this
,
SIGNAL
(
lastWindowClosed
()),
this
,
SLOT
(
quit
()));
const
QString
fontFileName
=
":/general/vera.ttf"
;
///< Font file is part of the QRC file and compiled into the app
//const QString fontFamilyName = "Bitstream Vera Sans";
if
(
!
QFile
::
exists
(
fontFileName
))
printf
(
"ERROR! font file: %s DOES NOT EXIST!
\n
"
,
fontFileName
.
toStdString
().
c_str
());
fontDatabase
.
addApplicationFont
(
fontFileName
);
// Avoid Using setFont(). In the Qt docu you can read the following:
// "Warning: Do not use this function in conjunction with Qt Style Sheets."
// setFont(fontDatabase.font(fontFamilyName, "Roman", 12));
// Start the user interface
// Start the user interface
splashScreen
->
showMessage
(
tr
(
"Starting user interface"
),
Qt
::
AlignLeft
|
Qt
::
AlignBottom
,
QColor
(
62
,
93
,
141
));
splashScreen
->
showMessage
(
tr
(
"Starting user interface"
),
Qt
::
AlignLeft
|
Qt
::
AlignBottom
,
QColor
(
62
,
93
,
141
));
MainWindow
*
mainWindow
=
new
MainWindow
(
splashScreen
,
mode
);
MainWindow
*
mainWindow
=
MainWindow
::
_create
(
splashScreen
,
mode
);
Q_CHECK_PTR
(
mainWindow
);
Q_CHECK_PTR
(
mainWindow
);
// If we made it this far and we still don't have a location. Either the specfied location was invalid
// or we coudn't create a default location. Either way, we need to let the user know and prompt for a new
/// settings.
QString
savedFilesLocation
=
settings
.
value
(
_savedFilesLocationKey
).
toString
();
if
(
savedFilesLocation
.
isEmpty
())
{
QGCMessageBox
::
warning
(
tr
(
"Bad save location"
),
tr
(
"The location to save files to is invalid, or cannot be written to. Please provide a new one."
));
mainWindow
->
showSettings
();
}
UDPLink
*
udpLink
=
NULL
;
UDPLink
*
udpLink
=
NULL
;
if
(
mainWindow
->
getCustomMode
()
==
MainWindow
::
CUSTOM_MODE_WIFI
)
if
(
mainWindow
->
getCustomMode
()
==
MainWindow
::
CUSTOM_MODE_WIFI
)
...
@@ -252,20 +262,6 @@ bool QGCApplication::_initForNormalAppBoot(void)
...
@@ -252,20 +262,6 @@ bool QGCApplication::_initForNormalAppBoot(void)
splashScreen
->
finish
(
mainWindow
);
splashScreen
->
finish
(
mainWindow
);
mainWindow
->
splashScreenFinished
();
mainWindow
->
splashScreenFinished
();
// If we made it this far and we still don't have a location. Either the specfied location was invalid
// or we coudn't create a default location. Either way, we need to let the user know and prompt for a new
/// settings.
if
(
savedFilesLocation
.
isEmpty
())
{
QGCMessageBox
::
warning
(
tr
(
"Bad save location"
),
tr
(
"The location to save files to is invalid, or cannot be written to. Please provide a new one."
));
mainWindow
->
showSettings
();
}
if
(
settingsUpgraded
)
{
mainWindow
->
showInfoMessage
(
tr
(
"Settings Cleared"
),
tr
(
"The format for QGroundControl saved settings has been modified. "
"Your saved settings have been reset to defaults."
));
}
// Check if link could be connected
// Check if link could be connected
if
(
udpLink
&&
LinkManager
::
instance
()
->
connectLink
(
udpLink
))
if
(
udpLink
&&
LinkManager
::
instance
()
->
connectLink
(
udpLink
))
...
...
src/comm/TCPLink.cc
View file @
3332ec2f
...
@@ -61,8 +61,6 @@ TCPLink::~TCPLink()
...
@@ -61,8 +61,6 @@ TCPLink::~TCPLink()
quit
();
quit
();
// Wait for it to exit
// Wait for it to exit
wait
();
wait
();
deleteLater
();
}
}
void
TCPLink
::
run
()
void
TCPLink
::
run
()
...
...
src/qgcunittest/MainWindowTest.cc
0 → 100644
View file @
3332ec2f
/*=====================================================================
QGroundControl Open Source Ground Control Station
(c) 2009 - 2014 QGROUNDCONTROL PROJECT <http://www.qgroundcontrol.org>
This file is part of the QGROUNDCONTROL project
QGROUNDCONTROL is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
QGROUNDCONTROL is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with QGROUNDCONTROL. If not, see <http://www.gnu.org/licenses/>.
======================================================================*/
/// @file
/// @brief Simple MainWindow unit test
///
/// @author Don Gagne <don@thegagnes.com>
#include "MainWindowTest.h"
#include "MainWindow.h"
UT_REGISTER_TEST
(
MainWindowTest
)
MainWindowTest
::
MainWindowTest
(
void
)
{
}
void
MainWindowTest
::
init
(
void
)
{
UnitTest
::
init
();
}
void
MainWindowTest
::
cleanup
(
void
)
{
UnitTest
::
cleanup
();
}
void
MainWindowTest
::
_simpleDisplay_test
(
void
)
{
MainWindow
*
mainWindow
=
MainWindow
::
_create
(
NULL
,
MainWindow
::
CUSTOM_MODE_PX4
);
Q_CHECK_PTR
(
mainWindow
);
mainWindow
->
close
();
delete
mainWindow
;
}
src/qgcunittest/MainWindowTest.h
0 → 100644
View file @
3332ec2f
/*=====================================================================
QGroundControl Open Source Ground Control Station
(c) 2009 - 2014 QGROUNDCONTROL PROJECT <http://www.qgroundcontrol.org>
This file is part of the QGROUNDCONTROL project
QGROUNDCONTROL is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
QGROUNDCONTROL is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with QGROUNDCONTROL. If not, see <http://www.gnu.org/licenses/>.
======================================================================*/
/// @file
/// @brief Simple MainWindow unit test
///
/// @author Don Gagne <don@thegagnes.com>
#ifndef MAINWINDOWTEST_H
#define MAINWINDOWTEST_H
#include "UnitTest.h"
class
MainWindowTest
:
public
UnitTest
{
Q_OBJECT
public:
MainWindowTest
(
void
);
private
slots
:
UT_DECLARE_DEFAULT_initTestCase
UT_DECLARE_DEFAULT_cleanupTestCase
void
init
(
void
);
void
cleanup
(
void
);
void
_simpleDisplay_test
(
void
);
};
#endif
src/qgcunittest/MessageBoxTest.cc
View file @
3332ec2f
...
@@ -22,7 +22,7 @@
...
@@ -22,7 +22,7 @@
======================================================================*/
======================================================================*/
/// @file
/// @file
/// @brief
The tests the unit test
QGCMessageBox catching mechanism.
/// @brief
Unit test for
QGCMessageBox catching mechanism.
///
///
/// @author Don Gagne <don@thegagnes.com>
/// @author Don Gagne <don@thegagnes.com>
...
...
src/qgcunittest/MessageBoxTest.h
View file @
3332ec2f
...
@@ -22,7 +22,7 @@
...
@@ -22,7 +22,7 @@
======================================================================*/
======================================================================*/
/// @file
/// @file
/// @brief
The tests the unit test
QGCMessageBox catching mechanism.
/// @brief
Unit test for
QGCMessageBox catching mechanism.
///
///
/// @author Don Gagne <don@thegagnes.com>
/// @author Don Gagne <don@thegagnes.com>
...
...
src/qgcunittest/MockLink.cc
View file @
3332ec2f
...
@@ -34,6 +34,35 @@
...
@@ -34,6 +34,35 @@
///
///
/// @author Don Gagne <don@thegagnes.com>
/// @author Don Gagne <don@thegagnes.com>
enum
PX4_CUSTOM_MAIN_MODE
{
PX4_CUSTOM_MAIN_MODE_MANUAL
=
1
,
PX4_CUSTOM_MAIN_MODE_ALTCTL
,
PX4_CUSTOM_MAIN_MODE_POSCTL
,
PX4_CUSTOM_MAIN_MODE_AUTO
,
PX4_CUSTOM_MAIN_MODE_ACRO
,
PX4_CUSTOM_MAIN_MODE_OFFBOARD
,
};
enum
PX4_CUSTOM_SUB_MODE_AUTO
{
PX4_CUSTOM_SUB_MODE_AUTO_READY
=
1
,
PX4_CUSTOM_SUB_MODE_AUTO_TAKEOFF
,
PX4_CUSTOM_SUB_MODE_AUTO_LOITER
,
PX4_CUSTOM_SUB_MODE_AUTO_MISSION
,
PX4_CUSTOM_SUB_MODE_AUTO_RTL
,
PX4_CUSTOM_SUB_MODE_AUTO_LAND
,
PX4_CUSTOM_SUB_MODE_AUTO_RTGS
};
union
px4_custom_mode
{
struct
{
uint16_t
reserved
;
uint8_t
main_mode
;
uint8_t
sub_mode
;
};
uint32_t
data
;
float
data_float
;
};
MockLink
::
MockLink
(
void
)
:
MockLink
::
MockLink
(
void
)
:
_linkId
(
getNextLinkId
()),
_linkId
(
getNextLinkId
()),
_name
(
"MockLink"
),
_name
(
"MockLink"
),
...
@@ -42,9 +71,15 @@ MockLink::MockLink(void) :
...
@@ -42,9 +71,15 @@ MockLink::MockLink(void) :
_vehicleComponentId
(
200
),
// FIXME: magic number?
_vehicleComponentId
(
200
),
// FIXME: magic number?
_inNSH
(
false
),
_inNSH
(
false
),
_mavlinkStarted
(
false
),
_mavlinkStarted
(
false
),
_mav
Mode
(
MAV_MODE_FLAG_MANUAL_INPUT
_ENABLED
),
_mav
BaseMode
(
MAV_MODE_FLAG_MANUAL_INPUT_ENABLED
|
MAV_MODE_FLAG_CUSTOM_MODE
_ENABLED
),
_mavState
(
MAV_STATE_STANDBY
)
_mavState
(
MAV_STATE_STANDBY
)
{
{
union
px4_custom_mode
px4_cm
;
px4_cm
.
data
=
0
;
px4_cm
.
main_mode
=
PX4_CUSTOM_MAIN_MODE_MANUAL
;
_mavCustomMode
=
px4_cm
.
data
;
_missionItemHandler
=
new
MockLinkMissionItemHandler
(
_vehicleSystemId
,
this
);
_missionItemHandler
=
new
MockLinkMissionItemHandler
(
_vehicleSystemId
,
this
);
Q_CHECK_PTR
(
_missionItemHandler
);
Q_CHECK_PTR
(
_missionItemHandler
);
...
@@ -56,7 +91,6 @@ MockLink::MockLink(void) :
...
@@ -56,7 +91,6 @@ MockLink::MockLink(void) :
MockLink
::~
MockLink
(
void
)
MockLink
::~
MockLink
(
void
)
{
{
_disconnect
();
_disconnect
();
deleteLater
();
}
}
void
MockLink
::
readBytes
(
void
)
void
MockLink
::
readBytes
(
void
)
...
@@ -184,8 +218,8 @@ void MockLink::_sendHeartBeat(void)
...
@@ -184,8 +218,8 @@ void MockLink::_sendHeartBeat(void)
&
msg
,
&
msg
,
MAV_TYPE_QUADROTOR
,
// MAV_TYPE
MAV_TYPE_QUADROTOR
,
// MAV_TYPE
MAV_AUTOPILOT_PX4
,
// MAV_AUTOPILOT
MAV_AUTOPILOT_PX4
,
// MAV_AUTOPILOT
_mav
Mode
,
// MAV_MODE
_mav
BaseMode
,
// MAV_MODE
0
,
// custom mode
_mavCustomMode
,
// custom mode
_mavState
);
// MAV_STATE
_mavState
);
// MAV_STATE
int
cBuffer
=
mavlink_msg_to_send_buffer
(
buffer
,
&
msg
);
int
cBuffer
=
mavlink_msg_to_send_buffer
(
buffer
,
&
msg
);
...
@@ -323,7 +357,8 @@ void MockLink::_handleSetMode(const mavlink_message_t& msg)
...
@@ -323,7 +357,8 @@ void MockLink::_handleSetMode(const mavlink_message_t& msg)
mavlink_msg_set_mode_decode
(
&
msg
,
&
request
);
mavlink_msg_set_mode_decode
(
&
msg
,
&
request
);
if
(
request
.
target_system
==
_vehicleSystemId
)
{
if
(
request
.
target_system
==
_vehicleSystemId
)
{
_mavMode
=
request
.
base_mode
;
_mavBaseMode
=
request
.
base_mode
;
_mavCustomMode
=
request
.
custom_mode
;
}
else
{
}
else
{
_errorInvalidTargetSystem
(
request
.
target_system
);
_errorInvalidTargetSystem
(
request
.
target_system
);
}
}
...
...
src/qgcunittest/MockLink.h
View file @
3332ec2f
...
@@ -118,7 +118,8 @@ private:
...
@@ -118,7 +118,8 @@ private:
typedef
QMap
<
uint16_t
,
mavlink_mission_item_t
>
MissionList_t
;
typedef
QMap
<
uint16_t
,
mavlink_mission_item_t
>
MissionList_t
;
MissionList_t
_missionItems
;
MissionList_t
_missionItems
;
uint8_t
_mavMode
;
uint8_t
_mavBaseMode
;
uint8_t
_mavCustomMode
;
uint8_t
_mavState
;
uint8_t
_mavState
;
};
};
...
...
src/ui/MainWindow.cc
View file @
3332ec2f
...
@@ -88,7 +88,6 @@ const QString MainWindow::defaultLightStyle = ":files/styles/style-light.css";
...
@@ -88,7 +88,6 @@ const QString MainWindow::defaultLightStyle = ":files/styles/style-light.css";
MainWindow
*
MainWindow
::
_create
(
QSplashScreen
*
splashScreen
,
enum
MainWindow
::
CUSTOM_MODE
mode
)
MainWindow
*
MainWindow
::
_create
(
QSplashScreen
*
splashScreen
,
enum
MainWindow
::
CUSTOM_MODE
mode
)
{
{
Q_ASSERT
(
_instance
==
NULL
);
Q_ASSERT
(
_instance
==
NULL
);
Q_ASSERT
(
splashScreen
);
new
MainWindow
(
splashScreen
,
mode
);
new
MainWindow
(
splashScreen
,
mode
);
...
@@ -125,12 +124,12 @@ MainWindow::MainWindow(QSplashScreen* splashScreen, enum MainWindow::CUSTOM_MODE
...
@@ -125,12 +124,12 @@ MainWindow::MainWindow(QSplashScreen* splashScreen, enum MainWindow::CUSTOM_MODE
menuActionHelper
(
new
MenuActionHelper
()),
menuActionHelper
(
new
MenuActionHelper
()),
_splashScreen
(
splashScreen
)
_splashScreen
(
splashScreen
)
{
{
Q_ASSERT
(
splashScreen
);
Q_ASSERT
(
_instance
==
NULL
);
Q_ASSERT
(
_instance
==
NULL
);
_instance
=
this
;
_instance
=
this
;
if
(
splashScreen
)
{
connect
(
this
,
&
MainWindow
::
initStatusChanged
,
splashScreen
,
&
QSplashScreen
::
showMessage
);
connect
(
this
,
&
MainWindow
::
initStatusChanged
,
splashScreen
,
&
QSplashScreen
::
showMessage
);
}
this
->
setAttribute
(
Qt
::
WA_DeleteOnClose
);
this
->
setAttribute
(
Qt
::
WA_DeleteOnClose
);
connect
(
menuActionHelper
,
SIGNAL
(
needToShowDockWidget
(
QString
,
bool
)),
SLOT
(
showDockWidget
(
QString
,
bool
)));
connect
(
menuActionHelper
,
SIGNAL
(
needToShowDockWidget
(
QString
,
bool
)),
SLOT
(
showDockWidget
(
QString
,
bool
)));
...
...
src/ui/MainWindow.h
View file @
3332ec2f
...
@@ -468,14 +468,9 @@ private slots:
...
@@ -468,14 +468,9 @@ private slots:
void
_saveTempFlightDataLog
(
QString
tempLogfile
);
void
_saveTempFlightDataLog
(
QString
tempLogfile
);
private:
private:
/// Constructor is private since all creation should be through MainWindow::
instance.
/// Constructor is private since all creation should be through MainWindow::
_create
MainWindow
(
QSplashScreen
*
splashScreen
,
enum
MainWindow
::
CUSTOM_MODE
mode
);
MainWindow
(
QSplashScreen
*
splashScreen
,
enum
MainWindow
::
CUSTOM_MODE
mode
);
/// @brief Two phase construction such that MainWindow::instance is available to code
void
_init
(
void
);
friend
class
QGCApplication
;
void
_hideSplashScreen
(
void
);
void
_hideSplashScreen
(
void
);
void
_openUrl
(
const
QString
&
url
,
const
QString
&
errorMessage
);
void
_openUrl
(
const
QString
&
url
,
const
QString
&
errorMessage
);
...
...
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