Commit 0846707b authored by pixhawk's avatar pixhawk

Merge branch 'dev' of github.com:pixhawk/qgroundcontrol into opmapcontrol

parents 5aab6ca2 5f82c714
images/splash.png

27.8 KB | W: | H:

images/splash.png

25.5 KB | W: | H:

images/splash.png
images/splash.png
images/splash.png
images/splash.png
  • 2-up
  • Swipe
  • Onion skin
This diff is collapsed.
......@@ -187,7 +187,8 @@ protected: //COMMENTS FOR TEST UNIT
int imagePackets; ///< Number of data packets being sent for this image
int imagePacketsArrived; ///< Number of data packets recieved
int imagePayload; ///< Payload size per transmitted packet (bytes). Standard is 254, and decreases when image resolution increases.
int imageQuality; ///< JPEG-Quality of the transmitted image (percentage)
int imageQuality; ///< Quality of the transmitted image (percentage)
int imageType; ///< Type of the transmitted image (BMP, PNG, JPEG, RAW 8 bit, RAW 32 bit)
QByteArray imageRecBuffer; ///< Buffer for the incoming bytestream
QImage image; ///< Image data of last completely transmitted image
quint64 imageStart;
......@@ -226,7 +227,7 @@ public:
}
int getSystemType();
QImage getImage();
void requestImage(); // ?
void requestImage();
int getAutopilotType() {
return autopilot;
}
......
......@@ -75,6 +75,7 @@ inline bool isinf(T value)
*/
HUD::HUD(int width, int height, QWidget* parent)
: QGLWidget(QGLFormat(QGL::SampleBuffers), parent),
u(NULL),
uas(NULL),
yawInt(0.0f),
mode(tr("UNKNOWN MODE")),
......@@ -136,7 +137,8 @@ HUD::HUD(int width, int height, QWidget* parent)
hudInstrumentsEnabled(true),
videoEnabled(false),
xImageFactor(1.0),
yImageFactor(1.0)
yImageFactor(1.0),
imageRequested(false)
{
// Set auto fill to false
setAutoFillBackground(false);
......@@ -158,11 +160,10 @@ HUD::HUD(int width, int height, QWidget* parent)
//qDebug() << __FILE__ << __LINE__ << "template image:" << imagePath;
//fill = QImage(imagePath);
//glImage = QGLWidget::convertToGLFormat(fill);
glImage = QGLWidget::convertToGLFormat(fill);
// Refresh timer
refreshTimer->setInterval(updateInterval);
//connect(refreshTimer, SIGNAL(timeout()), this, SLOT(update()));
connect(refreshTimer, SIGNAL(timeout()), this, SLOT(paintHUD()));
// Resize to correct size and fill with image
......@@ -282,6 +283,7 @@ void HUD::setActiveUAS(UASInterface* uas)
UAS* u = dynamic_cast<UAS*>(this->uas);
if (u) {
disconnect(u, SIGNAL(imageStarted(quint64)), this, SLOT(startImage(quint64)));
disconnect(u, SIGNAL(imageReady(UASInterface*)), this, SLOT(copyImage()));
}
}
......@@ -303,10 +305,12 @@ void HUD::setActiveUAS(UASInterface* uas)
UAS* u = dynamic_cast<UAS*>(uas);
if (u) {
connect(u, SIGNAL(imageStarted(quint64)), this, SLOT(startImage(quint64)));
connect(u, SIGNAL(imageReady(UASInterface*)), this, SLOT(copyImage()));
}
// Set new UAS
this->uas = uas;
this->u = dynamic_cast<UAS*>(this->uas);
}
}
......@@ -666,9 +670,6 @@ void HUD::paintHUD()
qDebug() << __FILE__ << __LINE__ << "template image:" << nextOfflineImage;
QImage fill = QImage(nextOfflineImage);
xImageFactor = width() / (float)fill.width();
yImageFactor = height() / (float)fill.height();
glImage = QGLWidget::convertToGLFormat(fill);
// Reset to save load efforts
......@@ -677,9 +678,13 @@ void HUD::paintHUD()
glRasterPos2i(0, 0);
glPixelZoom(xImageFactor, yImageFactor);
xImageFactor = width() / (float)glImage.width();
yImageFactor = height() / (float)glImage.height();
float imageFactor = qMin(xImageFactor, yImageFactor);
glPixelZoom(imageFactor, imageFactor);
// Resize to correct size and fill with image
glDrawPixels(glImage.width(), glImage.height(), GL_RGBA, GL_UNSIGNED_BYTE, glImage.bits());
//qDebug() << "DRAWING GL IMAGE";
} else {
// Blue / brown background
paintCenterBackground(roll, pitch, yawTrans);
......@@ -1623,3 +1628,9 @@ void HUD::setPixels(int imgid, const unsigned char* imageData, int length, int s
// }
}
}
void HUD::copyImage()
{
qDebug() << "HUD::copyImage()";
this->glImage = QGLWidget::convertToGLFormat(this->u->getImage());
}
......@@ -88,6 +88,8 @@ public slots:
void enableHUDInstruments(bool enabled);
/** @brief Enable Video */
void enableVideo(bool enabled);
/** @brief Copy an image from the current active UAS */
void copyImage();
protected slots:
......@@ -216,6 +218,8 @@ protected:
QAction* selectOfflineDirectoryAction;
QAction* selectVideoChannelAction;
void paintEvent(QPaintEvent *event);
bool imageRequested;
UAS* u;
};
......
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