Commit 9faba674 authored by Lorenz Meier's avatar Lorenz Meier

Merge pull request #296 from Susurrus/win_fixes

Compilation fixes for Windows
parents bcb61f43 35bf2700
......@@ -94,43 +94,62 @@ QGCToolBar {
border-top-color: #969696;
border-bottom-color: #484848;
background: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, stop: 0 #4B4B4B, stop: 0.3 #404040, stop: 0.34 #383838, stop:1 #181818);
padding: 0;
margin: 0;
}
QGCToolBar QLabel {
font-size: 12pt;
font-weight: bold;
margin: 3px 2px;
}
QGCToolBar QLabel#symbolLabel {
background-clip: content;
margin: 4px 2px;
padding: 0 2px;
border-radius: 4px;
}
QGCToolBar QLabel#toolBarBatteryBar {
color: #008000;
color: #0F0;
}
QGCToolBar QLabel#toolBarTimeoutLabel {
border-radius: 4px;
padding: 0;
color: #000;
background-color: #FF0037;
}
QGCToolBar QLabel#toolBarModeLabel {
color: #ACEBFE;
}
QGCToolBar QLabel#toolBarStateLabel {
color: #FEC654;
}
QGCToolBar QLabel#toolBarBatteryVoltageLabel {
color: #0F0;
}
QGCToolBar QLabel#toolBarWpLabel {
color: #ACEBFE;
}
QGCToolBar QLabel#toolBarMessageLabel {
color: #ACEBFE;
}
QGCToolBar QProgressBar {
height: 26px;
max-height: 16px;
margin: 4px 2px;
}
QGCToolBar QToolButton {
margin: 0;
padding-left: 0;
padding-right: 0;
padding: 0;
border: none;
border-top: 1px solid #333;
border-bottom: 1px solid #333;
border-radius: 0;
height: 24px;
margin-bottom: 4px;
text-align: left;
font-weight: bold;
background-color: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, stop: 0 #AAA, stop: 1 #BBB);
color: #000;
}
......@@ -147,7 +166,7 @@ QGCToolBar QToolButton:hover {
QGCToolBar QToolButton#advancedButton {
margin-left: 0;
margin-right: 13px;
padding-left: 4px;
padding: 0 12px 0 4px;
padding-right: 8px;
border-radius: 0;
border-bottom-right-radius: 6px;
......
......@@ -94,16 +94,16 @@ QGCToolBar {
border-top-color: #969696;
border-bottom-color: #484848;
background: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, stop: 0 #DDD, stop: 1 #999);
padding: 0;
margin: 0;
}
QGCToolBar QLabel {
font-size: 12pt;
font-weight: bold;
margin: 3px 2px;
}
QGCToolBar QLabel#symbolLabel {
background-clip: content;
margin: 4px 2px;
padding: 0 2px;
border-radius: 4px;
}
QGCToolBar QLabel#toolBarBatteryBar {
......@@ -111,26 +111,45 @@ QGCToolBar QLabel#toolBarBatteryBar {
}
QGCToolBar QLabel#toolBarTimeoutLabel {
border-radius: 4px;
padding: 0;
color: #000;
background-color: #FF0037;
}
QGCToolBar QLabel#toolBarModeLabel {
color: #475E66;
}
QGCToolBar QLabel#toolBarStateLabel {
color: #80632A;
}
QGCToolBar QLabel#toolBarBatteryVoltageLabel {
color: #008000;
}
QGCToolBar QLabel#toolBarWpLabel {
color: #475E66;
}
QGCToolBar QLabel#toolBarMessageLabel {
color: #475E66;
}
QGCToolBar QProgressBar {
height: 26px;
max-height: 16px;
margin: 4px 2px;
}
QGCToolBar QToolButton {
margin: 0;
padding-left: 0;
padding-right: 0;
padding: 0;
border: none;
border-top: 1px solid #DDD;
border-bottom: 1px solid #DDD;
border-radius: 0;
height: 24px;
margin-bottom: 4px;
text-align: left;
font-weight: bold;
background-color: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, stop: 0 #333, stop: 1 #444);
color: #FFF;
}
......@@ -147,7 +166,7 @@ QGCToolBar QToolButton:hover {
QGCToolBar QToolButton#advancedButton {
margin-left: 0;
margin-right: 13px;
padding-left: 4px;
padding: 0 12px 0 4px;
padding-right: 8px;
border-radius: 0;
border-bottom-right-radius: 6px;
......
......@@ -231,7 +231,7 @@ void MainWindow::init()
joystick = new JoystickInput();
#ifdef MOUSE_ENABLED_WIN
emit initStatusChanged(tr("Initializing 3D mouse interface", Qt::AlignLeft | Qt::AlignBottom, QColor(62, 93, 141));
emit initStatusChanged(tr("Initializing 3D mouse interface"), Qt::AlignLeft | Qt::AlignBottom, QColor(62, 93, 141));
mouseInput = new Mouse3DInput(this);
mouse = new Mouse6dofInput(mouseInput);
......
......@@ -112,7 +112,7 @@
*/
double PrimaryFlightDisplay_round(double value, int digits=0)
{
return floor(value * pow(10, digits) + 0.5) / pow(10, digits);
return floor(value * pow(10.0, digits) + 0.5) / pow(10.0, digits);
}
const int PrimaryFlightDisplay::tickValues[] = {10, 20, 30, 45, 60};
......
......@@ -41,6 +41,7 @@ QGCToolBar::QGCToolBar(QWidget *parent) :
firstAction(NULL)
{
setObjectName("QGCToolBar");
setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding);
// Do not load UI, wait for actions
}
......@@ -70,14 +71,14 @@ void QGCToolBar::heartbeatTimeout(bool timeout, unsigned int ms)
toolBarTimeoutLabel->setStyleSheet(QString("QLabel {color: #FFF; background-color: #6B0017;}"));
}
toolBarTimeoutLabel->setText(tr("CONNECTION LOST: %1 s").arg((ms / 1000.0f), 2, 'f', 1, ' '));
toolBarTimeoutAction->setVisible(true);
}
else
{
// Check if loss text is present, reset once
if (toolBarTimeoutLabel->text() != "")
if (toolBarTimeoutAction->isVisible())
{
toolBarTimeoutLabel->setText("");
toolBarTimeoutLabel->setStyleSheet(QString(""));
toolBarTimeoutAction->setVisible(false);
}
}
}
......@@ -93,13 +94,15 @@ void QGCToolBar::createUI()
toolBarNameLabel = new QLabel(this);
toolBarNameLabel->setToolTip(tr("Currently controlled vehicle"));
toolBarNameLabel->setAlignment(Qt::AlignCenter);
toolBarNameLabel->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Minimum);
addWidget(toolBarNameLabel);
toolBarTimeoutLabel = new QLabel(this);
toolBarTimeoutLabel->setToolTip(tr("System timed out, interval since last message"));
toolBarTimeoutLabel->setAlignment(Qt::AlignCenter);
toolBarTimeoutLabel->setObjectName("toolBarTimeoutLabel");
addWidget(toolBarTimeoutLabel);
toolBarTimeoutLabel->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Minimum);
toolBarTimeoutAction = addWidget(toolBarTimeoutLabel);
toolBarSafetyLabel = new QLabel(this);
toolBarSafetyLabel->setToolTip(tr("Vehicle safety state"));
......@@ -108,11 +111,13 @@ void QGCToolBar::createUI()
toolBarModeLabel = new QLabel(this);
toolBarModeLabel->setToolTip(tr("Vehicle mode"));
toolBarModeLabel->setObjectName("toolBarModeLabel");
toolBarModeLabel->setAlignment(Qt::AlignCenter);
addWidget(toolBarModeLabel);
toolBarStateLabel = new QLabel(this);
toolBarStateLabel->setToolTip(tr("Vehicle state"));
toolBarStateLabel->setObjectName("toolBarStateLabel");
toolBarStateLabel->setAlignment(Qt::AlignCenter);
addWidget(toolBarStateLabel);
......@@ -123,16 +128,18 @@ void QGCToolBar::createUI()
toolBarBatteryBar->setMaximumWidth(100);
toolBarBatteryBar->setToolTip(tr("Battery charge level"));
toolBarBatteryBar->setObjectName("toolBarBatteryBar");
toolBarBatteryBar->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::MinimumExpanding);
addWidget(toolBarBatteryBar);
toolBarBatteryVoltageLabel = new QLabel(this);
toolBarBatteryVoltageLabel->setObjectName("toolBarBatteryVoltageLabel");
toolBarBatteryVoltageLabel->setToolTip(tr("Battery voltage"));
toolBarBatteryVoltageLabel->setObjectName("toolBarBatteryVoltageLabel");
toolBarBatteryVoltageLabel->setAlignment(Qt::AlignCenter);
addWidget(toolBarBatteryVoltageLabel);
toolBarWpLabel = new QLabel(this);
toolBarWpLabel->setToolTip(tr("Current waypoint"));
toolBarWpLabel->setObjectName("toolBarWpLabel");
toolBarWpLabel->setAlignment(Qt::AlignCenter);
addWidget(toolBarWpLabel);
......@@ -143,6 +150,7 @@ void QGCToolBar::createUI()
toolBarMessageLabel = new QLabel(this);
toolBarMessageLabel->setToolTip(tr("Most recent system message"));
toolBarMessageLabel->setObjectName("toolBarMessageLabel");
addWidget(toolBarMessageLabel);
QWidget* spacer = new QWidget();
......@@ -192,6 +200,7 @@ void QGCToolBar::resetToolbarUI()
toolBarNameLabel->setText("------");
toolBarNameLabel->setStyleSheet("");
toolBarTimeoutLabel->setText(tr("UNCONNECTED"));
//toolBarTimeoutLabel->show();
toolBarSafetyLabel->setText("----");
toolBarModeLabel->setText("------");
toolBarStateLabel->setText("------");
......@@ -201,6 +210,8 @@ void QGCToolBar::resetToolbarUI()
toolBarWpLabel->setText("WP--");
toolBarDistLabel->setText("--- ---- m");
toolBarMessageLabel->clear();
lastSystemMessage = "";
lastSystemMessageTimeMs = 0;
symbolLabel->setStyleSheet("");
symbolLabel->clear();
}
......@@ -341,8 +352,10 @@ void QGCToolBar::setActiveUAS(UASInterface* active)
symbolLabel->setStyleSheet(QString("QWidget {background-color: %1;}").arg(mav->getColor().name()));
toolBarModeLabel->setText(mav->getShortMode());
toolBarStateLabel->setText(mav->getShortState());
toolBarTimeoutLabel->setText("");
toolBarDistLabel->setText("");
toolBarTimeoutAction->setVisible(false);
toolBarMessageLabel->clear();
lastSystemMessageTimeMs = 0;
toolBarDistLabel->clear();
toolBarBatteryBar->setEnabled(true);
setSystemType(mav, mav->getSystemType());
}
......@@ -370,20 +383,34 @@ void QGCToolBar::updateView()
toolBarWpLabel->setText(tr("WP%1").arg(wpId));
toolBarBatteryBar->setValue(batteryPercent);
if (batteryPercent < 30 && toolBarBatteryBar->value() >= 30) {
toolBarBatteryBar->setStyleSheet("QProgressBar::chunk { background-color: green}");
if (MainWindow::instance()->getStyle() == MainWindow::QGC_MAINWINDOW_STYLE_LIGHT)
{
toolBarBatteryBar->setStyleSheet("QProgressBar {color: #FFF} QProgressBar::chunk { background-color: #008000}");
}
else
{
toolBarBatteryBar->setStyleSheet("QProgressBar {color: #000} QProgressBar QProgressBar::chunk { background-color: #0F0}");
}
} else if (batteryPercent >= 30 && toolBarBatteryBar->value() < 30){
toolBarBatteryBar->setStyleSheet("QProgressBar::chunk { background-color: yellow}");
if (MainWindow::instance()->getStyle() == MainWindow::QGC_MAINWINDOW_STYLE_LIGHT)
{
toolBarBatteryBar->setStyleSheet("QProgressBar {color: #FFF} QProgressBar::chunk { background-color: #808000}");
}
else
{
toolBarBatteryBar->setStyleSheet("QProgressBar {color: #000} QProgressBar QProgressBar::chunk { background-color: #FF0}");
}
}
toolBarBatteryVoltageLabel->setText(tr("%1 V").arg(batteryVoltage, 4, 'f', 1, ' '));
toolBarStateLabel->setText(tr("%1").arg(state));
toolBarModeLabel->setText(tr("%1").arg(mode));
toolBarStateLabel->setText(QString("%1").arg(state));
toolBarModeLabel->setText(QString("%1").arg(mode));
toolBarNameLabel->setText(systemName);
// expire after 15 seconds
if (QGC::groundTimeMilliseconds() - lastSystemMessageTimeMs < 15000) {
toolBarMessageLabel->setText(tr("%1").arg(lastSystemMessage));
toolBarMessageLabel->setText(QString("%1").arg(lastSystemMessage));
} else {
toolBarMessageLabel->setText(tr("%1").arg(""));
toolBarMessageLabel->clear();
}
// Display the system armed state with a red-on-yellow background if armed or green text if safe.
......
......@@ -93,6 +93,7 @@ protected:
QLabel* symbolLabel;
QLabel* toolBarNameLabel;
QLabel* toolBarTimeoutLabel;
QAction* toolBarTimeoutAction; ///< Needed to set label (in)visible.
QLabel* toolBarSafetyLabel;
QLabel* toolBarModeLabel;
QLabel* toolBarStateLabel;
......
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