Commit 72f8399a authored by LM's avatar LM

Fixed status view

parent 0209f4ad
......@@ -338,6 +338,7 @@ QProgressBar {
padding: 2px;
color: #DDDDDF;
background-color: #111118;
height: 10px;
}
QProgressBar:horizontal {
......@@ -398,3 +399,28 @@ QDialog {
QTabBar::tab:selected {
border: 2px solid #379AC3;
}
QLabel {
background-color: transparent;
}
QLabel#toolBarNameLabel {
font: bold 16px;
color: #3C7B9E;
}
QLabel#toolBarModeLabel {
font: 12px;
}
QLabel#toolBarStateLabel {
font: 12px;
color: #3C7B9E;
}
QLabel#toolBarMessageLabel {
font: 12px;
font-style: italic;
color: #3C7B9E;
}
......@@ -49,21 +49,30 @@ QGCToolBar::QGCToolBar(QWidget *parent) :
// 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);
messageLabel = new QLabel("No system messages.", this);
toolBarNameLabel = new QLabel("------", this);
toolBarModeLabel = new QLabel("------", this);
toolBarModeLabel->setStyleSheet("QLabel { margin: 0px 4px; font: 16px; color: #3C7B9E; }");
toolBarStateLabel = new QLabel("------", this);
toolBarStateLabel->setStyleSheet("QLabel { margin: 0px 4px; font: 16px; color: #FEC654; }");
toolBarWpLabel = new QLabel("---", this);
toolBarDistLabel = new QLabel("--- ---- m", this);
toolBarMessageLabel = new QLabel("No system messages.", this);
toolBarBatteryBar = new QProgressBar(this);
toolBarBatteryBar->setStyleSheet("QProgressBar:horizontal { margin: 0px 8px; border: 1px solid #4A4A4F; border-radius: 4px; text-align: center; padding: 2px; color: #111111; background-color: #111118; height: 10px; } QProgressBar:horizontal QLabel { font-size: 9px; color: #111111; } QProgressBar::chunk { background-color: green; }");
toolBarBatteryBar->setMinimum(0);
toolBarBatteryBar->setMaximum(100);
toolBarBatteryBar->setMaximumWidth(200);
//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; }");
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 0px 0px 20px; background-color: none; }");
addWidget(symbolButton);
addWidget(nameLabel);
addWidget(modeLabel);
addWidget(stateLabel);
addWidget(wpLabel);
addWidget(distlabel);
addWidget(messageLabel);
addWidget(toolBarNameLabel);
addWidget(toolBarModeLabel);
addWidget(toolBarStateLabel);
addWidget(toolBarBatteryBar);
addWidget(toolBarWpLabel);
addWidget(toolBarDistLabel);
addWidget(toolBarMessageLabel);
//addWidget(new QSpacerItem(20, 0, QSizePolicy::Expanding));
// DONE INITIALIZING BUTTONS
......@@ -127,6 +136,7 @@ void QGCToolBar::setActiveUAS(UASInterface* active)
disconnect(mav, SIGNAL(nameChanged(QString)), this, SLOT(updateName(QString)));
disconnect(mav, SIGNAL(systemTypeSet(UASInterface*,uint)), this, SLOT(setSystemType(UASInterface*,uint)));
disconnect(mav, SIGNAL(textMessageReceived(int,int,int,QString)), this, SLOT(receiveTextMessage(int,int,int,QString)));
disconnect(mav, SIGNAL(batteryChanged(UASInterface*,double,double,int)), this, SLOT(updateBatteryRemaining(UASInterface*,double,double,int)));
}
// Connect new system
......@@ -136,11 +146,16 @@ void QGCToolBar::setActiveUAS(UASInterface* active)
connect(active, SIGNAL(nameChanged(QString)), this, SLOT(updateName(QString)));
connect(active, SIGNAL(systemTypeSet(UASInterface*,uint)), this, SLOT(setSystemType(UASInterface*,uint)));
connect(active, SIGNAL(textMessageReceived(int,int,int,QString)), this, SLOT(receiveTextMessage(int,int,int,QString)));
connect(active, SIGNAL(batteryChanged(UASInterface*,double,double,int)), this, SLOT(updateBatteryRemaining(UASInterface*,double,double,int)));
// Update all values once
nameLabel->setText(mav->getUASName());
modeLabel->setText(mav->getShortMode());
stateLabel->setText(mav->getShortState());
toolBarNameLabel->setText(mav->getUASName());
toolBarNameLabel->setStyleSheet(QString("QLabel { font: bold 16px; color: %1; }").arg(mav->getColor().name()));
symbolButton->setStyleSheet(QString("QWidget { background-color: %1; 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 4px 0px 20px; background-color: none; }").arg(mav->getColor().name()));
// toolBarModeLabel->setStyleSheet("QLabel { font: 16px; color: #3C7B9E; }");
// toolBarStateLabel->setStyleSheet("QLabel { font: 16px; color: #FEC654; }");
toolBarModeLabel->setText(mav->getShortMode());
toolBarStateLabel->setText(mav->getShortState());
setSystemType(mav, mav->getSystemType());
}
......@@ -149,23 +164,28 @@ void QGCToolBar::createCustomWidgets()
}
void QGCToolBar::updateBatteryRemaining(UASInterface* uas, double voltage, double percent, int seconds)
{
toolBarBatteryBar->setValue(percent);
}
void QGCToolBar::updateState(UASInterface* system, QString name, QString description)
{
Q_UNUSED(system);
Q_UNUSED(description);
stateLabel->setText(tr(" State: %1").arg(name));
toolBarStateLabel->setText(tr("%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));
toolBarModeLabel->setText(tr("%1").arg(name));
}
void QGCToolBar::updateName(const QString& name)
{
nameLabel->setText(name);
toolBarNameLabel->setText(name);
}
/**
......@@ -209,7 +229,7 @@ void QGCToolBar::receiveTextMessage(int uasid, int componentid, int severity, QS
Q_UNUSED(uasid);
Q_UNUSED(componentid);
Q_UNUSED(severity);
messageLabel->setText(text);
toolBarMessageLabel->setText(text);
}
QGCToolBar::~QGCToolBar()
......
......@@ -28,6 +28,7 @@ This file is part of the QGROUNDCONTROL project
#include <QAction>
#include <QToolButton>
#include <QLabel>
#include <QProgressBar>
#include "UASInterface.h"
#include "QGCMAVLinkLogPlayer.h"
......@@ -57,6 +58,8 @@ public slots:
void logging(bool enabled);
/** @brief Set log playing component */
void setLogPlayer(QGCMAVLinkLogPlayer* player);
/** @brief Update battery charge state */
void updateBatteryRemaining(UASInterface* uas, double voltage, double percent, int seconds);
protected:
void createCustomWidgets();
......@@ -65,12 +68,13 @@ protected:
QAction* logReplayAction;
UASInterface* mav;
QToolButton* symbolButton;
QLabel* nameLabel;
QLabel* modeLabel;
QLabel* stateLabel;
QLabel* wpLabel;
QLabel* distlabel;
QLabel* messageLabel;
QLabel* toolBarNameLabel;
QLabel* toolBarModeLabel;
QLabel* toolBarStateLabel;
QLabel* toolBarWpLabel;
QLabel* toolBarDistLabel;
QLabel* toolBarMessageLabel;
QProgressBar* toolBarBatteryBar;
};
#endif // QGCTOOLBAR_H
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