1
0
mirror of https://github.com/f4exb/sdrangel.git synced 2024-11-25 09:18:54 -05:00

Satellite and Star tracker plugins: added dark theme option for the charts

This commit is contained in:
f4exb 2021-04-20 02:27:43 +02:00
parent 6f4e596cca
commit b23b33bdc4
23 changed files with 83 additions and 5 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 35 KiB

After

Width:  |  Height:  |  Size: 52 KiB

Binary file not shown.

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

Binary file not shown.

Before

Width:  |  Height:  |  Size: 76 KiB

After

Width:  |  Height:  |  Size: 91 KiB

Binary file not shown.

Binary file not shown.

Before

Width:  |  Height:  |  Size: 66 KiB

After

Width:  |  Height:  |  Size: 76 KiB

Binary file not shown.

View File

@ -152,6 +152,8 @@ Pass charts can be plotted showing the azimuth and elevation of the target satel
The arrows next to the chart combobox, allow the pass number to be selected. Pass 0 is the next pass, with higher numbered passes occurring later in time.
The amount of passes is determined by the prediction period, which can be set in the Settings dialog.
click on this icon ![Star Tracker Chart theme](../../../doc/img/StarTracker_chart_theme.png) to switch between light and dark themes for the charts.
<h2>Satellite Data</h2>
The satellite data table displays calculated data about the selected satellites.

View File

@ -326,6 +326,7 @@ void SatelliteTrackerGUI::displaySettings()
ui->dateTimeSelect->setCurrentIndex(1);
}
ui->autoTarget->setChecked(m_settings.m_autoTarget);
ui->darkTheme->setChecked(m_settings.m_chartsDarkTheme);
plotChart();
blockApplySettings(false);
}
@ -649,6 +650,13 @@ void SatelliteTrackerGUI::on_prevPass_clicked()
}
}
void SatelliteTrackerGUI::on_darkTheme_clicked(bool checked)
{
m_settings.m_chartsDarkTheme = checked;
plotChart();
applySettings();
}
void SatelliteTrackerGUI::on_chartSelect_currentIndexChanged(int index)
{
(void) index;
@ -689,6 +697,7 @@ void SatelliteTrackerGUI::plotPolarChart()
// Always create a new chart, otherwise sometimes they aren't drawn properly
m_polarChart = new QPolarChart();
m_polarChart->setTheme(m_settings.m_chartsDarkTheme ? QChart::ChartThemeDark : QChart::ChartThemeLight);
QValueAxis *angularAxis = new QValueAxis();
QCategoryAxis *radialAxis = new QCategoryAxis();
@ -892,6 +901,7 @@ void SatelliteTrackerGUI::plotAzElChart()
// Always create a new chart, otherwise sometimes they aren't drawn properly
m_lineChart = new QChart();
m_lineChart->setTheme(m_settings.m_chartsDarkTheme ? QChart::ChartThemeDark : QChart::ChartThemeLight);
QDateTimeAxis *xAxis = new QDateTimeAxis();
QValueAxis *yLeftAxis = new QValueAxis();
QValueAxis *yRightAxis = new QValueAxis();

View File

@ -143,6 +143,7 @@ private slots:
void on_chartSelect_currentIndexChanged(int index);
void on_nextPass_clicked();
void on_prevPass_clicked();
void on_darkTheme_clicked(bool checked);
void on_satTable_cellDoubleClicked(int row, int column);
void satTable_sectionMoved(int logicalIndex, int oldVisualIndex, int newVisualIndex);
void satTable_sectionResized(int logicalIndex, int oldSize, int newSize);

View File

@ -482,6 +482,24 @@
</property>
</widget>
</item>
<item>
<widget class="QToolButton" name="darkTheme">
<property name="toolTip">
<string>Choose between light and dark themes</string>
</property>
<property name="text">
<string/>
</property>
<property name="icon">
<iconset resource="../../../sdrgui/resources/res.qrc">
<normaloff>:/lightdark.png</normaloff>
<normalon>:/darklight.png</normalon>:/lightdark.png</iconset>
</property>
<property name="checkable">
<bool>true</bool>
</property>
</widget>
</item>
</layout>
</item>
<item>

View File

@ -71,6 +71,7 @@ void SatelliteTrackerSettings::resetToDefaults()
m_reverseAPIPort = 8888;
m_reverseAPIFeatureSetIndex = 0;
m_reverseAPIFeatureIndex = 0;
m_chartsDarkTheme = false;
for (int i = 0; i < SAT_COL_COLUMNS; i++)
{
m_columnIndexes[i] = i;
@ -118,6 +119,7 @@ QByteArray SatelliteTrackerSettings::serialize() const
s.writeU32(33, m_reverseAPIPort);
s.writeU32(34, m_reverseAPIFeatureSetIndex);
s.writeU32(35, m_reverseAPIFeatureIndex);
s.writeBool(36, m_chartsDarkTheme);
for (int i = 0; i < SAT_COL_COLUMNS; i++)
s.writeS32(100 + i, m_columnIndexes[i]);
@ -194,6 +196,7 @@ bool SatelliteTrackerSettings::deserialize(const QByteArray& data)
m_reverseAPIFeatureSetIndex = utmp > 99 ? 99 : utmp;
d.readU32(35, &utmp, 0);
m_reverseAPIFeatureIndex = utmp > 99 ? 99 : utmp;
d.readBool(36, &m_chartsDarkTheme, false);
for (int i = 0; i < SAT_COL_COLUMNS; i++)
d.readS32(100 + i, &m_columnIndexes[i], i);

View File

@ -74,6 +74,7 @@ struct SatelliteTrackerSettings
QString m_losSpeech; //!< Text to say on LOS
QString m_aosCommand; //!< Command/script to execute on AOS
QString m_losCommand; //!< Command/script to execute on LOS
bool m_chartsDarkTheme; //!< Set dark theme for charts (effective for GUI only)
QHash<QString, QList<SatelliteDeviceSettings *> *> m_deviceSettings; //!< Settings for each device set for each satellite
int m_columnIndexes[SAT_COL_COLUMNS];//!< How the columns are ordered in the table

View File

@ -120,6 +120,10 @@ Displays the calculated elevation (angle in degrees - 0 to horizon and 90 to zen
<h2>Plots</h2>
<h3>Light or dark theme</h3>
click on this icon ![Star Tracker Chart theme](../../../doc/img/StarTracker_chart_theme.png) to switch between light and dark themes for the charts.
<h3>Elevation vs time</h3>
![Star Tracker Elevation vs Time](../../../doc/img/StarTracker_elevationvstime.png)

View File

@ -304,6 +304,9 @@ void StarTrackerGUI::displaySettings()
setTitleColor(m_settings.m_rgbColor);
setWindowTitle(m_settings.m_title);
blockApplySettings(true);
ui->darkTheme->setChecked(m_settings.m_chartsDarkTheme);
m_solarFluxChart.setTheme(m_settings.m_chartsDarkTheme ? QChart::ChartThemeDark : QChart::ChartThemeLight);
m_chart.setTheme(m_settings.m_chartsDarkTheme ? QChart::ChartThemeDark : QChart::ChartThemeLight);
ui->latitude->setValue(m_settings.m_latitude);
ui->longitude->setValue(m_settings.m_longitude);
ui->target->setCurrentIndex(ui->target->findText(m_settings.m_target));
@ -944,6 +947,7 @@ void StarTrackerGUI::plotElevationLineChart()
QChart *oldChart = m_azElLineChart;
m_azElLineChart = new QChart();
m_azElLineChart->setTheme(m_settings.m_chartsDarkTheme ? QChart::ChartThemeDark : QChart::ChartThemeLight);
QDateTimeAxis *xAxis = new QDateTimeAxis();
QValueAxis *yLeftAxis = new QValueAxis();
QValueAxis *yRightAxis = new QValueAxis();
@ -1060,6 +1064,7 @@ void StarTrackerGUI::plotElevationPolarChart()
QChart *oldChart = m_azElPolarChart;
m_azElPolarChart = new QPolarChart();
m_azElPolarChart->setTheme(m_settings.m_chartsDarkTheme ? QChart::ChartThemeDark : QChart::ChartThemeLight);
QValueAxis *angularAxis = new QValueAxis();
QCategoryAxis *radialAxis = new QCategoryAxis();
@ -1453,7 +1458,7 @@ void StarTrackerGUI::updateSolarFlux(bool all)
QString solarFluxFile = getSolarFluxFilename();
if (m_dlm.confirmDownload(solarFluxFile, nullptr, 1))
{
QString urlString = QString("http://www.sws.bom.gov.au/Category/World Data Centre/Data Display and Download/Solar Radio/station/learmonth/SRD/%1/L%2.SRD")
QString urlString = QString("https://www.sws.bom.gov.au/Category/World Data Centre/Data Display and Download/Solar Radio/station/learmonth/SRD/%1/L%2.SRD")
.arg(today.year()).arg(today.toString("yyMMdd"));
m_dlm.download(QUrl(urlString), solarFluxFile, this);
}
@ -1475,6 +1480,15 @@ void StarTrackerGUI::on_downloadSolarFlux_clicked()
updateSolarFlux(true);
}
void StarTrackerGUI::on_darkTheme_clicked(bool checked)
{
m_settings.m_chartsDarkTheme = checked;
m_solarFluxChart.setTheme(m_settings.m_chartsDarkTheme ? QChart::ChartThemeDark : QChart::ChartThemeLight);
m_chart.setTheme(m_settings.m_chartsDarkTheme ? QChart::ChartThemeDark : QChart::ChartThemeLight);
plotChart();
applySettings();
}
void StarTrackerGUI::downloadFinished(const QString& filename, bool success)
{
(void) filename;

View File

@ -146,6 +146,7 @@ private slots:
void plotAreaChanged(const QRectF &plotArea);
void autoUpdateSolarFlux();
void on_downloadSolarFlux_clicked();
void on_darkTheme_clicked(bool checked);
void networkManagerFinished(QNetworkReply *reply);
void downloadFinished(const QString& filename, bool success);
};

View File

@ -563,6 +563,24 @@ This can be specified as a decimal (E.g. 12.23) or in hours, minutes and seconds
<item>
<widget class="QComboBox" name="chartSubSelect"/>
</item>
<item>
<widget class="QToolButton" name="darkTheme">
<property name="toolTip">
<string>Choose between light and dark themes</string>
</property>
<property name="text">
<string/>
</property>
<property name="icon">
<iconset resource="../../../sdrgui/resources/res.qrc">
<normaloff>:/lightdark.png</normaloff>
<normalon>:/darklight.png</normalon>:/lightdark.png</iconset>
</property>
<property name="checkable">
<bool>true</bool>
</property>
</widget>
</item>
</layout>
</item>
<item>

View File

@ -54,6 +54,7 @@ void StarTrackerSettings::resetToDefaults()
m_drawSunOnMap = true;
m_drawMoonOnMap = true;
m_drawStarOnMap = true;
m_chartsDarkTheme = false;
m_title = "Star Tracker";
m_rgbColor = QColor(225, 25, 99).rgb();
m_useReverseAPI = false;
@ -98,6 +99,7 @@ QByteArray StarTrackerSettings::serialize() const
s.writeU32(29, m_solarFluxUnits);
s.writeDouble(30, m_beamwidth);
s.writeU32(31, m_solarFluxData);
s.writeBool(32, m_chartsDarkTheme);
return s.final();
}
@ -165,6 +167,7 @@ bool StarTrackerSettings::deserialize(const QByteArray& data)
d.readU32(29, (quint32 *)&m_solarFluxUnits, SFU);
d.readDouble(30, &m_beamwidth, 25.0);
d.readU32(31, (quint32 *)&m_solarFluxData, DRAO_2800);
d.readBool(32, &m_chartsDarkTheme, false);
return true;
}

View File

@ -52,6 +52,7 @@ struct StarTrackerSettings
bool m_drawSunOnMap;
bool m_drawMoonOnMap;
bool m_drawStarOnMap;
bool m_chartsDarkTheme; // Dark theme for charts
QString m_title;
quint32 m_rgbColor;

Binary file not shown.

After

Width:  |  Height:  |  Size: 936 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 941 B

View File

@ -1,6 +1,8 @@
<RCC>
<qresource prefix="/">
<file>info.png</file>
<file>darklight.png</file>
<file>lightdark.png</file>
<file>arrow_left.png</file>
<file>arrow_right.png</file>
<file>star.png</file>