Skip to content

Commit

Permalink
Fix: very small intervals in forecast chart have bad background color…
Browse files Browse the repository at this point in the history
…s. Bump to version 1.32.0.
  • Loading branch information
FelixdelasPozas committed Jan 26, 2025
1 parent e7e9820 commit 2c88b12
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 6 deletions.
2 changes: 1 addition & 1 deletion AboutDialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
#include <QDesktopServices>
#include <QUrl>

const QString AboutDialog::VERSION{"1.31.4"};
const QString AboutDialog::VERSION{"1.32.0"};
const QString COPYRIGHT{"Copyright (c) 2016-%1 Félix de las Pozas Álvarez"};

//-----------------------------------------------------------------
Expand Down
4 changes: 2 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ project(TrayWeather)

# Version Number
set (TRAYWEATHER_VERSION_MAJOR 1)
set (TRAYWEATHER_VERSION_MINOR 31)
set (TRAYWEATHER_VERSION_PATCH 4)
set (TRAYWEATHER_VERSION_MINOR 32)
set (TRAYWEATHER_VERSION_PATCH 0)

set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
Expand Down
9 changes: 9 additions & 0 deletions WeatherDialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1632,13 +1632,15 @@ QLinearGradient WeatherDialog::sunriseSunsetGradient(QDateTime begin, QDateTime
std::set<unsigned long long> sunrises, sunsets;
constexpr unsigned long long minuteMs = 15 * 60 * 1000;

QColor startColor = darkColor;
for(int i = 0; i < m_forecast->size(); ++i)
{
const auto &entry = m_forecast->at(i);
const auto [sunrise, sunset] = computeSunriseSunset(entry, m_config->longitude, m_config->latitude);

sunrises.emplace(sunrise * 1000);
sunsets.emplace(sunset * 1000);
if(startT >= sunrise*1000 && endT <= sunset*1000) startColor = lightColor;
}

for(const unsigned long long sunrise: sunrises)
Expand All @@ -1657,6 +1659,13 @@ QLinearGradient WeatherDialog::sunriseSunsetGradient(QDateTime begin, QDateTime
std::sort(stops.begin(), stops.end(), sortStops);
for(const auto &s: stops) plotAreaGradient.setColorAt(s.first, s.second);

// in case of very small intervals where stops are empty.
if(stops.isEmpty())
{
plotAreaGradient.setColorAt(0, startColor);
plotAreaGradient.setColorAt(1, startColor);
}

return plotAreaGradient;
}

Expand Down
6 changes: 3 additions & 3 deletions readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -170,16 +170,16 @@ To the translation in your language. For example in Spanish it is:

# Repository information

**Version**: 1.31.4
**Version**: 1.32.0

**Status**: finished.

**cloc statistics**

| Language |files |blank |comment |code |
|:-----------------------------|--------------:|------------:|-----------------:|-----:|
| C++ | 12 | 1332 | 526 | 6573 |
| C++ | 12 | 1335 | 527 | 6584 |
| C/C++ Header | 12 | 419 | 1243 | 1282 |
| HTML | 1 | 33 | 0 | 152 |
| CMake | 1 | 19 | 12 | 129 |
| **Total** | **26** | **1803** | **1781** | **8136** |
| **Total** | **26** | **1806** | **1782** | **8147** |

0 comments on commit 2c88b12

Please sign in to comment.