Commit fb197a75 authored by Don Gagne's avatar Don Gagne

Move ui style from MainWindow to QGCApplication

parent 4127e96e
...@@ -69,11 +69,15 @@ const char* QGCApplication::_deleteAllSettingsKey = "DeleteAllSettingsNextBoot"; ...@@ -69,11 +69,15 @@ const char* QGCApplication::_deleteAllSettingsKey = "DeleteAllSettingsNextBoot";
const char* QGCApplication::_settingsVersionKey = "SettingsVersion"; const char* QGCApplication::_settingsVersionKey = "SettingsVersion";
const char* QGCApplication::_savedFilesLocationKey = "SavedFilesLocation"; const char* QGCApplication::_savedFilesLocationKey = "SavedFilesLocation";
const char* QGCApplication::_promptFlightDataSave = "PromptFLightDataSave"; const char* QGCApplication::_promptFlightDataSave = "PromptFLightDataSave";
const char* QGCApplication::_styleKey = "StyleIsDark";
const char* QGCApplication::_defaultSavedFileDirectoryName = "QGroundControl"; const char* QGCApplication::_defaultSavedFileDirectoryName = "QGroundControl";
const char* QGCApplication::_savedFileMavlinkLogDirectoryName = "FlightData"; const char* QGCApplication::_savedFileMavlinkLogDirectoryName = "FlightData";
const char* QGCApplication::_savedFileParameterDirectoryName = "SavedParameters"; const char* QGCApplication::_savedFileParameterDirectoryName = "SavedParameters";
const char* QGCApplication::_darkStyleFile = ":files/styles/style-dark.css";
const char* QGCApplication::_lightStyleFile = ":files/styles/style-light.css";
/** /**
* @brief Constructor for the main application. * @brief Constructor for the main application.
* *
...@@ -87,7 +91,8 @@ const char* QGCApplication::_savedFileParameterDirectoryName = "SavedParameters" ...@@ -87,7 +91,8 @@ const char* QGCApplication::_savedFileParameterDirectoryName = "SavedParameters"
QGCApplication::QGCApplication(int &argc, char* argv[], bool unitTesting) : QGCApplication::QGCApplication(int &argc, char* argv[], bool unitTesting) :
QApplication(argc, argv), QApplication(argc, argv),
_runningUnitTests(unitTesting) _runningUnitTests(unitTesting),
_styleIsDark(true)
{ {
Q_ASSERT(_app == NULL); Q_ASSERT(_app == NULL);
_app = this; _app = this;
...@@ -201,6 +206,9 @@ void QGCApplication::_initCommon(void) ...@@ -201,6 +206,9 @@ void QGCApplication::_initCommon(void)
"Your saved settings have been reset to defaults.")); "Your saved settings have been reset to defaults."));
} }
_styleIsDark = settings.value(_styleKey, _styleIsDark).toBool();
_loadCurrentStyle();
// Load saved files location and validate // Load saved files location and validate
QString savedFilesLocation; QString savedFilesLocation;
...@@ -514,3 +522,56 @@ void QGCApplication::saveTempFlightDataLogOnMainThread(QString tempLogfile) ...@@ -514,3 +522,56 @@ void QGCApplication::saveTempFlightDataLogOnMainThread(QString tempLogfile)
} }
QFile::remove(tempLogfile); QFile::remove(tempLogfile);
} }
void QGCApplication::setStyle(bool styleIsDark)
{
QSettings settings;
settings.setValue(_styleKey, styleIsDark);
_styleIsDark = styleIsDark;
_loadCurrentStyle();
emit styleChanged(_styleIsDark);
}
void QGCApplication::_loadCurrentStyle(void)
{
bool success = true;
QString styles;
// Signal to the user that the app will pause to apply a new stylesheet
setOverrideCursor(Qt::WaitCursor);
// The dark style sheet is the master. Any other selected style sheet just overrides
// the colors of the master sheet.
QFile masterStyleSheet(_darkStyleFile);
if (masterStyleSheet.open(QIODevice::ReadOnly | QIODevice::Text)) {
styles = masterStyleSheet.readAll();
} else {
qDebug() << "Unable to load master dark style sheet";
success = false;
}
if (success && !_styleIsDark) {
qDebug() << "LOADING LIGHT";
// Load the slave light stylesheet.
QFile styleSheet(_lightStyleFile);
if (styleSheet.open(QIODevice::ReadOnly | QIODevice::Text)) {
styles += styleSheet.readAll();
} else {
qDebug() << "Unable to load slave light sheet:";
success = false;
}
}
if (!styles.isEmpty()) {
setStyleSheet(styles);
}
if (!success) {
// Fall back to plastique if we can't load our own
setStyle("plastique");
}
// Finally restore the cursor before returning.
restoreOverrideCursor();
}
...@@ -87,6 +87,12 @@ public: ...@@ -87,6 +87,12 @@ public:
/// @brief Returns truee if unit test are being run /// @brief Returns truee if unit test are being run
bool runningUnitTests(void) { return _runningUnitTests; } bool runningUnitTests(void) { return _runningUnitTests; }
/// @return true: dark ui style, false: light ui style
bool styleIsDark(void) { return _styleIsDark; }
/// Set the current UI style
void setStyle(bool styleIsDark);
public slots: public slots:
/// You can connect to this slot to show an information message box from a different thread. /// You can connect to this slot to show an information message box from a different thread.
void informationMessageBoxOnMainThread(const QString& title, const QString& msg); void informationMessageBoxOnMainThread(const QString& title, const QString& msg);
...@@ -101,6 +107,10 @@ public slots: ...@@ -101,6 +107,10 @@ public slots:
void saveTempFlightDataLogOnMainThread(QString tempLogfile); void saveTempFlightDataLogOnMainThread(QString tempLogfile);
signals: signals:
/// Signals that the style has changed
/// @param darkStyle true: dark style, false: light style
void styleChanged(bool darkStyle);
/// This is connected to MAVLinkProtocol::checkForLostLogFiles. We signal this to ourselves to call the slot /// This is connected to MAVLinkProtocol::checkForLostLogFiles. We signal this to ourselves to call the slot
/// on the MAVLinkProtocol thread; /// on the MAVLinkProtocol thread;
void checkForLostLogFiles(void); void checkForLostLogFiles(void);
...@@ -125,11 +135,13 @@ public: ...@@ -125,11 +135,13 @@ public:
private: private:
void _createSingletons(void); void _createSingletons(void);
void _destroySingletons(void); void _destroySingletons(void);
void _loadCurrentStyle(void);
static const char* _settingsVersionKey; ///< Settings key which hold settings version static const char* _settingsVersionKey; ///< Settings key which hold settings version
static const char* _deleteAllSettingsKey; ///< If this settings key is set on boot, all settings will be deleted static const char* _deleteAllSettingsKey; ///< If this settings key is set on boot, all settings will be deleted
static const char* _savedFilesLocationKey; ///< Settings key for user visible saved files location static const char* _savedFilesLocationKey; ///< Settings key for user visible saved files location
static const char* _promptFlightDataSave; ///< Settings key to prompt for saving Flight Data Log for all flights static const char* _promptFlightDataSave; ///< Settings key to prompt for saving Flight Data Log for all flights
static const char* _styleKey; ///< Settings key for UI style
static const char* _defaultSavedFileDirectoryName; ///< Default name for user visible save file directory static const char* _defaultSavedFileDirectoryName; ///< Default name for user visible save file directory
static const char* _savedFileMavlinkLogDirectoryName; ///< Name of mavlink log subdirectory static const char* _savedFileMavlinkLogDirectoryName; ///< Name of mavlink log subdirectory
...@@ -137,6 +149,10 @@ private: ...@@ -137,6 +149,10 @@ private:
bool _runningUnitTests; ///< true: running unit tests, false: normal app bool _runningUnitTests; ///< true: running unit tests, false: normal app
static const char* _darkStyleFile;
static const char* _lightStyleFile;
bool _styleIsDark; ///< true: dark style, false: light style
/// Unit Test have access to creating and destroying singletons /// Unit Test have access to creating and destroying singletons
friend class UnitTest; friend class UnitTest;
}; };
......
...@@ -24,7 +24,7 @@ ...@@ -24,7 +24,7 @@
#include "ui_HDDisplay.h" #include "ui_HDDisplay.h"
#include "MG.h" #include "MG.h"
#include "QGC.h" #include "QGC.h"
#include "MainWindow.h" #include "QGCApplication.h"
#include <QDebug> #include <QDebug>
HDDisplay::HDDisplay(const QStringList &plotList, QString title, QWidget *parent) : HDDisplay::HDDisplay(const QStringList &plotList, QString title, QWidget *parent) :
...@@ -440,14 +440,7 @@ void HDDisplay::renderOverlay() ...@@ -440,14 +440,7 @@ void HDDisplay::renderOverlay()
const float spacing = 0.4f; // 40% of width const float spacing = 0.4f; // 40% of width
const float gaugeWidth = vwidth / (((float)columns) + (((float)columns+1) * spacing + spacing * 0.5f)); const float gaugeWidth = vwidth / (((float)columns) + (((float)columns+1) * spacing + spacing * 0.5f));
QColor gaugeColor; QColor gaugeColor;
if (MainWindow::instance()->getStyle() == MainWindow::QGC_MAINWINDOW_STYLE_LIGHT) gaugeColor = qgcApp()->styleIsDark() ? gaugeColor = QColor(255, 255, 255) : gaugeColor = QColor(0, 0, 0);
{
gaugeColor = QColor(0, 0, 0);
}
else
{
gaugeColor = QColor(255, 255, 255);
}
//drawSystemIndicator(10.0f-gaugeWidth/2.0f, 20.0f, 10.0f, 40.0f, 15.0f, &painter); //drawSystemIndicator(10.0f-gaugeWidth/2.0f, 20.0f, 10.0f, 40.0f, 15.0f, &painter);
//drawGauge(15.0f, 15.0f, gaugeWidth/2.0f, 0, 1.0f, "thrust", values.value("thrust", 0.0f), gaugeColor, &painter, qMakePair(0.45f, 0.8f), qMakePair(0.8f, 1.0f), true); //drawGauge(15.0f, 15.0f, gaugeWidth/2.0f, 0, 1.0f, "thrust", values.value("thrust", 0.0f), gaugeColor, &painter, qMakePair(0.45f, 0.8f), qMakePair(0.8f, 1.0f), true);
//drawGauge(15.0f+gaugeWidth*1.7f, 15.0f, gaugeWidth/2.0f, 0, 10.0f, "altitude", values.value("altitude", 0.0f), gaugeColor, &painter, qMakePair(1.0f, 2.5f), qMakePair(0.0f, 0.5f), true); //drawGauge(15.0f+gaugeWidth*1.7f, 15.0f, gaugeWidth/2.0f, 0, 10.0f, "altitude", values.value("altitude", 0.0f), gaugeColor, &painter, qMakePair(1.0f, 2.5f), qMakePair(0.0f, 0.5f), true);
...@@ -582,15 +575,15 @@ void HDDisplay::drawGauge(float xRef, float yRef, float radius, float min, float ...@@ -582,15 +575,15 @@ void HDDisplay::drawGauge(float xRef, float yRef, float radius, float min, float
// Select color scheme based on light or dark theme. // Select color scheme based on light or dark theme.
QColor valueColor; QColor valueColor;
QColor backgroundColor; QColor backgroundColor;
if (MainWindow::instance()->getStyle() == MainWindow::QGC_MAINWINDOW_STYLE_LIGHT) if (qgcApp()->styleIsDark())
{ {
valueColor = QColor(26, 75, 95); valueColor = QGC::colorCyan;
backgroundColor = QColor(246, 246, 246); backgroundColor = QColor(34, 34, 34);
} }
else else
{ {
valueColor = QGC::colorCyan; valueColor = QColor(26, 75, 95);
backgroundColor = QColor(34, 34, 34); backgroundColor = QColor(246, 246, 246);
} }
// Draw the circle // Draw the circle
......
...@@ -35,18 +35,16 @@ This file is part of the QGROUNDCONTROL project ...@@ -35,18 +35,16 @@ This file is part of the QGROUNDCONTROL project
#include <QGraphicsScene> #include <QGraphicsScene>
#include <QHBoxLayout> #include <QHBoxLayout>
#include <QDoubleSpinBox> #include <QDoubleSpinBox>
#include <QDebug>
#include "UASManager.h" #include "UASManager.h"
#include "HSIDisplay.h" #include "HSIDisplay.h"
#include "QGC.h" #include "QGC.h"
#include "Waypoint.h" #include "Waypoint.h"
#include "UASWaypointManager.h" #include "UASWaypointManager.h"
#include <qmath.h> #include <qmath.h>
//#include "Waypoint2DIcon.h"
#include "MAV2DIcon.h" #include "MAV2DIcon.h"
#include "MainWindow.h" #include "QGCApplication.h"
#include <QDebug>
HSIDisplay::HSIDisplay(QWidget *parent) : HSIDisplay::HSIDisplay(QWidget *parent) :
HDDisplay(QStringList(), "HSI", parent), HDDisplay(QStringList(), "HSI", parent),
...@@ -279,26 +277,26 @@ void HSIDisplay::renderOverlay() ...@@ -279,26 +277,26 @@ void HSIDisplay::renderOverlay()
QColor statusColor; QColor statusColor;
QColor waypointLineColor; QColor waypointLineColor;
QColor attitudeColor; QColor attitudeColor;
if (MainWindow::instance()->getStyle() == MainWindow::QGC_MAINWINDOW_STYLE_LIGHT) if (qgcApp()->styleIsDark())
{ {
ringColor = QGC::colorBlack; ringColor = QColor(255, 255, 255);
positionColor = QColor(20, 20, 200); positionColor = QColor(20, 20, 200);
setpointColor = QColor(150, 250, 150); setpointColor = QColor(150, 250, 150);
labelColor = QColor(26, 75, 95); labelColor = QGC::colorCyan;
valueColor = QColor(40, 40, 40); valueColor = QColor(255, 255, 255);
statusColor = QGC::colorOrange; statusColor = QGC::colorOrange;
waypointLineColor = QGC::colorDarkYellow; waypointLineColor = QGC::colorYellow;
attitudeColor = QColor(200, 20, 20); attitudeColor = QColor(200, 20, 20);
} }
else else
{ {
ringColor = QColor(255, 255, 255); ringColor = QGC::colorBlack;
positionColor = QColor(20, 20, 200); positionColor = QColor(20, 20, 200);
setpointColor = QColor(150, 250, 150); setpointColor = QColor(150, 250, 150);
labelColor = QGC::colorCyan; labelColor = QColor(26, 75, 95);
valueColor = QColor(255, 255, 255); valueColor = QColor(40, 40, 40);
statusColor = QGC::colorOrange; statusColor = QGC::colorOrange;
waypointLineColor = QGC::colorYellow; waypointLineColor = QGC::colorDarkYellow;
attitudeColor = QColor(200, 20, 20); attitudeColor = QColor(200, 20, 20);
} }
...@@ -475,15 +473,15 @@ void HSIDisplay::drawStatusFlag(float x, float y, QString label, bool status, bo ...@@ -475,15 +473,15 @@ void HSIDisplay::drawStatusFlag(float x, float y, QString label, bool status, bo
{ {
QColor statusColor; QColor statusColor;
QColor labelColor; QColor labelColor;
if (MainWindow::instance()->getStyle() == MainWindow::QGC_MAINWINDOW_STYLE_LIGHT) if (qgcApp()->styleIsDark())
{ {
statusColor = QColor(40, 40, 40); statusColor = QColor(250, 250, 250);
labelColor = QColor(26, 75, 95); labelColor = QGC::colorCyan;
} }
else else
{ {
statusColor = QColor(250, 250, 250); statusColor = QColor(40, 40, 40);
labelColor = QGC::colorCyan; labelColor = QColor(26, 75, 95);
} }
// Draw the label. // Draw the label.
...@@ -537,15 +535,15 @@ void HSIDisplay::drawPositionLock(float x, float y, QString label, int status, b ...@@ -537,15 +535,15 @@ void HSIDisplay::drawPositionLock(float x, float y, QString label, int status, b
QColor intermediateStatusColor (Qt::yellow); QColor intermediateStatusColor (Qt::yellow);
QColor posStatusColor(20, 200, 20); QColor posStatusColor(20, 200, 20);
QColor statusColor; QColor statusColor;
if (MainWindow::instance()->getStyle() == MainWindow::QGC_MAINWINDOW_STYLE_LIGHT) if (qgcApp()->styleIsDark())
{ {
statusColor = QColor(40, 40, 40); statusColor = QColor(250, 250, 250);
labelColor = QColor(26, 75, 95); labelColor = QGC::colorCyan;
} }
else else
{ {
statusColor = QColor(250, 250, 250); statusColor = QColor(40, 40, 40);
labelColor = QGC::colorCyan; labelColor = QColor(26, 75, 95);
} }
// Draw the label. // Draw the label.
......
...@@ -44,7 +44,7 @@ This file is part of the QGROUNDCONTROL project ...@@ -44,7 +44,7 @@ This file is part of the QGROUNDCONTROL project
#include "UAS.h" #include "UAS.h"
#include "HUD.h" #include "HUD.h"
#include "QGC.h" #include "QGC.h"
#include "MainWindow.h" #include "QGCApplication.h"
#include "QGCFileDialog.h" #include "QGCFileDialog.h"
/** /**
...@@ -131,7 +131,7 @@ HUD::HUD(int width, int height, QWidget* parent) ...@@ -131,7 +131,7 @@ HUD::HUD(int width, int height, QWidget* parent)
// Set up the initial color theme. This can be updated by a styleChanged // Set up the initial color theme. This can be updated by a styleChanged
// signal from MainWindow. // signal from MainWindow.
styleChanged(((MainWindow*)parent)->getStyle()); styleChanged(qgcApp()->styleIsDark());
// Refresh timer // Refresh timer
refreshTimer->setInterval(updateInterval); refreshTimer->setInterval(updateInterval);
...@@ -156,8 +156,7 @@ HUD::HUD(int width, int height, QWidget* parent) ...@@ -156,8 +156,7 @@ HUD::HUD(int width, int height, QWidget* parent)
// Connect the themeChanged signal from the MainWindow to this widget, so it // Connect the themeChanged signal from the MainWindow to this widget, so it
// can change it's styling accordingly. // can change it's styling accordingly.
connect((MainWindow*)parent, SIGNAL(styleChanged(MainWindow::QGC_MAINWINDOW_STYLE)), connect(qgcApp(), &QGCApplication::styleChanged, this, &HUD::styleChanged);
this, SLOT(styleChanged(MainWindow::QGC_MAINWINDOW_STYLE)));
// Connect with UAS // Connect with UAS
connect(UASManager::instance(), SIGNAL(activeUASSet(UASInterface*)), this, SLOT(setActiveUAS(UASInterface*))); connect(UASManager::instance(), SIGNAL(activeUASSet(UASInterface*)), this, SLOT(setActiveUAS(UASInterface*)));
...@@ -177,31 +176,15 @@ QSize HUD::sizeHint() const ...@@ -177,31 +176,15 @@ QSize HUD::sizeHint() const
return QSize(width(), (width()*3.0f)/4); return QSize(width(), (width()*3.0f)/4);
} }
void HUD::styleChanged(MainWindow::QGC_MAINWINDOW_STYLE newTheme) void HUD::styleChanged(bool styleIsDark)
{ {
// Generate a background image that's dependent on the current color scheme. // Generate a background image that's dependent on the current color scheme.
QImage fill = QImage(width(), height(), QImage::Format_Indexed8); QImage fill = QImage(width(), height(), QImage::Format_Indexed8);
if (newTheme == MainWindow::QGC_MAINWINDOW_STYLE_LIGHT) fill.fill(styleIsDark ? 0 : 255);
{
fill.fill(255);
}
else
{
fill.fill(0);
}
glImage = QGLWidget::convertToGLFormat(fill); glImage = QGLWidget::convertToGLFormat(fill);
// Now set the other default colors based on the current color scheme. // Now set the other default colors based on the current color scheme.
if (newTheme == MainWindow::QGC_MAINWINDOW_STYLE_LIGHT) if (styleIsDark)
{
defaultColor = QColor(0x01, 0x47, 0x01);
setPointColor = QColor(0x82, 0x17, 0x82);
warningColor = Qt::darkYellow;
criticalColor = Qt::darkRed;
infoColor = QColor(0x07, 0x82, 0x07);
fuelColor = criticalColor;
}
else
{ {
defaultColor = QColor(70, 200, 70); defaultColor = QColor(70, 200, 70);
setPointColor = QColor(200, 20, 200); setPointColor = QColor(200, 20, 200);
...@@ -210,6 +193,15 @@ void HUD::styleChanged(MainWindow::QGC_MAINWINDOW_STYLE newTheme) ...@@ -210,6 +193,15 @@ void HUD::styleChanged(MainWindow::QGC_MAINWINDOW_STYLE newTheme)
infoColor = QColor(20, 200, 20); infoColor = QColor(20, 200, 20);
fuelColor = criticalColor; fuelColor = criticalColor;
} }
else
{
defaultColor = QColor(0x01, 0x47, 0x01);
setPointColor = QColor(0x82, 0x17, 0x82);
warningColor = Qt::darkYellow;
criticalColor = Qt::darkRed;
infoColor = QColor(0x07, 0x82, 0x07);
fuelColor = criticalColor;
}
} }
void HUD::showEvent(QShowEvent* event) void HUD::showEvent(QShowEvent* event)
...@@ -1226,14 +1218,7 @@ void HUD::setImageSize(int width, int height, int depth, int channels) ...@@ -1226,14 +1218,7 @@ void HUD::setImageSize(int width, int height, int depth, int channels)
} }
// Fill first channel of image with black pixels // Fill first channel of image with black pixels
if (MainWindow::instance()->getStyle() == MainWindow::QGC_MAINWINDOW_STYLE_LIGHT) image->fill(qgcApp()->styleIsDark() ? 0 : 255);
{
image->fill(255);
}
else
{
image->fill(0);
}
glImage = *image; glImage = *image;
qDebug() << __FILE__ << __LINE__ << "Setting up image"; qDebug() << __FILE__ << __LINE__ << "Setting up image";
......
...@@ -60,7 +60,7 @@ public: ...@@ -60,7 +60,7 @@ public:
void resize(int w, int h); void resize(int w, int h);
public slots: public slots:
void styleChanged(MainWindow::QGC_MAINWINDOW_STYLE newTheme); void styleChanged(bool styleIsDark);
/** @brief Set the currently monitored UAS */ /** @brief Set the currently monitored UAS */
virtual void setActiveUAS(UASInterface* uas); virtual void setActiveUAS(UASInterface* uas);
......
#include "JoystickWidget.h" #include "JoystickWidget.h"
#include "MainWindow.h" #include "QGCApplication.h"
#include "ui_JoystickWidget.h" #include "ui_JoystickWidget.h"
#include "JoystickButton.h" #include "JoystickButton.h"
#include "JoystickAxis.h" #include "JoystickAxis.h"
...@@ -42,8 +42,8 @@ JoystickWidget::JoystickWidget(JoystickInput* joystick, QWidget *parent) : ...@@ -42,8 +42,8 @@ JoystickWidget::JoystickWidget(JoystickInput* joystick, QWidget *parent) :
connect(m_ui->enableCheckBox, SIGNAL(toggled(bool)), this->joystick, SLOT(setEnabled(bool))); connect(m_ui->enableCheckBox, SIGNAL(toggled(bool)), this->joystick, SLOT(setEnabled(bool)));
// Update the button label colors based on the current theme and watch for future theme changes. // Update the button label colors based on the current theme and watch for future theme changes.
styleChanged(MainWindow::instance()->getStyle()); styleChanged(qgcApp()->styleIsDark());
connect(MainWindow::instance(), SIGNAL(styleChanged(MainWindow::QGC_MAINWINDOW_STYLE)), this, SLOT(styleChanged(MainWindow::QGC_MAINWINDOW_STYLE))); connect(qgcApp(), &QGCApplication::styleChanged, this, &JoystickWidget::styleChanged);
// Display the widget above all other windows. // Display the widget above all other windows.
this->raise(); this->raise();
...@@ -81,15 +81,15 @@ void JoystickWidget::initUI() ...@@ -81,15 +81,15 @@ void JoystickWidget::initUI()
} }
} }
void JoystickWidget::styleChanged(MainWindow::QGC_MAINWINDOW_STYLE newStyle) void JoystickWidget::styleChanged(bool styleIsDark)
{ {
if (newStyle == MainWindow::QGC_MAINWINDOW_STYLE_LIGHT) if (styleIsDark)
{ {
buttonLabelColor = QColor(0x73, 0xD9, 0x5D); buttonLabelColor = QColor(0x14, 0xC6, 0x14);
} }
else else
{ {
buttonLabelColor = QColor(0x14, 0xC6, 0x14); buttonLabelColor = QColor(0x73, 0xD9, 0x5D);
} }
} }
......
...@@ -71,7 +71,7 @@ public slots: ...@@ -71,7 +71,7 @@ public slots:
/** @brief Trigger a UI change based on a button being released */ /** @brief Trigger a UI change based on a button being released */
void joystickButtonReleased(int key); void joystickButtonReleased(int key);
/** @brief Update the UI color scheme when the MainWindow theme changes. */ /** @brief Update the UI color scheme when the MainWindow theme changes. */
void styleChanged(MainWindow::QGC_MAINWINDOW_STYLE); void styleChanged(bool styleIsDark);
/** Update the UI assuming the joystick has stayed the same. */ /** Update the UI assuming the joystick has stayed the same. */
void updateUI(); void updateUI();
......
...@@ -80,10 +80,6 @@ This file is part of the QGROUNDCONTROL project ...@@ -80,10 +80,6 @@ This file is part of the QGROUNDCONTROL project
static MainWindow* _instance = NULL; ///< @brief MainWindow singleton static MainWindow* _instance = NULL; ///< @brief MainWindow singleton
// Set up some constants
const QString MainWindow::defaultDarkStyle = ":files/styles/style-dark.css";
const QString MainWindow::defaultLightStyle = ":files/styles/style-light.css";
MainWindow* MainWindow::_create(QSplashScreen* splashScreen, enum MainWindow::CUSTOM_MODE mode) MainWindow* MainWindow::_create(QSplashScreen* splashScreen, enum MainWindow::CUSTOM_MODE mode)
{ {
Q_ASSERT(_instance == NULL); Q_ASSERT(_instance == NULL);
...@@ -111,7 +107,6 @@ void MainWindow::deleteInstance(void) ...@@ -111,7 +107,6 @@ void MainWindow::deleteInstance(void)
/// constructor. /// constructor.
MainWindow::MainWindow(QSplashScreen* splashScreen, enum MainWindow::CUSTOM_MODE mode) : MainWindow::MainWindow(QSplashScreen* splashScreen, enum MainWindow::CUSTOM_MODE mode) :
currentView(VIEW_FLIGHT), currentView(VIEW_FLIGHT),
currentStyle(QGC_MAINWINDOW_STYLE_DARK),
centerStackActionGroup(new QActionGroup(this)), centerStackActionGroup(new QActionGroup(this)),
autoReconnect(false), autoReconnect(false),
simulationLink(NULL), simulationLink(NULL),
...@@ -131,10 +126,6 @@ MainWindow::MainWindow(QSplashScreen* splashScreen, enum MainWindow::CUSTOM_MODE ...@@ -131,10 +126,6 @@ MainWindow::MainWindow(QSplashScreen* splashScreen, enum MainWindow::CUSTOM_MODE
loadSettings(); loadSettings();
emit initStatusChanged(tr("Loading style"), Qt::AlignLeft | Qt::AlignBottom, QColor(62, 93, 141));
qApp->setStyle("plastique");
loadStyle(currentStyle);
if (settings.contains("ADVANCED_MODE")) if (settings.contains("ADVANCED_MODE"))
{ {
menuActionHelper->setAdvancedMode(settings.value("ADVANCED_MODE").toBool()); menuActionHelper->setAdvancedMode(settings.value("ADVANCED_MODE").toBool());
...@@ -951,7 +942,6 @@ void MainWindow::loadSettings() ...@@ -951,7 +942,6 @@ void MainWindow::loadSettings()
settings.beginGroup("QGC_MAINWINDOW"); settings.beginGroup("QGC_MAINWINDOW");
autoReconnect = settings.value("AUTO_RECONNECT", autoReconnect).toBool(); autoReconnect = settings.value("AUTO_RECONNECT", autoReconnect).toBool();
currentStyle = (QGC_MAINWINDOW_STYLE)settings.value("CURRENT_STYLE", currentStyle).toInt();
lowPowerMode = settings.value("LOW_POWER_MODE", lowPowerMode).toBool(); lowPowerMode = settings.value("LOW_POWER_MODE", lowPowerMode).toBool();
bool dockWidgetTitleBarEnabled = settings.value("DOCK_WIDGET_TITLEBARS",menuActionHelper->dockWidgetTitleBarsEnabled()).toBool(); bool dockWidgetTitleBarEnabled = settings.value("DOCK_WIDGET_TITLEBARS",menuActionHelper->dockWidgetTitleBarsEnabled()).toBool();
settings.endGroup(); settings.endGroup();
...@@ -967,7 +957,6 @@ void MainWindow::storeSettings() ...@@ -967,7 +957,6 @@ void MainWindow::storeSettings()
settings.beginGroup("QGC_MAINWINDOW"); settings.beginGroup("QGC_MAINWINDOW");
settings.setValue("AUTO_RECONNECT", autoReconnect); settings.setValue("AUTO_RECONNECT", autoReconnect);
settings.setValue("CURRENT_STYLE", currentStyle);
settings.setValue("LOW_POWER_MODE", lowPowerMode); settings.setValue("LOW_POWER_MODE", lowPowerMode);
settings.endGroup(); settings.endGroup();
...@@ -1055,51 +1044,6 @@ void MainWindow::enableAutoReconnect(bool enabled) ...@@ -1055,51 +1044,6 @@ void MainWindow::enableAutoReconnect(bool enabled)
autoReconnect = enabled; autoReconnect = enabled;
} }
bool MainWindow::loadStyle(QGC_MAINWINDOW_STYLE style)
{
//qDebug() << "LOAD STYLE" << style;
bool success = true;
QString styles;
// Signal to the user that the app will pause to apply a new stylesheet
qApp->setOverrideCursor(Qt::WaitCursor);
// Store the new style classification.
currentStyle = style;
// The dark style sheet is the master. Any other selected style sheet just overrides
// the colors of the master sheet.
QFile masterStyleSheet(defaultDarkStyle);
if (masterStyleSheet.open(QIODevice::ReadOnly | QIODevice::Text)) {
styles = masterStyleSheet.readAll();
} else {
qDebug() << "Unable to load master dark style sheet";
success = false;
}
if (success && style == QGC_MAINWINDOW_STYLE_LIGHT) {
qDebug() << "LOADING LIGHT";
// Load the slave light stylesheet.
QFile styleSheet(defaultLightStyle);
if (styleSheet.open(QIODevice::ReadOnly | QIODevice::Text)) {
styles += styleSheet.readAll();
} else {
qDebug() << "Unable to load slave light sheet:";
success = false;
}
}
if (!styles.isEmpty()) {
qApp->setStyleSheet(styles);
emit styleChanged(style);
}
// Finally restore the cursor before returning.
qApp->restoreOverrideCursor();
return success;
}
/** /**
* @brief Create all actions associated to the main window * @brief Create all actions associated to the main window
* *
......
...@@ -111,22 +111,6 @@ public: ...@@ -111,22 +111,6 @@ public:
~MainWindow(); ~MainWindow();
enum QGC_MAINWINDOW_STYLE
{
QGC_MAINWINDOW_STYLE_DARK,
QGC_MAINWINDOW_STYLE_LIGHT
};
// Declare default dark and light stylesheets. These should be file-resource
// paths.
static const QString defaultDarkStyle;
static const QString defaultLightStyle;
/** @brief Get current visual style */
QGC_MAINWINDOW_STYLE getStyle() const
{
return currentStyle;
}
/** @brief Get auto link reconnect setting */ /** @brief Get auto link reconnect setting */
bool autoReconnectEnabled() const bool autoReconnectEnabled() const
...@@ -215,8 +199,6 @@ public slots: ...@@ -215,8 +199,6 @@ public slots:
/** @brief Save power by reducing update rates */ /** @brief Save power by reducing update rates */
void enableLowPowerMode(bool enabled) { lowPowerMode = enabled; } void enableLowPowerMode(bool enabled) { lowPowerMode = enabled; }
/** @brief Load the specified style. */
bool loadStyle(QGC_MAINWINDOW_STYLE style);
/** @brief Add a custom tool widget */ /** @brief Add a custom tool widget */
void createCustomWidget(); void createCustomWidget();
...@@ -266,7 +248,6 @@ protected slots: ...@@ -266,7 +248,6 @@ protected slots:
void normalActionItemCallback(); void normalActionItemCallback();
signals: signals:
void styleChanged(MainWindow::QGC_MAINWINDOW_STYLE newTheme);
void initStatusChanged(const QString& message, int alignment, const QColor &color); void initStatusChanged(const QString& message, int alignment, const QColor &color);
/** Emitted when any value changes from any source */ /** Emitted when any value changes from any source */
void valueChanged(const int uasId, const QString& name, const QString& unit, const QVariant& value, const quint64 msec); void valueChanged(const int uasId, const QString& name, const QString& unit, const QVariant& value, const quint64 msec);
...@@ -331,7 +312,6 @@ protected: ...@@ -331,7 +312,6 @@ protected:
/** @brief Keeps track of the current view */ /** @brief Keeps track of the current view */
VIEW_SECTIONS currentView; VIEW_SECTIONS currentView;
QGC_MAINWINDOW_STYLE currentStyle;
void storeViewState(); void storeViewState();
void loadViewState(); void loadViewState();
......
...@@ -72,8 +72,7 @@ QGCDataPlot2D::QGCDataPlot2D(QWidget *parent) : ...@@ -72,8 +72,7 @@ QGCDataPlot2D::QGCDataPlot2D(QWidget *parent) :
connect(ui->style, SIGNAL(currentIndexChanged(QString)), plot, SLOT(setStyleText(QString))); connect(ui->style, SIGNAL(currentIndexChanged(QString)), plot, SLOT(setStyleText(QString)));
// Allow style changes to propagate through this widget // Allow style changes to propagate through this widget
connect(MainWindow::instance(), SIGNAL(styleChanged(MainWindow::QGC_MAINWINDOW_STYLE)), connect(qgcApp(), &QGCApplication::styleChanged, plot, &IncrementalPlot::styleChanged);
plot, SLOT(styleChanged(MainWindow::QGC_MAINWINDOW_STYLE)));
} }
void QGCDataPlot2D::reloadFile() void QGCDataPlot2D::reloadFile()
......
...@@ -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 "QGCToolBar.h" #include "QGCToolBar.h"
#include "UASManager.h" #include "UASManager.h"
#include "MainWindow.h" #include "MainWindow.h"
#include "QGCApplication.h"
QGCToolBar::QGCToolBar(QWidget *parent) : QGCToolBar::QGCToolBar(QWidget *parent) :
QToolBar(parent), QToolBar(parent),
...@@ -445,23 +446,13 @@ void QGCToolBar::updateView() ...@@ -445,23 +446,13 @@ void QGCToolBar::updateView()
toolBarBatteryBar->setValue(batteryPercent); toolBarBatteryBar->setValue(batteryPercent);
if (batteryPercent < 30 && toolBarBatteryBar->value() >= 30) { if (batteryPercent < 30 && toolBarBatteryBar->value() >= 30) {
if (MainWindow::instance()->getStyle() == MainWindow::QGC_MAINWINDOW_STYLE_LIGHT) toolBarBatteryBar->setStyleSheet(qgcApp()->styleIsDark() ?
{ "QProgressBar {color: #000} QProgressBar QProgressBar::chunk { background-color: #0F0}" :
toolBarBatteryBar->setStyleSheet("QProgressBar {color: #FFF} QProgressBar::chunk { background-color: #008000}"); "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){
if (MainWindow::instance()->getStyle() == MainWindow::QGC_MAINWINDOW_STYLE_LIGHT) toolBarBatteryBar->setStyleSheet(qgcApp()->styleIsDark() ?
{ "QProgressBar {color: #000} QProgressBar QProgressBar::chunk { background-color: #FF0}" :
toolBarBatteryBar->setStyleSheet("QProgressBar {color: #FFF} QProgressBar::chunk { background-color: #808000}"); "QProgressBar {color: #FFF} QProgressBar::chunk { background-color: #808000}");
}
else
{
toolBarBatteryBar->setStyleSheet("QProgressBar {color: #000} QProgressBar QProgressBar::chunk { background-color: #FF0}");
}
} }
} }
...@@ -493,14 +484,9 @@ void QGCToolBar::updateView() ...@@ -493,14 +484,9 @@ void QGCToolBar::updateView()
} }
else else
{ {
if (MainWindow::instance()->getStyle() == MainWindow::QGC_MAINWINDOW_STYLE_LIGHT) toolBarSafetyLabel->setStyleSheet(qgcApp()->styleIsDark() ?
{ "QLabel {color: #14C814; font-size: 15pt;}" :
toolBarSafetyLabel->setStyleSheet("QLabel {color: #0D820D; font-size: 15pt;}"); "QLabel {color: #0D820D; font-size: 15pt;}");
}
else
{
toolBarSafetyLabel->setStyleSheet("QLabel {color: #14C814; font-size: 15pt;}");
}
toolBarSafetyLabel->setText(tr("DISARMED")); toolBarSafetyLabel->setText(tr("DISARMED"));
} }
......
...@@ -86,8 +86,7 @@ _ui(new Ui::SettingsDialog) ...@@ -86,8 +86,7 @@ _ui(new Ui::SettingsDialog)
connect(_ui->customModeComboBox, SIGNAL(currentIndexChanged(int)), this, SLOT(selectCustomMode(int))); connect(_ui->customModeComboBox, SIGNAL(currentIndexChanged(int)), this, SLOT(selectCustomMode(int)));
// Application color style // Application color style
MainWindow::QGC_MAINWINDOW_STYLE style = _mainWindow->getStyle(); _ui->styleChooser->setCurrentIndex(qgcApp()->styleIsDark() ? 0 : 1);
_ui->styleChooser->setCurrentIndex(style);
_ui->savedFilesLocation->setText(qgcApp()->savedFilesLocation()); _ui->savedFilesLocation->setText(qgcApp()->savedFilesLocation());
_ui->promptFlightDataSave->setChecked(qgcApp()->promptFlightDataSave()); _ui->promptFlightDataSave->setChecked(qgcApp()->promptFlightDataSave());
...@@ -105,7 +104,7 @@ SettingsDialog::~SettingsDialog() ...@@ -105,7 +104,7 @@ SettingsDialog::~SettingsDialog()
void SettingsDialog::styleChanged(int index) void SettingsDialog::styleChanged(int index)
{ {
_mainWindow->loadStyle((index == 1) ? MainWindow::QGC_MAINWINDOW_STYLE_LIGHT : MainWindow::QGC_MAINWINDOW_STYLE_DARK); qgcApp()->setStyle(index == 0);
} }
void SettingsDialog::selectCustomMode(int mode) void SettingsDialog::selectCustomMode(int mode)
......
...@@ -6,6 +6,8 @@ ...@@ -6,6 +6,8 @@
#include "MAVLinkProtocol.h" #include "MAVLinkProtocol.h"
#include "UASManager.h" #include "UASManager.h"
#include "IncrementalPlot.h" #include "IncrementalPlot.h"
#include "QGCApplication.h"
#include <float.h> #include <float.h>
#include <qwt_plot.h> #include <qwt_plot.h>
#include <qwt_plot_layout.h> #include <qwt_plot_layout.h>
...@@ -222,9 +224,8 @@ QGCXYPlot::QGCXYPlot(QWidget *parent) : ...@@ -222,9 +224,8 @@ QGCXYPlot::QGCXYPlot(QWidget *parent) :
plot->setAutoReplot(); plot->setAutoReplot();
xycurve = new XYPlotCurve(); xycurve = new XYPlotCurve();
xycurve->attach(plot); xycurve->attach(plot);
styleChanged(MainWindow::instance()->getStyle()); styleChanged(qgcApp()->styleIsDark());
connect(MainWindow::instance(), SIGNAL(styleChanged(MainWindow::QGC_MAINWINDOW_STYLE)), connect(qgcApp(), &QGCApplication::styleChanged, this, &QGCXYPlot::styleChanged);
this, SLOT(styleChanged(MainWindow::QGC_MAINWINDOW_STYLE)));
connect(ui->minX, SIGNAL(valueChanged(double)),this, SLOT(updateMinMaxSettings())); connect(ui->minX, SIGNAL(valueChanged(double)),this, SLOT(updateMinMaxSettings()));
connect(ui->maxX, SIGNAL(valueChanged(double)),this, SLOT(updateMinMaxSettings())); connect(ui->maxX, SIGNAL(valueChanged(double)),this, SLOT(updateMinMaxSettings()));
connect(ui->minY, SIGNAL(valueChanged(double)),this, SLOT(updateMinMaxSettings())); connect(ui->minY, SIGNAL(valueChanged(double)),this, SLOT(updateMinMaxSettings()));
...@@ -401,12 +402,9 @@ void QGCXYPlot::appendData(int uasId, const QString& curve, const QString& unit, ...@@ -401,12 +402,9 @@ void QGCXYPlot::appendData(int uasId, const QString& curve, const QString& unit,
} }
} }
void QGCXYPlot::styleChanged(MainWindow::QGC_MAINWINDOW_STYLE style) void QGCXYPlot::styleChanged(bool styleIsDark)
{ {
if (style == MainWindow::QGC_MAINWINDOW_STYLE_LIGHT) xycurve->setColor(styleIsDark ? Qt::white : Qt::black);
xycurve->setColor(Qt::black);
else
xycurve->setColor(Qt::white);
} }
void QGCXYPlot::updateMinMaxSettings() void QGCXYPlot::updateMinMaxSettings()
......
...@@ -2,7 +2,6 @@ ...@@ -2,7 +2,6 @@
#define QGCXYPLOT_H #define QGCXYPLOT_H
#include "QGCToolWidgetItem.h" #include "QGCToolWidgetItem.h"
#include "MainWindow.h"
namespace Ui namespace Ui
{ {
...@@ -28,7 +27,7 @@ public slots: ...@@ -28,7 +27,7 @@ public slots:
void readSettings(const QString& pre,const QVariantMap& settings); void readSettings(const QString& pre,const QVariantMap& settings);
void appendData(int uasId, const QString& curve, const QString& unit, const QVariant& variant, quint64 usec); void appendData(int uasId, const QString& curve, const QString& unit, const QVariant& variant, quint64 usec);
void clearPlot(); void clearPlot();
void styleChanged(MainWindow::QGC_MAINWINDOW_STYLE style); void styleChanged(bool styleIsDark);
void updateMinMaxSettings(); void updateMinMaxSettings();
......
#include "ChartPlot.h" #include "ChartPlot.h"
#include "MainWindow.h" #include "QGCApplication.h"
const QColor ChartPlot::baseColors[numColors] = { const QColor ChartPlot::baseColors[numColors] = {
QColor(242,255,128), QColor(242,255,128),
...@@ -54,7 +54,7 @@ ChartPlot::ChartPlot(QWidget *parent): ...@@ -54,7 +54,7 @@ ChartPlot::ChartPlot(QWidget *parent):
} }
// Now that all objects have been initialized, color everything. // Now that all objects have been initialized, color everything.
styleChanged(MainWindow::instance()->getStyle()); styleChanged(qgcApp()->styleIsDark());
} }
ChartPlot::~ChartPlot() ChartPlot::~ChartPlot()
...@@ -88,47 +88,41 @@ void ChartPlot::shuffleColors() ...@@ -88,47 +88,41 @@ void ChartPlot::shuffleColors()
} }
} }
void ChartPlot::styleChanged(MainWindow::QGC_MAINWINDOW_STYLE style) void ChartPlot::styleChanged(bool styleIsDark)
{ {
// Generate a new color list for curves and recolor them. // Generate a new color list for curves and recolor them.
for (int i = 0; i < numColors; ++i) for (int i = 0; i < numColors; ++i)
{ {
if (style == MainWindow::QGC_MAINWINDOW_STYLE_LIGHT) { colors[i] = styleIsDark ? baseColors[i].lighter(150) : baseColors[i].darker(150);
colors[i] = baseColors[i].darker(150);
}
else
{
colors[i] = baseColors[i].lighter(150);
}
} }
shuffleColors(); shuffleColors();
// Configure the rest of the UI colors based on the current theme. // Configure the rest of the UI colors based on the current theme.
if (style == MainWindow::QGC_MAINWINDOW_STYLE_LIGHT) if (styleIsDark)
{ {
// Set the coloring of the area selector for zooming. // Set the coloring of the area selector for zooming.
zoomer->setRubberBandPen(QPen(QColor(0x37, 0x9A, 0xC3), zoomerWidth, Qt::DotLine)); zoomer->setRubberBandPen(QPen(QColor(0xB8, 0xD3, 0xE6), zoomerWidth, Qt::DotLine));
zoomer->setTrackerPen(QPen(QColor(0x37, 0x9A, 0xC3))); zoomer->setTrackerPen(QPen(QColor(0xB8, 0xD3, 0xE6)));
// Set canvas background // Set canvas background
setCanvasBackground(QColor(0xFF, 0xFF, 0xFF)); setCanvasBackground(QColor(0, 0, 0));
// Configure the plot grid. // Configure the plot grid.
grid->setMinorPen(QPen(QColor(0x55, 0x55, 0x55), gridWidth, Qt::DotLine)); grid->setMinorPen(QPen(QColor(0xAA, 0xAA, 0xAA), gridWidth, Qt::DotLine));
grid->setMajorPen(QPen(QColor(0x22, 0x22, 0x22), gridWidth, Qt::DotLine)); grid->setMajorPen(QPen(QColor(0xDD, 0xDD, 0xDD), gridWidth, Qt::DotLine));
} }
else else
{ {
// Set the coloring of the area selector for zooming. // Set the coloring of the area selector for zooming.
zoomer->setRubberBandPen(QPen(QColor(0xB8, 0xD3, 0xE6), zoomerWidth, Qt::DotLine)); zoomer->setRubberBandPen(QPen(QColor(0x37, 0x9A, 0xC3), zoomerWidth, Qt::DotLine));
zoomer->setTrackerPen(QPen(QColor(0xB8, 0xD3, 0xE6))); zoomer->setTrackerPen(QPen(QColor(0x37, 0x9A, 0xC3)));
// Set canvas background // Set canvas background
setCanvasBackground(QColor(0, 0, 0)); setCanvasBackground(QColor(0xFF, 0xFF, 0xFF));
// Configure the plot grid. // Configure the plot grid.
grid->setMinorPen(QPen(QColor(0xAA, 0xAA, 0xAA), gridWidth, Qt::DotLine)); grid->setMinorPen(QPen(QColor(0x55, 0x55, 0x55), gridWidth, Qt::DotLine));
grid->setMajorPen(QPen(QColor(0xDD, 0xDD, 0xDD), gridWidth, Qt::DotLine)); grid->setMajorPen(QPen(QColor(0x22, 0x22, 0x22), gridWidth, Qt::DotLine));
} }
// And finally refresh the widget to make sure all color changes are redrawn. // And finally refresh the widget to make sure all color changes are redrawn.
......
...@@ -26,7 +26,7 @@ public: ...@@ -26,7 +26,7 @@ public:
public slots: public slots:
/** @brief Generate coloring for this plot canvas based on current window theme */ /** @brief Generate coloring for this plot canvas based on current window theme */
void styleChanged(MainWindow::QGC_MAINWINDOW_STYLE style); void styleChanged(bool styleIsDark);
protected: protected:
const static int numColors = 20; const static int numColors = 20;
......
...@@ -52,6 +52,7 @@ This file is part of the PIXHAWK project ...@@ -52,6 +52,7 @@ This file is part of the PIXHAWK project
#include "MG.h" #include "MG.h"
#include "QGCFileDialog.h" #include "QGCFileDialog.h"
#include "QGCMessageBox.h" #include "QGCMessageBox.h"
#include "QGCApplication.h"
LinechartWidget::LinechartWidget(int systemid, QWidget *parent) : QWidget(parent), LinechartWidget::LinechartWidget(int systemid, QWidget *parent) : QWidget(parent),
sysid(systemid), sysid(systemid),
...@@ -140,7 +141,7 @@ LinechartWidget::LinechartWidget(int systemid, QWidget *parent) : QWidget(parent ...@@ -140,7 +141,7 @@ LinechartWidget::LinechartWidget(int systemid, QWidget *parent) : QWidget(parent
createLayout(); createLayout();
// And make sure we're listening for future style changes // And make sure we're listening for future style changes
connect(MainWindow::instance(), SIGNAL(styleChanged(MainWindow::QGC_MAINWINDOW_STYLE)), this, SLOT(recolor())); connect(qgcApp(), &QGCApplication::styleChanged, this, &LinechartWidget::recolor);
updateTimer->setInterval(updateInterval); updateTimer->setInterval(updateInterval);
connect(updateTimer, SIGNAL(timeout()), this, SLOT(refresh())); connect(updateTimer, SIGNAL(timeout()), this, SLOT(refresh()));
...@@ -676,7 +677,7 @@ void LinechartWidget::removeCurve(QString curve) ...@@ -676,7 +677,7 @@ void LinechartWidget::removeCurve(QString curve)
void LinechartWidget::recolor() void LinechartWidget::recolor()
{ {
activePlot->styleChanged(MainWindow::instance()->getStyle()); activePlot->styleChanged(qgcApp()->styleIsDark());
foreach (QString key, colorIcons.keys()) foreach (QString key, colorIcons.keys())
{ {
QWidget* colorIcon = colorIcons.value(key, 0); QWidget* colorIcon = colorIcons.value(key, 0);
......
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