Commit 9a11483b authored by pixhawk's avatar pixhawk

Fixed many, many small visual issues

parent 887469bb
* { font-family: "Bitstream Vera Sans"; font: "Roman"; font-size: 12px; }
QWidget#colorIcon {}
QWidget {
background-color: #F6F6F6;
color: #000000;
background-clip: border;
font-size: 11px;
}
QGroupBox {
border: 1px solid #222216;
border-radius: 3px;
padding: 10px 0px 0px 0px;
margin-top: 1ex; /* leave space at the top for the title */
}
QCheckBox {
/*background-color: #252528;*/
color: #222221;
}
QCheckBox::indicator {
border: 1px solid #111111;
border-radius: 2px;
color: #222221;
width: 10px;
height: 10px;
}
QLineEdit {
border: 1px solid #111111;
border-radius: 2px;
}
QTextEdit {
border: 1px solid #111111;
border-radius: 2px;
}
QPlainTextEdit {
border: 1px solid #111111;
border-radius: 2px;
}
QComboBox {
border: 1px solid #111111;
border-radius: 2px;
}
QCheckBox::indicator:checked {
background-color: #222222;
}
QCheckBox::indicator:checked:hover {
background-color: #222222;
}
QCheckBox::indicator:checked:pressed {
background-color: #222222;
}
QCheckBox::indicator:indeterminate:hover {
image: url(:/images/checkbox_indeterminate_hover.png);
}
QCheckBox::indicator:indeterminate:pressed {
image: url(:/images/checkbox_indeterminate_pressed.png);
}
QGroupBox::title {
subcontrol-origin: margin;
subcontrol-position: top center; /* position at the top center */
margin: 0 3px 0px 3px;
padding: 0 3px 0px 0px;
font: bold 8px;
color: #DDDDDF;
}
QMainWindow::separator {
background: #090909;
width: 2px; /* when vertical */
height: 2px; /* when horizontal */
}
QMainWindow::separator:hover {
background: white;
}
QDockWidget {
border: 1px solid #32345E;
/* titlebar-close-icon: url(close.png);
titlebar-normal-icon: url(undock.png);*/
}
QDockWidget::title {
text-align: left; /* align the text to the left */
background: lightgray;
padding-left: 5px;
}
QDockWidget::close-button, QDockWidget::float-button {
border: 1px solid transparent;
background: darkgray;
padding: 0px;
}
QDockWidget::close-button:hover, QDockWidget::float-button:hover {
background: gray;
}
QDockWidget::close-button:pressed, QDockWidget::float-button:pressed {
padding: 1px -1px -1px 1px;
}
QDockWidget::close-button, QDockWidget::float-button {
background-color: #181820;
color: #EEEEEE;
}
QDockWidget::title {
text-align: left;
background: #121214;
color: #4A4A4F;
padding-left: 5px;
height: 10px;
border-bottom: 1px solid #222222;
}
QSeparator {
color: #EEEEEE;
}
QSpinBox {
min-height: 14px;
max-height: 18px;
border: 1px solid #4A4A4F;
border-radius: 5px;
}
QSpinBox::up-button {
subcontrol-origin: border;
subcontrol-position: top right; /* position at the top right corner */
border-image: url(:/images/actions/go-up.svg) 1;
border-width: 1px;
}
QSpinBox::down-button {
subcontrol-origin: border;
subcontrol-position: bottom right; /* position at the top right corner */
border-image: url(:/images/actions/go-down.svg) 1;
border-width: 1px;
}
QDoubleSpinBox {
min-height: 14px;
max-height: 18px;
border: 1px solid #4A4A4F;
border-radius: 5px;
}
QDoubleSpinBox::up-button {
subcontrol-origin: border;
subcontrol-position: top right; /* position at the top right corner */
border-image: url(:/images/actions/go-up.svg) 1;
border-width: 1px;
max-width: 5px;
}
QDoubleSpinBox::down-button {
subcontrol-origin: border;
subcontrol-position: bottom right; /* position at the top right corner */
border-image: url(:/images/actions/go-down.svg) 1;
border-width: 1px;
max-width: 5px;
}
QPushButton {
font-weight: bold;
min-height: 18px;
max-height: 18px;
border: 2px solid #4A4A4F;
border-radius: 5px;
padding-left: 10px;
padding-right: 10px;
background-color: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, stop: 0 #232228, stop: 1 #020208);
}
QPushButton:checked {
background-color: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, stop: 0 #404040, stop: 1 #808080);
}
QPushButton:pressed {
background-color: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, stop: 0 #bbbbbb, stop: 1 #b0b0b0);
}
QToolButton {
font-weight: bold;
min-height: 16px;
min-width: 24px;
max-height: 18px;
border: 2px solid #4A4A4F;
border-radius: 5px;
background-color: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, stop: 0 #232228, stop: 1 #020208);
}
QToolButton:checked {
background-color: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, stop: 0 #090909, stop: 1 #353535);
}
QToolButton:pressed {
background-color: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, stop: 0 #bbbbbb, stop: 1 #b0b0b0);
}
QToolTip {
background-color: #404040;
border-radius: 3px;
}
QPushButton#forceLandButton {
font-weight: bold;
min-height: 30px;
color: #000000;
background: qlineargradient(x1:0, y1:0, x2:0, y2:1,
stop:0 #ffee01, stop:1 #ae8f00) url("ICONDIR/control/emergency-button.png");
background-clip: border;
border-width: 1px;
border-color: #222222;
border-radius: 5px;
}
QPushButton:pressed#forceLandButton {
font-weight: bold;
min-height: 30px;
color: #000000;
background: qlineargradient(x1:0, y1:0, x2:0, y2:1,
stop:0 #bbaa00, stop:1 #a05b00) url("ICONDIR/control/emergency-button.png");
background-clip: border;
border-width: 1px;
border-color: #222222;
border-radius: 5px;
}
QPushButton#killButton {
font-weight: bold;
min-height: 30px;
color: #000000;
background: qlineargradient(x1:0, y1:0, x2:0, y2:1,
stop:0 #ffb917, stop:1 #b37300) url("ICONDIR/control/emergency-button.png");
background-clip: border;
border-width: 1px;
border-color: #222222;
border-radius: 5px;
}
QPushButton:pressed#killButton {
font-weight: bold;
min-height: 30px;
color: #000000;
background: qlineargradient(x1:0, y1:0, x2:0, y2:1,
stop:0 #bb8500, stop:1 #903000) url("ICONDIR/control/emergency-button.png");
background-clip: border;
border-width: 1px;
border-color: #222222;
border-radius: 5px;
}
QPushButton#controlButton {
min-height: 25px;
background-color: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, stop: 0 #A0AE00, stop: 1 #909E00);
}
QPushButton:checked#controlButton {
background-color: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, stop: 0 #b76f11, stop: 1 #e1a718);
}
QProgressBar {
border: 1px solid #4A4A4F;
border-radius: 4px;
text-align: center;
padding: 2px;
color: #DDDDDF;
background-color: #111118;
}
QProgressBar:horizontal {
height: 9px;
}
QProgressBar:vertical {
width: 9px;
}
QProgressBar::chunk {
background-color: #3C7B9E;
}
QProgressBar::chunk#batteryBar {
background-color: green;
}
QProgressBar::chunk#speedBar {
background-color: yellow;
}
QProgressBar::chunk#thrustBar {
background-color: orange;
}
...@@ -83,6 +83,9 @@ macx { ...@@ -83,6 +83,9 @@ macx {
QMAKE_POST_LINK += && cp -rf $$BASEDIR/audio $$TARGETDIR/qgroundcontrol.app/Contents/MacOs QMAKE_POST_LINK += && cp -rf $$BASEDIR/audio $$TARGETDIR/qgroundcontrol.app/Contents/MacOs
# Copy google earth starter file # Copy google earth starter file
QMAKE_POST_LINK += && cp -f $$BASEDIR/images/earth.html $$TARGETDIR/qgroundcontrol.app/Contents/MacOs QMAKE_POST_LINK += && cp -f $$BASEDIR/images/earth.html $$TARGETDIR/qgroundcontrol.app/Contents/MacOs
# Copy CSS stylesheets
QMAKE_POST_LINK += && cp -f $$BASEDIR/images/style-mission.css $$TARGETDIR/qgroundcontrol.app/Contents/MacOs/style-indoor.css
QMAKE_POST_LINK += && cp -f $$BASEDIR/images/style-outdoor.css $$TARGETDIR/qgroundcontrol.app/Contents/MacOs
# Copy model files # Copy model files
#QMAKE_POST_LINK += && cp -f $$BASEDIR/models/*.dae $$TARGETDIR/qgroundcontrol.app/Contents/MacOs #QMAKE_POST_LINK += && cp -f $$BASEDIR/models/*.dae $$TARGETDIR/qgroundcontrol.app/Contents/MacOs
......
...@@ -34,4 +34,9 @@ quint64 groundTimeUsecs() ...@@ -34,4 +34,9 @@ quint64 groundTimeUsecs()
return static_cast<quint64>(microseconds + (time.time().msec()*1000)); return static_cast<quint64>(microseconds + (time.time().msec()*1000));
} }
int applicationVersion()
{
return APPLICATIONVERSION;
}
} }
...@@ -15,9 +15,11 @@ namespace QGC ...@@ -15,9 +15,11 @@ namespace QGC
/** @brief Get the current ground time in microseconds */ /** @brief Get the current ground time in microseconds */
quint64 groundTimeUsecs(); quint64 groundTimeUsecs();
int applicationVersion();
const QString APPNAME = "QGROUNDCONTROL"; const QString APPNAME = "QGROUNDCONTROL";
const QString COMPANYNAME = "OPENMAV"; const QString COMPANYNAME = "OPENMAV";
const int APPLICATIONVERSION = 80; // 0.8.0
} }
#define QGC_EVENTLOOP_DEBUG 0 #define QGC_EVENTLOOP_DEBUG 0
......
...@@ -447,7 +447,7 @@ void MAVLinkSimulationLink::mainloop() ...@@ -447,7 +447,7 @@ void MAVLinkSimulationLink::mainloop()
chan.chan5_raw = (chan.chan3_raw + chan.chan4_raw) / 2.0f; chan.chan5_raw = (chan.chan3_raw + chan.chan4_raw) / 2.0f;
chan.chan6_raw = (chan.chan3_raw + chan.chan2_raw) / 2.0f; chan.chan6_raw = (chan.chan3_raw + chan.chan2_raw) / 2.0f;
chan.chan7_raw = (chan.chan4_raw + chan.chan2_raw) / 2.0f; chan.chan7_raw = (chan.chan4_raw + chan.chan2_raw) / 2.0f;
chan.chan8_raw = (chan.chan6_raw + chan.chan2_raw) / 2.0f; chan.chan8_raw = 0;
chan.rssi = 100; chan.rssi = 100;
messageSize = mavlink_msg_rc_channels_raw_encode(systemId, componentId, &msg, &chan); messageSize = mavlink_msg_rc_channels_raw_encode(systemId, componentId, &msg, &chan);
// Allocate buffer with packet data // Allocate buffer with packet data
......
...@@ -279,15 +279,15 @@ void UAS::receiveMessage(LinkInterface* link, mavlink_message_t message) ...@@ -279,15 +279,15 @@ void UAS::receiveMessage(LinkInterface* link, mavlink_message_t message)
mavlink_msg_raw_imu_decode(&message, &raw); mavlink_msg_raw_imu_decode(&message, &raw);
quint64 time = getUnixTime(raw.usec); quint64 time = getUnixTime(raw.usec);
emit valueChanged(uasId, "Accel. X", raw.xacc, time); emit valueChanged(uasId, "accel x", raw.xacc, time);
emit valueChanged(uasId, "Accel. Y", raw.yacc, time); emit valueChanged(uasId, "accel y", raw.yacc, time);
emit valueChanged(uasId, "Accel. Z", raw.zacc, time); emit valueChanged(uasId, "accel z", raw.zacc, time);
emit valueChanged(uasId, "Gyro Phi", static_cast<double>(raw.xgyro), time); emit valueChanged(uasId, "gyro roll", static_cast<double>(raw.xgyro), time);
emit valueChanged(uasId, "Gyro Theta", static_cast<double>(raw.ygyro), time); emit valueChanged(uasId, "gyro pitch", static_cast<double>(raw.ygyro), time);
emit valueChanged(uasId, "Gyro Psi", static_cast<double>(raw.zgyro), time); emit valueChanged(uasId, "gyro yaw", static_cast<double>(raw.zgyro), time);
emit valueChanged(uasId, "Mag. X", raw.xmag, time); emit valueChanged(uasId, "mag x", raw.xmag, time);
emit valueChanged(uasId, "Mag. Y", raw.ymag, time); emit valueChanged(uasId, "mag y", raw.ymag, time);
emit valueChanged(uasId, "Mag. Z", raw.zmag, time); emit valueChanged(uasId, "mag z", raw.zmag, time);
} }
break; break;
case MAVLINK_MSG_ID_ATTITUDE: case MAVLINK_MSG_ID_ATTITUDE:
...@@ -303,20 +303,20 @@ void UAS::receiveMessage(LinkInterface* link, mavlink_message_t message) ...@@ -303,20 +303,20 @@ void UAS::receiveMessage(LinkInterface* link, mavlink_message_t message)
// emit valueChanged(uasId, "roll IMU", mavlink_msg_attitude_get_roll(&message), time); // emit valueChanged(uasId, "roll IMU", mavlink_msg_attitude_get_roll(&message), time);
// emit valueChanged(uasId, "pitch IMU", mavlink_msg_attitude_get_pitch(&message), time); // emit valueChanged(uasId, "pitch IMU", mavlink_msg_attitude_get_pitch(&message), time);
// emit valueChanged(uasId, "yaw IMU", mavlink_msg_attitude_get_yaw(&message), time); // emit valueChanged(uasId, "yaw IMU", mavlink_msg_attitude_get_yaw(&message), time);
emit valueChanged(uasId, "roll IMU", mavlink_msg_attitude_get_roll(&message), time); emit valueChanged(uasId, "roll (rad)", mavlink_msg_attitude_get_roll(&message), time);
emit valueChanged(uasId, "pitch IMU", mavlink_msg_attitude_get_pitch(&message), time); emit valueChanged(uasId, "pitch (rad)", mavlink_msg_attitude_get_pitch(&message), time);
emit valueChanged(uasId, "yaw IMU", mavlink_msg_attitude_get_yaw(&message), time); emit valueChanged(uasId, "yaw (rad)", mavlink_msg_attitude_get_yaw(&message), time);
emit valueChanged(uasId, "rollspeed IMU", attitude.rollspeed, time); emit valueChanged(uasId, "rollspeed (rad)", attitude.rollspeed, time);
emit valueChanged(uasId, "pitchspeed IMU", attitude.pitchspeed, time); emit valueChanged(uasId, "pitchspeed (rad)", attitude.pitchspeed, time);
emit valueChanged(uasId, "yawspeed IMU", attitude.yawspeed, time); emit valueChanged(uasId, "yawspeed (rad)", attitude.yawspeed, time);
// Emit in angles // Emit in angles
emit valueChanged(uasId, "roll (deg)", (attitude.roll/M_PI)*180.0, time); emit valueChanged(uasId, "roll", (attitude.roll/M_PI)*180.0, time);
emit valueChanged(uasId, "pitch (deg)", (attitude.pitch/M_PI)*180.0, time); emit valueChanged(uasId, "pitch", (attitude.pitch/M_PI)*180.0, time);
emit valueChanged(uasId, "yaw (deg)", (attitude.yaw/M_PI)*180.0, time); emit valueChanged(uasId, "yaw", (attitude.yaw/M_PI)*180.0, time);
emit valueChanged(uasId, "roll V (deg/s)", (attitude.rollspeed/M_PI)*180.0, time); emit valueChanged(uasId, "rollspeed", (attitude.rollspeed/M_PI)*180.0, time);
emit valueChanged(uasId, "pitch V (deg/s)", (attitude.pitchspeed/M_PI)*180.0, time); emit valueChanged(uasId, "pitchspeed", (attitude.pitchspeed/M_PI)*180.0, time);
emit valueChanged(uasId, "yaw V (deg/s)", (attitude.yawspeed/M_PI)*180.0, time); emit valueChanged(uasId, "yawspeed", (attitude.yawspeed/M_PI)*180.0, time);
emit attitudeChanged(this, attitude.roll, attitude.pitch, attitude.yaw, time); emit attitudeChanged(this, attitude.roll, attitude.pitch, attitude.yaw, time);
} }
...@@ -334,9 +334,9 @@ void UAS::receiveMessage(LinkInterface* link, mavlink_message_t message) ...@@ -334,9 +334,9 @@ void UAS::receiveMessage(LinkInterface* link, mavlink_message_t message)
emit valueChanged(uasId, "x", pos.x, time); emit valueChanged(uasId, "x", pos.x, time);
emit valueChanged(uasId, "y", pos.y, time); emit valueChanged(uasId, "y", pos.y, time);
emit valueChanged(uasId, "z", pos.z, time); emit valueChanged(uasId, "z", pos.z, time);
emit valueChanged(uasId, "Vx", pos.vx, time); emit valueChanged(uasId, "x speed", pos.vx, time);
emit valueChanged(uasId, "Vy", pos.vy, time); emit valueChanged(uasId, "y speed", pos.vy, time);
emit valueChanged(uasId, "Vz", pos.vz, time); emit valueChanged(uasId, "z speed", pos.vz, time);
emit localPositionChanged(this, pos.x, pos.y, pos.z, time); emit localPositionChanged(this, pos.x, pos.y, pos.z, time);
emit speedChanged(this, pos.vx, pos.vy, pos.vz, time); emit speedChanged(this, pos.vx, pos.vy, pos.vz, time);
...@@ -366,12 +366,12 @@ void UAS::receiveMessage(LinkInterface* link, mavlink_message_t message) ...@@ -366,12 +366,12 @@ void UAS::receiveMessage(LinkInterface* link, mavlink_message_t message)
speedX = pos.vx/100.0; speedX = pos.vx/100.0;
speedY = pos.vy/100.0; speedY = pos.vy/100.0;
speedZ = pos.vz/100.0; speedZ = pos.vz/100.0;
emit valueChanged(uasId, "lat", pos.lat, time); emit valueChanged(uasId, "latitude", pos.lat, time);
emit valueChanged(uasId, "lon", pos.lon, time); emit valueChanged(uasId, "longitude", pos.lon, time);
emit valueChanged(uasId, "alt", pos.alt, time); emit valueChanged(uasId, "altitutde", pos.alt, time);
emit valueChanged(uasId, "g-vx", speedX, time); emit valueChanged(uasId, "gps x speed", speedX, time);
emit valueChanged(uasId, "g-vy", speedY, time); emit valueChanged(uasId, "gps y speed", speedY, time);
emit valueChanged(uasId, "g-vz", speedZ, time); emit valueChanged(uasId, "gps z speed", speedZ, time);
emit globalPositionChanged(this, longitude, latitude, altitude, time); emit globalPositionChanged(this, longitude, latitude, altitude, time);
emit speedChanged(this, speedX, speedY, speedZ, time); emit speedChanged(this, speedX, speedY, speedZ, time);
// Set internal state // Set internal state
...@@ -397,8 +397,8 @@ void UAS::receiveMessage(LinkInterface* link, mavlink_message_t message) ...@@ -397,8 +397,8 @@ void UAS::receiveMessage(LinkInterface* link, mavlink_message_t message)
// quint64 time = getUnixTime(pos.usec); // quint64 time = getUnixTime(pos.usec);
quint64 time = MG::TIME::getGroundTimeNow(); quint64 time = MG::TIME::getGroundTimeNow();
emit valueChanged(uasId, "lat", pos.lat, time); emit valueChanged(uasId, "latitude", pos.lat, time);
emit valueChanged(uasId, "lon", pos.lon, time); emit valueChanged(uasId, "longitude", pos.lon, time);
if (pos.fix_type > 0) if (pos.fix_type > 0)
{ {
...@@ -411,7 +411,7 @@ void UAS::receiveMessage(LinkInterface* link, mavlink_message_t message) ...@@ -411,7 +411,7 @@ void UAS::receiveMessage(LinkInterface* link, mavlink_message_t message)
alt = 0; alt = 0;
emit textMessageReceived(uasId, message.compid, 255, "GCS ERROR: RECEIVED NaN FOR ALTITUDE"); emit textMessageReceived(uasId, message.compid, 255, "GCS ERROR: RECEIVED NaN FOR ALTITUDE");
} }
emit valueChanged(uasId, "alt", pos.alt, time); emit valueChanged(uasId, "altitude", pos.alt, time);
// Smaller than threshold and not NaN // Smaller than threshold and not NaN
if (pos.v < 1000000 && pos.v == pos.v) if (pos.v < 1000000 && pos.v == pos.v)
{ {
...@@ -447,9 +447,9 @@ void UAS::receiveMessage(LinkInterface* link, mavlink_message_t message) ...@@ -447,9 +447,9 @@ void UAS::receiveMessage(LinkInterface* link, mavlink_message_t message)
{ {
mavlink_raw_pressure_t pressure; mavlink_raw_pressure_t pressure;
mavlink_msg_raw_pressure_decode(&message, &pressure); mavlink_msg_raw_pressure_decode(&message, &pressure);
emit valueChanged(uasId, "Abs pressure", pressure.press_abs, this->getUnixTime(0)); emit valueChanged(uasId, "abs pressure", pressure.press_abs, this->getUnixTime(0));
emit valueChanged(uasId, "Diff pressure 1", pressure.press_diff1, this->getUnixTime(0)); emit valueChanged(uasId, "diff pressure 1", pressure.press_diff1, this->getUnixTime(0));
emit valueChanged(uasId, "Diff pressure 2", pressure.press_diff2, this->getUnixTime(0)); emit valueChanged(uasId, "diff pressure 2", pressure.press_diff2, this->getUnixTime(0));
} }
break; break;
case MAVLINK_MSG_ID_RC_CHANNELS_RAW: case MAVLINK_MSG_ID_RC_CHANNELS_RAW:
......
...@@ -194,10 +194,10 @@ void HDDisplay::saveState() ...@@ -194,10 +194,10 @@ void HDDisplay::saveState()
for (int i = 0; i < acceptList->count(); i++) for (int i = 0; i < acceptList->count(); i++)
{ {
QString key = acceptList->at(i); QString key = acceptList->at(i);
instruments += "|" + QString::number(minValues.value(key, -1.0))+","+key+","+QString::number(maxValues.value(key, +1.0)); instruments += "|" + QString::number(minValues.value(key, -1.0))+","+key+","+QString::number(maxValues.value(key, +1.0))+","+((symmetric.value(key, false)) ? "s" : "");
} }
qDebug() << "Saving" << instruments; // qDebug() << "Saving" << instruments;
settings.setValue(windowTitle()+"_gauges", instruments); settings.setValue(windowTitle()+"_gauges", instruments);
settings.sync(); settings.sync();
...@@ -240,6 +240,8 @@ void HDDisplay::removeItemByAction() ...@@ -240,6 +240,8 @@ void HDDisplay::removeItemByAction()
acceptList->removeAt(index); acceptList->removeAt(index);
minValues.remove(item); minValues.remove(item);
maxValues.remove(item); maxValues.remove(item);
symmetric.remove(item);
adjustGaugeAspectRatio();
} }
} }
...@@ -277,8 +279,16 @@ void HDDisplay::addGauge(const QString& gauge) ...@@ -277,8 +279,16 @@ void HDDisplay::addGauge(const QString& gauge)
val = parts.first().toDouble(&ok); val = parts.first().toDouble(&ok);
if (ok) minValues.insert(key, val); if (ok) minValues.insert(key, val);
// Convert max to double number // Convert max to double number
val = parts.last().toDouble(&ok); val = parts.at(2).toDouble(&ok);
if (ok) maxValues.insert(key, val); if (ok) maxValues.insert(key, val);
// Convert symmetric flag
if (parts.length() >= 4)
{
if (parts.at(3).contains("s"))
{
symmetric.insert(key, true);
}
}
// Add value to acceptlist // Add value to acceptlist
acceptList->append(key); acceptList->append(key);
} }
...@@ -394,7 +404,7 @@ void HDDisplay::renderOverlay() ...@@ -394,7 +404,7 @@ void HDDisplay::renderOverlay()
for (int i = 0; i < acceptList->size(); ++i) for (int i = 0; i < acceptList->size(); ++i)
{ {
QString value = acceptList->at(i); QString value = acceptList->at(i);
drawGauge(xCoord, yCoord, gaugeWidth/2.0f, minValues.value(value, -1.0f), maxValues.value(value, 1.0f), value, values.value(value, minValues.value(value, 0.0f)), gaugeColor, &painter, goodRanges.value(value, qMakePair(0.0f, 0.5f)), critRanges.value(value, qMakePair(0.7f, 1.0f)), true); drawGauge(xCoord, yCoord, gaugeWidth/2.0f, minValues.value(value, -1.0f), maxValues.value(value, 1.0f), value, values.value(value, minValues.value(value, 0.0f)), gaugeColor, &painter, symmetric.value(value, false), goodRanges.value(value, qMakePair(0.0f, 0.5f)), critRanges.value(value, qMakePair(0.7f, 1.0f)), true);
xCoord += gaugeWidth + leftSpacing; xCoord += gaugeWidth + leftSpacing;
// Move one row down if necessary // Move one row down if necessary
if (xCoord + gaugeWidth*0.9f > vwidth) if (xCoord + gaugeWidth*0.9f > vwidth)
...@@ -513,17 +523,33 @@ void HDDisplay::drawChangeRateStrip(float xRef, float yRef, float height, float ...@@ -513,17 +523,33 @@ void HDDisplay::drawChangeRateStrip(float xRef, float yRef, float height, float
paintText(label, defaultColor, 3.0f, xRef+width/2.0f, yRef+height-((scaledValue - minRate)/(maxRate-minRate))*height - 1.6f, painter); paintText(label, defaultColor, 3.0f, xRef+width/2.0f, yRef+height-((scaledValue - minRate)/(maxRate-minRate))*height - 1.6f, painter);
} }
void HDDisplay::drawGauge(float xRef, float yRef, float radius, float min, float max, QString name, float value, const QColor& color, QPainter* painter, QPair<float, float> goodRange, QPair<float, float> criticalRange, bool solid) void HDDisplay::drawGauge(float xRef, float yRef, float radius, float min, float max, QString name, float value, const QColor& color, QPainter* painter, bool symmetric, QPair<float, float> goodRange, QPair<float, float> criticalRange, bool solid)
{ {
// Draw the circle // Draw the circle
QPen circlePen(Qt::SolidLine); QPen circlePen(Qt::SolidLine);
// Rotate the whole gauge with this angle (in radians) for the zero position // Rotate the whole gauge with this angle (in radians) for the zero position
const float zeroRotation = 0.49f; float zeroRotation;
if (symmetric)
{
zeroRotation = 1.35f;
}
else
{
zeroRotation = 0.49f;
}
// Scale the rotation so that the gauge does one revolution // Scale the rotation so that the gauge does one revolution
// per max. change // per max. change
const float rangeScale = ((2.0f * M_PI) / (max - min)) * 0.72f; float rangeScale;
if (symmetric)
{
rangeScale = ((2.0f * M_PI) / (max - min)) * 0.57f;
}
else
{
rangeScale = ((2.0f * M_PI) / (max - min)) * 0.72f;
}
const float scaledValue = (value-min)*rangeScale; const float scaledValue = (value-min)*rangeScale;
...@@ -558,7 +584,15 @@ void HDDisplay::drawGauge(float xRef, float yRef, float radius, float min, float ...@@ -558,7 +584,15 @@ void HDDisplay::drawGauge(float xRef, float yRef, float radius, float min, float
QBrush brush(QGC::colorBackground, Qt::SolidPattern); QBrush brush(QGC::colorBackground, Qt::SolidPattern);
painter->setBrush(brush); painter->setBrush(brush);
painter->setPen(Qt::NoPen); painter->setPen(Qt::NoPen);
painter->drawRect(refToScreenX(xRef-radius/2.5f), refToScreenY(yRef+nameHeight+radius/4.0f), refToScreenX(radius+radius/2.0f), refToScreenY((radius - radius/4.0f)*1.2f));
if (symmetric)
{
painter->drawRect(refToScreenX(xRef-radius), refToScreenY(yRef+nameHeight+radius/4.0f), refToScreenX(radius+radius), refToScreenY((radius - radius/4.0f)*1.2f));
}
else
{
painter->drawRect(refToScreenX(xRef-radius/2.5f), refToScreenY(yRef+nameHeight+radius/4.0f), refToScreenX(radius+radius/2.0f), refToScreenY((radius - radius/4.0f)*1.2f));
}
// Draw good value and crit. value markers // Draw good value and crit. value markers
if (goodRange.first != goodRange.second) if (goodRange.first != goodRange.second)
......
...@@ -114,7 +114,7 @@ protected: ...@@ -114,7 +114,7 @@ protected:
void drawChangeRateStrip(float xRef, float yRef, float height, float minRate, float maxRate, float value, QPainter* painter); void drawChangeRateStrip(float xRef, float yRef, float height, float minRate, float maxRate, float value, QPainter* painter);
void drawChangeIndicatorGauge(float xRef, float yRef, float radius, float expectedMaxChange, float value, const QColor& color, QPainter* painter, bool solid=true); void drawChangeIndicatorGauge(float xRef, float yRef, float radius, float expectedMaxChange, float value, const QColor& color, QPainter* painter, bool solid=true);
void drawGauge(float xRef, float yRef, float radius, float min, float max, const QString name, float value, const QColor& color, QPainter* painter, QPair<float, float> goodRange, QPair<float, float> criticalRange, bool solid=true); void drawGauge(float xRef, float yRef, float radius, float min, float max, const QString name, float value, const QColor& color, QPainter* painter, bool symmetric, QPair<float, float> goodRange, QPair<float, float> criticalRange, bool solid=true);
void drawSystemIndicator(float xRef, float yRef, int maxNum, float maxWidth, float maxHeight, QPainter* painter); void drawSystemIndicator(float xRef, float yRef, int maxNum, float maxWidth, float maxHeight, QPainter* painter);
void paintText(QString text, QColor color, float fontSize, float refX, float refY, QPainter* painter); void paintText(QString text, QColor color, float fontSize, float refX, float refY, QPainter* painter);
...@@ -143,6 +143,7 @@ protected: ...@@ -143,6 +143,7 @@ protected:
QMap<QString, quint64> lastUpdate; ///< The last update time for this variable QMap<QString, quint64> lastUpdate; ///< The last update time for this variable
QMap<QString, float> minValues; ///< The minimum value this variable is assumed to have QMap<QString, float> minValues; ///< The minimum value this variable is assumed to have
QMap<QString, float> maxValues; ///< The maximum value this variable is assumed to have QMap<QString, float> maxValues; ///< The maximum value this variable is assumed to have
QMap<QString, bool> symmetric; ///< Draw the gauge / dial symmetric bool = yes
QMap<QString, QPair<float, float> > goodRanges; ///< The range of good values QMap<QString, QPair<float, float> > goodRanges; ///< The range of good values
QMap<QString, QPair<float, float> > critRanges; ///< The range of critical values QMap<QString, QPair<float, float> > critRanges; ///< The range of critical values
double scalingFactor; ///< Factor used to scale all absolute values to screen coordinates double scalingFactor; ///< Factor used to scale all absolute values to screen coordinates
......
...@@ -242,8 +242,7 @@ void HUD::updateValue(UASInterface* uas, QString name, double value, quint64 mse ...@@ -242,8 +242,7 @@ void HUD::updateValue(UASInterface* uas, QString name, double value, quint64 mse
*/ */
void HUD::setActiveUAS(UASInterface* uas) void HUD::setActiveUAS(UASInterface* uas)
{ {
qDebug() << "ATTEMPTING TO SET UAS"; if (this->uas != NULL)
if (this->uas != NULL && this->uas != uas)
{ {
// Disconnect any previously connected active MAV // Disconnect any previously connected active MAV
disconnect(uas, SIGNAL(attitudeChanged(UASInterface*,double,double,double,quint64)), this, SLOT(updateAttitude(UASInterface*, double, double, double, quint64))); disconnect(uas, SIGNAL(attitudeChanged(UASInterface*,double,double,double,quint64)), this, SLOT(updateAttitude(UASInterface*, double, double, double, quint64)));
...@@ -254,25 +253,15 @@ void HUD::setActiveUAS(UASInterface* uas) ...@@ -254,25 +253,15 @@ void HUD::setActiveUAS(UASInterface* uas)
} }
// Now connect the new UAS // Now connect the new UAS
//if (this->uas != uas)
// {
qDebug() << "UAS SET!" << "ID:" << uas->getUASID();
// Setup communication // Setup communication
connect(uas, SIGNAL(attitudeChanged(UASInterface*,double,double,double,quint64)), this, SLOT(updateAttitude(UASInterface*, double, double, double, quint64))); connect(uas, SIGNAL(attitudeChanged(UASInterface*,double,double,double,quint64)), this, SLOT(updateAttitude(UASInterface*, double, double, double, quint64)));
connect(uas, SIGNAL(batteryChanged(UASInterface*, double, double, int)), this, SLOT(updateBattery(UASInterface*, double, double, int))); connect(uas, SIGNAL(batteryChanged(UASInterface*, double, double, int)), this, SLOT(updateBattery(UASInterface*, double, double, int)));
connect(uas, SIGNAL(statusChanged(UASInterface*,QString,QString)), this, SLOT(updateState(UASInterface*,QString))); connect(uas, SIGNAL(statusChanged(UASInterface*,QString,QString)), this, SLOT(updateState(UASInterface*,QString)));
connect(uas, SIGNAL(modeChanged(int,QString,QString)), this, SLOT(updateMode(int,QString,QString))); connect(uas, SIGNAL(modeChanged(int,QString,QString)), this, SLOT(updateMode(int,QString,QString)));
connect(uas, SIGNAL(heartbeat(UASInterface*)), this, SLOT(receiveHeartbeat(UASInterface*))); connect(uas, SIGNAL(heartbeat(UASInterface*)), this, SLOT(receiveHeartbeat(UASInterface*)));
//connect(uas, SIGNAL(thrustChanged(UASInterface*, double)), this, SLOT(updateThrust(UASInterface*, double)));
//connect(uas, SIGNAL(localPositionChanged(UASInterface*,double,double,double,quint64)), this, SLOT(updateLocalPosition(UASInterface*,double,double,double,quint64))); // Set new UAS
//connect(uas, SIGNAL(globalPositionChanged(UASInterface*,double,double,double,quint64)), this, SLOT(updateGlobalPosition(UASInterface*,double,double,double,quint64))); this->uas = uas;
//connect(uas, SIGNAL(speedChanged(UASInterface*,double,double,double,quint64)), this, SLOT(updateSpeed(UASInterface*,double,double,double,quint64)));
//connect(uas, SIGNAL(statusChanged(UASInterface*,QString,QString)), this, SLOT(updateState(UASInterface*,QString,QString)));
//connect(uas, SIGNAL(loadChanged(UASInterface*, double)), this, SLOT(updateLoad(UASInterface*, double)));
//connect(uas, SIGNAL(attitudeThrustSetPointChanged(UASInterface*,double,double,double,double,quint64)), this, SLOT(updateAttitudeThrustSetPoint(UASInterface*,double,double,double,double,quint64)));
//connect(uas, SIGNAL(valueChanged(UASInterface*,QString,double,quint64)), this, SLOT(updateValue(UASInterface*,QString,double,quint64)));
//}
} }
void HUD::updateAttitudeThrustSetPoint(UASInterface*, double rollDesired, double pitchDesired, double yawDesired, double thrustDesired, quint64 msec) void HUD::updateAttitudeThrustSetPoint(UASInterface*, double rollDesired, double pitchDesired, double yawDesired, double thrustDesired, quint64 msec)
...@@ -329,7 +318,7 @@ void HUD::updateLocalPosition(UASInterface* uas,double x,double y,double z,quint ...@@ -329,7 +318,7 @@ void HUD::updateLocalPosition(UASInterface* uas,double x,double y,double z,quint
updateValue(uas, "z", z, timestamp); updateValue(uas, "z", z, timestamp);
} }
void HUD::updateGlobalPosition(UASInterface*,double lat, double lon, double altitude, quint64 timestamp) void HUD::updateGlobalPosition(UASInterface* uas,double lat, double lon, double altitude, quint64 timestamp)
{ {
updateValue(uas, "lat", lat, timestamp); updateValue(uas, "lat", lat, timestamp);
updateValue(uas, "lon", lon, timestamp); updateValue(uas, "lon", lon, timestamp);
...@@ -581,7 +570,7 @@ void HUD::paintHUD() ...@@ -581,7 +570,7 @@ void HUD::paintHUD()
// Translate for yaw // Translate for yaw
const float maxYawTrans = 60.0f; const float maxYawTrans = 60.0f;
static float yawDiff = 0.0f;
float newYawDiff = valuesDot.value("yaw", 0.0f); float newYawDiff = valuesDot.value("yaw", 0.0f);
if (isinf(newYawDiff)) newYawDiff = yawDiff; if (isinf(newYawDiff)) newYawDiff = yawDiff;
if (newYawDiff > M_PI) newYawDiff = newYawDiff - M_PI; if (newYawDiff > M_PI) newYawDiff = newYawDiff - M_PI;
......
...@@ -188,6 +188,7 @@ protected: ...@@ -188,6 +188,7 @@ protected:
float roll; float roll;
float pitch; float pitch;
float yaw; float yaw;
float yawDiff;
void paintEvent(QPaintEvent *event); void paintEvent(QPaintEvent *event);
}; };
......
This diff is collapsed.
...@@ -142,19 +142,19 @@ public slots: ...@@ -142,19 +142,19 @@ public slots:
========================================================== ==========================================================
*/ */
void loadWidgets(); // void loadWidgets();
/** @brief Load data view, allowing to plot flight data */ /** @brief Load data view, allowing to plot flight data */
void loadDataView(QString fileName); void loadDataView(QString fileName);
/** @brief Load 3D map view */ // /** @brief Load 3D map view */
void load3DMapView(); // void load3DMapView();
/** @brief Load 3D Google Earth view */ // /** @brief Load 3D Google Earth view */
void loadGoogleEarthView(); // void loadGoogleEarthView();
/** @brief Load 3D view */ // /** @brief Load 3D view */
void load3DView(); // void load3DView();
/** /**
* @brief Shows a Docked Widget based on the action sender * @brief Shows a Docked Widget based on the action sender
...@@ -393,6 +393,8 @@ private: ...@@ -393,6 +393,8 @@ private:
Ui::MainWindow ui; Ui::MainWindow ui;
QString buildMenuKey (SETTINGS_SECTIONS section , TOOLS_WIDGET_NAMES tool, VIEW_SECTIONS view); QString buildMenuKey (SETTINGS_SECTIONS section , TOOLS_WIDGET_NAMES tool, VIEW_SECTIONS view);
QString getWindowStateKey();
QString getWindowGeometryKey();
}; };
......
...@@ -38,7 +38,7 @@ ...@@ -38,7 +38,7 @@
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>1000</width> <width>1000</width>
<height>25</height> <height>22</height>
</rect> </rect>
</property> </property>
<widget class="QMenu" name="menuMGround"> <widget class="QMenu" name="menuMGround">
...@@ -50,6 +50,7 @@ ...@@ -50,6 +50,7 @@
<addaction name="actionMuteAudioOutput"/> <addaction name="actionMuteAudioOutput"/>
<addaction name="actionSimulate"/> <addaction name="actionSimulate"/>
<addaction name="separator"/> <addaction name="separator"/>
<addaction name="actionReloadStyle"/>
<addaction name="actionExit"/> <addaction name="actionExit"/>
</widget> </widget>
<widget class="QMenu" name="menuNetwork"> <widget class="QMenu" name="menuNetwork">
...@@ -100,7 +101,6 @@ ...@@ -100,7 +101,6 @@
<addaction name="actionPilotsView"/> <addaction name="actionPilotsView"/>
<addaction name="separator"/> <addaction name="separator"/>
<addaction name="actionMavlinkView"/> <addaction name="actionMavlinkView"/>
<addaction name="actionReloadStyle"/>
</widget> </widget>
<addaction name="menuMGround"/> <addaction name="menuMGround"/>
<addaction name="menuNetwork"/> <addaction name="menuNetwork"/>
...@@ -179,33 +179,6 @@ ...@@ -179,33 +179,6 @@
<string>Open UAS Preferences</string> <string>Open UAS Preferences</string>
</property> </property>
</action> </action>
<action name="actionEngineerView">
<property name="icon">
<iconset resource="../../mavground.qrc">
<normaloff>:/images/apps/utilities-system-monitor.svg</normaloff>:/images/apps/utilities-system-monitor.svg</iconset>
</property>
<property name="text">
<string>Show engineer view</string>
</property>
</action>
<action name="actionPilotView">
<property name="icon">
<iconset resource="../../mavground.qrc">
<normaloff>:/images/status/weather-overcast.svg</normaloff>:/images/status/weather-overcast.svg</iconset>
</property>
<property name="text">
<string>Show pilot view</string>
</property>
</action>
<action name="actionStyleConfig">
<property name="icon">
<iconset resource="../../mavground.qrc">
<normaloff>:/images/categories/applications-internet.svg</normaloff>:/images/categories/applications-internet.svg</iconset>
</property>
<property name="text">
<string>Reload visual style</string>
</property>
</action>
<action name="actionJoystickSettings"> <action name="actionJoystickSettings">
<property name="icon"> <property name="icon">
<iconset resource="../../mavground.qrc"> <iconset resource="../../mavground.qrc">
...@@ -218,30 +191,6 @@ ...@@ -218,30 +191,6 @@
<bool>true</bool> <bool>true</bool>
</property> </property>
</action> </action>
<action name="actionOperatorView">
<property name="icon">
<iconset resource="../../mavground.qrc">
<normaloff>:/images/status/network-wireless-encrypted.svg</normaloff>:/images/status/network-wireless-encrypted.svg</iconset>
</property>
<property name="text">
<string>Show operator view</string>
</property>
<property name="toolTip">
<string>Shop the 2D map and system status</string>
</property>
</action>
<action name="action3DView">
<property name="icon">
<iconset resource="../../mavground.qrc">
<normaloff>:/images/categories/preferences-system.svg</normaloff>:/images/categories/preferences-system.svg</iconset>
</property>
<property name="text">
<string>Show 3D Local View</string>
</property>
<property name="toolTip">
<string>Show 3D view</string>
</property>
</action>
<action name="actionSimulate"> <action name="actionSimulate">
<property name="checkable"> <property name="checkable">
<bool>true</bool> <bool>true</bool>
...@@ -257,87 +206,6 @@ ...@@ -257,87 +206,6 @@
<string>Simulate one vehicle to test and evaluate this application</string> <string>Simulate one vehicle to test and evaluate this application</string>
</property> </property>
</action> </action>
<action name="actionShow_full_view">
<property name="icon">
<iconset resource="../../mavground.qrc">
<normaloff>:/images/status/network-transmit-receive.svg</normaloff>:/images/status/network-transmit-receive.svg</iconset>
</property>
<property name="text">
<string>Show full view</string>
</property>
</action>
<action name="actionShow_MAVLink_view">
<property name="icon">
<iconset resource="../../mavground.qrc">
<normaloff>:/images/devices/network-wired.svg</normaloff>:/images/devices/network-wired.svg</iconset>
</property>
<property name="text">
<string>Show MAVLink view</string>
</property>
</action>
<action name="actionOnline_documentation">
<property name="icon">
<iconset resource="../../mavground.qrc">
<normaloff>:/images/categories/applications-internet.svg</normaloff>:/images/categories/applications-internet.svg</iconset>
</property>
<property name="text">
<string>Online documentation</string>
</property>
</action>
<action name="actionShow_data_analysis_view">
<property name="icon">
<iconset resource="../../mavground.qrc">
<normaloff>:/images/apps/utilities-system-monitor.svg</normaloff>:/images/apps/utilities-system-monitor.svg</iconset>
</property>
<property name="text">
<string>Show data analysis view</string>
</property>
</action>
<action name="actionProject_Roadmap">
<property name="icon">
<iconset resource="../../mavground.qrc">
<normaloff>:/images/status/software-update-available.svg</normaloff>:/images/status/software-update-available.svg</iconset>
</property>
<property name="text">
<string>Project Roadmap</string>
</property>
</action>
<action name="actionCredits_Developers">
<property name="icon">
<iconset resource="../../mavground.qrc">
<normaloff>:/images/categories/preferences-system.svg</normaloff>:/images/categories/preferences-system.svg</iconset>
</property>
<property name="text">
<string>Credits / Developers</string>
</property>
</action>
<action name="actionGlobalOperatorView">
<property name="icon">
<iconset resource="../../mavground.qrc">
<normaloff>:/images/categories/applications-internet.svg</normaloff>:/images/categories/applications-internet.svg</iconset>
</property>
<property name="text">
<string>Show 2D Map View</string>
</property>
</action>
<action name="action3DMapView">
<property name="icon">
<iconset resource="../../mavground.qrc">
<normaloff>:/images/categories/applications-internet.svg</normaloff>:/images/categories/applications-internet.svg</iconset>
</property>
<property name="text">
<string>Show 3D Global View</string>
</property>
</action>
<action name="actionGoogleEarthView">
<property name="icon">
<iconset resource="../../mavground.qrc">
<normaloff>:/images/mapproviders/googleearth.svg</normaloff>:/images/mapproviders/googleearth.svg</iconset>
</property>
<property name="text">
<string>Google Earth View</string>
</property>
</action>
<action name="actionShow_Slugs_View"> <action name="actionShow_Slugs_View">
<property name="icon"> <property name="icon">
<iconset resource="../../mavground.qrc"> <iconset resource="../../mavground.qrc">
...@@ -387,6 +255,9 @@ ...@@ -387,6 +255,9 @@
</property> </property>
</action> </action>
<action name="actionOperatorsView"> <action name="actionOperatorsView">
<property name="checkable">
<bool>true</bool>
</property>
<property name="icon"> <property name="icon">
<iconset resource="../../mavground.qrc"> <iconset resource="../../mavground.qrc">
<normaloff>:/images/status/weather-overcast.svg</normaloff>:/images/status/weather-overcast.svg</iconset> <normaloff>:/images/status/weather-overcast.svg</normaloff>:/images/status/weather-overcast.svg</iconset>
...@@ -396,6 +267,9 @@ ...@@ -396,6 +267,9 @@
</property> </property>
</action> </action>
<action name="actionEngineersView"> <action name="actionEngineersView">
<property name="checkable">
<bool>true</bool>
</property>
<property name="icon"> <property name="icon">
<iconset resource="../../mavground.qrc"> <iconset resource="../../mavground.qrc">
<normaloff>:/images/apps/utilities-system-monitor.svg</normaloff>:/images/apps/utilities-system-monitor.svg</iconset> <normaloff>:/images/apps/utilities-system-monitor.svg</normaloff>:/images/apps/utilities-system-monitor.svg</iconset>
...@@ -405,6 +279,9 @@ ...@@ -405,6 +279,9 @@
</property> </property>
</action> </action>
<action name="actionMavlinkView"> <action name="actionMavlinkView">
<property name="checkable">
<bool>true</bool>
</property>
<property name="icon"> <property name="icon">
<iconset resource="../../mavground.qrc"> <iconset resource="../../mavground.qrc">
<normaloff>:/images/devices/network-wired.svg</normaloff>:/images/devices/network-wired.svg</iconset> <normaloff>:/images/devices/network-wired.svg</normaloff>:/images/devices/network-wired.svg</iconset>
...@@ -419,10 +296,13 @@ ...@@ -419,10 +296,13 @@
<normaloff>:/images/categories/applications-internet.svg</normaloff>:/images/categories/applications-internet.svg</iconset> <normaloff>:/images/categories/applications-internet.svg</normaloff>:/images/categories/applications-internet.svg</iconset>
</property> </property>
<property name="text"> <property name="text">
<string>Reload Style</string> <string>Reload Stylesheet</string>
</property> </property>
</action> </action>
<action name="actionPilotsView"> <action name="actionPilotsView">
<property name="checkable">
<bool>true</bool>
</property>
<property name="icon"> <property name="icon">
<iconset resource="../../mavground.qrc"> <iconset resource="../../mavground.qrc">
<normaloff>:/images/status/network-wireless-encrypted.svg</normaloff>:/images/status/network-wireless-encrypted.svg</iconset> <normaloff>:/images/status/network-wireless-encrypted.svg</normaloff>:/images/status/network-wireless-encrypted.svg</iconset>
......
...@@ -197,7 +197,7 @@ void QGCRemoteControlView::redraw() ...@@ -197,7 +197,7 @@ void QGCRemoteControlView::redraw()
// Update raw values // Update raw values
for(int i = 0; i < rawLabels.count(); i++) for(int i = 0; i < rawLabels.count(); i++)
{ {
rawLabels.at(i)->setText(QString("%1 us").arg(raw.at(i), 4)); rawLabels.at(i)->setText(QString("%1 us").arg(raw.at(i), 4, 10, QChar('0')));
} }
// Update percent bars // Update percent bars
......
...@@ -266,14 +266,17 @@ void LinechartWidget::createLayout() ...@@ -266,14 +266,17 @@ void LinechartWidget::createLayout()
void LinechartWidget::appendData(int uasId, QString curve, double value, quint64 usec) void LinechartWidget::appendData(int uasId, QString curve, double value, quint64 usec)
{ {
// Order matters here, first append to plot, then update curve list if (isVisible())
activePlot->appendData(curve, usec, value);
// Store data
QLabel* label = curveLabels->value(curve, NULL);
// Make sure the curve will be created if it does not yet exist
if(!label)
{ {
addCurve(curve); // Order matters here, first append to plot, then update curve list
activePlot->appendData(curve, usec, value);
// Store data
QLabel* label = curveLabels->value(curve, NULL);
// Make sure the curve will be created if it does not yet exist
if(!label)
{
addCurve(curve);
}
} }
// Log data // Log data
...@@ -305,7 +308,15 @@ void LinechartWidget::refresh() ...@@ -305,7 +308,15 @@ void LinechartWidget::refresh()
QMap<QString, QLabel*>::iterator i; QMap<QString, QLabel*>::iterator i;
for (i = curveLabels->begin(); i != curveLabels->end(); ++i) for (i = curveLabels->begin(); i != curveLabels->end(); ++i)
{ {
str.sprintf("%+.2f", activePlot->getCurrentValue(i.key())); double val = activePlot->getCurrentValue(i.key());
if (val > 9999 || val < 0.002)
{
str.sprintf("% 10e", val);
}
else
{
str.sprintf("% 10f", val);
}
// Value // Value
i.value()->setText(str); i.value()->setText(str);
} }
...@@ -313,7 +324,7 @@ void LinechartWidget::refresh() ...@@ -313,7 +324,7 @@ void LinechartWidget::refresh()
QMap<QString, QLabel*>::iterator j; QMap<QString, QLabel*>::iterator j;
for (j = curveMeans->begin(); j != curveMeans->end(); ++j) for (j = curveMeans->begin(); j != curveMeans->end(); ++j)
{ {
str.sprintf("%+.2f", activePlot->getMean(j.key())); str.sprintf("% 8.2e", activePlot->getMean(j.key()));
j.value()->setText(str); j.value()->setText(str);
} }
// QMap<QString, QLabel*>::iterator k; // QMap<QString, QLabel*>::iterator k;
...@@ -327,7 +338,7 @@ void LinechartWidget::refresh() ...@@ -327,7 +338,7 @@ void LinechartWidget::refresh()
for (l = curveVariances->begin(); l != curveVariances->end(); ++l) for (l = curveVariances->begin(); l != curveVariances->end(); ++l)
{ {
// Variance // Variance
str.sprintf("%.2e", activePlot->getVariance(l.key())); str.sprintf("% 8e", activePlot->getVariance(l.key()));
l.value()->setText(str); l.value()->setText(str);
} }
} }
......
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