1
0
mirror of https://bitbucket.org/librepilot/librepilot.git synced 2025-01-30 15:52:12 +01:00

git-svn-id: svn://svn.openpilot.org/OpenPilot/trunk@746 ebee16cc-31ac-478f-84a7-5cbb03baadba

This commit is contained in:
pip 2010-06-11 15:59:48 +00:00 committed by pip
parent 54a48953a4
commit c537df4ade
2 changed files with 54 additions and 19 deletions

View File

@ -34,7 +34,7 @@ MapGadgetWidget::MapGadgetWidget(QWidget *parent) : QWidget(parent)
{ {
int size = 256; int size = 256;
gcsButton = 0; // added by cathy gscButton = 0; // added by cathy
uavButton = 0; // added by cathy uavButton = 0; // added by cathy
follow_uav = false; // added by cathy follow_uav = false; // added by cathy
@ -132,33 +132,31 @@ void MapGadgetWidget::resizeEvent(QResizeEvent *event)
QWidget::resizeEvent(event); QWidget::resizeEvent(event);
} }
// changed by cathy
void MapGadgetWidget::addUserControls() void MapGadgetWidget::addUserControls()
{ { // create the user controls
// create user controls
gcsButton = new QPushButton("GCS"); // added by cathy
uavButton = new QPushButton("UAV"); // added by cathy
QPushButton* zoomin = new QPushButton("+");
QPushButton* zoomout = new QPushButton("-");
// cathy // cathy
gcsButton->setMinimumWidth(50); gscButton = new QPushButton("GCS");
gcsButton->setMaximumWidth(50); gscButton->setMinimumWidth(50);
gcsButton->setToolTip("Jump too ground station control"); gscButton->setMaximumWidth(50);
connect(gcsButton, SIGNAL(clicked(bool)), this, SLOT(gcsButtonClick())); gscButton->setToolTip("Jump too ground station control");
connect(gscButton, SIGNAL(clicked(bool)), this, SLOT(gscButtonClick()));
// cathy // cathy
uavButton = new QPushButton("UAV");
uavButton->setMinimumWidth(50); uavButton->setMinimumWidth(50);
uavButton->setMaximumWidth(50); uavButton->setMaximumWidth(50);
uavButton->setCheckable(true); uavButton->setCheckable(true);
uavButton->setToolTip("Stay centered on the UAV if checked"); uavButton->setToolTip("Stay centered on the UAV");
connect(uavButton, SIGNAL(clicked(bool)), this, SLOT(uavButtonClick())); connect(uavButton, SIGNAL(clicked(bool)), this, SLOT(uavButtonClick()));
QPushButton* zoomin = new QPushButton("+");
zoomin->setMinimumWidth(50); zoomin->setMinimumWidth(50);
zoomin->setMaximumWidth(50); zoomin->setMaximumWidth(50);
zoomin->setToolTip("Zoom in"); zoomin->setToolTip("Zoom in");
connect(zoomin, SIGNAL(clicked(bool)), m_mc, SLOT(zoomIn())); connect(zoomin, SIGNAL(clicked(bool)), m_mc, SLOT(zoomIn()));
QPushButton* zoomout = new QPushButton("-");
zoomout->setMinimumWidth(50); zoomout->setMinimumWidth(50);
zoomout->setMaximumWidth(50); zoomout->setMaximumWidth(50);
zoomout->setToolTip("Zoom out"); zoomout->setToolTip("Zoom out");
@ -169,7 +167,7 @@ void MapGadgetWidget::addUserControls()
innerlayout->setSpacing(3); innerlayout->setSpacing(3);
innerlayout->setMargin(2); innerlayout->setMargin(2);
innerlayout->addSpacing(10); innerlayout->addSpacing(10);
innerlayout->addWidget(gcsButton); innerlayout->addWidget(gscButton);
innerlayout->addWidget(uavButton); innerlayout->addWidget(uavButton);
innerlayout->addSpacing(10); innerlayout->addSpacing(10);
innerlayout->addWidget(zoomin); innerlayout->addWidget(zoomin);
@ -180,8 +178,8 @@ void MapGadgetWidget::addUserControls()
void MapGadgetWidget::gscButtonClick() // added by cathy void MapGadgetWidget::gscButtonClick() // added by cathy
{ {
follow_uav = false;
uavButton->setChecked(false); uavButton->setChecked(false);
follow_uav = uavButton->isChecked();
// jump straight too the GSC location // jump straight too the GSC location
@ -193,8 +191,8 @@ void MapGadgetWidget::uavButtonClick() // added by cathy
if (follow_uav) if (follow_uav)
{ {
PositionActual::DataFields data = m_positionActual->getData(); // PositionActual::DataFields data = m_positionActual->getData();
setPosition(QPointF(data.Longitude, data.Latitude)); // setPosition(QPointF(data.Longitude, data.Latitude));
} }
} }
@ -241,6 +239,44 @@ void MapGadgetWidget::keyPressEvent(QKeyEvent* event)
// emit(close()); // emit(close());
} }
else else
if (event->key() == Qt::Key_F1) // F1
{
gscButtonClick();
}
else
if (event->key() == Qt::Key_F2) // F2
{
uavButton->setChecked(!follow_uav);
follow_uav = uavButton->isChecked();
uavButtonClick();
}
else
if (event->key() == Qt::Key_Up)
{
}
else
if (event->key() == Qt::Key_Down)
{
}
else
if (event->key() == Qt::Key_Left)
{
}
else
if (event->key() == Qt::Key_Right)
{
}
else
if (event->key() == Qt::Key_PageUp)
{
m_mc->zoomIn();
}
else
if (event->key() == Qt::Key_PageDown)
{
m_mc->zoomOut();
}
else
{ {
qDebug() << event->key() << endl; qDebug() << event->key() << endl;
} }

View File

@ -81,9 +81,8 @@ private:
PositionActual *m_positionActual; PositionActual *m_positionActual;
QPushButton *gcsButton; // added by cathy QPushButton *gscButton; // added by cathy
QPushButton *uavButton; // added by cathy QPushButton *uavButton; // added by cathy
}; };
#endif /* MAPGADGETWIDGET_H_ */ #endif /* MAPGADGETWIDGET_H_ */