1 /*
2     SPDX-FileCopyrightText: 2012 Akarsh Simha <akarsh.simha@kdemail.net>
3 
4     SPDX-License-Identifier: GPL-2.0-or-later
5 */
6 
7 #pragma once
8 
9 #include <QSortFilterProxyModel>
10 
11 class QModelIndex;
12 
13 /**
14  * @class SessionSortFilterProxyModel
15  * @short Sort best observation times by reimplementing lessThan() to work on the transit times of objects
16  *
17  * Any observing session starts at about sunset (~ 6 PM local time)
18  * and goes on till sunrise (~ 6 AM local time). Thus, the correct
19  * order to view objects in is to view those with meridian transit
20  * times just after 12 noon local time first, working towards those
21  * that transit in the evening, and finishing the ones that have
22  * meridian transits just before 12 noon at the end of the
23  * session. So, the observing session list should be sorted in a
24  * special manner when sorting by time.  This class reimplements
25  * lessThan() in QSortFilterProxyModel to obtain the required sorting.
26  */
27 class SessionSortFilterProxyModel : public QSortFilterProxyModel
28 {
29     Q_OBJECT;
30 
31   public:
32     explicit SessionSortFilterProxyModel(QObject *parent = nullptr);
33 
34   protected:
35     bool lessThan(const QModelIndex &left, const QModelIndex &right) const override;
36 };
37