File indexing completed on 2024-05-19 05:37:54
0001 /* 0002 SPDX-FileCopyrightText: 2009 Aaron Seigo <aseigo@kde.org> 0003 0004 SPDX-License-Identifier: LGPL-2.0-or-later 0005 */ 0006 0007 #pragma once 0008 0009 #include <Plasma5Support/DataContainer> 0010 #include <QTimeZone> 0011 0012 class Sun; 0013 class Moon; 0014 0015 class TimeSource : public Plasma5Support::DataContainer 0016 { 0017 Q_OBJECT 0018 0019 public: 0020 explicit TimeSource(const QString &name, QObject *parent = nullptr); 0021 ~TimeSource() override; 0022 void setTimeZone(const QString &name); 0023 void updateTime(); 0024 0025 private: 0026 QString parseName(const QString &name); 0027 void addMoonPositionData(const QDateTime &dt); 0028 void addDailyMoonPositionData(const QDateTime &dt); 0029 void addSolarPositionData(const QDateTime &dt); 0030 void addDailySolarPositionData(const QDateTime &dt); 0031 Sun *sun(); 0032 Moon *moon(); 0033 0034 QString m_tzName; 0035 int m_offset; 0036 double m_latitude; 0037 double m_longitude; 0038 Sun *m_sun; 0039 Moon *m_moon; 0040 bool m_moonPosition : 1; 0041 bool m_solarPosition : 1; 0042 bool m_userDateTime : 1; 0043 bool m_local : 1; 0044 QTimeZone m_tz; 0045 };