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