forked from sqlitebrowser/sqlitebrowser
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathEditDialog.h
More file actions
88 lines (71 loc) · 1.76 KB
/
Copy pathEditDialog.h
File metadata and controls
88 lines (71 loc) · 1.76 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
#ifndef EDITDIALOG_H
#define EDITDIALOG_H
#include <QDialog>
#include <QPersistentModelIndex>
#include "jsontextedit.h"
class QHexEdit;
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;
JsonTextEdit* jsonEdit;
QPersistentModelIndex currentIndex;
int dataSource;
int dataType;
bool textNullSet;
bool isReadOnly;
bool mustIndentAndCompact;
QByteArray removedBom;
enum DataSources {
TextBuffer,
HexBuffer,
JsonBuffer
};
enum DataTypes {
Binary,
Image,
Null,
Text,
JSON
};
enum EditModes {
TextEditor = 0,
HexEditor = 1,
JsonEditor = 2,
ImageViewer = 3
};
int checkDataType(const QByteArray& data);
QString humanReadableSize(double byteCount) const;
bool promptInvalidData(const QString& dataType, const QString& errorString);
};
#endif