Commit 86c7e134 authored by lm's avatar lm

Merged with 0.9 dev branches

parents 5d57365a 7f9de5e1
# Onboard parameters for system MAV 042
#
# MAV ID COMPONENT ID PARAM NAME VALUE (FLOAT)
42 1 HANDLEWPDELAY 0.20000000298
42 1 POSFILTER 1
42 1 PROTDELAY 40
42 1 PROTTIMEOUT 2
42 1 SETPOINTDELAY 1
42 1 YAWTOLERANCE 0.174500003457
42 200 ACC_NAV_OFFS_X 0
42 200 ACC_NAV_OFFS_Y 0
42 200 ACC_NAV_OFFS_Z -1000
42 200 ATT_KAL_KACC 0.00329999998212
42 200 ATT_KAL_YAWMOD 3
42 200 ATT_OFFSET_X 0
42 200 ATT_OFFSET_Y 0
42 200 ATT_OFFSET_Z -0.0799999982119
42 200 CAL_ACC_X 0
42 200 CAL_ACC_Y 0
42 200 CAL_ACC_Z 0
42 200 CAL_FIT_ACTIVE 0
42 200 CAL_FIT_GYRO_X 31496.8007812
42 200 CAL_FIT_GYRO_Y 29383.4003906
42 200 CAL_FIT_GYRO_Z 30151.0996094
42 200 CAL_GYRO_X 29767
42 200 CAL_GYRO_Y 29654
42 200 CAL_GYRO_Z 29570
42 200 CAL_MAG_X 375
42 200 CAL_MAG_Y -25
42 200 CAL_MAG_Z -1000
42 200 CAL_PRES_DIFF 10000
42 200 CAL_TEMP 29051
42 200 CAM_ANG_X_FAC 0
42 200 CAM_ANG_X_OFF 0
42 200 CAM_ANG_Y_FAC 0
42 200 CAM_ANG_Y_OFF 0.428000003099
42 200 CAM_EXP 1000
42 200 CAM_INTERVAL 200000
42 200 DEBUG_1 0
42 200 DEBUG_2 0
42 200 DEBUG_3 0
42 200 DEBUG_4 0
42 200 DEBUG_5 1
42 200 DEBUG_6 0
42 200 GPS_MODE 0
42 200 KAL_VEL_AX 1
42 200 KAL_VEL_AY 1
42 200 KAL_VEL_BX 0
42 200 KAL_VEL_BY 0
42 200 MIX_OFFSET 0
42 200 MIX_POSITION 0
42 200 MIX_POS_YAW 0
42 200 MIX_REMOTE 0
42 200 MIX_Z_POSITION 0
42 200 PID_ATT_AWU 0.300000011921
42 200 PID_ATT_D 30
42 200 PID_ATT_I 60
42 200 PID_ATT_LIM 100
42 200 PID_ATT_P 90
42 200 PID_POS_AWU 5
42 200 PID_POS_D 2
42 200 PID_POS_I 0.20000000298
42 200 PID_POS_LIM 0.20000000298
42 200 PID_POS_P 1.79999995232
42 200 PID_POS_Z_AWU 3
42 200 PID_POS_Z_D 0.20000000298
42 200 PID_POS_Z_I 0.300000011921
42 200 PID_POS_Z_LIM 0.300000011921
42 200 PID_POS_Z_P 0.25
42 200 PID_YAWPOS_AWU 1
42 200 PID_YAWPOS_D 1
42 200 PID_YAWPOS_I 0.10000000149
42 200 PID_YAWPOS_LIM 3
42 200 PID_YAWPOS_P 5
42 200 PID_YAWSPEED_D 0
42 200 PID_YAWSPEED_I 5
42 200 PID_YAWSPEED_P 15
42 200 PID_YAWSPE_AWU 1
42 200 PID_YAWSPE_LIM 50
42 200 POS_HOV_TRUST 0.300000011921
42 200 POS_SON_MODE 0
42 200 POS_SON_SCALE 1
42 200 POS_SP_ACCEPT 1
42 200 POS_SP_X 0
42 200 POS_SP_Y 0
42 200 POS_SP_YAW 0
42 200 POS_SP_Z -0.213201999664
42 200 POS_TIMEOUT 2000000
42 200 POS_YAW_TRACK 0
42 200 RC_NICK_CHAN 1
42 200 RC_ROLL_CHAN 2
42 200 RC_SAFETY_CHAN 5
42 200 RC_THRUST_CHAN 3
42 200 RC_TRIM_CHAN 0
42 200 RC_TUNE_CHAN1 5
42 200 RC_TUNE_CHAN2 6
42 200 RC_TUNE_CHAN3 7
42 200 RC_TUNE_CHAN4 8
42 200 RC_YAW_CHAN 4
42 200 SEND_DEBUGCHAN 0
42 200 SLOT_ATTITUDE 1
42 200 SLOT_CONTROL 0
42 200 SLOT_RAW_IMU 0
42 200 SLOT_RC 0
42 200 SYS_COMP_ID 200
42 200 SYS_ID 42
42 200 SYS_IMU_RESET 0
42 200 SYS_SW_VER 2000
42 200 SYS_TYPE 2
42 200 UART_0_BAUD 115200
42 200 UART_1_BAUD 115200
42 200 VEL_DAMP 0.949999988079
42 200 VEL_OFFSET_X 0
42 200 VEL_OFFSET_Y 0
42 200 VEL_OFFSET_Z 0
42 200 VICON_MODE 0
42 200 VICON_TKO_DIST 0.5
42 200 VICON_TKO_TIME 2
42 200 VIS_OUTL_TRESH 0.20000000298
[PIXHAWK%20Quadrotor%20Commands]
QGC_TOOL_WIDGET_ITEMS\1\TYPE=BUTTON
QGC_TOOL_WIDGET_ITEMS\1\QGC_ACTION_BUTTON_DESCRIPTION=CALIBRATE GYRO
QGC_TOOL_WIDGET_ITEMS\1\QGC_ACTION_BUTTON_BUTTONTEXT=Calibrate
QGC_TOOL_WIDGET_ITEMS\1\QGC_ACTION_BUTTON_ACTIONID=17
QGC_TOOL_WIDGET_ITEMS\2\TYPE=BUTTON
QGC_TOOL_WIDGET_ITEMS\2\QGC_ACTION_BUTTON_DESCRIPTION=Record logfile and images
QGC_TOOL_WIDGET_ITEMS\2\QGC_ACTION_BUTTON_BUTTONTEXT=Start
QGC_TOOL_WIDGET_ITEMS\2\QGC_ACTION_BUTTON_ACTIONID=21
QGC_TOOL_WIDGET_ITEMS\3\TYPE=BUTTON
QGC_TOOL_WIDGET_ITEMS\3\QGC_ACTION_BUTTON_DESCRIPTION=Stop recording
QGC_TOOL_WIDGET_ITEMS\3\QGC_ACTION_BUTTON_BUTTONTEXT=Stop
QGC_TOOL_WIDGET_ITEMS\3\QGC_ACTION_BUTTON_ACTIONID=23
QGC_TOOL_WIDGET_ITEMS\size=3
......@@ -84,6 +84,8 @@ macx {
# Copy audio files if needed
QMAKE_POST_LINK += && cp -rf $$BASEDIR/audio $$TARGETDIR/qgroundcontrol.app/Contents/MacOS
# Copy contributed files
QMAKE_POST_LINK += && cp -rf $$BASEDIR/files $$TARGETDIR/qgroundcontrol.app/Contents/MacOS
# Copy google earth starter file
QMAKE_POST_LINK += && cp -f $$BASEDIR/images/earth.html $$TARGETDIR/qgroundcontrol.app/Contents/MacOS
# Copy CSS stylesheets
......@@ -221,7 +223,10 @@ message("Compiling for linux 32")
DEFINES += QGC_LIBFREENECT_ENABLED
}
# Validated copy commands
QMAKE_POST_LINK += && cp -rf $$BASEDIR/audio $$DESTDIR
QMAKE_POST_LINK += && cp -rf $$BASEDIR/files $$DESTDIR
QMAKE_POST_LINK += && cp -rf $$BASEDIR/data $$DESTDIR
QMAKE_POST_LINK += && mkdir -p $$DESTDIR/images
QMAKE_POST_LINK += && cp -rf $$BASEDIR/images/Vera.ttf $$DESTDIR/images/Vera.ttf
......@@ -295,6 +300,8 @@ linux-g++-64 {
DEFINES += QGC_LIBFREENECT_ENABLED
}
# Validated copy commands
QMAKE_POST_LINK += && cp -rf $$BASEDIR/audio $$DESTDIR
QMAKE_POST_LINK += && cp -rf $$BASEDIR/files $$DESTDIR
QMAKE_POST_LINK += && cp -rf $$BASEDIR/data $$DESTDIR
QMAKE_POST_LINK += && mkdir -p $$DESTDIR/images
......@@ -371,6 +378,7 @@ DEFINES += QGC_OSG_ENABLED
exists($$TARGETDIR/debug) {
QMAKE_POST_LINK += $$quote(copy /Y "$$BASEDIR_WIN\\lib\\sdl\\win32\\SDL.dll" "$$TARGETDIR_WIN\\debug"$$escape_expand(\\n))
QMAKE_POST_LINK += $$quote(xcopy /Y "$$BASEDIR_WIN\\audio" "$$TARGETDIR_WIN\\debug\\audio" /E /I $$escape_expand(\\n))
QMAKE_POST_LINK += $$quote(xcopy /Y "$$BASEDIR_WIN\\files" "$$TARGETDIR_WIN\\debug\\files" /E /I $$escape_expand(\\n))
QMAKE_POST_LINK += $$quote(xcopy /Y "$$BASEDIR_WIN\\models" "$$TARGETDIR_WIN\\debug\\models" /E /I $$escape_expand(\\n))
QMAKE_POST_LINK += $$quote(copy /Y "$$BASEDIR_WIN\\images\\earth.html" "$$TARGETDIR_WIN\\debug"$$escape_expand(\\n))
QMAKE_POST_LINK += $$quote(copy /Y "$$BASEDIR_WIN\\thirdParty\\libxbee\\lib\\libxbee.dll" "$$TARGETDIR_WIN\\debug"$$escape_expand(\\n))
......@@ -391,6 +399,7 @@ DEFINES += QGC_OSG_ENABLED
exists($$TARGETDIR/release) {
QMAKE_POST_LINK += $$quote(copy /Y "$$BASEDIR_WIN\\lib\\sdl\\win32\\SDL.dll" "$$TARGETDIR_WIN\\release"$$escape_expand(\\n))
QMAKE_POST_LINK += $$quote(xcopy /Y "$$BASEDIR_WIN\\audio" "$$TARGETDIR_WIN\\release\\audio" /E /I $$escape_expand(\\n))
QMAKE_POST_LINK += $$quote(xcopy /Y "$$BASEDIR_WIN\\files" "$$TARGETDIR_WIN\\release\\files" /E /I $$escape_expand(\\n))
QMAKE_POST_LINK += $$quote(xcopy /Y "$$BASEDIR_WIN\\models" "$$TARGETDIR_WIN\\release\\models" /E /I $$escape_expand(\\n))
QMAKE_POST_LINK += $$quote(copy /Y "$$BASEDIR_WIN\\images\\earth.html" "$$TARGETDIR_WIN\\release\\earth.html" $$escape_expand(\\n))
QMAKE_POST_LINK += $$quote(copy /Y "$$BASEDIR_WIN\\thirdParty\\libxbee\\lib\\libxbee.dll" "$$TARGETDIR_WIN\\release"$$escape_expand(\\n))
......
......@@ -137,12 +137,12 @@ GAudioOutput::GAudioOutput(QObject* parent) : QObject(parent),
}
}
GAudioOutput::~GAudioOutput()
{
#ifdef _MSC_VER2
::CoUninitialize();
#endif
}
//GAudioOutput::~GAudioOutput()
//{
//#ifdef _MSC_VER2
// ::CoUninitialize();
//#endif
//}
void GAudioOutput::mute(bool mute)
{
......
......@@ -124,7 +124,7 @@ protected:
bool muted;
private:
GAudioOutput(QObject* parent=NULL);
~GAudioOutput();
// ~GAudioOutput();
};
#endif // AUDIOOUTPUT_H
......@@ -49,28 +49,28 @@ quint64 groundTimeMilliseconds()
float limitAngleToPMPIf(float angle)
{
while (angle > ((float)M_PI+FLT_EPSILON)) {
angle -= 2.0f * (float)M_PI;
}
// while (angle > ((float)M_PI+FLT_EPSILON)) {
// angle -= 2.0f * (float)M_PI;
// }
while (angle <= -((float)M_PI+FLT_EPSILON)) {
angle += 2.0f * (float)M_PI;
}
// while (angle <= -((float)M_PI+FLT_EPSILON)) {
// angle += 2.0f * (float)M_PI;
// }
return angle;
}
double limitAngleToPMPId(double angle)
{
if (angle < -M_PI) {
while (angle < -M_PI) {
angle += M_PI;
}
} else if (angle > M_PI) {
while (angle > M_PI) {
angle -= M_PI;
}
}
// if (angle < -M_PI) {
// while (angle < -M_PI) {
// angle += M_PI;
// }
// } else if (angle > M_PI) {
// while (angle > M_PI) {
// angle -= M_PI;
// }
// }
return angle;
}
......
......@@ -203,7 +203,7 @@ QGCCore::QGCCore(int &argc, char* argv[]) : QApplication(argc, argv)
QGCCore::~QGCCore()
{
//mainWindow->storeSettings();
mainWindow->hide();
mainWindow->close();
mainWindow->deleteLater();
// Delete singletons
delete LinkManager::instance();
......
......@@ -66,6 +66,22 @@ protected:
DomModel* model;
void changeEvent(QEvent *e);
signals:
void visibilityChanged(bool visible);
protected:
void showEvent(QShowEvent* event)
{
QWidget::showEvent(event);
emit visibilityChanged(true);
}
void hideEvent(QHideEvent* event)
{
QWidget::hideEvent(event);
emit visibilityChanged(false);
}
private:
Ui::XMLCommProtocolWidget *m_ui;
};
......
......@@ -56,7 +56,6 @@ void PxQuadMAV::receiveMessage(LinkInterface* link, mavlink_message_t message)
// FIXME Kind of a hack to load data from disk
mavlink_image_triggered_t img;
mavlink_msg_image_triggered_decode(&message, &img);
qDebug() << "IMAGE AVAILABLE:" << img.timestamp;
emit imageStarted(img.timestamp);
}
break;
......
This diff is collapsed.
......@@ -108,6 +108,14 @@ public:
double getAltitude() const {
return altitude;
}
virtual bool localPositionKnown() const
{
return isLocalPositionKnown;
}
virtual bool globalPositionKnown() const
{
return isGlobalPositionKnown;
}
double getRoll() const {
return roll;
......@@ -201,15 +209,17 @@ protected: //COMMENTS FOR TEST UNIT
quint64 imageStart;
QMap<int, QMap<QString, QVariant>* > parameters; ///< All parameters
bool paramsOnceRequested; ///< If the parameter list has been read at least once
int airframe; ///< The airframe type
bool attitudeKnown; ///< True if attitude was received, false else
bool paramsOnceRequested; ///< If the parameter list has been read at least once
int airframe; ///< The airframe type
bool attitudeKnown; ///< True if attitude was received, false else
QGCUASParamManager* paramManager; ///< Parameter manager class
QString shortStateText; ///< Short textual state description
QString shortModeText; ///< Short textual mode description
bool attitudeStamped; ///< Should arriving data be timestamped with the last attitude? This helps with broken system time clocks on the MAV
quint64 lastAttitude; ///< Timestamp of last attitude measurement
QGCFlightGearLink* simulation; ///< Hardware in the loop simulation link
QString shortStateText; ///< Short textual state description
QString shortModeText; ///< Short textual mode description
bool attitudeStamped; ///< Should arriving data be timestamped with the last attitude? This helps with broken system time clocks on the MAV
quint64 lastAttitude; ///< Timestamp of last attitude measurement
QGCFlightGearLink* simulation; ///< Hardware in the loop simulation link
bool isLocalPositionKnown; ///< If the local position has been received for this MAV
bool isGlobalPositionKnown; ///< If the global position has been received for this MAV
public:
/** @brief Set the current battery type */
......
......@@ -76,10 +76,12 @@ public:
virtual double getLocalX() const = 0;
virtual double getLocalY() const = 0;
virtual double getLocalZ() const = 0;
virtual bool localPositionKnown() const = 0;
virtual double getLatitude() const = 0;
virtual double getLongitude() const = 0;
virtual double getAltitude() const = 0;
virtual bool globalPositionKnown() const = 0;
virtual double getRoll() const = 0;
virtual double getPitch() const = 0;
......@@ -181,15 +183,15 @@ public:
/** @brief Get the type of the system (airplane, quadrotor, helicopter,..)*/
virtual int getSystemType() = 0;
virtual QString getSystemTypeName() = 0;
/** @brief Get the type of the autopilot (PIXHAWK, APM, UDB, PPZ,..) */
virtual int getAutopilotType() = 0;
virtual QString getAutopilotTypeName() = 0;
virtual void setAutopilotType(int apType)= 0;
QColor getColor() {
return color;
}
virtual int getAutopilotType() = 0;
virtual QString getAutopilotTypeName() = 0;
virtual void setAutopilotType(int apType)= 0;
public slots:
/** @brief Set a new name for the system */
......@@ -490,6 +492,6 @@ protected:
};
Q_DECLARE_INTERFACE(UASInterface, "org.qgroundcontrol/1.0");
Q_DECLARE_INTERFACE(UASInterface, "org.qgroundcontrol/1.0")
#endif // _UASINTERFACE_H_
......@@ -267,7 +267,7 @@ void CommConfigurationWindow::setLinkType(int linktype)
foreach (QAction* act, actions)
{
if (act->data().toInt() == LinkManager::instance()->getLinks().indexOf(tmpLink))
{
{
act->trigger();
break;
}
......
......@@ -58,8 +58,8 @@ HSIDisplay::HSIDisplay(QWidget *parent) :
posXSet(0.0f),
posYSet(0.0f),
posZSet(0.0f),
attXSaturation(0.5f),
attYSaturation(0.5f),
attXSaturation(0.2f),
attYSaturation(0.2f),
attYawSaturation(0.5f),
posXSaturation(0.05f),
posYSaturation(0.05f),
......@@ -474,7 +474,7 @@ QPointF HSIDisplay::metricWorldToBody(QPointF world)
{
// First translate to body-centered coordinates
// Rotate around -yaw
float angle = yaw + M_PI;
float angle = -yaw - M_PI;
QPointF result(cos(angle) * (x - world.x()) - sin(angle) * (y - world.y()), sin(angle) * (x - world.x()) + cos(angle) * (y - world.y()));
return result;
}
......@@ -945,7 +945,7 @@ void HSIDisplay::drawPositionDirection(float xRef, float yRef, float radius, con
{
if (xyControlKnown && xyControlEnabled) {
// Draw the needle
const float maxWidth = radius / 10.0f;
const float maxWidth = radius / 5.0f;
const float minWidth = maxWidth * 0.3f;
float angle = atan2(posXSet, -posYSet);
......@@ -985,10 +985,9 @@ void HSIDisplay::drawAttitudeDirection(float xRef, float yRef, float radius, con
const float maxWidth = radius / 10.0f;
const float minWidth = maxWidth * 0.3f;
float angle = atan2(attXSet, attYSet);
angle -= (float)M_PI/2.0f;
float angle = atan2(attYSet, -attXSet);
radius *= sqrt(pow(attXSet, 2) + pow(attYSet, 2)) / sqrt(attXSaturation + attYSaturation);
radius *= sqrt(attXSet*attXSet + attYSet*attYSet) / sqrt(attXSaturation*attXSaturation + attYSaturation*attYSaturation);
QPolygonF p(6);
......
......@@ -200,14 +200,16 @@ void HUD::showEvent(QShowEvent* event)
// events
QGLWidget::showEvent(event);
refreshTimer->start(updateInterval);
emit visibilityChanged(true);
}
void HUD::hideEvent(QHideEvent* event)
{
// React only to internal (pre-display)
// events
QGLWidget::hideEvent(event);
refreshTimer->stop();
QGLWidget::hideEvent(event);
emit visibilityChanged(false);
}
void HUD::contextMenuEvent (QContextMenuEvent* event)
......@@ -1047,10 +1049,10 @@ void HUD::paintPitchLines(float pitch, QPainter* painter)
float offset = pitch;
if (offset < 0) offset = -offset;
int offsetCount = 0;
while (offset > lineDistance) {
offset -= lineDistance;
offsetCount++;
}
// while (offset > lineDistance) {
// offset -= lineDistance;
// offsetCount++;
// }
int iPos = (int)(0.5f + lineDistance); ///< The first line
int iNeg = (int)(-0.5f - lineDistance); ///< The first line
......
......@@ -113,6 +113,9 @@ protected slots:
void drawPolygon(QPolygonF refPolygon, QPainter* painter);
signals:
void visibilityChanged(bool visible);
protected:
void commitRawDataToGL();
/** @brief Convert reference coordinates to screen coordinates */
......
This diff is collapsed.
......@@ -113,9 +113,9 @@ public:
return lowPowerMode;
}
QList<QAction*> listLinkMenuActions(void);
public slots:
// /** @brief Store the mainwindow settings */
// void storeSettings();
/** @brief Shows a status message on the bottom status bar */
void showStatusMessage(const QString& status, int timeout);
......@@ -161,9 +161,6 @@ public slots:
/** @brief Show the project roadmap */
void showRoadMap();
/** @brief Shows the widgets based on configuration and current view and autopilot */
void presentView();
/** @brief Reload the CSS style sheet */
void reloadStylesheet();
/** @brief Let the user select the CSS style sheet */
......@@ -184,9 +181,15 @@ public slots:
/** @brief Add a custom tool widget */
void createCustomWidget();
/** @brief Load a custom tool widget from a file */
/** @brief Load a custom tool widget from a file chosen by user (QFileDialog) */
void loadCustomWidget();
/** @brief Load a custom tool widget from a file */
void loadCustomWidget(const QString& fileName, bool singleinstance=false);
/** @brief Load custom widgets from default file */
void loadCustomWidgetsFromDefaults(const QString& systemType, const QString& autopilotType);
void closeEvent(QCloseEvent* event);
/** @brief Load data view, allowing to plot flight data */
......@@ -195,100 +198,37 @@ public slots:
/**
* @brief Shows a Docked Widget based on the action sender
*
* This slot is written to be used in conjunction with the addToToolsMenu function
* This slot is written to be used in conjunction with the addTool() function
* It shows the QDockedWidget based on the action sender
*
*/
void showToolWidget(bool visible);
void showTool(bool visible);
/**
* @brief Shows a Widget from the center stack based on the action sender
*
* This slot is written to be used in conjunction with the addToCentralWidgetsMenu function
* This slot is written to be used in conjunction with the addCentralWidget() function
* It shows the Widget based on the action sender
*
*/
void showCentralWidget();
/** @brief Change actively a QDockWidgets visibility by an action */
void showDockWidget(bool vis);
/** @brief Updates a QDockWidget's checked status based on its visibility */
void updateVisibilitySettings(bool vis);
/** @brief Updates a QDockWidget's location */
void updateLocationSettings (Qt::DockWidgetArea location);
public:
QList<QAction*> listLinkMenuActions(void);
protected:
MainWindow(QWidget *parent = 0);
/** @brief Set default window settings for the current autopilot type */
void setDefaultSettingsForAp();
// These defines are used to save the settings when selecting with
// which widgets populate the views
// FIXME: DO NOT PUT CUSTOM VALUES IN THIS ENUM since it is iterated over
// this will be fixed in a future release.
typedef enum _TOOLS_WIDGET_NAMES {
MENU_UAS_CONTROL_PARAM,
MENU_UAS_CONTROL,
MENU_UAS_INFO,
MENU_CAMERA,
MENU_UAS_LIST,
MENU_WAYPOINTS,
MENU_STATUS,
MENU_DETECTION,
MENU_DEBUG_CONSOLE,
MENU_PARAMETERS,
MENU_HDD_1,
MENU_HDD_2,
MENU_WATCHDOG,
MENU_HUD,
MENU_HSI,
MENU_RC_VIEW,
MENU_SLUGS_DATA,
MENU_SLUGS_PID,
MENU_SLUGS_HIL,
MENU_SLUGS_CAMERA,
MENU_MAVLINK_LOG_PLAYER,
MENU_VIDEO_STREAM_1,
MENU_VIDEO_STREAM_2,
MENU_MAVLINK_INSPECTOR,
CENTRAL_SEPARATOR= 255, // do not change
CENTRAL_LINECHART,
CENTRAL_PROTOCOL,
CENTRAL_MAP,
CENTRAL_3D_LOCAL,
CENTRAL_3D_MAP,
CENTRAL_OSGEARTH,
CENTRAL_GOOGLE_EARTH,
CENTRAL_HUD,
CENTRAL_DATA_PLOT,
} TOOLS_WIDGET_NAMES;
typedef enum _SETTINGS_SECTIONS {
SECTION_MENU,
SUB_SECTION_CHECKED,
SUB_SECTION_LOCATION
} SETTINGS_SECTIONS;
typedef enum _VIEW_SECTIONS {
typedef enum _VIEW_SECTIONS
{
VIEW_ENGINEER,
VIEW_OPERATOR,
VIEW_PILOT,
VIEW_MAVLINK,
VIEW_UNCONNECTED, ///< View in unconnected mode, when no UAS is available
VIEW_FULL ///< All widgets, mostly intended for multi-screen setups
VIEW_FULL ///< All widgets shown at once
} VIEW_SECTIONS;
QHash<int, QAction*> toolsMenuActions; // Holds ptr to the Menu Actions
QHash<int, QWidget*> dockWidgets; // Holds ptr to the Actual Dock widget
QHash<int, Qt::DockWidgetArea> dockWidgetLocations; // Holds the location
// QHash<int, QAction*> toolsMenuActions; // Holds ptr to the Menu Actions
// QHash<int, QWidget*> dockWidgets; // Holds ptr to the Actual Dock widget
/**
* @brief Adds an already instantiated QDockedWidget to the Tools Menu
......@@ -297,24 +237,11 @@ protected:
* tools menu and connects the QMenuAction to a slot that shows the widget and
* checks/unchecks the tools menu item
*
* @param widget The QDockedWidget being added
* @param widget The QDockWidget being added
* @param title The entry that will appear in the Menu and in the QDockedWidget title bar
* @param slotName The slot to which the triggered() signal of the menu action will be connected.
* @param tool The ENUM defined in MainWindow.h that is associated to the widget
* @param location The default location for the QDockedWidget in case there is no previous key in the settings
*/
void addToToolsMenu (QWidget* widget, const QString title, const char * slotName, TOOLS_WIDGET_NAMES tool, Qt::DockWidgetArea location=Qt::RightDockWidgetArea);
/**
* @brief Determines if a QDockWidget needs to be show and if so, shows it
*
* Based on the the autopilot and the current view it queries the settings and shows the
* widget if necessary
*
* @param widget The QDockWidget requested to be shown
* @param view The view for which the QDockWidget is requested
*/
void showTheWidget (TOOLS_WIDGET_NAMES widget, VIEW_SECTIONS view = VIEW_MAVLINK);
void addTool(QDockWidget* widget, const QString& title, Qt::DockWidgetArea location=Qt::RightDockWidgetArea);
/**
* @brief Adds an already instantiated QWidget to the center stack
......@@ -326,21 +253,8 @@ protected:
*
* @param widget The QWidget being added
* @param title The entry that will appear in the Menu
* @param slotName The slot to which the triggered() signal of the menu action will be connected.
* @param centralWidget The ENUM defined in MainWindow.h that is associated to the widget
*/
void addToCentralWidgetsMenu ( QWidget* widget, const QString title,const char * slotName, TOOLS_WIDGET_NAMES centralWidget);
/**
* @brief Determines if a QWidget needs to be show and if so, shows it
*
* Based on the the autopilot and the current view it queries the settings and shows the
* widget if necessary
*
* @param centralWidget The QWidget requested to be shown
* @param view The view for which the QWidget is requested
*/
void showTheCentralWidget (TOOLS_WIDGET_NAMES centralWidget, VIEW_SECTIONS view);
void addCentralWidget(QWidget* widget, const QString& title);
/** @brief Catch window resize events */
void resizeEvent(QResizeEvent * event);
......@@ -350,25 +264,13 @@ protected:
bool aboutToCloseFlag;
bool changingViewsFlag;
void clearView();
void storeViewState();
void loadViewState();
void buildCustomWidget();
void buildCommonWidgets();
void buildPxWidgets();
void buildSlugsWidgets();
void connectCommonWidgets();
void connectPxWidgets();
void connectSlugsWidgets();
void arrangeCommonCenterStack();
void arrangePxCenterStack();
void arrangeSlugsCenterStack();
void connectCommonActions();
void connectPxActions();
void connectSlugsActions();
void configureWindowName();
void loadSettings();
......@@ -382,12 +284,11 @@ protected:
QSettings settings;
QStackedWidget *centerStack;
QActionGroup centerStackActionGroup;
// Center widgets
QPointer<Linecharts> linechartWidget;
QPointer<HUD> hudWidget;
QPointer<QGCMapTool> mapWidget;
QPointer<XMLCommProtocolWidget> protocolWidget;
QPointer<QGCDataPlot2D> dataplotWidget;
......@@ -400,6 +301,7 @@ protected:
#if (defined _MSC_VER) || (defined Q_OS_MAC)
QPointer<QGCGoogleEarthView> gEarthWidget;
#endif
// Dock widgets
QPointer<QDockWidget> controlDockWidget;
QPointer<QDockWidget> controlParameterWidget;
......@@ -460,7 +362,6 @@ protected:
private:
Ui::MainWindow ui;
QString buildMenuKey (SETTINGS_SECTIONS section , TOOLS_WIDGET_NAMES tool, VIEW_SECTIONS view);
QString getWindowStateKey();
QString getWindowGeometryKey();
......
......@@ -51,7 +51,7 @@
<x>0</x>
<y>0</y>
<width>800</width>
<height>22</height>
<height>25</height>
</rect>
</property>
<widget class="QMenu" name="menuMGround">
......
......@@ -46,7 +46,22 @@ public slots:
/** @brief Calculate and display regression function*/
bool calculateRegression();
signals:
void visibilityChanged(bool visible);
protected:
void showEvent(QShowEvent* event)
{
QWidget::showEvent(event);
emit visibilityChanged(true);
}
void hideEvent(QHideEvent* event)
{
QWidget::hideEvent(event);
emit visibilityChanged(false);
}
void changeEvent(QEvent *e);
IncrementalPlot* plot;
LogCompressor* compressor;
......
......@@ -166,54 +166,74 @@ void WaypointList::read()
void WaypointList::add()
{
if (uas) {
if (uas)
{
const QVector<Waypoint *> &waypoints = uas->getWaypointManager()->getWaypointList();
Waypoint *wp;
if (waypoints.size() > 0) {
if (waypoints.size() > 0)
{
// Create waypoint with last frame
Waypoint *last = waypoints.at(waypoints.size()-1);
wp = new Waypoint(0, last->getX(), last->getY(), last->getZ(), last->getParam1(), last->getParam2(), last->getParam3(), last->getParam4(),
last->getAutoContinue(), false, last->getFrame(), last->getAction());
uas->getWaypointManager()->addWaypoint(wp);
} else {
// Create global frame waypoint per default
wp = new Waypoint(0, uas->getLatitude(), uas->getLongitude(), uas->getAltitude(), 0.0, 0.0, 0.0, 0.0, true, true, MAV_FRAME_GLOBAL, MAV_CMD_NAV_WAYPOINT);
uas->getWaypointManager()->addWaypoint(wp);
}
else
{
// Create first waypoint at current MAV position
addCurrentPositonWaypoint();
}
}
}
void WaypointList::addCurrentPositonWaypoint()
{
/* TODO: implement with new waypoint structure
if (uas)
{
// For Global Waypoints
//if(isGlobalWP)
//{
//isLocalWP = false;
//}
//else
const QVector<Waypoint *> &waypoints = uas->getWaypointManager()->getWaypointList();
Waypoint *wp;
Waypoint *last = 0;
if (waypoints.size() > 0)
{
const QVector<Waypoint *> &waypoints = uas->getWaypointManager()->getWaypointList();
if (waypoints.size() > 0)
last = waypoints.at(waypoints.size()-1);
}
if (uas->globalPositionKnown())
{
float acceptanceRadiusGlobal = 10.0f;
float holdTime = 0.0f;
float yawGlobal = 0.0f;
if (last)
{
Waypoint *last = waypoints.at(waypoints.size()-1);
Waypoint *wp = new Waypoint(0, (qRound(mavX*100))/100., (qRound(mavY*100))/100., (qRound(mavZ*100))/100., (qRound(mavYaw*100))/100., last->getAutoContinue(), false, last->getOrbit(), last->getHoldTime());
uas->getWaypointManager()->addWaypoint(wp);
acceptanceRadiusGlobal = last->getAcceptanceRadius();
holdTime = last->getHoldTime();
yawGlobal = last->getYaw();
}
else
// Create global frame waypoint per default
wp = new Waypoint(0, uas->getLatitude(), uas->getLongitude(), uas->getAltitude(), yawGlobal, acceptanceRadiusGlobal, holdTime, 0.0, true, true, MAV_FRAME_GLOBAL_RELATIVE_ALT, MAV_CMD_NAV_WAYPOINT);
uas->getWaypointManager()->addWaypoint(wp);
updateStatusLabel(tr("Added GLOBAL, ALTITUDE OVER GROUND waypoint"));
}
else if (uas->localPositionKnown())
{
float acceptanceRadiusLocal = 0.2f;
float holdTime = 0.5f;
if (last)
{
Waypoint *wp = new Waypoint(0, (qRound(mavX*100))/100., (qRound(mavY*100))/100., (qRound(mavZ*100))/100., (qRound(mavYaw*100))/100., true, true, 0.15, 2000);
uas->getWaypointManager()->addWaypoint(wp);
acceptanceRadiusLocal = last->getAcceptanceRadius();
holdTime = last->getHoldTime();
}
//isLocalWP = true;
// Create local frame waypoint as second option
wp = new Waypoint(0, uas->getLocalX(), uas->getLocalY(), uas->getLocalZ(), uas->getYaw(), acceptanceRadiusLocal, holdTime, 0.0, true, true, MAV_FRAME_LOCAL_NED, MAV_CMD_NAV_WAYPOINT);
uas->getWaypointManager()->addWaypoint(wp);
updateStatusLabel(tr("Added LOCAL (NED) waypoint"));
}
else
{
// Do nothing
updateStatusLabel(tr("Not adding waypoint, no position known of MAV known yet."));
}
}
*/
}
void WaypointList::updateStatusLabel(const QString &string)
......@@ -223,23 +243,30 @@ void WaypointList::updateStatusLabel(const QString &string)
void WaypointList::changeCurrentWaypoint(quint16 seq)
{
if (uas) {
if (uas)
{
uas->getWaypointManager()->setCurrentWaypoint(seq);
}
}
void WaypointList::currentWaypointChanged(quint16 seq)
{
if (uas) {
if (uas)
{
const QVector<Waypoint *> &waypoints = uas->getWaypointManager()->getWaypointList();
if (seq < waypoints.size()) {
for(int i = 0; i < waypoints.size(); i++) {
if (seq < waypoints.size())
{
for(int i = 0; i < waypoints.size(); i++)
{
WaypointView* widget = wpViews.find(waypoints[i]).value();
if (waypoints[i]->getId() == seq) {
if (waypoints[i]->getId() == seq)
{
widget->setCurrent(true);
} else {
}
else
{
widget->setCurrent(false);
}
}
......
......@@ -18,6 +18,7 @@ QGCToolWidget::QGCToolWidget(const QString& title, QWidget *parent) :
QWidget(parent),
mav(NULL),
mainMenuAction(NULL),
widgetTitle(title),
ui(new Ui::QGCToolWidget)
{
ui->setupUi(this);
......@@ -41,6 +42,7 @@ QGCToolWidget::QGCToolWidget(const QString& title, QWidget *parent) :
}
this->setWindowTitle(title);
setObjectName(title+"WIDGET");
QList<UASInterface*> systems = UASManager::instance()->getUASList();
foreach (UASInterface* uas, systems) {
......@@ -58,6 +60,18 @@ QGCToolWidget::~QGCToolWidget()
delete ui;
}
void QGCToolWidget::setParent(QWidget *parent)
{
QWidget::setParent(parent);
// Try with parent
QDockWidget* dock = dynamic_cast<QDockWidget*>(parent);
if (dock)
{
dock->setWindowTitle(getTitle());
dock->setObjectName(getTitle()+"DOCK");
}
}
/**
* @param parent Object later holding these widgets, usually the main window
* @return List of all widgets
......@@ -107,14 +121,26 @@ QList<QGCToolWidget*> QGCToolWidget::createWidgetsFromSettings(QWidget* parent,
return instances()->values();
}
void QGCToolWidget::loadSettings(const QString& settings)
/**
* @param singleinstance If this is set to true, the widget settings will only be loaded if not another widget with the same title exists
*/
bool QGCToolWidget::loadSettings(const QString& settings, bool singleinstance)
{
QSettings set(settings, QSettings::IniFormat);
QStringList groups = set.childGroups();
QString widgetName = groups.first();
setTitle(widgetName);
qDebug() << "WIDGET TITLE LOADED: " << widgetName;
loadSettings(set);
if (groups.length() > 0)
{
QString widgetName = groups.first();
if (singleinstance && QGCToolWidget::instances()->keys().contains(widgetName)) return false;
setTitle(widgetName);
qDebug() << "WIDGET TITLE LOADED: " << widgetName;
loadSettings(set);
return true;
}
else
{
return false;
}
}
void QGCToolWidget::loadSettings(QSettings& settings)
......@@ -339,15 +365,9 @@ void QGCToolWidget::importWidget()
const QString QGCToolWidget::getTitle()
{
QDockWidget* parent = dynamic_cast<QDockWidget*>(this->parentWidget());
if (parent) {
return parent->windowTitle();
} else {
return this->windowTitle();
}
return widgetTitle;
}
void QGCToolWidget::setTitle()
{
QDockWidget* parent = dynamic_cast<QDockWidget*>(this->parentWidget());
......@@ -373,6 +393,7 @@ void QGCToolWidget::setTitle()
void QGCToolWidget::setTitle(QString title)
{
widgetTitle = title;
QDockWidget* parent = dynamic_cast<QDockWidget*>(this->parentWidget());
if (parent) {
QSettings settings;
......
......@@ -33,6 +33,7 @@ public:
int isVisible(int view) { return viewVisible.value(view, false); }
Qt::DockWidgetArea getDockWidgetArea(int view) { return dockWidgetArea.value(view, Qt::BottomDockWidgetArea); }
void setParent(QWidget *parent);
public slots:
void addUAS(UASInterface* uas);
......@@ -47,7 +48,7 @@ public slots:
/** @brief Load this widget from a QSettings object */
void loadSettings(QSettings& settings);
/** @brief Load this widget from a settings file */
void loadSettings(const QString& settings);
bool loadSettings(const QString& settings, bool singleinstance=false);
/** @brief Store this widget to a QSettings object */
void storeSettings(QSettings& settings);
/** @brief Store this widget to a settings file */
......@@ -71,6 +72,7 @@ protected:
QAction* mainMenuAction; ///< Main menu action
QMap<int, Qt::DockWidgetArea> dockWidgetArea; ///< Dock widget area desired by this widget
QMap<int, bool> viewVisible; ///< Visibility in one view
QString widgetTitle;
void contextMenuEvent(QContextMenuEvent* event);
void createActions();
......
......@@ -417,9 +417,12 @@ void LinechartPlot::setVisible(QString id, bool visible)
{
if(curves.contains(id)) {
curves.value(id)->setVisible(visible);
if(visible) {
if(visible)
{
curves.value(id)->attach(this);
} else {
}
else
{
curves.value(id)->detach();
}
}
......@@ -639,7 +642,7 @@ void LinechartPlot::paintRealtime()
windowLock.unlock();
// Defined both on windows 32- and 64 bit
#ifndef _WIN32
#if !(defined Q_OS_WIN)
// const bool cacheMode =
// canvas()->testPaintAttribute(QwtPlotCanvas::PaintCached);
......@@ -648,11 +651,11 @@ void LinechartPlot::paintRealtime()
const QPaintEngine *pe = canvas()->paintEngine();
bool directPaint = pe->hasFeature(QPaintEngine::PaintOutsidePaintEvent);
if ( pe->type() == QPaintEngine::X11 ) {
//if ( pe->type() == QPaintEngine::X11 ) {
// Even if not recommended by TrollTech, Qt::WA_PaintOutsidePaintEvent
// works on X11. This has an tremendous effect on the performance..
directPaint = true;
}
//}
canvas()->setAttribute(Qt::WA_PaintOutsidePaintEvent, directPaint);
#endif
......@@ -665,7 +668,7 @@ void LinechartPlot::paintRealtime()
replot();
}
#ifndef _WIN32
#if !(defined Q_OS_WIN)
canvas()->setAttribute(Qt::WA_PaintOutsidePaintEvent, oldDirectPaint);
#endif
......
......@@ -219,7 +219,7 @@ public:
static const int SCALE_BEST_FIT = 1;
static const int SCALE_LOGARITHMIC = 2;
static const int DEFAULT_REFRESH_RATE = 50; ///< The default refresh rate is 25 Hz / every 100 ms
static const int DEFAULT_REFRESH_RATE = 100; ///< The default refresh rate is 10 Hz / every 100 ms
static const int DEFAULT_PLOT_INTERVAL = 1000 * 8; ///< The default plot interval is 15 seconds
static const int DEFAULT_SCALE_INTERVAL = 1000 * 8;
......
......@@ -143,7 +143,7 @@ LinechartWidget::LinechartWidget(int systemid, QWidget *parent) : QWidget(parent
//connect(this, SIGNAL(plotWindowPositionUpdated(int)), scrollbar, SLOT(setValue(int)));
//connect(scrollbar, SIGNAL(sliderMoved(int)), this, SLOT(setPlotWindowPosition(int)));
updateTimer->setInterval(300);
updateTimer->setInterval(updateInterval);
connect(updateTimer, SIGNAL(timeout()), this, SLOT(refresh()));
readSettings();
}
......@@ -433,6 +433,7 @@ void LinechartWidget::appendData(int uasId, const QString& curve, const QString&
void LinechartWidget::refresh()
{
setUpdatesEnabled(false);
QString str;
// Value
QMap<QString, QLabel*>::iterator i;
......@@ -484,6 +485,7 @@ void LinechartWidget::refresh()
str.sprintf("% 8.3e", activePlot->getVariance(l.key()));
l.value()->setText(str);
}
setUpdatesEnabled(true);
}
......@@ -510,11 +512,6 @@ void LinechartWidget::startLogging()
// QString("./pixhawk-log-" + date.toString("yyyy-MM-dd") + "-" + QString::number(logindex) + ".log")
QString fileName = QFileDialog::getSaveFileName(this, tr("Specify log file name"), QDesktopServices::storageLocation(QDesktopServices::DesktopLocation), tr("Logfile (*.csv *.txt);;"));
if (!fileName.contains(".")) {
// .csv is default extension
fileName.append(".csv");
}
while (!(fileName.endsWith(".txt") || fileName.endsWith(".csv")) && !abort && fileName != "") {
QMessageBox msgBox;
msgBox.setIcon(QMessageBox::Critical);
......@@ -522,14 +519,16 @@ void LinechartWidget::startLogging()
msgBox.setInformativeText("Please choose .txt or .csv as file extension. Click OK to change the file extension, cancel to not start logging.");
msgBox.setStandardButtons(QMessageBox::Ok | QMessageBox::Cancel);
msgBox.setDefaultButton(QMessageBox::Ok);
if(msgBox.exec() == QMessageBox::Cancel) {
if(msgBox.exec() != QMessageBox::Ok)
{
abort = true;
break;
}
fileName = QFileDialog::getSaveFileName(this, tr("Specify log file name"), QDesktopServices::storageLocation(QDesktopServices::DesktopLocation), tr("Logfile (*.txt, *.csv);;"));
fileName = QFileDialog::getSaveFileName(this, tr("Specify log file name"), QDesktopServices::storageLocation(QDesktopServices::DesktopLocation), tr("Logfile (*.txt *.csv);;"));
}
qDebug() << "SAVE FILE" << fileName;
// Check if the user did not abort the file save dialog
if (!abort && fileName != "") {
logFile = new QFile(fileName);
......@@ -626,6 +625,7 @@ void LinechartWidget::addCurve(const QString& curve, const QString& unit)
curvesWidgetLayout->addWidget(checkBox, labelRow, 0);
QWidget* colorIcon = new QWidget(this);
colorIcons.insert(curve+unit, colorIcon);
colorIcon->setMinimumSize(QSize(5, 14));
colorIcon->setMaximumSize(4, 14);
......@@ -636,13 +636,11 @@ void LinechartWidget::addCurve(const QString& curve, const QString& unit)
//checkBox->setText(QString());
label->setText(curve);
QColor color = plot->getColorForCurve(curve+unit);
if(color.isValid()) {
QString colorstyle;
colorstyle = colorstyle.sprintf("QWidget { background-color: #%X%X%X; }", color.red(), color.green(), color.blue());
colorIcon->setStyleSheet(colorstyle);
colorIcon->setAutoFillBackground(true);
}
QColor color(Qt::gray);// = plot->getColorForCurve(curve+unit);
QString colorstyle;
colorstyle = colorstyle.sprintf("QWidget { background-color: #%X%X%X; }", color.red(), color.green(), color.blue());
colorIcon->setStyleSheet(colorstyle);
colorIcon->setAutoFillBackground(true);
// Value
value = new QLabel(this);
......@@ -854,8 +852,22 @@ void LinechartWidget::takeButtonClick(bool checked)
QCheckBox* button = qobject_cast<QCheckBox*>(QObject::sender());
if(button != NULL) {
if(button != NULL)
{
activePlot->setVisible(button->objectName(), checked);
QColor color = activePlot->getColorForCurve(button->objectName());
if(color.isValid())
{
QString colorstyle;
colorstyle = colorstyle.sprintf("QWidget { background-color: #%X%X%X; }", color.red(), color.green(), color.blue());
QWidget* colorIcon = colorIcons.value(button->objectName(), 0);
if (colorIcon)
{
colorIcon->setStyleSheet(colorstyle);
colorIcon->setAutoFillBackground(true);
}
}
}
}
......
......@@ -134,6 +134,7 @@ protected:
QMap<QString, QLabel*>* curveMedians; ///< References to the curve medians
QMap<QString, QLabel*>* curveVariances; ///< References to the curve variances
QMap<QString, int> intData; ///< Current values for integer-valued curves
QMap<QString, QWidget*> colorIcons; ///< Reference to color icons
QWidget* curvesWidget; ///< The QWidget containing the curve selection button
QGridLayout* curvesWidgetLayout; ///< The layout for the curvesWidget QWidget
......@@ -161,7 +162,7 @@ protected:
LogCompressor* compressor;
QCheckBox* selectAllCheckBox;
int selectedMAV; ///< The MAV for which plot items are accepted, -1 for all systems
static const int updateInterval = 400; ///< Time between number updates, in milliseconds
static const int updateInterval = 1000; ///< Time between number updates, in milliseconds
static const int MAX_CURVE_MENUITEM_NUMBER = 8;
static const int PAGESTEP_TIME_SCROLLBAR_VALUE = (MAX_TIME_SCROLLBAR_VALUE - MIN_TIME_SCROLLBAR_VALUE) / 10;
......
......@@ -30,32 +30,35 @@ void Linecharts::showEvent(QShowEvent* event)
{
// React only to internal (pre-display)
// events
Q_UNUSED(event) {
QWidget* prevWidget = currentWidget();
if (prevWidget) {
LinechartWidget* chart = dynamic_cast<LinechartWidget*>(prevWidget);
if (chart) {
this->active = true;
chart->setActive(true);
}
Q_UNUSED(event)
QWidget* prevWidget = currentWidget();
if (prevWidget)
{
LinechartWidget* chart = dynamic_cast<LinechartWidget*>(prevWidget);
if (chart) {
this->active = true;
chart->setActive(true);
}
}
QWidget::showEvent(event);
emit visibilityChanged(true);
}
void Linecharts::hideEvent(QHideEvent* event)
{
// React only to internal (pre-display)
// events
Q_UNUSED(event) {
QWidget* prevWidget = currentWidget();
if (prevWidget) {
LinechartWidget* chart = dynamic_cast<LinechartWidget*>(prevWidget);
if (chart) {
this->active = false;
chart->setActive(false);
}
Q_UNUSED(event)
QWidget* prevWidget = currentWidget();
if (prevWidget) {
LinechartWidget* chart = dynamic_cast<LinechartWidget*>(prevWidget);
if (chart) {
this->active = false;
chart->setActive(false);
}
}
QWidget::hideEvent(event);
emit visibilityChanged(false);
}
void Linecharts::selectSystem(int systemid)
......
......@@ -17,6 +17,7 @@ public:
signals:
/** @brief This signal is emitted once a logfile has been finished writing */
void logfileWritten(QString fileName);
void visibilityChanged(bool visible);
public slots:
/** @brief Select plot for one system */
......@@ -27,6 +28,7 @@ public slots:
void addSource(QObject* obj);
protected:
QMap<int, LinechartWidget*> plots;
QVector<QObject*> genericSources;
bool active;
......
......@@ -20,6 +20,22 @@ public slots:
/** @brief Update slider zoom from map change */
void setZoom(int zoom);
signals:
void visibilityChanged(bool visible);
protected:
void showEvent(QShowEvent* event)
{
QWidget::showEvent(event);
emit visibilityChanged(true);
}
void hideEvent(QHideEvent* event)
{
QWidget::hideEvent(event);
emit visibilityChanged(false);
}
private:
Ui::QGCMapTool *ui;
};
......
......@@ -376,18 +376,20 @@ void QGCGoogleEarthView::moveToPosition()
void QGCGoogleEarthView::hideEvent(QHideEvent* event)
{
Q_UNUSED(event);
updateTimer->stop();
QWidget::hideEvent(event);
emit visibilityChanged(false);
}
void QGCGoogleEarthView::showEvent(QShowEvent* event)
{
// React only to internal (pre-display)
// events
Q_UNUSED(event)
QWidget::showEvent(event);
// Enable widget, initialize on first run
if (!webViewInitialized) {
if (!webViewInitialized)
{
#if (defined Q_OS_MAC)
webViewMac->setPage(new QGCWebPage(webViewMac));
webViewMac->settings()->setAttribute(QWebSettings::PluginsEnabled, true);
......@@ -404,9 +406,12 @@ void QGCGoogleEarthView::showEvent(QShowEvent* event)
gEarthInitialized = false;
QTimer::singleShot(3000, this, SLOT(initializeGoogleEarth()));
} else {
}
else
{
updateTimer->start(refreshRateMs);
}
emit visibilityChanged(true);
}
void QGCGoogleEarthView::printWinException(int no, QString str1, QString str2, QString str3)
......
......@@ -137,6 +137,9 @@ public:
/** @brief Get a document element */
QVariant documentElement(QString name);
signals:
void visibilityChanged(bool visible);
protected:
void changeEvent(QEvent *e);
QTimer* updateTimer;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment