Warning, file /utilities/okteta/kasten/controllers/view/info/statistictablemodel.hpp was not indexed or was modified since last indexation (in which case cross-reference links may be missing, inaccurate or erroneous).
0001 /* 0002 This file is part of the Okteta Kasten module, made within the KDE community. 0003 0004 SPDX-FileCopyrightText: 2008 Friedrich W. H. Kossebau <kossebau@kde.org> 0005 0006 SPDX-License-Identifier: LGPL-2.1-only OR LGPL-3.0-only OR LicenseRef-KDE-Accepted-LGPL 0007 */ 0008 0009 #ifndef KASTEN_STATISTICTABLEMODEL_HPP 0010 #define KASTEN_STATISTICTABLEMODEL_HPP 0011 0012 // Okteta core 0013 #include <Okteta/OktetaCore> 0014 // Qt 0015 #include <QAbstractTableModel> 0016 #include <QFont> 0017 0018 namespace Okteta { 0019 class CharCodec; 0020 class ValueCodec; 0021 } 0022 0023 namespace Kasten { 0024 0025 class StatisticTableModel : public QAbstractTableModel 0026 { 0027 Q_OBJECT 0028 0029 public: 0030 enum ColumnIds 0031 { 0032 ValueId = 0, 0033 CharacterId = 1, 0034 CountId = 2, 0035 PercentId = 3, 0036 NoOfIds = 4 // TODO: what pattern is usually used to mark number of ids? 0037 }; 0038 0039 enum Roles { 0040 SortRole = Qt::UserRole, 0041 }; 0042 0043 public: 0044 explicit StatisticTableModel(int* byteCount, QObject* parent = nullptr); 0045 ~StatisticTableModel() override; 0046 0047 public: // QAbstractTableModel API 0048 int rowCount(const QModelIndex& parent) const override; 0049 int columnCount(const QModelIndex& parent) const override; 0050 QVariant data(const QModelIndex& index, int role) const override; 0051 QVariant headerData(int section, Qt::Orientation orientation, int role) const override; 0052 0053 public: 0054 void update(int size); 0055 0056 public Q_SLOTS: 0057 void setCharCodec(const QString& codecName); 0058 void setValueCoding(int valueCoding); 0059 void setSubstituteChar(QChar substituteChar); 0060 void setUndefinedChar(QChar undefinedChar); 0061 0062 Q_SIGNALS: 0063 void headerChanged(); 0064 void sizeChanged(int size); 0065 0066 public: 0067 const QFont &fixedFont() const; 0068 0069 private: 0070 int mSize = -1; 0071 int* mByteCount; 0072 0073 Okteta::ValueCoding mValueCoding; 0074 Okteta::ValueCodec* mValueCodec; 0075 Okteta::CharCodec* mCharCodec; 0076 QChar mSubstituteChar; 0077 QChar mUndefinedChar; 0078 QFont mFixedFont; 0079 }; 0080 0081 inline const QFont &StatisticTableModel::fixedFont() const 0082 { 0083 return mFixedFont; 0084 } 0085 0086 } 0087 0088 #endif