File indexing completed on 2024-04-14 03:43:26
0001 /* 0002 SPDX-FileCopyrightText: 2012 Akarsh Simha <akarsh.simha@kdemail.net> 0003 0004 SPDX-License-Identifier: GPL-2.0-or-later 0005 */ 0006 0007 #pragma once 0008 0009 #include <QSortFilterProxyModel> 0010 0011 class QModelIndex; 0012 0013 /** 0014 * @class SessionSortFilterProxyModel 0015 * @short Sort best observation times by reimplementing lessThan() to work on the transit times of objects 0016 * 0017 * Any observing session starts at about sunset (~ 6 PM local time) 0018 * and goes on till sunrise (~ 6 AM local time). Thus, the correct 0019 * order to view objects in is to view those with meridian transit 0020 * times just after 12 noon local time first, working towards those 0021 * that transit in the evening, and finishing the ones that have 0022 * meridian transits just before 12 noon at the end of the 0023 * session. So, the observing session list should be sorted in a 0024 * special manner when sorting by time. This class reimplements 0025 * lessThan() in QSortFilterProxyModel to obtain the required sorting. 0026 */ 0027 class SessionSortFilterProxyModel : public QSortFilterProxyModel 0028 { 0029 Q_OBJECT; 0030 0031 public: 0032 explicit SessionSortFilterProxyModel(QObject *parent = nullptr); 0033 0034 protected: 0035 bool lessThan(const QModelIndex &left, const QModelIndex &right) const override; 0036 };