Repository navigation
Expand file tree
/
Copy pathEditDialog.h
More file actions
93 lines (77 loc) · 2.08 KB
/
Copy pathEditDialog.h
File metadata and controls
93 lines (77 loc) · 2.08 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
#ifndef EDITDIALOG_H
#define EDITDIALOG_H
#include <QDialog>
#include <QPersistentModelIndex>
class QHexEdit;
class DockTextEdit;
namespace Ui {
class EditDialog;
}
class EditDialog : public QDialog
{
Q_OBJECT
public:
explicit EditDialog(QWidget* parent = nullptr);
~EditDialog();
void setCurrentIndex(const QModelIndex& idx);
public slots:
virtual void setFocus();
virtual void reject();
void setReadOnly(bool ro);
void reloadSettings();
protected:
virtual void showEvent(QShowEvent* ev);
private slots:
void importData();
void exportData();
void setNull();
void updateApplyButton();
virtual void accept();
void loadData(const QByteArray& data);
void toggleOverwriteMode();
void editModeChanged(int newMode);
void editTextChanged();
void updateCellInfo(const QByteArray& data);
void setMustIndentAndCompact(bool enable);
signals:
void recordTextUpdated(const QPersistentModelIndex& idx, const QByteArray& data, bool isBlob);
private:
Ui::EditDialog* ui;
QHexEdit* hexEdit;
DockTextEdit* sciEdit;
QPersistentModelIndex currentIndex;
int dataSource;
int dataType;
bool isReadOnly;
bool mustIndentAndCompact;
QByteArray removedBom;
enum DataSources {
TextBuffer,
HexBuffer,
SciBuffer
};
// SVG is both an Image and an XML document so it is treated separately
enum DataTypes {
Binary,
Image,
Null,
Text,
JSON,
SVG
};
// Edit modes and editor stack (this must be aligned with the UI)
// Note that JSON and XML share the Scintilla widget.
enum EditModes {
TextEditor = 0,
HexEditor = 1,
ImageViewer = 2,
JsonEditor, SciEditor = 3,
XmlEditor = 4
};
int checkDataType(const QByteArray& data);
QString humanReadableSize(double byteCount) const;
bool promptInvalidData(const QString& dataType, const QString& errorString);
void setDataInBuffer(const QByteArray& data, DataSources source);
void setStackCurrentIndex(int editMode);
};
#endif