This repository was archived by the owner on Sep 30, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 120
Expand file tree
/
Copy pathhexeditwidget.h
More file actions
133 lines (112 loc) · 3.65 KB
/
Copy pathhexeditwidget.h
File metadata and controls
133 lines (112 loc) · 3.65 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
/*
* Copyright 2017 CodiLime
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
#pragma once
#include <QGroupBox>
#include <QLabel>
#include <QSplitter>
#include <QTreeView>
#include <QWidget>
#include <QStringList>
#include <QToolBar>
#include <QToolButton>
#include <QMainWindow>
#include <QSharedPointer>
#include "visualization/base.h"
#include "ui/fileblobmodel.h"
#include "ui/hexedit.h"
#include "ui/searchdialog.h"
#include "ui/dockwidget.h"
#include "dbif/info.h"
#include "dbif/types.h"
namespace veles {
namespace ui {
class HexEditWidget : public View {
Q_OBJECT
public:
explicit HexEditWidget(MainWindowWithDetachableDockWidgets *main_window,
QSharedPointer<FileBlobModel>& data_model,
QSharedPointer<QItemSelectionModel>& selection_model);
void reapplySettings() override;
void setParserIds(QStringList ids);
QString addressAsText(qint64 addr);
QAction* uploadAction() {return upload_act_;}
QAction* undoAction() {return undo_act_;}
QAction* discardAction() {return discard_act_;}
QAction* findAction() {return find_act_;}
QAction* findNextAction() {return find_next_act_;}
QAction* showVisualizationAction() {return visualization_act_;}
QAction* showHexEditAction() {return show_hex_edit_act_;}
QAction* showNodeTreeAction() {return show_node_tree_act_;}
signals:
void showNodeTree(bool show);
void showMinimap(bool show);
void updateMinimap(qint64 start_addr, qint64 region_size);
public slots:
void nodeTreeVisibilityChanged(bool visibility);
void minimapVisibilityChanged(bool visibility);
void minimapSelectionChanged(size_t start, size_t end);
private slots:
void parse(QAction *action);
void findNext();
void showSearchDialog();
bool saveAs();
void showVisualization();
void showHexEditor();
void newBinData();
void enableFindNext(bool enable);
void selectionChanged(qint64 start_addr, qint64 selection_size);
void editStateChanged(bool has_changes, bool has_undo);
private:
bool saveFile(const QString &file_name);
void addDummySlices(dbif::ObjectHandle);
void addChunk(QString name, QString type, QString comment, uint64_t start,
uint64_t end, const QModelIndex &index = QModelIndex());
void setupDataModelHandlers();
void createActions();
void createToolBars();
void createSliceCreatorWidget();
void initParsersMenu();
void createSelectionInfo();
bool getRangeValues(qint64 *begin, qint64 *end);
MainWindowWithDetachableDockWidgets *main_window_;
QFile file_;
bool is_untitled_;
QToolBar *file_tool_bar_;
QToolBar *edit_tool_bar_;
QToolBar *tools_tool_bar_;
QAction *upload_act_;
QAction *save_as_act_;
QAction *save_readable_;
QAction *undo_act_;
QAction *discard_act_;
QAction *redo_act_;
QAction *find_act_;
QAction *find_next_act_;
QAction *visualization_act_;
QAction *show_node_tree_act_;
QAction *show_minimap_act_;
QAction *show_hex_edit_act_;
SearchDialog *search_dialog_;
HexEdit *hex_edit_;
QSharedPointer<FileBlobModel> data_model_;
QSharedPointer<QItemSelectionModel> selection_model_;
QStringList parsers_ids_;
QMenu parsers_menu_;
QLabel* selection_label_;
};
} // namespace ui
} // namespace veles