MeteorShowerDialog.hpp   MSConfigDialog.hpp 
/* /*
* Stellarium: Meteor Showers Plug-in * Stellarium: Meteor Showers Plug-in
* Copyright (C) 2013 Marcos Cardinot * Copyright (C) 2013-2015 Marcos Cardinot
* Copyright (C) 2011 Alexander Wolf
* *
* This program is free software; you can redistribute it and/or * This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License * modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2 * as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version. * of the License, or (at your option) any later version.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details. * GNU General Public License for more details.
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software * along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Suite 500, Boston, MA 02110-1335, USA. * Foundation, Inc., 51 Franklin Street, Suite 500, Boston, MA 02110-1335, USA.
*/ */
#ifndef _METEORSHOWERDIALOG_HPP_ #ifndef _MSCONFIGDIALOG_HPP_
#define _METEORSHOWERDIALOG_HPP_ #define _MSCONFIGDIALOG_HPP_
#include <QColor>
#include <QLabel>
#include <QObject>
#include <QTreeWidget>
#include "MeteorShowers.hpp" #include "MeteorShowers.hpp"
#include "StelDialog.hpp" #include "StelDialog.hpp"
class QTimer; class Ui_MSConfigDialog;
class Ui_meteorShowerDialog;
class MeteorShowers;
class MeteorShowerDialog : public StelDialog //! @class MSConfigDialog
//! Configuration window.
//! @author Marcos Cardinot <mcardinot@gmail.com>
//! @ingroup meteorShowers
class MSConfigDialog : public StelDialog
{ {
Q_OBJECT Q_OBJECT
public: public:
MeteorShowerDialog(); //! Constructor
~MeteorShowerDialog(); MSConfigDialog(MeteorShowersMgr *mgr);
//! Destructor
~MSConfigDialog();
//! Initializes the components based on the current settings
void init();
protected: protected:
//! Initialize the dialog widgets and connect the signals/slots //! Initializes the dialog and connect the signals/slots
void createDialogContent(); void createDialogContent();
public slots: public slots:
void retranslate(); void retranslate();
void refreshUpdateValues(void); //! Refresh details about the last u
pdate
void refreshMarkersColor(void); //! Refresh the color of all markers
void refreshRangeDates(void); //! Refresh dates range when year in
main app change
private slots: private slots:
void setUpdateValues(int hours); //! Refresh details about the last update
void setUpdatesEnabled(bool checkState); void refreshUpdateTab();
void updateStateReceiver(MeteorShowers::UpdateState state);
void updateCompleteReceiver(); //! Refresh the color of all markers
void restoreDefaults(void); void refreshMarkersColor();
void saveSettings(void);
void updateJSON(void); //! Sets the color of the active radiant based on confirmed data.
void setColorARR(void); //! Set color of active radiant based on re void setColorARC();
al data.
void setColorARG(void); //! Set color of active radiant based on ge //! Sets the color of the active radiant based on generic data.
neric data. void setColorARG();
void setColorIR(void); //! Set color of inactive radiant.
void checkDates(void); //! Checks if the inputed dates are valid f //! Sets the color of the inactive radiant.
or use. void setColorIR();
void searchEvents(void); //! Search events and fill the list.
void selectEvent(const QModelIndex &modelIndex); //! If an event is
selected by user, the current date change and the object is selected.
void repaintTreeWidget(void);
private: private:
Ui_meteorShowerDialog* ui; MeteorShowersMgr* m_mgr;
MeteorShowers* plugin; Ui_MSConfigDialog* m_ui;
void setAboutHtml(void);
void updateGuiFromSettings(void); void setAboutHtml();
QTimer* updateTimer;
//! Defines the number and the order of the columns in the table tha
t lists active meteor showers
//! @enum ModelColumns
enum ModelColumns {
ColumnName, //! name column
ColumnZHR, //! zhr column
ColumnDataType, //! data type column
ColumnPeak, //! peak date column
ColumnCount //! total number of columns
};
QTreeWidget* treeWidget; //! list of events
void initListEvents(void); //! Init header and list of events
void setHeaderNames(void); //! Update header names
// Reimplementation of QTreeWidgetItem class to fix the sorting bug
class TreeWidgetItem : public QTreeWidgetItem
{
public:
TreeWidgetItem(QTreeWidget* parent):QTreeWidgetItem(parent){
}
private:
bool operator<(const QTreeWidgetItem &other)const {
int column = treeWidget()->sortColumn();
if (column == ColumnPeak)
return QDateTime::fromString(text(column),"d
d/MMM/yyyy").operator <(QDateTime::fromString(other.text(column),"dd/MMM/yy
yy"));
else if (column == ColumnZHR)
return text(column).toInt() < other.text(col
umn).toInt();
else //ColumnName or ColumnDataType
return text(column).toLower() < other.text(c
olumn).toLower();
}
};
}; };
#endif // _METEORSHOWERDIALOG_HPP_ #endif // _MSCONFIGDIALOG_HPP_
 End of changes. 10 change blocks. 
82 lines changed or deleted 36 lines changed or added

This html diff was produced by rfcdiff 1.41. The latest version is available from http://tools.ietf.org/tools/rfcdiff/