1 /* 2 SPDX-FileCopyrightText: 2003 Jason Harris <jharris@30doradus.org> 3 4 SPDX-License-Identifier: GPL-2.0-or-later 5 */ 6 7 #pragma once 8 9 #include "kstarsdatetime.h" 10 #include "ui_planetviewer.h" 11 12 #include <QDialog> 13 #include <QTimer> 14 15 class QKeyEvent; 16 class QPaintEvent; 17 18 #define AUMAX 48 19 20 class KSPlanetBase; 21 22 class PlanetViewerUI : public QFrame, public Ui::PlanetViewer 23 { 24 Q_OBJECT 25 26 public: 27 explicit PlanetViewerUI(QWidget *parent = nullptr); 28 }; 29 30 /** 31 * @class PlanetViewer 32 * @short Display an overhead view of the solar system 33 * 34 * @version 1.0 35 * @author Jason Harris 36 */ 37 class PlanetViewer : public QDialog 38 { 39 Q_OBJECT 40 41 public: 42 explicit PlanetViewer(QWidget *parent = nullptr); 43 centerPlanet()44 inline QString centerPlanet() const { return CenterPlanet; } setCenterPlanet(const QString & cp)45 inline void setCenterPlanet(const QString &cp) { CenterPlanet = cp; } 46 planetObject(uint i)47 inline KPlotObject *planetObject(uint i) const { return planet[i]; } 48 QString planetName(uint i) const; 49 50 protected: 51 void keyPressEvent(QKeyEvent *e) override; 52 void paintEvent(QPaintEvent *) override; 53 54 private slots: 55 void initPlotObjects(); 56 void tick(); 57 void setTimeScale(float); 58 void slotChangeDate(); 59 void slotRunClock(); 60 void slotToday(); 61 void slotCloseWindow(); 62 63 private: 64 void updatePlanets(); 65 66 PlanetViewerUI *pw { nullptr }; 67 KStarsDateTime ut; 68 double scale { 0 }; 69 bool isClockRunning { false }; 70 QTimer tmr; 71 int UpdateInterval[9], LastUpdate[9]; 72 QString CenterPlanet; 73 QList<KSPlanetBase *> PlanetList; 74 KPlotObject *ksun { nullptr }; 75 KPlotObject *planet[9] { nullptr }; 76 }; 77