File indexing completed on 2024-05-05 03:50:42
0001 // SPDX-License-Identifier: LGPL-2.1-or-later 0002 // 0003 // SPDX-FileCopyrightText: 2012 Rene Kuettner <rene@bitkanal.net> 0004 // 0005 0006 #ifndef MARBLE_ECLIPSESBROWSERDIALOG_H 0007 #define MARBLE_ECLIPSESBROWSERDIALOG_H 0008 0009 #include <QDialog> 0010 0011 namespace Ui { 0012 class EclipsesBrowserDialog; 0013 } 0014 0015 namespace Marble { 0016 0017 class EclipsesModel; 0018 class MarbleModel; 0019 0020 /** 0021 * @brief The eclipse browser dialog 0022 * 0023 * This implements the logic for the eclipse browser dialog. 0024 */ 0025 class EclipsesBrowserDialog : public QDialog 0026 { 0027 Q_OBJECT 0028 0029 public: 0030 explicit EclipsesBrowserDialog( const MarbleModel *model, 0031 QWidget *parent = nullptr ); 0032 0033 ~EclipsesBrowserDialog() override; 0034 0035 /** 0036 * @brief Set the year 0037 * 0038 * This sets the year the browser currently shows eclipses for. 0039 * 0040 * @see year 0041 */ 0042 void setYear( int year ); 0043 0044 /** 0045 * @brief Return the year the browser is set to 0046 * 0047 * @return The year the browser shows eclipses for at the moment 0048 * @see setYear 0049 */ 0050 int year() const; 0051 0052 /** 0053 * @brief Set whether or not to list lunar eclipses 0054 * @param enable whether or not to list lunar eclipses 0055 * 0056 * @see withLunarEclipses 0057 */ 0058 void setWithLunarEclipses( const bool enable ); 0059 0060 /** 0061 * @brief Returns whether or not lunar eclipses are listed 0062 * 0063 * @return Whether or not lunar eclipses are listed 0064 * @see setWithLunarEclipses 0065 */ 0066 bool withLunarEclipses() const; 0067 0068 Q_SIGNALS: 0069 /** 0070 * @brief This signal is emitted when the use clicks the "show" button 0071 * @param year the year of the selected eclipse event 0072 * @param index the index of the selected eclipse item 0073 */ 0074 void buttonShowClicked( int year, int index ); 0075 0076 /** 0077 * @brief This signal is emitted when the 'Settings' button is clicked 0078 */ 0079 void buttonSettingsClicked(); 0080 0081 protected Q_SLOTS: 0082 /** 0083 * @brief Accept the dialog 0084 * 0085 * This emits the buttonShowClicked signal 0086 * 0087 * @see buttonShowClicked 0088 */ 0089 void accept() override; 0090 0091 /** 0092 * @brief Update the list of eclipses for the given year 0093 * @param year The year to list eclipses for 0094 */ 0095 void updateEclipsesForYear( int year ); 0096 0097 /** 0098 * @brief Update the dialog's button states 0099 * 0100 * Disable/enable the show button according to the current selection. 0101 */ 0102 void updateButtonStates(); 0103 0104 protected: 0105 /** 0106 * @brief Initialize the object 0107 */ 0108 void initialize(); 0109 0110 private: 0111 const MarbleModel *m_marbleModel; 0112 Ui::EclipsesBrowserDialog *m_browserWidget; 0113 EclipsesModel *m_eclModel; 0114 }; 0115 0116 } // namespace Marble 0117 0118 #endif // MARBLE_ECLIPSESBROWSERDIALOG_H 0119