-
-
Notifications
You must be signed in to change notification settings - Fork 340
Expand file tree
/
Copy pathDialogEditGPR.h
More file actions
89 lines (70 loc) · 1.74 KB
/
DialogEditGPR.h
File metadata and controls
89 lines (70 loc) · 1.74 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
/*
* Copyright (C) 2015 Ruslan Kabatsayev <b7.10110111@gmail.com>
*
* SPDX-License-Identifier: GPL-2.0-or-later
*/
#ifndef DIALOG_EDIT_GPR_H_20151011_
#define DIALOG_EDIT_GPR_H_20151011_
#include "Register.h"
#include <QDialog>
#include <array>
#include <cstddef>
#include <cstdint>
class QLabel;
namespace ODbgRegisterView {
class GprEdit;
class DialogEditGPR : public QDialog {
Q_OBJECT
public:
explicit DialogEditGPR(QWidget *parent = nullptr, Qt::WindowFlags f = Qt::WindowFlags());
public:
[[nodiscard]] Register value() const;
void setValue(const Register ®);
private Q_SLOTS:
void onTextEdited(const QString &);
private:
enum Column {
FORMAT_LABELS_COL,
FIRST_ENTRY_COL,
GPR64_COL = FIRST_ENTRY_COL,
GPR32_COL,
GPR16_COL,
GPR8H_COL,
GPR8L_COL,
TOTAL_COLS,
ENTRY_COLS = TOTAL_COLS - 1,
CHAR_COLS = 2
};
enum Row {
GPR_LABELS_ROW,
FIRST_ENTRY_ROW,
HEX_ROW = FIRST_ENTRY_ROW,
SIGNED_ROW,
UNSIGNED_ROW,
LAST_FULL_LENGTH_ROW = UNSIGNED_ROW,
CHAR_ROW,
ROW_AFTER_ENTRIES,
FULL_LENGTH_ROWS = LAST_FULL_LENGTH_ROW - FIRST_ENTRY_ROW + 1,
ENTRY_ROWS = ROW_AFTER_ENTRIES - FIRST_ENTRY_ROW
};
protected:
bool eventFilter(QObject *, QEvent *) override;
private:
void updateAllEntriesExcept(GprEdit *notUpdated);
void hideColumn(Column col);
void hideRow(Row row);
void setupEntriesAndLabels();
void resetLayout();
QLabel *&columnLabel(Column col);
QLabel *&rowLabel(Row row);
GprEdit *&entry(Row row, Column col);
void setupFocus();
private:
std::array<QLabel *, ENTRY_COLS + ENTRY_ROWS> labels_ = {{nullptr}};
std::array<GprEdit *, FULL_LENGTH_ROWS * ENTRY_COLS + CHAR_COLS> entries_ = {{nullptr}};
std::uint64_t value_;
std::size_t bitSize_ = 0;
Register reg_;
};
}
#endif