Browse Source

Removed OpenGL dependency in HUD, merged in HUD from Soren Kuula and config changes from Michael Carpenter

QGC4.4
Lorenz Meier 12 years ago
parent
commit
9582bd5aba
  1. 3
      files/styles/style-indoor.css
  2. 2
      qgroundcontrol.pro
  3. 167
      src/ui/HUD.cc
  4. 9
      src/ui/HUD.h
  5. 6
      src/ui/QGCRGBDView.cc
  6. 8
      src/ui/QGCToolBar.cc
  7. 5
      src/ui/UASRawStatusView.cpp
  8. 25
      src/ui/uas/UASQuickViewGaugeItem.cc
  9. 19
      src/ui/uas/UASQuickViewGaugeItem.h

3
files/styles/style-indoor.css

@ -179,7 +179,6 @@ QDoubleSpinBox::down-button {
QPushButton { QPushButton {
min-height: 16px; min-height: 16px;
max-height: 20px;
border: 1px solid #465158; border: 1px solid #465158;
margin: 1px; margin: 1px;
border-radius: 2px; border-radius: 2px;
@ -203,8 +202,6 @@ QPushButton:pressed {
QToolButton { QToolButton {
font-weight: bold; font-weight: bold;
min-height: 16px; min-height: 16px;
/*min-width: 24px;*/
max-height: 20px;
border: 1px solid #4A4A4F; border: 1px solid #4A4A4F;
margin: 1px; margin: 1px;
border-radius: 2px; border-radius: 2px;

2
qgroundcontrol.pro

@ -383,6 +383,7 @@ HEADERS += src/MG.h \
src/ui/uas/UASQuickViewItem.h \ src/ui/uas/UASQuickViewItem.h \
src/ui/uas/UASQuickViewItemSelect.h \ src/ui/uas/UASQuickViewItemSelect.h \
src/ui/uas/UASQuickViewTextItem.h \ src/ui/uas/UASQuickViewTextItem.h \
src/ui/uas/UASQuickViewGaugeItem.h \
src/ui/uas/UASActionsWidget.h \ src/ui/uas/UASActionsWidget.h \
src/ui/designer/QGCRadioChannelDisplay.h \ src/ui/designer/QGCRadioChannelDisplay.h \
src/ui/QGCTabbedInfoView.h \ src/ui/QGCTabbedInfoView.h \
@ -557,6 +558,7 @@ SOURCES += src/main.cc \
src/ui/uas/UASQuickViewItem.cc \ src/ui/uas/UASQuickViewItem.cc \
src/ui/uas/UASQuickView.cc \ src/ui/uas/UASQuickView.cc \
src/ui/uas/UASQuickViewTextItem.cc \ src/ui/uas/UASQuickViewTextItem.cc \
src/ui/uas/UASQuickViewGaugeItem.cc \
src/ui/uas/UASQuickViewItemSelect.cc \ src/ui/uas/UASQuickViewItemSelect.cc \
src/ui/uas/UASActionsWidget.cpp \ src/ui/uas/UASActionsWidget.cpp \
src/ui/designer/QGCRadioChannelDisplay.cpp \ src/ui/designer/QGCRadioChannelDisplay.cpp \

167
src/ui/HUD.cc

@ -60,7 +60,7 @@ This file is part of the QGROUNDCONTROL project
* @param parent * @param parent
*/ */
HUD::HUD(int width, int height, QWidget* parent) HUD::HUD(int width, int height, QWidget* parent)
: QGLWidget(QGLFormat(QGL::SampleBuffers), parent), : QWidget(parent),
uas(NULL), uas(NULL),
yawInt(0.0f), yawInt(0.0f),
mode(tr("UNKNOWN MODE")), mode(tr("UNKNOWN MODE")),
@ -120,7 +120,7 @@ HUD::HUD(int width, int height, QWidget* parent)
offlineDirectory(""), offlineDirectory(""),
nextOfflineImage(""), nextOfflineImage(""),
HUDInstrumentsEnabled(true), HUDInstrumentsEnabled(true),
videoEnabled(false), videoEnabled(true),
xImageFactor(1.0), xImageFactor(1.0),
yImageFactor(1.0), yImageFactor(1.0),
imageRequested(false), imageRequested(false),
@ -147,14 +147,14 @@ HUD::HUD(int width, int height, QWidget* parent)
//qDebug() << __FILE__ << __LINE__ << "template image:" << imagePath; //qDebug() << __FILE__ << __LINE__ << "template image:" << imagePath;
//fill = QImage(imagePath); //fill = QImage(imagePath);
glImage = QGLWidget::convertToGLFormat(fill); glImage = fill;
// Refresh timer // Refresh timer
refreshTimer->setInterval(updateInterval); refreshTimer->setInterval(updateInterval);
connect(refreshTimer, SIGNAL(timeout()), this, SLOT(paintHUD())); connect(refreshTimer, SIGNAL(timeout()), this, SLOT(paintHUD()));
// Resize to correct size and fill with image // Resize to correct size and fill with image
resize(this->width(), this->height()); QWidget::resize(this->width(), this->height());
//glDrawPixels(glImage.width(), glImage.height(), GL_RGBA, GL_UNSIGNED_BYTE, glImage.bits()); //glDrawPixels(glImage.width(), glImage.height(), GL_RGBA, GL_UNSIGNED_BYTE, glImage.bits());
// Set size once // Set size once
@ -200,7 +200,7 @@ void HUD::showEvent(QShowEvent* event)
{ {
// React only to internal (pre-display) // React only to internal (pre-display)
// events // events
QGLWidget::showEvent(event); QWidget::showEvent(event);
refreshTimer->start(updateInterval); refreshTimer->start(updateInterval);
emit visibilityChanged(true); emit visibilityChanged(true);
} }
@ -210,7 +210,7 @@ void HUD::hideEvent(QHideEvent* event)
// React only to internal (pre-display) // React only to internal (pre-display)
// events // events
refreshTimer->stop(); refreshTimer->stop();
QGLWidget::hideEvent(event); QWidget::hideEvent(event);
emit visibilityChanged(false); emit visibilityChanged(false);
} }
@ -448,73 +448,6 @@ float HUD::refToScreenY(float y)
} }
/** /**
* This functions works in the OpenGL view, which is already translated by
* the x and y center offsets.
*
*/
void HUD::paintCenterBackground(float roll, float pitch, float yaw)
{
Q_UNUSED(yaw);
// Center indicator is 100 mm wide
float referenceWidth = 70.0;
float referenceHeight = 70.0;
// HUD is assumed to be 200 x 150 mm
// so that positions can be hardcoded
// but can of course be scaled.
double referencePositionX = vwidth / 2.0 - referenceWidth/2.0;
double referencePositionY = vheight / 2.0 - referenceHeight/2.0;
//this->width()/2.0+(xCenterOffset*scalingFactor), this->height()/2.0+(yCenterOffset*scalingFactor);
setupGLView(referencePositionX, referencePositionY, referenceWidth, referenceHeight);
// Store current position in the model view
// the position will be restored after drawing
glMatrixMode(GL_MODELVIEW);
glPushMatrix();
// Move to the center of the window
glTranslatef(referenceWidth/2.0f,referenceHeight/2.0f,0);
// Move based on the yaw difference
//glTranslatef(yaw, 0.0f, 0.0f);
// Rotate based on the bank
glRotatef((roll/M_PI)*180.0f, 0.0f, 0.0f, 1.0f);
// Translate in the direction of the rotation based
// on the pitch. On the 777, a pitch of 1 degree = 2 mm
//glTranslatef(0, ((-pitch/M_PI)*180.0f * vPitchPerDeg), 0);
glTranslatef(0.0f, (-pitch * vPitchPerDeg * 16.5f), 0.0f);
// Ground
glColor3ub(179,102,0);
glBegin(GL_POLYGON);
glVertex2f(-300,-900);
glVertex2f(-300,0);
glVertex2f(300,0);
glVertex2f(300,-900);
glVertex2f(-300,-900);
glEnd();
// Sky
glColor3ub(0,153,204);
glBegin(GL_POLYGON);
glVertex2f(-300,0);
glVertex2f(-300,900);
glVertex2f(300,900);
glVertex2f(300,0);
glVertex2f(-300,0);
glEnd();
}
/**
* Paint text on top of the image and OpenGL drawings * Paint text on top of the image and OpenGL drawings
* *
* @param text chars to write * @param text chars to write
@ -547,29 +480,6 @@ void HUD::paintText(QString text, QColor color, float fontSize, float refX, floa
painter->setPen(prevPen); painter->setPen(prevPen);
} }
void HUD::initializeGL()
{
bool antialiasing = true;
// Antialiasing setup
if(antialiasing) {
glEnable(GL_MULTISAMPLE);
glEnable(GL_BLEND);
glBlendFunc(GL_SRC_ALPHA,GL_ONE_MINUS_SRC_ALPHA);
glEnable(GL_POINT_SMOOTH);
glEnable(GL_LINE_SMOOTH);
glHint(GL_POINT_SMOOTH_HINT, GL_NICEST);
glHint(GL_LINE_SMOOTH_HINT, GL_NICEST);
} else {
glDisable(GL_BLEND);
glDisable(GL_POINT_SMOOTH);
glDisable(GL_LINE_SMOOTH);
}
}
/** /**
* @param referencePositionX horizontal position in the reference mm-unit space * @param referencePositionX horizontal position in the reference mm-unit space
* @param referencePositionY horizontal position in the reference mm-unit space * @param referencePositionY horizontal position in the reference mm-unit space
@ -583,23 +493,6 @@ void HUD::setupGLView(float referencePositionX, float referencePositionY, float
// Translate and scale the GL view in the virtual reference coordinate units on the screen // Translate and scale the GL view in the virtual reference coordinate units on the screen
int pixelPositionX = (int)((referencePositionX * scalingFactor) + xCenterOffset); int pixelPositionX = (int)((referencePositionX * scalingFactor) + xCenterOffset);
int pixelPositionY = this->height() - (referencePositionY * scalingFactor) + yCenterOffset - pixelHeight; int pixelPositionY = this->height() - (referencePositionY * scalingFactor) + yCenterOffset - pixelHeight;
//qDebug() << "Pixel x" << pixelPositionX << "pixelY" << pixelPositionY;
//qDebug() << "xCenterOffset:" << xCenterOffset << "yCenterOffest" << yCenterOffset
//The viewport is established at the correct pixel position and clips everything
// out of the desired instrument location
glViewport(pixelPositionX, pixelPositionY, pixelWidth, pixelHeight);
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
// The ortho projection is setup in a way that so that the drawing is done in the
// reference coordinate space
glOrtho(0, referenceWidth, 0, referenceHeight, -1, 1);
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
//glScalef(scaleX, scaleY, 1.0f);
} }
void HUD::paintRollPitchStrips() void HUD::paintRollPitchStrips()
@ -668,22 +561,13 @@ void HUD::paintHUD()
double scalingFactorH = this->height()/vheight; double scalingFactorH = this->height()/vheight;
if (scalingFactorH < scalingFactor) scalingFactor = scalingFactorH; if (scalingFactorH < scalingFactor) scalingFactor = scalingFactorH;
// OPEN GL PAINTING
// Store model view matrix to be able to reset it to the previous state
makeCurrent();
glMatrixMode(GL_MODELVIEW);
glPushMatrix();
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
// Fill with black background // Fill with black background
if (videoEnabled) { if (videoEnabled) {
if (nextOfflineImage != "" && QFileInfo(nextOfflineImage).exists()) { if (nextOfflineImage != "" && QFileInfo(nextOfflineImage).exists()) {
qDebug() << __FILE__ << __LINE__ << "template image:" << nextOfflineImage; qDebug() << __FILE__ << __LINE__ << "template image:" << nextOfflineImage;
QImage fill = QImage(nextOfflineImage); QImage fill = QImage(nextOfflineImage);
glImage = QGLWidget::convertToGLFormat(fill); glImage = fill;
// Reset to save load efforts // Reset to save load efforts
nextOfflineImage = ""; nextOfflineImage = "";
@ -693,22 +577,14 @@ void HUD::paintHUD()
if (dataStreamEnabled || videoEnabled) if (dataStreamEnabled || videoEnabled)
{ {
glRasterPos2i(0, 0);
xImageFactor = width() / (float)glImage.width(); xImageFactor = width() / (float)glImage.width();
yImageFactor = height() / (float)glImage.height(); yImageFactor = height() / (float)glImage.height();
float imageFactor = qMin(xImageFactor, yImageFactor); float imageFactor = qMin(xImageFactor, yImageFactor);
glPixelZoom(imageFactor, imageFactor);
// Resize to correct size and fill with image // Resize to correct size and fill with image
glDrawPixels(glImage.width(), glImage.height(), GL_RGBA, GL_UNSIGNED_BYTE, glImage.bits()); // FIXME
//qDebug() << "DRAWING GL IMAGE";
} else {
// Blue / brown background
paintCenterBackground(roll, pitch, yawTrans);
}
glMatrixMode(GL_MODELVIEW); }
glPopMatrix();
// END OF OPENGL PAINTING // END OF OPENGL PAINTING
@ -889,11 +765,6 @@ void HUD::paintHUD()
painter.begin(this); painter.begin(this);
painter.end(); painter.end();
} }
//glDisable(GL_MULTISAMPLE);
//glFlush();
} }
} }
@ -1303,20 +1174,6 @@ void HUD::drawCircle(float refX, float refY, float radius, float startDeg, float
drawEllipse(refX, refY, radius, radius, startDeg, endDeg, lineWidth, color, painter); drawEllipse(refX, refY, radius, radius, startDeg, endDeg, lineWidth, color, painter);
} }
void HUD::resizeGL(int w, int h)
{
if (isVisible()) {
glViewport(0, 0, w, h);
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
glOrtho(0, w, 0, h, -1, 1);
glMatrixMode(GL_MODELVIEW);
glPolygonMode(GL_FRONT, GL_FILL);
//FIXME
paintHUD();
}
}
void HUD::selectWaypoint(int uasId, int id) void HUD::selectWaypoint(int uasId, int id)
{ {
Q_UNUSED(uasId); Q_UNUSED(uasId);
@ -1364,7 +1221,7 @@ void HUD::setImageSize(int width, int height, int depth, int channels)
// Fill first channel of image with black pixels // Fill first channel of image with black pixels
image->fill(0); image->fill(0);
glImage = QGLWidget::convertToGLFormat(*image); glImage = *image;
qDebug() << __FILE__ << __LINE__ << "Setting up image"; qDebug() << __FILE__ << __LINE__ << "Setting up image";
@ -1415,7 +1272,7 @@ void HUD::commitRawDataToGL()
} }
} }
glImage = QGLWidget::convertToGLFormat(*newImage); glImage = *newImage;
delete image; delete image;
image = newImage; image = newImage;
// Switch buffers // Switch buffers
@ -1516,7 +1373,7 @@ void HUD::copyImage()
UAS* u = dynamic_cast<UAS*>(this->uas); UAS* u = dynamic_cast<UAS*>(this->uas);
if (u) if (u)
{ {
this->glImage = QGLWidget::convertToGLFormat(u->getImage()); this->glImage = u->getImage();
// Save to directory if logging is enabled // Save to directory if logging is enabled
if (imageLoggingEnabled) if (imageLoggingEnabled)

9
src/ui/HUD.h

@ -33,7 +33,7 @@ This file is part of the QGROUNDCONTROL project
#define HUD_H #define HUD_H
#include <QImage> #include <QImage>
#include <QGLWidget> #include <QWidget>
#include <QPainter> #include <QPainter>
#include <QFontDatabase> #include <QFontDatabase>
#include <QTimer> #include <QTimer>
@ -47,7 +47,7 @@ This file is part of the QGROUNDCONTROL project
* It can superimpose the HUD over the current live image stream (any arriving image stream will be auto- * It can superimpose the HUD over the current live image stream (any arriving image stream will be auto-
* matically used as background), or it draws the classic blue-brown background known from instruments. * matically used as background), or it draws the classic blue-brown background known from instruments.
*/ */
class HUD : public QGLWidget class HUD : public QWidget
{ {
Q_OBJECT Q_OBJECT
public: public:
@ -55,10 +55,10 @@ public:
~HUD(); ~HUD();
void setImageSize(int width, int height, int depth, int channels); void setImageSize(int width, int height, int depth, int channels);
void resizeGL(int w, int h); void resize(int w, int h);
public slots: public slots:
void initializeGL(); // void initializeGL();
//void paintGL(); //void paintGL();
/** @brief Set the currently monitored UAS */ /** @brief Set the currently monitored UAS */
@ -98,7 +98,6 @@ public slots:
protected slots: protected slots:
void paintCenterBackground(float roll, float pitch, float yaw);
void paintRollPitchStrips(); void paintRollPitchStrips();
void paintPitchLines(float pitch, QPainter* painter); void paintPitchLines(float pitch, QPainter* painter);
/** @brief Paint text on top of the image and OpenGL drawings */ /** @brief Paint text on top of the image and OpenGL drawings */

6
src/ui/QGCRGBDView.cc

@ -78,7 +78,7 @@ void QGCRGBDView::clearData(void)
QImage offlineImg; QImage offlineImg;
qDebug() << offlineImg.load(":/files/images/status/colorbars.png"); qDebug() << offlineImg.load(":/files/images/status/colorbars.png");
glImage = QGLWidget::convertToGLFormat(offlineImg); glImage = offlineImg;
} }
void QGCRGBDView::contextMenuEvent(QContextMenuEvent* event) void QGCRGBDView::contextMenuEvent(QContextMenuEvent* event)
@ -104,14 +104,14 @@ void QGCRGBDView::enableRGB(bool enabled)
{ {
rgbEnabled = enabled; rgbEnabled = enabled;
dataStreamEnabled = rgbEnabled | depthEnabled; dataStreamEnabled = rgbEnabled | depthEnabled;
resize(size()); QWidget::resize(size().width(), size().height());
} }
void QGCRGBDView::enableDepth(bool enabled) void QGCRGBDView::enableDepth(bool enabled)
{ {
depthEnabled = enabled; depthEnabled = enabled;
dataStreamEnabled = rgbEnabled | depthEnabled; dataStreamEnabled = rgbEnabled | depthEnabled;
resize(size()); QWidget::resize(size().width(), size().height());
} }
float colormapJet[128][3] = { float colormapJet[128][3] = {

8
src/ui/QGCToolBar.cc

@ -163,7 +163,7 @@ void QGCToolBar::createUI()
connectButton = new QPushButton(tr("Connect"), this); connectButton = new QPushButton(tr("Connect"), this);
connectButton->setToolTip(tr("Connect wireless link to MAV")); connectButton->setToolTip(tr("Connect wireless link to MAV"));
connectButton->setCheckable(true); connectButton->setCheckable(true);
connectButton->setStyleSheet("QPushButton {min-height: 20px; color: #222222; background-color: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, stop: 0 #5AAA49, stop: 1 #106B38); margin-left: 4px; margin-right: 4px; border-radius: 4px; border: 1px solid #085B35; } QPushButton:checked { background-color: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, stop: 0 #FF9000, stop: 1 #FFD450); color: #222222; border-color: #D1892A}"); connectButton->setStyleSheet("QPushButton { min-height: 24px; max-height: 24px; color: #222222; background-color: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, stop: 0 #5AAA49, stop: 1 #106B38); margin-left: 4px; margin-right: 4px; border-radius: 4px; border: 1px solid #085B35; } QPushButton:checked { background-color: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, stop: 0 #FF9000, stop: 1 #FFD450); color: #222222; border-color: #D1892A}");
addWidget(connectButton); addWidget(connectButton);
connect(connectButton, SIGNAL(clicked(bool)), this, SLOT(connectLink(bool))); connect(connectButton, SIGNAL(clicked(bool)), this, SLOT(connectLink(bool)));
@ -209,7 +209,7 @@ void QGCToolBar::setPerspectiveChangeActions(const QList<QAction*> &actions)
first->setCheckable(true); first->setCheckable(true);
connect(first, SIGNAL(clicked(bool)), actions.first(), SIGNAL(triggered(bool))); connect(first, SIGNAL(clicked(bool)), actions.first(), SIGNAL(triggered(bool)));
connect(actions.first(),SIGNAL(triggered(bool)),first,SLOT(setChecked(bool))); connect(actions.first(),SIGNAL(triggered(bool)),first,SLOT(setChecked(bool)));
first->setStyleSheet("QToolButton { min-width: 60px; color: #222222; background-color: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, stop: 0 #A2A3A4, stop: 1 #B6B7B8); margin-left: 8px; margin-right: 0px; padding-left: 4px; padding-right: 8px; border-radius: 0px; border : 0px solid blue; border-bottom-left-radius: 6px; border-top-left-radius: 6px; border-left: 1px solid #484848; border-top: 1px solid #484848; border-bottom: 1px solid #484848; } QToolButton:checked { background-color: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, stop: 0 #555555, stop: 1 #787878); color: #DDDDDD; }"); first->setStyleSheet("QToolButton { min-height: 24px; max-height: 24px; min-width: 60px; color: #222222; background-color: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, stop: 0 #A2A3A4, stop: 1 #B6B7B8); margin-left: 8px; margin-right: 0px; padding-left: 4px; padding-right: 8px; border-radius: 0px; border : 0px solid blue; border-bottom-left-radius: 6px; border-top-left-radius: 6px; border-left: 1px solid #484848; border-top: 1px solid #484848; border-bottom: 1px solid #484848; } QToolButton:checked { background-color: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, stop: 0 #555555, stop: 1 #787878); color: #DDDDDD; }");
addWidget(first); addWidget(first);
group->addButton(first); group->addButton(first);
@ -225,7 +225,7 @@ void QGCToolBar::setPerspectiveChangeActions(const QList<QAction*> &actions)
btn->setCheckable(true); btn->setCheckable(true);
connect(btn, SIGNAL(clicked(bool)), actions.at(i), SIGNAL(triggered(bool))); connect(btn, SIGNAL(clicked(bool)), actions.at(i), SIGNAL(triggered(bool)));
connect(actions.at(i),SIGNAL(triggered(bool)),btn,SLOT(setChecked(bool))); connect(actions.at(i),SIGNAL(triggered(bool)),btn,SLOT(setChecked(bool)));
btn->setStyleSheet("QToolButton { min-width: 60px; color: #222222; background-color: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, stop: 0 #A2A3A4, stop: 1 #B6B7B8); margin-left: -2px; margin-right: -2px; padding-left: 0px; padding-right: 0px; border-radius: 0px; border-top: 1px solid #484848; border-bottom: 1px solid #484848; } QToolButton:checked { background-color: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, stop: 0 #555555, stop: 1 #787878); color: #DDDDDD; }"); btn->setStyleSheet("QToolButton { min-height: 24px; max-height: 24px; min-width: 60px; color: #222222; background-color: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, stop: 0 #A2A3A4, stop: 1 #B6B7B8); margin-left: -2px; margin-right: -2px; padding-left: 0px; padding-right: 0px; border-radius: 0px; border-top: 1px solid #484848; border-bottom: 1px solid #484848; } QToolButton:checked { background-color: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, stop: 0 #555555, stop: 1 #787878); color: #DDDDDD; }");
addWidget(btn); addWidget(btn);
group->addButton(btn); group->addButton(btn);
} }
@ -237,7 +237,7 @@ void QGCToolBar::setPerspectiveChangeActions(const QList<QAction*> &actions)
advancedButton->setText(tr("Pro")); advancedButton->setText(tr("Pro"));
advancedButton->setToolTip(tr("Options for advanced users")); advancedButton->setToolTip(tr("Options for advanced users"));
advancedButton->setCheckable(true); advancedButton->setCheckable(true);
advancedButton->setStyleSheet("QPushButton { min-height: 20px; max-height: 20px; min-width: 60px; font-weight: bold; text-align: left; color: #222222; background-color: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, stop: 0 #A2A3A4, stop: 1 #B6B7B8); margin-left: 0px; margin-right: 13px; padding-left: 4px; padding-right: 8px; border-radius: 0px; border : 0px solid blue; border-bottom-right-radius: 6px; border-top-right-radius: 6px; border-right: 1px solid #484848; border-top: 1px solid #484848; border-bottom: 1px solid #484848; } QPushButton:checked { background-color: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, stop: 0 #555555, stop: 1 #787878); color: #DDDDDD; }"); advancedButton->setStyleSheet("QPushButton { min-height: 24px; max-height: 24px; min-width: 60px; font-weight: bold; text-align: left; color: #222222; background-color: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, stop: 0 #A2A3A4, stop: 1 #B6B7B8); margin-left: 0px; margin-right: 13px; padding-left: 4px; padding-right: 8px; border-radius: 0px; border : 0px solid blue; border-bottom-right-radius: 6px; border-top-right-radius: 6px; border-right: 1px solid #484848; border-top: 1px solid #484848; border-bottom: 1px solid #484848; } QPushButton:checked { background-color: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, stop: 0 #555555, stop: 1 #787878); color: #DDDDDD; }");
addWidget(advancedButton); addWidget(advancedButton);
group->addButton(advancedButton); group->addButton(advancedButton);
} else { } else {

5
src/ui/UASRawStatusView.cpp

@ -13,7 +13,10 @@ UASRawStatusView::UASRawStatusView(QWidget *parent) : QWidget(parent)
ui.tableWidget->setEditTriggers(QAbstractItemView::NoEditTriggers); ui.tableWidget->setEditTriggers(QAbstractItemView::NoEditTriggers);
QTimer *timer = new QTimer(this); QTimer *timer = new QTimer(this);
connect(timer,SIGNAL(timeout()),this,SLOT(updateTableTimerTick())); connect(timer,SIGNAL(timeout()),this,SLOT(updateTableTimerTick()));
timer->start(2000);
// FIXME reinstate once fixed.
//timer->start(2000);
} }
void UASRawStatusView::addSource(MAVLinkDecoder *decoder) void UASRawStatusView::addSource(MAVLinkDecoder *decoder)
{ {

25
src/ui/uas/UASQuickViewGaugeItem.cc

@ -0,0 +1,25 @@
#include "UASQuickViewGaugeItem.h"
#include <QVBoxLayout>
UASQuickViewGaugeItem::UASQuickViewGaugeItem(QWidget *parent) : UASQuickViewItem(parent)
{
}
void UASQuickViewGaugeItem::setValue(double value)
{
valueLabel->setText(QString::number(value,'f',4));
}
void UASQuickViewGaugeItem::setTitle(QString title)
{
titleLabel->setText(title);
}
void UASQuickViewGaugeItem::resizeEvent(QResizeEvent *event)
{
QFont valuefont = valueLabel->font();
QFont titlefont = titleLabel->font();
valuefont.setPixelSize(this->height() / 2.0);
titlefont.setPixelSize(this->height() / 4.0);
valueLabel->setFont(valuefont);
titleLabel->setFont(titlefont);
update();
}

19
src/ui/uas/UASQuickViewGaugeItem.h

@ -0,0 +1,19 @@
#ifndef UASQuickViewGaugeItem_H
#define UASQuickViewGaugeItem_H
#include "UASQuickViewItem.h"
#include <QLabel>
class UASQuickViewGaugeItem : public UASQuickViewItem
{
public:
UASQuickViewGaugeItem(QWidget *parent=0);
void setValue(double value);
void setTitle(QString title);
protected:
void resizeEvent(QResizeEvent *event);
private:
QLabel *titleLabel;
QLabel *valueLabel;
};
#endif // UASQuickViewGaugeItem_H
Loading…
Cancel
Save