~ubuntu-branches/ubuntu/vivid/kdesdk/vivid

« back to all changes in this revision

Viewing changes to okteta/kasten/controllers/view/structures/structtool.h

  • Committer: Package Import Robot
  • Author(s): Jonathan Riddell
  • Date: 2012-06-06 11:49:54 UTC
  • mfrom: (0.4.21)
  • Revision ID: package-import@ubuntu.com-20120606114954-rdls73fzlpzxglbx
Tags: 4:4.8.80-0ubuntu1
* New uptream beta release
* Update dont_export_private_classes.diff

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
/*
2
2
 *   This file is part of the Okteta Kasten Framework, made within the KDE community.
3
3
 *
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>
6
6
 *
7
7
 *   This library is free software; you can redistribute it and/or
23
23
#ifndef STRUCTTOOL_H_
24
24
#define STRUCTTOOL_H_
25
25
 
26
 
#include <KDebug>
27
26
// lib
28
27
#include "oktetakastencontrollers_export.h"
29
28
// tool
30
29
#include "structviewpreferences.h"
 
30
#include "datatypes/topleveldatainformation.h"
31
31
// Kasten core
32
32
#include <abstracttool.h>
33
33
// Okteta core
34
34
#include <address.h>
35
 
#include <arraychangemetricslist.h>
36
35
//Qt
37
 
#include <QModelIndex>
38
 
#include <QFileInfo>
39
 
#include <QStringList>
40
 
 
41
 
#include <kdemacros.h>
42
 
 
43
 
class DataInformationBase;
 
36
class QModelIndex;
 
37
 
44
38
class DataInformation;
45
 
class TopLevelDataInformation;
46
39
namespace Okteta
47
40
{
48
 
class CharCodec;
 
41
class ArrayChangeMetricsList;
49
42
class AbstractByteArrayModel;
50
43
}
51
44
 
52
 
namespace Kasten1
 
45
namespace Kasten2
53
46
{
54
 
class ByteArrayView;
55
 
class StructureDefinitionFile;
56
47
class StructuresManager;
 
48
class StructToolPrivate;
57
49
 
58
 
class OKTETAKASTENCONTROLLERS_EXPORT StructTool: public AbstractTool
 
50
class OKTETAKASTENCONTROLLERS_EXPORT StructTool : public AbstractTool
59
51
{
60
52
Q_OBJECT
61
 
Q_DISABLE_COPY(StructTool)
 
53
    Q_DISABLE_COPY(StructTool)
62
54
public:
63
55
    StructTool();
64
56
    virtual ~StructTool();
65
 
public:
 
57
 
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;
 
76
 
 
77
    //interface for model
 
78
    QVariant headerData(int column, int role);
 
79
    int childCount() const;
 
80
    DataInformation* childAt(int idx) const;
 
81
    TopLevelDataInformation::List allData() const;
 
82
 
85
83
Q_SIGNALS:
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);
 
97
 
99
98
public Q_SLOTS:
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();
108
106
 
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();
114
112
 
115
113
protected:
116
 
    // source
117
 
    ByteArrayView* mByteArrayView;
118
 
    Okteta::AbstractByteArrayModel* mByteArrayModel;
119
 
    Okteta::Address mCursorIndex;
120
 
    //  Okteta::CharCodec* mCharCodec;
121
 
 
122
 
    // settings
123
 
    StructViewPreferences::EnumByteOrder::type mByteOrder;
124
 
    StructuresManager* mManager;
125
 
    QList<TopLevelDataInformation*> mData;
126
 
    bool mWritingData : 1;
127
 
    bool mCurrentItemDataChanged : 1;
128
 
public:
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;
134
115
};
 
116
 
135
117
}
136
118
#endif /* STRUCTTOOL_H_ */