mirror of
https://github.com/Serial-Studio/Serial-Studio.git
synced 2025-01-31 17:42:55 +08:00
Finish implementing gauge
This commit is contained in:
parent
728156917c
commit
c15702cf3b
@ -49,7 +49,7 @@
|
|||||||
"widgetIndicator2":"#d72d60",
|
"widgetIndicator2":"#d72d60",
|
||||||
"widgetIndicator3":"#2d6073",
|
"widgetIndicator3":"#2d6073",
|
||||||
"widgetAlternativeBackground":"#121218",
|
"widgetAlternativeBackground":"#121218",
|
||||||
"widgetControlBackground":"#111111",
|
"widgetControlBackground":"#bebebe",
|
||||||
"gyroSky":"#5c93c5",
|
"gyroSky":"#5c93c5",
|
||||||
"gyroText":"#ffffff",
|
"gyroText":"#ffffff",
|
||||||
"gyroGround":"#7d5233",
|
"gyroGround":"#7d5233",
|
||||||
@ -61,7 +61,7 @@
|
|||||||
"mapSkyHighAltitude":"#283e51",
|
"mapSkyHighAltitude":"#283e51",
|
||||||
"connectButtonChecked":"#d72d60",
|
"connectButtonChecked":"#d72d60",
|
||||||
"connectButtonUnchecked":"#2eed5c",
|
"connectButtonUnchecked":"#2eed5c",
|
||||||
"barWidgetColors":[
|
"widgetColors":[
|
||||||
"#f94144",
|
"#f94144",
|
||||||
"#f3722c",
|
"#f3722c",
|
||||||
"#f8961e",
|
"#f8961e",
|
||||||
|
@ -61,7 +61,7 @@
|
|||||||
"mapSkyHighAltitude":"#283e51",
|
"mapSkyHighAltitude":"#283e51",
|
||||||
"connectButtonChecked":"#fe696e",
|
"connectButtonChecked":"#fe696e",
|
||||||
"connectButtonUnchecked":"#26cd40",
|
"connectButtonUnchecked":"#26cd40",
|
||||||
"barWidgetColors":[
|
"widgetColors":[
|
||||||
"#f94144",
|
"#f94144",
|
||||||
"#f3722c",
|
"#f3722c",
|
||||||
"#f8961e",
|
"#f8961e",
|
||||||
|
@ -193,10 +193,10 @@ void ThemeManager::loadTheme(const int id)
|
|||||||
// clang-format on
|
// clang-format on
|
||||||
|
|
||||||
// Read bar widget colors
|
// Read bar widget colors
|
||||||
m_barWidgetColors.clear();
|
m_widgetColors.clear();
|
||||||
auto list = colors.value("barWidgetColors").toArray();
|
auto list = colors.value("widgetColors").toArray();
|
||||||
for (int i = 0; i < list.count(); ++i)
|
for (int i = 0; i < list.count(); ++i)
|
||||||
m_barWidgetColors.append(list.at(i).toString());
|
m_widgetColors.append(list.at(i).toString());
|
||||||
|
|
||||||
// Update application palette
|
// Update application palette
|
||||||
QPalette palette;
|
QPalette palette;
|
||||||
@ -556,9 +556,9 @@ QColor ThemeManager::connectButtonUnchecked() const
|
|||||||
return m_connectButtonUnchecked;
|
return m_connectButtonUnchecked;
|
||||||
}
|
}
|
||||||
|
|
||||||
QStringList ThemeManager::barWidgetColors() const
|
QStringList ThemeManager::widgetColors() const
|
||||||
{
|
{
|
||||||
return m_barWidgetColors;
|
return m_widgetColors;
|
||||||
}
|
}
|
||||||
|
|
||||||
QStringList ThemeManager::availableThemes() const
|
QStringList ThemeManager::availableThemes() const
|
||||||
|
@ -213,8 +213,8 @@ class ThemeManager : public QObject
|
|||||||
Q_PROPERTY(QColor connectButtonUnchecked
|
Q_PROPERTY(QColor connectButtonUnchecked
|
||||||
READ connectButtonUnchecked
|
READ connectButtonUnchecked
|
||||||
NOTIFY themeChanged)
|
NOTIFY themeChanged)
|
||||||
Q_PROPERTY(QStringList barWidgetColors
|
Q_PROPERTY(QStringList widgetColors
|
||||||
READ barWidgetColors
|
READ widgetColors
|
||||||
NOTIFY themeChanged)
|
NOTIFY themeChanged)
|
||||||
Q_PROPERTY(QStringList availableThemes
|
Q_PROPERTY(QStringList availableThemes
|
||||||
READ availableThemes
|
READ availableThemes
|
||||||
@ -290,7 +290,7 @@ public:
|
|||||||
QColor connectButtonChecked() const;
|
QColor connectButtonChecked() const;
|
||||||
QColor connectButtonUnchecked() const;
|
QColor connectButtonUnchecked() const;
|
||||||
|
|
||||||
QStringList barWidgetColors() const;
|
QStringList widgetColors() const;
|
||||||
QStringList availableThemes() const;
|
QStringList availableThemes() const;
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
@ -368,7 +368,7 @@ private:
|
|||||||
QColor m_mapSkyHighAltitude;
|
QColor m_mapSkyHighAltitude;
|
||||||
QColor m_connectButtonChecked;
|
QColor m_connectButtonChecked;
|
||||||
QColor m_connectButtonUnchecked;
|
QColor m_connectButtonUnchecked;
|
||||||
QStringList m_barWidgetColors;
|
QStringList m_widgetColors;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -85,11 +85,11 @@ Bar::Bar(const int index)
|
|||||||
|
|
||||||
// Get thermo color
|
// Get thermo color
|
||||||
QString color;
|
QString color;
|
||||||
auto barcl = theme->barWidgetColors();
|
auto colors = theme->widgetColors();
|
||||||
if (barcl.count() > m_index)
|
if (colors.count() > m_index)
|
||||||
color = barcl.at(m_index);
|
color = colors.at(m_index);
|
||||||
else
|
else
|
||||||
color = barcl.at(barcl.count() % m_index);
|
color = colors.at(colors.count() % m_index);
|
||||||
|
|
||||||
// Configure thermo style
|
// Configure thermo style
|
||||||
m_thermo.setPipeWidth(64);
|
m_thermo.setPipeWidth(64);
|
||||||
|
@ -25,6 +25,7 @@
|
|||||||
#include "Misc/ThemeManager.h"
|
#include "Misc/ThemeManager.h"
|
||||||
|
|
||||||
#include <QPainter>
|
#include <QPainter>
|
||||||
|
#include <QApplication>
|
||||||
#include <QResizeEvent>
|
#include <QResizeEvent>
|
||||||
#include <QwtDialNeedle>
|
#include <QwtDialNeedle>
|
||||||
#include <QwtRoundScaleDraw>
|
#include <QwtRoundScaleDraw>
|
||||||
@ -76,7 +77,7 @@ void GaugeObject::drawScaleContents(QPainter *painter, const QPointF ¢er,
|
|||||||
|
|
||||||
// Paint label
|
// Paint label
|
||||||
painter->setFont(labelFont);
|
painter->setFont(labelFont);
|
||||||
painter->setPen(palette().color(QPalette::Highlight));
|
painter->setPen(Misc::ThemeManager::getInstance()->widgetIndicator1());
|
||||||
painter->drawText(rect, flags,
|
painter->drawText(rect, flags,
|
||||||
QString("%1 %2").arg(QString::number(value(), 'f', 2), m_label));
|
QString("%1 %2").arg(QString::number(value(), 'f', 2), m_label));
|
||||||
}
|
}
|
||||||
@ -98,7 +99,7 @@ Gauge::Gauge(const int index)
|
|||||||
|
|
||||||
// Get needle & knob color
|
// Get needle & knob color
|
||||||
QString needleColor;
|
QString needleColor;
|
||||||
auto colors = theme->barWidgetColors();
|
auto colors = theme->widgetColors();
|
||||||
auto knobColor = theme->widgetControlBackground();
|
auto knobColor = theme->widgetControlBackground();
|
||||||
if (colors.count() > m_index)
|
if (colors.count() > m_index)
|
||||||
needleColor = colors.at(m_index);
|
needleColor = colors.at(m_index);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user