Browse Source

Merge branch 'dev-win' into dev-winXbee

Conflicts:
	qgroundcontrol.pri
QGC4.4
oberion 14 years ago
parent
commit
e555424ab8
  1. 2
      copydebug.txt
  2. 4
      copyrelease.txt
  3. 54
      qgroundcontrol.pri
  4. 6
      qgroundcontrol.pro
  5. 2
      src/apps/mavlinkgen/generator/MAVLinkXMLParser.cc
  6. 2
      src/comm/UDPLink.cc
  7. 14
      src/uas/UAS.cc
  8. 6
      src/uas/UAS.h
  9. 4
      src/uas/UASInterface.h
  10. 2
      src/uas/UASManager.h
  11. 31
      src/ui/MainWindow.cc
  12. 4
      src/ui/MainWindow.h
  13. 161
      src/ui/QGCToolBar.cc
  14. 69
      src/ui/QGCToolBar.h
  15. 3
      src/ui/uas/UASView.cc

2
copydebug.txt

@ -0,0 +1,2 @@ @@ -0,0 +1,2 @@
designer
.lib

4
copyrelease.txt

@ -0,0 +1,4 @@ @@ -0,0 +1,4 @@
designer
.lib
.pdb
d4.dll

54
qgroundcontrol.pri

@ -18,7 +18,7 @@ @@ -18,7 +18,7 @@
# -------------------------------------------------
message(Qt version $$[QT_VERSION])
message(Using Qt from $$[QTDIR])
message(Using Qt from $(QTDIR))
release {
# DEFINES += QT_NO_DEBUG_OUTPUT
@ -34,9 +34,6 @@ win32-msvc2008|win32-msvc2010 { @@ -34,9 +34,6 @@ win32-msvc2008|win32-msvc2010 {
# Turn off serial port warnings
DEFINES += _TTY_NOWARN_
#QMAKE_POST_LINK += && cp -rf $$BASEDIR/models $$TARGETDIR/debug/.
#QMAKE_POST_LINK += && cp -rf $$BASEDIR/models $$TARGETDIR/release/.
# MAC OS X
macx {
@ -367,27 +364,44 @@ DEFINES += QGC_OSG_ENABLED @@ -367,27 +364,44 @@ DEFINES += QGC_OSG_ENABLED
TARGETDIR_WIN = $$replace(TARGETDIR,"/","\\")
exists($$TARGETDIR/debug) {
QMAKE_POST_LINK += $$quote(copy /Y "$$BASEDIR_WIN\\lib\\sdl\\win32\\SDL.dll" "$$TARGETDIR_WIN\\debug\\SDL.dll"$$escape_expand(\\n))
QMAKE_POST_LINK += $$quote(xcopy \"$$BASEDIR_WIN\\audio\" \"$$TARGETDIR_WIN\\debug\\audio\\\" /S /E /Y $$escape_expand(\\n))
QMAKE_POST_LINK += $$quote(xcopy \"$$BASEDIR_WIN\\models\" \"$$TARGETDIR_WIN\\debug\\models\\\" /S /E /Y $$escape_expand(\\n))
QMAKE_POST_LINK += $$quote(copy /Y \"$$BASEDIR_WIN\\images\\earth.html\" \"$$TARGETDIR_WIN\\debug\\earth.html\"$$escape_expand(\\n))
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\\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))
# QMAKE_POST_LINK += && copy /Y \"$$BASEDIR_WIN\\lib\\sdl\\win32\\SDL.dll\" \"$$TARGETDIR_WIN\\debug\\SDL.dll\"
# QMAKE_POST_LINK += && xcopy \"$$BASEDIR_WIN\\audio\" \"$$TARGETDIR_WIN\\debug\\audio\\\" /S /E /Y
# QMAKE_POST_LINK += && xcopy \"$$BASEDIR_WIN\\models\" \"$$TARGETDIR_WIN\\debug\\models\\\" /S /E /Y
# QMAKE_POST_LINK += && copy /Y \"$$BASEDIR_WIN\\images\\earth.html\" \"$$TARGETDIR_WIN\\debug\\earth.html\"
QMAKE_POST_LINK += $$quote(xcopy /Y "$(QTDIR)\\plugins" "$$TARGETDIR_WIN\\debug" /E /I /EXCLUDE:copydebug.txt $$escape_expand(\\n))
QMAKE_POST_LINK += $$quote(copy /Y "$(QTDIR)\\bin\\phonond4.dll" "$$TARGETDIR_WIN\\debug"$$escape_expand(\\n))
QMAKE_POST_LINK += $$quote(copy /Y "$(QTDIR)\\bin\\QtCored4.dll" "$$TARGETDIR_WIN\\debug"$$escape_expand(\\n))
QMAKE_POST_LINK += $$quote(copy /Y "$(QTDIR)\\bin\\QtGuid4.dll" "$$TARGETDIR_WIN\\debug"$$escape_expand(\\n))
QMAKE_POST_LINK += $$quote(copy /Y "$(QTDIR)\\bin\\QtMultimediad4.dll" "$$TARGETDIR_WIN\\debug"$$escape_expand(\\n))
QMAKE_POST_LINK += $$quote(copy /Y "$(QTDIR)\\bin\\QtNetworkd4.dll" "$$TARGETDIR_WIN\\debug"$$escape_expand(\\n))
QMAKE_POST_LINK += $$quote(copy /Y "$(QTDIR)\\bin\\QtOpenGLd4.dll" "$$TARGETDIR_WIN\\debug"$$escape_expand(\\n))
QMAKE_POST_LINK += $$quote(copy /Y "$(QTDIR)\\bin\\QtSqld4.dll" "$$TARGETDIR_WIN\\debug"$$escape_expand(\\n))
QMAKE_POST_LINK += $$quote(copy /Y "$(QTDIR)\\bin\\QtSvgd4.dll" "$$TARGETDIR_WIN\\debug"$$escape_expand(\\n))
QMAKE_POST_LINK += $$quote(copy /Y "$(QTDIR)\\bin\\QtWebKitd4.dll" "$$TARGETDIR_WIN\\debug"$$escape_expand(\\n))
QMAKE_POST_LINK += $$quote(copy /Y "$(QTDIR)\\bin\\QtXmld4.dll" "$$TARGETDIR_WIN\\debug"$$escape_expand(\\n))
QMAKE_POST_LINK += $$quote(copy /Y "$(QTDIR)\\bin\\QtXmlPatternsd4.dll" "$$TARGETDIR_WIN\\debug"$$escape_expand(\\n))
}
exists($$TARGETDIR/release) {
QMAKE_POST_LINK += $$quote(copy /Y \"$$BASEDIR_WIN\\lib\\sdl\\win32\\SDL.dll\" \"$$TARGETDIR_WIN\\release\\SDL.dll\"$$escape_expand(\\n))
QMAKE_POST_LINK += $$quote(xcopy \"$$BASEDIR_WIN\\audio\" \"$$TARGETDIR_WIN\\release\\audio\\\" /S /E /Y $$escape_expand(\\n))
QMAKE_POST_LINK += $$quote(xcopy \"$$BASEDIR_WIN\\models\" \"$$TARGETDIR_WIN\\release\\models\\\" /S /E /Y $$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\\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\\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))
# QMAKE_POST_LINK += && copy /Y \"$$BASEDIR_WIN\\lib\\sdl\\win32\\SDL.dll\" \"$$TARGETDIR_WIN\\release\\SDL.dll\"
# QMAKE_POST_LINK += && xcopy \"$$BASEDIR_WIN\\audio\" \"$$TARGETDIR_WIN\\release\\audio\\\" /S /E /Y
# QMAKE_POST_LINK += && xcopy \"$$BASEDIR_WIN\\models\" \"$$TARGETDIR_WIN\\release\\models\\\" /S /E /Y
# QMAKE_POST_LINK += && copy /Y \"$$BASEDIR_WIN\\images\\earth.html\" \"$$TARGETDIR_WIN\\release\\earth.html\"
QMAKE_POST_LINK += $$quote(xcopy /Y "$(QTDIR)\\plugins" "$$TARGETDIR_WIN\\release" /E /I /EXCLUDE:copyrelease.txt $$escape_expand(\\n))
QMAKE_POST_LINK += $$quote(copy /Y "$(QTDIR)\\bin\\phonon4.dll" "$$TARGETDIR_WIN\\release"$$escape_expand(\\n))
QMAKE_POST_LINK += $$quote(copy /Y "$(QTDIR)\\bin\\QtCore4.dll" "$$TARGETDIR_WIN\\release"$$escape_expand(\\n))
QMAKE_POST_LINK += $$quote(copy /Y "$(QTDIR)\\bin\\QtGui4.dll" "$$TARGETDIR_WIN\\release"$$escape_expand(\\n))
QMAKE_POST_LINK += $$quote(copy /Y "$(QTDIR)\\bin\\QtMultimedia4.dll" "$$TARGETDIR_WIN\\release"$$escape_expand(\\n))
QMAKE_POST_LINK += $$quote(copy /Y "$(QTDIR)\\bin\\QtNetwork4.dll" "$$TARGETDIR_WIN\\release"$$escape_expand(\\n))
QMAKE_POST_LINK += $$quote(copy /Y "$(QTDIR)\\bin\\QtOpenGL4.dll" "$$TARGETDIR_WIN\\release"$$escape_expand(\\n))
QMAKE_POST_LINK += $$quote(copy /Y "$(QTDIR)\\bin\\QtSql4.dll" "$$TARGETDIR_WIN\\release"$$escape_expand(\\n))
QMAKE_POST_LINK += $$quote(copy /Y "$(QTDIR)\\bin\\QtSvg4.dll" "$$TARGETDIR_WIN\\release"$$escape_expand(\\n))
QMAKE_POST_LINK += $$quote(copy /Y "$(QTDIR)\\bin\\QtWebKit4.dll" "$$TARGETDIR_WIN\\release"$$escape_expand(\\n))
QMAKE_POST_LINK += $$quote(copy /Y "$(QTDIR)\\bin\\QtXml4.dll" "$$TARGETDIR_WIN\\release"$$escape_expand(\\n))
QMAKE_POST_LINK += $$quote(copy /Y "$(QTDIR)\\bin\\QtXmlPatterns4.dll" "$$TARGETDIR_WIN\\release"$$escape_expand(\\n))
}
}

6
qgroundcontrol.pro

@ -319,7 +319,8 @@ HEADERS += src/MG.h \ @@ -319,7 +319,8 @@ HEADERS += src/MG.h \
src/ui/map/QGCMapTool.h \
src/ui/map/QGCMapToolBar.h \
src/libs/qextserialport/qextserialenumerator.h \
src/QGCGeo.h
src/QGCGeo.h \
src/ui/QGCToolBar.h
# Google Earth is only supported on Mac OS and Windows with Visual Studio Compiler
macx|win32-msvc2008|win32-msvc2010::HEADERS += src/ui/map3D/QGCGoogleEarthView.h
@ -442,7 +443,8 @@ SOURCES += src/main.cc \ @@ -442,7 +443,8 @@ SOURCES += src/main.cc \
src/ui/map/MAV2DIcon.cc \
src/ui/map/Waypoint2DIcon.cc \
src/ui/map/QGCMapTool.cc \
src/ui/map/QGCMapToolBar.cc
src/ui/map/QGCMapToolBar.cc \
src/ui/QGCToolBar.cc
# Enable Google Earth only on Mac OS and Windows with Visual Studio compiler
macx|win32-msvc2008|win32-msvc2010::SOURCES += src/ui/map3D/QGCGoogleEarthView.cc

2
src/apps/mavlinkgen/generator/MAVLinkXMLParser.cc

@ -276,8 +276,8 @@ bool MAVLinkXMLParser::generate() @@ -276,8 +276,8 @@ bool MAVLinkXMLParser::generate()
else if (pp2.isElement())
{
fieldComment += pp2.text() + sep;
pp = pp.nextSibling();
}
pp = pp.nextSibling();
}
fieldComment = fieldComment.replace("\n", " ");
fieldComment = " /* " + fieldComment.simplified() + " */";

2
src/comm/UDPLink.cc

@ -2,7 +2,7 @@ @@ -2,7 +2,7 @@
QGroundControl Open Source Ground Control Station
(c) 2009, 2010 QGROUNDCONTROL PROJECT <http://www.qgroundcontrol.org>
(c) 2009 - 2011 QGROUNDCONTROL PROJECT <http://www.qgroundcontrol.org>
This file is part of the QGROUNDCONTROL project

14
src/uas/UAS.cc

@ -242,6 +242,8 @@ void UAS::receiveMessage(LinkInterface* link, mavlink_message_t message) @@ -242,6 +242,8 @@ void UAS::receiveMessage(LinkInterface* link, mavlink_message_t message)
emit statusChanged(this, uasState, stateDescription);
emit statusChanged(this->status);
shortStateText = uasState;
stateAudio = " changed status to " + uasState;
}
@ -311,6 +313,8 @@ void UAS::receiveMessage(LinkInterface* link, mavlink_message_t message) @@ -311,6 +313,8 @@ void UAS::receiveMessage(LinkInterface* link, mavlink_message_t message)
break;
}
shortModeText = mode;
emit modeChanged(this->getUASID(), mode, "");
//qDebug() << "2 SYSTEM MODE:" << mode;
@ -2106,6 +2110,16 @@ QString UAS::getUASName(void) const @@ -2106,6 +2110,16 @@ QString UAS::getUASName(void) const
return result;
}
const QString& UAS::getShortState() const
{
return shortStateText;
}
const QString& UAS::getShortMode() const
{
return shortModeText;
}
void UAS::addLink(LinkInterface* link)
{
if (!links->contains(link)) {

6
src/uas/UAS.h

@ -68,6 +68,10 @@ public: @@ -68,6 +68,10 @@ public:
/** @brief The name of the robot */
QString getUASName(void) const;
/** @brief Get short state */
const QString& getShortState() const;
/** @brief Get short mode */
const QString& getShortMode() const;
/** @brief Get the unique system id */
int getUASID() const;
/** @brief Get the airframe */
@ -198,6 +202,8 @@ protected: //COMMENTS FOR TEST UNIT @@ -198,6 +202,8 @@ protected: //COMMENTS FOR TEST UNIT
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
public:
/** @brief Set the current battery type */

4
src/uas/UASInterface.h

@ -60,6 +60,10 @@ public: @@ -60,6 +60,10 @@ public:
/** @brief The name of the robot **/
virtual QString getUASName() const = 0;
/** @brief Get short state */
virtual const QString& getShortState() const = 0;
/** @brief Get short mode */
virtual const QString& getShortMode() const = 0;
//virtual QColor getColor() = 0;
virtual int getUASID() const = 0; ///< Get the ID of the connected UAS
/** @brief The time interval the robot is switched on **/

2
src/uas/UASManager.h

@ -2,7 +2,7 @@ @@ -2,7 +2,7 @@
QGroundControl Open Source Ground Control Station
(c) 2009, 2010 QGROUNDCONTROL PROJECT <http://www.qgroundcontrol.org>
(c) 2009 - 2011 QGROUNDCONTROL PROJECT <http://www.qgroundcontrol.org>
This file is part of the QGROUNDCONTROL project

31
src/ui/MainWindow.cc

@ -1,4 +1,24 @@ @@ -1,4 +1,24 @@
/*===================================================================
/*=====================================================================
QGroundControl Open Source Ground Control Station
(c) 2009 - 2011 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/>.
======================================================================*/
/**
@ -15,7 +35,6 @@ @@ -15,7 +35,6 @@
#include <QTimer>
#include <QHostInfo>
#include "MG.h"
#include "QGC.h"
#include "MAVLinkSimulationLink.h"
#include "SerialLink.h"
@ -138,6 +157,14 @@ MainWindow::MainWindow(QWidget *parent): @@ -138,6 +157,14 @@ MainWindow::MainWindow(QWidget *parent):
joystickWidget = 0;
joystick = new JoystickInput();
// Load Toolbar
toolBar = new QGCToolBar(this);
this->addToolBar(toolBar);
// Add actions
toolBar->addPerspectiveChangeAction(ui.actionOperatorsView);
toolBar->addPerspectiveChangeAction(ui.actionEngineersView);
toolBar->addPerspectiveChangeAction(ui.actionPilotsView);
// Enable and update view
presentView();

4
src/ui/MainWindow.h

@ -67,7 +67,7 @@ This file is part of the QGROUNDCONTROL project @@ -67,7 +67,7 @@ This file is part of the QGROUNDCONTROL project
#if (defined Q_OS_MAC) | (defined _MSC_VER)
#include "QGCGoogleEarthView.h"
#endif
//#include "QMap3DWidget.h"
#include "QGCToolBar.h"
#include "SlugsDataSensorView.h"
#include "LogCompressor.h"
@ -419,6 +419,8 @@ protected: @@ -419,6 +419,8 @@ protected:
QPointer<QDockWidget> slugsHilSimWidget;
QPointer<QDockWidget> slugsCamControlWidget;
QPointer<QGCToolBar> toolBar;
// Popup widgets
JoystickWidget* joystickWidget;

161
src/ui/QGCToolBar.cc

@ -0,0 +1,161 @@ @@ -0,0 +1,161 @@
/*=====================================================================
QGroundControl Open Source Ground Control Station
(c) 2009 - 2011 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/>.
======================================================================*/
#include <QToolButton>
#include <QLabel>
#include "QGCToolBar.h"
#include "UASManager.h"
QGCToolBar::QGCToolBar(QWidget *parent) :
QToolBar(parent),
toggleLoggingAction(NULL),
logReplayAction(NULL),
mav(NULL)
{
setObjectName("QGC_TOOLBAR");
createCustomWidgets();
setActiveUAS(UASManager::instance()->getActiveUAS());
connect(UASManager::instance(), SIGNAL(activeUASSet(UASInterface*)), this, SLOT(setActiveUAS(UASInterface*)));
}
void QGCToolBar::addPerspectiveChangeAction(QAction* action)
{
addAction(action);
}
void QGCToolBar::setActiveUAS(UASInterface* active)
{
// Do nothing if system is the same or NULL
if ((active == NULL) || mav == active) return;
if (mav)
{
// Disconnect old system
disconnect(mav, SIGNAL(statusChanged(UASInterface*,QString,QString)), this, SLOT(updateState(UASInterface*,QString,QString)));
disconnect(mav, SIGNAL(modeChanged(int,QString,QString)), this, SLOT(updateMode(int,QString,QString)));
disconnect(mav, SIGNAL(nameChanged(QString)), this, SLOT(updateName(QString)));
disconnect(mav, SIGNAL(systemTypeSet(UASInterface*,uint)), this, SLOT(setSystemType(UASInterface*,uint)));
}
// Connect new system
mav = active;
connect(active, SIGNAL(statusChanged(UASInterface*,QString,QString)), this, SLOT(updateState(UASInterface*, QString,QString)));
connect(active, SIGNAL(modeChanged(int,QString,QString)), this, SLOT(updateMode(int,QString,QString)));
connect(active, SIGNAL(nameChanged(QString)), this, SLOT(updateName(QString)));
connect(active, SIGNAL(systemTypeSet(UASInterface*,uint)), this, SLOT(setSystemType(UASInterface*,uint)));
// Update all values once
nameLabel->setText(mav->getUASName());
modeLabel->setText(mav->getShortMode());
stateLabel->setText(mav->getShortState());
setSystemType(mav, mav->getSystemType());
}
void QGCToolBar::createCustomWidgets()
{
// Add internal actions
// Add MAV widget
symbolButton = new QToolButton(this);
nameLabel = new QLabel("------", this);
modeLabel = new QLabel("------", this);
stateLabel = new QLabel("------", this);
wpLabel = new QLabel("---", this);
distlabel = new QLabel("--- ---- m", this);
//symbolButton->setIcon(":");
symbolButton->setStyleSheet("QWidget { background-color: #050508; color: #DDDDDF; background-clip: border; } QToolButton { font-weight: bold; font-size: 12px; border: 0px solid #999999; border-radius: 5px; min-width:22px; max-width: 22px; min-height: 22px; max-height: 22px; padding: 0px; margin: 0px; background-color: none; }");
addWidget(symbolButton);
addWidget(nameLabel);
addWidget(modeLabel);
addWidget(stateLabel);
addWidget(wpLabel);
addWidget(distlabel);
toggleLoggingAction = new QAction(QIcon(":"), "Start Logging", this);
logReplayAction = new QAction(QIcon(":"), "Start Replay", this);
//addAction(toggleLoggingAction);
//addAction(logReplayAction);
addSeparator();
}
void QGCToolBar::updateState(UASInterface* system, QString name, QString description)
{
Q_UNUSED(system);
Q_UNUSED(description);
stateLabel->setText(tr(" State: %1").arg(name));
}
void QGCToolBar::updateMode(int system, QString name, QString description)
{
Q_UNUSED(system);
Q_UNUSED(description);
modeLabel->setText(tr(" Mode: %1").arg(name));
}
void QGCToolBar::updateName(const QString& name)
{
nameLabel->setText(name);
}
/**
* The current system type is represented through the system icon.
*
* @param uas Source system, has to be the same as this->uas
* @param systemType type ID, following the MAVLink system type conventions
* @see http://pixhawk.ethz.ch/software/mavlink
*/
void QGCToolBar::setSystemType(UASInterface* uas, unsigned int systemType)
{
Q_UNUSED(uas);
// Set matching icon
switch (systemType) {
case 0:
symbolButton->setIcon(QIcon(":/images/mavs/generic.svg"));
break;
case 1:
symbolButton->setIcon(QIcon(":/images/mavs/fixed-wing.svg"));
break;
case 2:
symbolButton->setIcon(QIcon(":/images/mavs/quadrotor.svg"));
break;
case 3:
symbolButton->setIcon(QIcon(":/images/mavs/coaxial.svg"));
break;
case 4:
symbolButton->setIcon(QIcon(":/images/mavs/helicopter.svg"));
break;
case 5:
symbolButton->setIcon(QIcon(":/images/mavs/unknown.svg"));
break;
default:
symbolButton->setIcon(QIcon(":/images/mavs/unknown.svg"));
break;
}
}
QGCToolBar::~QGCToolBar()
{
delete toggleLoggingAction;
delete logReplayAction;
}

69
src/ui/QGCToolBar.h

@ -0,0 +1,69 @@ @@ -0,0 +1,69 @@
/*=====================================================================
QGroundControl Open Source Ground Control Station
(c) 2009 - 2011 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/>.
======================================================================*/
#ifndef QGCTOOLBAR_H
#define QGCTOOLBAR_H
#include <QToolBar>
#include <QAction>
#include <QToolButton>
#include <QLabel>
#include "UASInterface.h"
class QGCToolBar : public QToolBar
{
Q_OBJECT
public:
explicit QGCToolBar(QWidget *parent = 0);
void addPerspectiveChangeAction(QAction* action);
~QGCToolBar();
public slots:
/** @brief Set the system that is currently displayed by this widget */
void setActiveUAS(UASInterface* active);
/** @brief Set the system state */
void updateState(UASInterface* system, QString name, QString description);
/** @brief Set the system mode */
void updateMode(int system, QString name, QString description);
/** @brief Update the system name */
void updateName(const QString& name);
/** @brief Set the MAV system type */
void setSystemType(UASInterface* uas, unsigned int systemType);
protected:
void createCustomWidgets();
QAction* toggleLoggingAction;
QAction* logReplayAction;
UASInterface* mav;
QToolButton* symbolButton;
QLabel* nameLabel;
QLabel* modeLabel;
QLabel* stateLabel;
QLabel* wpLabel;
QLabel* distlabel;
};
#endif // QGCTOOLBAR_H

3
src/ui/uas/UASView.cc

@ -146,6 +146,9 @@ UASView::UASView(UASInterface* uas, QWidget *parent) : @@ -146,6 +146,9 @@ UASView::UASView(UASInterface* uas, QWidget *parent) :
m_ui->killButton->hide();
m_ui->shutdownButton->hide();
// Set state and mode
updateMode(uas->getUASID(), uas->getShortMode(), "");
updateState(uas, uas->getShortState(), "");
setSystemType(uas, uas->getSystemType());
}

Loading…
Cancel
Save