|
|
@ -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) |
|
|
|
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) |
|
|
|
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() |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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 |
|
|
|
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() |
|
|
|