File indexing completed on 2024-12-15 03:44:58
0001 /* 0002 SPDX-FileCopyrightText: 2017 Volker Krause <vkrause@kde.org> 0003 0004 SPDX-License-Identifier: MIT 0005 */ 0006 0007 #ifndef KUSERFEEDBACK_CONSOLE_AGGREGATOR_H 0008 #define KUSERFEEDBACK_CONSOLE_AGGREGATOR_H 0009 0010 #include <core/aggregation.h> 0011 0012 #include <memory> 0013 0014 class QAbstractItemModel; 0015 0016 #if QT_VERSION < QT_VERSION_CHECK(6, 0, 0) 0017 namespace QtCharts { 0018 class QChart; 0019 } 0020 using QtCharts::QChart; 0021 #else 0022 class QChart; 0023 #endif 0024 0025 namespace KUserFeedback { 0026 namespace Console { 0027 0028 class Aggregation; 0029 class SingleRowFilterProxyModel; 0030 0031 class Aggregator 0032 { 0033 public: 0034 explicit Aggregator(); 0035 virtual ~Aggregator(); 0036 0037 enum ChartMode { 0038 None = 0x0, 0039 Singular = 0x1, 0040 Timeline = 0x2 0041 }; 0042 Q_DECLARE_FLAGS(ChartModes, ChartMode) 0043 0044 Aggregation aggregation() const; 0045 void setAggregation(const Aggregation &aggr); 0046 0047 QAbstractItemModel *sourceModel() const; 0048 void setSourceModel(QAbstractItemModel *model); 0049 0050 virtual QString displayName() const; 0051 0052 virtual ChartModes chartModes() const; 0053 0054 virtual QAbstractItemModel *timeAggregationModel(); 0055 QAbstractItemModel* singularAggregationModel(); 0056 virtual void setSingularTime(int row); 0057 0058 virtual QChart *singlularChart(); 0059 virtual QChart *timelineChart(); 0060 0061 private: 0062 QAbstractItemModel *m_sourceModel = nullptr; 0063 std::unique_ptr<SingleRowFilterProxyModel> m_singularModel; 0064 Aggregation m_aggregation; 0065 }; 0066 0067 }} 0068 0069 Q_DECLARE_METATYPE(KUserFeedback::Console::Aggregator*) 0070 Q_DECLARE_OPERATORS_FOR_FLAGS(KUserFeedback::Console::Aggregator::ChartModes) 0071 0072 #endif // KUSERFEEDBACK_CONSOLE_AGGREGATOR_H