2
2
* This file is part of the Okteta Kasten Framework, made within the KDE community.
4
* Copyright 2009, 2011, 2010 Alex Richardson <alex.richardson@gmx.de>
4
* Copyright 2009, 2010, 2011 Alex Richardson <alex.richardson@gmx.de>
5
5
* Copyright 2009 Friedrich W. H. Kossebau <kossebau@kde.org>
7
7
* This library is free software; you can redistribute it and/or
23
23
#ifndef STRUCTTOOL_H_
24
24
#define STRUCTTOOL_H_
28
27
#include "oktetakastencontrollers_export.h"
30
29
#include "structviewpreferences.h"
30
#include "datatypes/topleveldatainformation.h"
32
32
#include <abstracttool.h>
34
34
#include <address.h>
35
#include <arraychangemetricslist.h>
37
#include <QModelIndex>
39
#include <QStringList>
41
#include <kdemacros.h>
43
class DataInformationBase;
44
38
class DataInformation;
45
class TopLevelDataInformation;
41
class ArrayChangeMetricsList;
49
42
class AbstractByteArrayModel;
55
class StructureDefinitionFile;
56
47
class StructuresManager;
48
class StructToolPrivate;
58
class OKTETAKASTENCONTROLLERS_EXPORT StructTool: public AbstractTool
50
class OKTETAKASTENCONTROLLERS_EXPORT StructTool : public AbstractTool
61
Q_DISABLE_COPY(StructTool)
53
Q_DISABLE_COPY(StructTool)
64
56
virtual ~StructTool();
66
58
// AbstractTool API
67
59
// virtual AbstractModel* targetModel() const;
68
60
virtual QString title() const;
72
64
StructViewPreferences::EnumByteOrder::type byteOrder() const;
73
65
void setByteOrder(StructViewPreferences::EnumByteOrder::type order);
74
66
int columnCount() const;
75
KDE_DEPRECATED bool setData(const QVariant& value, int role, DataInformation* item);
76
67
bool setData(const QVariant& value, int role, DataInformation* item, uint row);
77
68
Okteta::AbstractByteArrayModel* byteArrayModel() const;
78
69
StructuresManager* manager() const;
82
73
/** check if there is any ByteArrayModel available to lock the structure */
83
74
bool canStructureBeLocked(const QModelIndex& idx) const;
84
75
bool isFileLoaded() const;
78
QVariant headerData(int column, int role);
79
int childCount() const;
80
DataInformation* childAt(int idx) const;
81
TopLevelDataInformation::List allData() const;
86
84
void dataChanged(int row, void* data); //actually a DataInformation*
87
85
void dataCleared();
96
94
void childrenAboutToBeRemoved(DataInformation* sender, uint startIndex, uint endIndex);
97
95
/** items are inserted before @p startIndex */
98
96
void childrenRemoved(const DataInformation* sender, uint startIndex, uint endIndex);
100
99
void setByteOrder(int order);
101
100
void mark(const QModelIndex& idx);
102
101
void unmark(/*const QModelIndex& idx*/);
103
void updateData(const Okteta::ArrayChangeMetricsList& list =
104
Okteta::ArrayChangeMetricsList());
102
void updateData(const Okteta::ArrayChangeMetricsList& list);
105
103
void addChildItem(TopLevelDataInformation* child);
106
104
void setSelectedStructuresInView();
107
105
void validateAllStructures();
109
107
protected Q_SLOTS:
108
void onByteOrderChanged();
110
109
void onCursorPositionChange(Okteta::Address pos);
111
110
void onContentsChange(const Okteta::ArrayChangeMetricsList&);
112
// void onCharCodecChange(const QString& codecName);
113
111
void onChildItemDataChanged();
117
ByteArrayView* mByteArrayView;
118
Okteta::AbstractByteArrayModel* mByteArrayModel;
119
Okteta::Address mCursorIndex;
120
// Okteta::CharCodec* mCharCodec;
123
StructViewPreferences::EnumByteOrder::type mByteOrder;
124
StructuresManager* mManager;
125
QList<TopLevelDataInformation*> mData;
126
bool mWritingData : 1;
127
bool mCurrentItemDataChanged : 1;
129
//interface for model
130
QVariant headerData(int column, int role);
131
int childCount() const;
132
DataInformation* childAt(int idx) const;
133
// QTextCodec* mUtf8Codec; //XXX add utf8 strings sometime
114
QScopedPointer<StructToolPrivate> d;
136
118
#endif /* STRUCTTOOL_H_ */