Commit 72f8399a authored by LM's avatar LM

Fixed status view

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