1 /*
2     This file is part of the Okteta Kasten module, made within the KDE community.
3 
4     SPDX-FileCopyrightText: 2008 Friedrich W. H. Kossebau <kossebau@kde.org>
5 
6     SPDX-License-Identifier: LGPL-2.1-only OR LGPL-3.0-only OR LicenseRef-KDE-Accepted-LGPL
7 */
8 
9 #ifndef KASTEN_INFOTOOL_HPP
10 #define KASTEN_INFOTOOL_HPP
11 
12 // Kasten core
13 #include <Kasten/AbstractTool>
14 // Okteta core
15 #include <Okteta/AddressRange>
16 
17 namespace Okteta {
18 class AbstractByteArrayModel;
19 }
20 
21 namespace Kasten {
22 
23 class StatisticTableModel;
24 
25 class ByteArrayView;
26 
27 /**
28  */
29 class InfoTool : public AbstractTool
30 {
31     Q_OBJECT
32 
33 public:
34     InfoTool();
35     ~InfoTool() override;
36 
37 public:
38     StatisticTableModel* statisticTableModel() const;
39     int size() const;
40     bool isApplyable() const;
41     bool isStatisticUptodate() const;
42 
43 public: // AbstractTool API
44 //     virtual AbstractModel* targetModel() const;
45     QString title() const override;
46 
47     void setTargetModel(AbstractModel* model) override;
48 
49 public Q_SLOTS:
50     void updateStatistic();
51 
52 Q_SIGNALS:
53     void isApplyableChanged(bool isApplyable);
54     void statisticDirty(bool dirty);
55 
56 private Q_SLOTS:
57     void onSelectionChanged();
58     void onSourceChanged();
59     void onSourceDestroyed();
60 
61 private:
62     int mByteCount[256]; // TODO: here or in statistic model?
63 
64     StatisticTableModel* mStatisticTableModel;
65 
66     ByteArrayView* mByteArrayView = nullptr;
67     Okteta::AbstractByteArrayModel* mByteArrayModel = nullptr;
68 
69     //
70     bool mSourceByteArrayModelUptodate = false;
71     // selection source
72     Okteta::AddressRange mSourceSelection;
73     // source of strings
74     Okteta::AbstractByteArrayModel* mSourceByteArrayModel = nullptr;
75 };
76 
77 }
78 
79 #endif
80