@@ -1,241 +1,253 | |||||
1 | #include "peripheralwidget.h" |
|
1 | #include "peripheralwidget.h" | |
2 |
|
2 | |||
3 | peripheralWidget::peripheralWidget(const QString &name, qint32 baseAddress, QWidget *parent) : |
|
3 | peripheralWidget::peripheralWidget(const QString &name, qint32 baseAddress, QWidget *parent) : | |
4 | QWidget(parent) |
|
4 | QWidget(parent) | |
5 | { |
|
5 | { | |
6 | p_name = name; |
|
6 | p_name = name; | |
7 | p_timer = new QTimer(this); |
|
7 | p_timer = new QTimer(this); | |
8 | p_timer->setInterval(500); |
|
8 | p_timer->setInterval(500); | |
9 | p_baseAddress = baseAddress; |
|
9 | p_baseAddress = baseAddress; | |
10 | p_header = p_name + QString(" @0x%1").arg((uint)p_baseAddress,8,16); |
|
10 | p_header = p_name + QString(" @0x%1").arg((uint)p_baseAddress,8,16); | |
11 | setAttribute(Qt::WA_AlwaysShowToolTips); |
|
11 | setAttribute(Qt::WA_AlwaysShowToolTips); | |
12 | setMouseTracking(true); |
|
12 | setMouseTracking(true); | |
13 | setFocusPolicy(Qt::StrongFocus); |
|
13 | setFocusPolicy(Qt::StrongFocus); | |
14 | selectedReg = -1; |
|
14 | selectedReg = -1; | |
15 | registersWdgts.clear(); |
|
15 | registersWdgts.clear(); | |
16 | connect(p_timer,SIGNAL(timeout()),this,SLOT(blinkCursor())); |
|
16 | connect(p_timer,SIGNAL(timeout()),this,SLOT(blinkCursor())); | |
17 | setFont(QFont("Utopia", 14,QFont::Bold)); |
|
17 | setFont(QFont("Utopia", 14,QFont::Bold)); | |
18 | } |
|
18 | } | |
19 |
|
19 | |||
20 | void peripheralWidget::blinkCursor() |
|
20 | void peripheralWidget::blinkCursor() | |
21 | { |
|
21 | { | |
22 | if(selectedReg!=-1) |
|
22 | if(selectedReg!=-1) | |
23 | registersWdgts.at(selectedReg)->blinkCursor(); |
|
23 | registersWdgts.at(selectedReg)->blinkCursor(); | |
24 | repaint(); |
|
24 | repaint(); | |
25 | } |
|
25 | } | |
26 |
|
26 | |||
27 | void peripheralWidget::addRegister(const QString &name, qint32 address) |
|
27 | void peripheralWidget::addRegister(const QString &name, qint32 address) | |
28 | { |
|
28 | { | |
29 | /*TODO Should regs by address*/ |
|
29 | /*TODO Should regs by address*/ | |
30 | registersWdgts.append(new registerWidget(name,address)); |
|
30 | registersWdgts.append(new registerWidget(name,address)); | |
31 | connect(registersWdgts.last(),SIGNAL(repaint()),this,SLOT(repaint())); |
|
31 | connect(registersWdgts.last(),SIGNAL(repaint()),this,SLOT(repaint())); | |
32 | } |
|
32 | } | |
33 |
|
33 | |||
34 | void peripheralWidget::leave() |
|
34 | void peripheralWidget::leave() | |
35 | { |
|
35 | { | |
36 | if(selectedReg!=-1) |
|
36 | if(selectedReg!=-1) | |
37 | { |
|
37 | { | |
38 | p_timer->stop(); |
|
38 | p_timer->stop(); | |
39 | registersWdgts.at(selectedReg)->leave(); |
|
39 | registersWdgts.at(selectedReg)->leave(); | |
40 | selectedReg = -1; |
|
40 | selectedReg = -1; | |
41 | repaint(); |
|
41 | repaint(); | |
42 | } |
|
42 | } | |
43 | } |
|
43 | } | |
44 |
|
44 | |||
45 | void peripheralWidget::enter(int cursorIndex, bool fromTop) |
|
45 | void peripheralWidget::enter(int cursorIndex, bool fromTop) | |
46 | { |
|
46 | { | |
47 | if(cursorIndex>=0 && cursorIndex<32) |
|
47 | if(cursorIndex>=0 && cursorIndex<32) | |
48 | { |
|
48 | { | |
49 | if(fromTop) |
|
49 | if(fromTop) | |
50 | { |
|
50 | { | |
51 | registersWdgts.at(0)->enter(cursorIndex); |
|
51 | registersWdgts.at(0)->enter(cursorIndex); | |
52 | selectedReg = 0; |
|
52 | selectedReg = 0; | |
53 | } |
|
53 | } | |
54 | else |
|
54 | else | |
55 | { |
|
55 | { | |
56 | registersWdgts.at(registersWdgts.count()-1)->enter(cursorIndex); |
|
56 | registersWdgts.at(registersWdgts.count()-1)->enter(cursorIndex); | |
57 | selectedReg = registersWdgts.count()-1; |
|
57 | selectedReg = registersWdgts.count()-1; | |
58 | } |
|
58 | } | |
59 | p_timer->start(); |
|
59 | p_timer->start(); | |
60 | this->setFocus(); |
|
60 | this->setFocus(); | |
61 | } |
|
61 | } | |
62 | } |
|
62 | } | |
63 |
|
63 | |||
64 | void peripheralWidget::mousePressEvent(QMouseEvent *event) |
|
64 | void peripheralWidget::mousePressEvent(QMouseEvent *event) | |
65 | { |
|
65 | { | |
66 | p_timer->stop(); |
|
66 | p_timer->stop(); | |
67 | if(selectedReg!=-1) |
|
67 | if(selectedReg!=-1) | |
68 | { |
|
68 | { | |
69 | registersWdgts.at(selectedReg)->leave(); |
|
69 | registersWdgts.at(selectedReg)->leave(); | |
70 | selectedReg = -1; |
|
70 | selectedReg = -1; | |
71 | } |
|
71 | } | |
72 | for(int i=0; i<registersWdgts.count();i++) |
|
72 | for(int i=0; i<registersWdgts.count();i++) | |
73 | { |
|
73 | { | |
74 | if(registersWdgts.at(i)->contains(event->pos())) |
|
74 | if(registersWdgts.at(i)->contains(event->pos())) | |
75 | { |
|
75 | { | |
76 | registersWdgts.at(i)->enter(registersWdgts.at(i)->cursorIndex(event->pos().x())); |
|
76 | registersWdgts.at(i)->enter(registersWdgts.at(i)->cursorIndex(event->pos().x())); | |
77 | selectedReg = i; |
|
77 | selectedReg = i; | |
78 | p_timer->start(); |
|
78 | p_timer->start(); | |
79 | emit clicked(this); |
|
79 | emit clicked(this); | |
80 | } |
|
80 | } | |
81 | } |
|
81 | } | |
82 | repaint(); |
|
82 | repaint(); | |
83 | } |
|
83 | } | |
84 |
|
84 | |||
85 | void peripheralWidget::mouseMoveEvent(QMouseEvent *event) |
|
85 | void peripheralWidget::mouseMoveEvent(QMouseEvent *event) | |
86 | { |
|
86 | { | |
87 | bool match=false; |
|
87 | bool match=false; | |
88 | if(event->buttons()==Qt::LeftButton) |
|
88 | if(event->buttons()==Qt::LeftButton) | |
89 | { |
|
89 | { | |
90 | for(int i=0; i<registersWdgts.count();i++) |
|
90 | for(int i=0; i<registersWdgts.count();i++) | |
91 | { |
|
91 | { | |
92 | if(registersWdgts.at(i)->contains(event->pos())) |
|
92 | if(registersWdgts.at(i)->contains(event->pos())) | |
93 | { |
|
93 | { | |
94 | registersWdgts.at(i)->updateSelection(registersWdgts.at(i)->cursorIndex(event->pos().x())); |
|
94 | registersWdgts.at(i)->updateSelection(registersWdgts.at(i)->cursorIndex(event->pos().x())); | |
95 | } |
|
95 | } | |
96 | } |
|
96 | } | |
97 | } |
|
97 | } | |
98 | else |
|
98 | else | |
99 | { |
|
99 | { | |
100 | for(int i=0; i<registersWdgts.count();i++) |
|
100 | for(int i=0; i<registersWdgts.count();i++) | |
101 | { |
|
101 | { | |
102 | if(registersWdgts.at(i)->contains(event->pos())) |
|
102 | if(registersWdgts.at(i)->contains(event->pos())) | |
103 | { |
|
103 | { | |
104 | match = true; |
|
104 | match = true; | |
105 | int bitfieldIndex=registersWdgts.at(i)->cursorIndex(event->pos().x()); |
|
105 | int bitfieldIndex=registersWdgts.at(i)->cursorIndex(event->pos().x()); | |
106 |
|
106 | |||
107 | QString toolTipText ="<b>< font color='Black'>"+registersWdgts.at(i)->bitFieldName(bitfieldIndex) +"</b><br />"; |
|
107 | QString toolTipText ="<b>< font color='Black'>"+registersWdgts.at(i)->bitFieldName(bitfieldIndex) +"</b><br />"; | |
108 | toolTipText+= "Hexadecimal=<b>< font color='Blue'>"+registersWdgts.at(i)->bitFieldToHex(bitfieldIndex)+"</b>"; |
|
108 | toolTipText+= "Hexadecimal=<b>< font color='Blue'>"+registersWdgts.at(i)->bitFieldToHex(bitfieldIndex)+"</b>"; | |
109 | toolTipText+= " Decimal=<b>< font color='BlueViolet'>"+registersWdgts.at(i)->bitFieldToDec(bitfieldIndex)+"</b><br />"; |
|
109 | toolTipText+= " Decimal=<b>< font color='BlueViolet'>"+registersWdgts.at(i)->bitFieldToDec(bitfieldIndex)+"</b><br />"; | |
110 | toolTipText+= registersWdgts.at(i)->bitFieldDesc(bitfieldIndex); |
|
110 | toolTipText+= registersWdgts.at(i)->bitFieldDesc(bitfieldIndex); | |
111 | QToolTip::showText(event->globalPos(),toolTipText,(QWidget*)this); |
|
111 | QToolTip::showText(event->globalPos(),toolTipText,(QWidget*)this); | |
112 | } |
|
112 | } | |
113 | } |
|
113 | } | |
114 | if(!match)QToolTip::hideText(); |
|
114 | if(!match)QToolTip::hideText(); | |
115 | } |
|
115 | } | |
116 | } |
|
116 | } | |
117 |
|
117 | |||
118 | void peripheralWidget::mouseReleaseEvent(QMouseEvent *event) |
|
118 | void peripheralWidget::mouseReleaseEvent(QMouseEvent *event) | |
119 | { |
|
119 | { | |
120 | Q_UNUSED(event) |
|
120 | Q_UNUSED(event) | |
121 | } |
|
121 | } | |
122 |
|
122 | |||
123 | void peripheralWidget::keyPressEvent(QKeyEvent *event) |
|
123 | void peripheralWidget::keyPressEvent(QKeyEvent *event) | |
124 | { |
|
124 | { | |
125 | if(this->selectedReg!=-1){ |
|
125 | if(this->selectedReg!=-1){ | |
126 | if(event->modifiers()==Qt::ControlModifier) |
|
126 | if(event->modifiers()==Qt::ControlModifier) | |
127 | { |
|
127 | { | |
128 | switch(event->key()) |
|
128 | switch(event->key()) | |
129 | { |
|
129 | { | |
130 | case Qt::Key_Up: |
|
130 | case Qt::Key_Up: | |
131 | registersWdgts.at(selectedReg)->set(registersWdgts.at(selectedReg)->cursorIndex()); |
|
131 | registersWdgts.at(selectedReg)->set(registersWdgts.at(selectedReg)->cursorIndex()); | |
132 | break; |
|
132 | break; | |
133 | case Qt::Key_Down: |
|
133 | case Qt::Key_Down: | |
134 | registersWdgts.at(selectedReg)->clear(registersWdgts.at(selectedReg)->cursorIndex()); |
|
134 | registersWdgts.at(selectedReg)->clear(registersWdgts.at(selectedReg)->cursorIndex()); | |
135 | break; |
|
135 | break; | |
136 | case Qt::Key_W: |
|
136 | case Qt::Key_W: | |
137 | emit writeRegSig(registersWdgts.at(selectedReg)->address(),registersWdgts.at(selectedReg)->value()); |
|
137 | emit writeRegSig(registersWdgts.at(selectedReg)->address(),registersWdgts.at(selectedReg)->value()); | |
|
138 | registersWdgts.at(selectedReg)->setUpdated(true); | |||
|
139 | registersWdgts.at(selectedReg)->repaint(); | |||
138 | break; |
|
140 | break; | |
139 | case Qt::Key_R: |
|
141 | case Qt::Key_R: | |
140 | qint32 value; |
|
142 | qint32 value; | |
141 | value = emit readRegSig(registersWdgts.at(selectedReg)->address()); |
|
143 | value = emit readRegSig(registersWdgts.at(selectedReg)->address()); | |
142 | registersWdgts.at(selectedReg)->setValue(value); |
|
144 | registersWdgts.at(selectedReg)->setValue(value); | |
143 | break; |
|
145 | break; | |
144 | default: |
|
146 | default: | |
145 | break; |
|
147 | break; | |
146 | } |
|
148 | } | |
147 | } |
|
149 | } | |
148 | else |
|
150 | else | |
149 | { |
|
151 | { | |
150 | switch(event->key()) |
|
152 | switch(event->key()) | |
151 | { |
|
153 | { | |
152 | case Qt::Key_0: |
|
154 | case Qt::Key_0: | |
153 | registersWdgts.at(selectedReg)->clear(registersWdgts.at(selectedReg)->cursorIndex()); |
|
155 | registersWdgts.at(selectedReg)->clear(registersWdgts.at(selectedReg)->cursorIndex()); | |
154 | registersWdgts.at(selectedReg)->moveCursorRight(1); |
|
156 | registersWdgts.at(selectedReg)->moveCursorRight(1); | |
155 | break; |
|
157 | break; | |
156 | case Qt::Key_1: |
|
158 | case Qt::Key_1: | |
157 | registersWdgts.at(selectedReg)->set(registersWdgts.at(selectedReg)->cursorIndex()); |
|
159 | registersWdgts.at(selectedReg)->set(registersWdgts.at(selectedReg)->cursorIndex()); | |
158 | registersWdgts.at(selectedReg)->moveCursorRight(1); |
|
160 | registersWdgts.at(selectedReg)->moveCursorRight(1); | |
159 | break; |
|
161 | break; | |
160 | case Qt::Key_Right: |
|
162 | case Qt::Key_Right: | |
161 | registersWdgts.at(selectedReg)->moveCursorRight(1); |
|
163 | registersWdgts.at(selectedReg)->moveCursorRight(1); | |
162 | this->repaint(); |
|
164 | this->repaint(); | |
163 | break; |
|
165 | break; | |
164 | case Qt::Key_Left: |
|
166 | case Qt::Key_Left: | |
165 | registersWdgts.at(selectedReg)->moveCursorLeft(1); |
|
167 | registersWdgts.at(selectedReg)->moveCursorLeft(1); | |
166 | this->repaint(); |
|
168 | this->repaint(); | |
167 | break; |
|
169 | break; | |
168 | case Qt::Key_Up: |
|
170 | case Qt::Key_Up: | |
169 | up(); |
|
171 | up(); | |
170 | break; |
|
172 | break; | |
171 | case Qt::Key_Down: |
|
173 | case Qt::Key_Down: | |
172 | down(); |
|
174 | down(); | |
173 | break; |
|
175 | break; | |
|
176 | case Qt::Key_W: | |||
|
177 | emit writeRegSig(registersWdgts.at(selectedReg)->address(),registersWdgts.at(selectedReg)->value()); | |||
|
178 | registersWdgts.at(selectedReg)->setUpdated(true); | |||
|
179 | registersWdgts.at(selectedReg)->repaint(); | |||
|
180 | break; | |||
|
181 | case Qt::Key_R: | |||
|
182 | qint32 value; | |||
|
183 | value = emit readRegSig(registersWdgts.at(selectedReg)->address()); | |||
|
184 | registersWdgts.at(selectedReg)->setValue(value); | |||
|
185 | break; | |||
174 | default: |
|
186 | default: | |
175 | break; |
|
187 | break; | |
176 | } |
|
188 | } | |
177 | } |
|
189 | } | |
178 |
|
190 | |||
179 | } |
|
191 | } | |
180 | } |
|
192 | } | |
181 |
|
193 | |||
182 | void peripheralWidget::paintEvent(QPaintEvent *event) |
|
194 | void peripheralWidget::paintEvent(QPaintEvent *event) | |
183 | { |
|
195 | { | |
184 | Q_UNUSED(event) |
|
196 | Q_UNUSED(event) | |
185 |
|
197 | |||
186 | QPainter painter(this); |
|
198 | QPainter painter(this); | |
187 | QPoint offset=QPoint(0,0); |
|
199 | QPoint offset=QPoint(0,0); | |
188 | int nameWidth = fontMetrics().width(p_header); |
|
200 | int nameWidth = fontMetrics().width(p_header); | |
189 | if(registersWdgts.count()==0) |
|
201 | if(registersWdgts.count()==0) | |
190 | { |
|
202 | { | |
191 | setMinimumSize(2*nameWidth+10,fontMetrics().height()+10); |
|
203 | setMinimumSize(2*nameWidth+10,fontMetrics().height()+10); | |
192 | } |
|
204 | } | |
193 | painter.drawText((this->minimumWidth()/2)-nameWidth,4,fontMetrics().width(p_header),fontMetrics().height()+4,Qt::AlignCenter,p_header); |
|
205 | painter.drawText((this->minimumWidth()/2)-nameWidth,4,fontMetrics().width(p_header),fontMetrics().height()+4,Qt::AlignCenter,p_header); | |
194 | offset+=QPoint(0,fontMetrics().height()+8); |
|
206 | offset+=QPoint(0,fontMetrics().height()+8); | |
195 | for(int i=0;i<registersWdgts.count();i++) |
|
207 | for(int i=0;i<registersWdgts.count();i++) | |
196 | { |
|
208 | { | |
197 | offset = registersWdgts.at(i)->paint(&painter,offset); |
|
209 | offset = registersWdgts.at(i)->paint(&painter,offset); | |
198 | } |
|
210 | } | |
199 | if(registersWdgts.count()>0) |
|
211 | if(registersWdgts.count()>0) | |
200 | { |
|
212 | { | |
201 | setMinimumSize(registersWdgts.first()->boundingRect().width(),offset.y()); |
|
213 | setMinimumSize(registersWdgts.first()->boundingRect().width(),offset.y()); | |
202 | } |
|
214 | } | |
203 | updateGeometry(); |
|
215 | updateGeometry(); | |
204 |
|
216 | |||
205 | } |
|
217 | } | |
206 |
|
218 | |||
207 | void peripheralWidget::up() |
|
219 | void peripheralWidget::up() | |
208 | { |
|
220 | { | |
209 | if(selectedReg!=-1) |
|
221 | if(selectedReg!=-1) | |
210 | { |
|
222 | { | |
211 | if(selectedReg >0) |
|
223 | if(selectedReg >0) | |
212 | { |
|
224 | { | |
213 | registersWdgts.at(selectedReg-1)->enter(registersWdgts.at(selectedReg)->cursorIndex()); |
|
225 | registersWdgts.at(selectedReg-1)->enter(registersWdgts.at(selectedReg)->cursorIndex()); | |
214 | registersWdgts.at(selectedReg)->leave(); |
|
226 | registersWdgts.at(selectedReg)->leave(); | |
215 | selectedReg-=1; |
|
227 | selectedReg-=1; | |
216 | repaint(); |
|
228 | repaint(); | |
217 | } |
|
229 | } | |
218 | else |
|
230 | else | |
219 | { |
|
231 | { | |
220 | emit upSig(this,registersWdgts.at(selectedReg)->cursorIndex()); |
|
232 | emit upSig(this,registersWdgts.at(selectedReg)->cursorIndex()); | |
221 | } |
|
233 | } | |
222 | } |
|
234 | } | |
223 | } |
|
235 | } | |
224 |
|
236 | |||
225 | void peripheralWidget::down() |
|
237 | void peripheralWidget::down() | |
226 | { |
|
238 | { | |
227 | if(selectedReg!=-1) |
|
239 | if(selectedReg!=-1) | |
228 | { |
|
240 | { | |
229 | if(selectedReg <(registersWdgts.count()-1)) |
|
241 | if(selectedReg <(registersWdgts.count()-1)) | |
230 | { |
|
242 | { | |
231 | registersWdgts.at(selectedReg+1)->enter(registersWdgts.at(selectedReg)->cursorIndex()); |
|
243 | registersWdgts.at(selectedReg+1)->enter(registersWdgts.at(selectedReg)->cursorIndex()); | |
232 | registersWdgts.at(selectedReg)->leave(); |
|
244 | registersWdgts.at(selectedReg)->leave(); | |
233 | selectedReg+=1; |
|
245 | selectedReg+=1; | |
234 | repaint(); |
|
246 | repaint(); | |
235 | } |
|
247 | } | |
236 | else |
|
248 | else | |
237 | { |
|
249 | { | |
238 | emit downSig(this,registersWdgts.at(selectedReg)->cursorIndex()); |
|
250 | emit downSig(this,registersWdgts.at(selectedReg)->cursorIndex()); | |
239 | } |
|
251 | } | |
240 | } |
|
252 | } | |
241 | } |
|
253 | } |
@@ -1,393 +1,411 | |||||
1 | #include "registerwidget.h" |
|
1 | #include "registerwidget.h" | |
2 | #include <QPaintEvent> |
|
2 | #include <QPaintEvent> | |
3 | #include <QPainter> |
|
3 | #include <QPainter> | |
4 |
|
4 | |||
5 | registerWidget::registerWidget(const QString &name, qint32 address, QObject *parent) : |
|
5 | registerWidget::registerWidget(const QString &name, qint32 address, QObject *parent) : | |
6 | QObject(parent) |
|
6 | QObject(parent) | |
7 | { |
|
7 | { | |
8 | p_address = address; |
|
8 | p_address = address; | |
9 | p_value = 0; |
|
9 | p_value = 0; | |
10 | p_addressEl = new regWidgetElement(QString("0x%1").arg((uint)p_address,8,16).replace(" ","0"),QFont("Utopia", 12),10,4); |
|
10 | p_addressEl = new regWidgetElement(QString("0x%1").arg((uint)p_address,8,16).replace(" ","0"),QFont("Utopia", 12),10,4); | |
11 | p_fieldsEl = new bitfieldsElement(QString("%1").arg((uint)p_value,32,2).replace(" ","0"),QFont("Utopia", 12),4,4); |
|
11 | p_fieldsEl = new bitfieldsElement(QString("%1").arg((uint)p_value,32,2).replace(" ","0"),QFont("Utopia", 12),4,4); | |
12 | p_nameEl = new regWidgetElement(name,QFont("Utopia", 12,QFont::Bold),4,4); |
|
12 | p_nameEl = new regWidgetElement(name,QFont("Utopia", 12,QFont::Bold),4,4); | |
13 | p_xMargins = 4; |
|
13 | p_xMargins = 4; | |
14 | p_yMargins = 6; |
|
14 | p_yMargins = 6; | |
15 | updateBoundingRect(); |
|
15 | updateBoundingRect(); | |
16 | } |
|
16 | } | |
17 |
|
17 | |||
18 | registerWidget::~registerWidget() |
|
18 | registerWidget::~registerWidget() | |
19 | { |
|
19 | { | |
20 | delete p_addressEl; |
|
20 | delete p_addressEl; | |
21 | delete p_fieldsEl; |
|
21 | delete p_fieldsEl; | |
22 | delete p_nameEl; |
|
22 | delete p_nameEl; | |
23 | } |
|
23 | } | |
24 |
|
24 | |||
25 | int registerWidget::contains(const QPointF &point) |
|
25 | int registerWidget::contains(const QPointF &point) | |
26 | { |
|
26 | { | |
27 | return p_boundingRect.contains(point.x(),point.y()); |
|
27 | return p_boundingRect.contains(point.x(),point.y()); | |
28 | } |
|
28 | } | |
29 |
|
29 | |||
30 | QPoint registerWidget::paint(QPainter* painter, QPoint offset) |
|
30 | QPoint registerWidget::paint(QPainter* painter, QPoint offset) | |
31 | { |
|
31 | { | |
32 | painter->save(); |
|
32 | painter->save(); | |
33 | painter->translate(offset); |
|
33 | painter->translate(offset); | |
34 | p_boundingRect.moveTopLeft(offset); |
|
34 | p_boundingRect.moveTopLeft(offset); | |
35 | painter->translate(p_addressEl->paint(painter)); |
|
35 | painter->translate(p_addressEl->paint(painter)); | |
36 | painter->translate(p_fieldsEl->paint(painter)); |
|
36 | painter->translate(p_fieldsEl->paint(painter)); | |
37 | p_nameEl->paint(painter); |
|
37 | p_nameEl->paint(painter); | |
38 | painter->restore(); |
|
38 | painter->restore(); | |
39 | return QPoint(0,p_boundingRect.height()+p_boundingRect.y()+p_yMargins); |
|
39 | return QPoint(0,p_boundingRect.height()+p_boundingRect.y()+p_yMargins); | |
40 | } |
|
40 | } | |
41 |
|
41 | |||
42 | QRect registerWidget::boundingRect() |
|
42 | QRect registerWidget::boundingRect() | |
43 | { |
|
43 | { | |
44 | return p_boundingRect; |
|
44 | return p_boundingRect; | |
45 | } |
|
45 | } | |
46 |
|
46 | |||
47 | uint registerWidget::cursorIndex() |
|
47 | uint registerWidget::cursorIndex() | |
48 | { |
|
48 | { | |
49 | return p_fieldsEl->cursorIndex(); |
|
49 | return p_fieldsEl->cursorIndex(); | |
50 | } |
|
50 | } | |
51 |
|
51 | |||
52 | uint registerWidget::cursorIndex(int xPos) |
|
52 | uint registerWidget::cursorIndex(int xPos) | |
53 | { |
|
53 | { | |
54 | if(xPos>p_addressEl->boundingRect().width() && xPos<(p_addressEl->boundingRect().width()+p_fieldsEl->boundingRect().width())) |
|
54 | if(xPos>p_addressEl->boundingRect().width() && xPos<(p_addressEl->boundingRect().width()+p_fieldsEl->boundingRect().width())) | |
55 | { |
|
55 | { | |
56 | return p_fieldsEl->cursorIndex(xPos-p_addressEl->boundingRect().width()); |
|
56 | return p_fieldsEl->cursorIndex(xPos-p_addressEl->boundingRect().width()); | |
57 | } |
|
57 | } | |
58 | return 0; |
|
58 | return 0; | |
59 | } |
|
59 | } | |
60 |
|
60 | |||
61 | void registerWidget::updateSelection(int index) |
|
61 | void registerWidget::updateSelection(int index) | |
62 | { |
|
62 | { | |
63 | p_fieldsEl->updateSelection(index); |
|
63 | p_fieldsEl->updateSelection(index); | |
64 | emit this->repaint(); |
|
64 | emit this->repaint(); | |
65 | } |
|
65 | } | |
66 |
|
66 | |||
67 | qint32 registerWidget::address() |
|
67 | qint32 registerWidget::address() | |
68 | { |
|
68 | { | |
69 | return p_address; |
|
69 | return p_address; | |
70 | } |
|
70 | } | |
71 |
|
71 | |||
72 | qint32 registerWidget::value() |
|
72 | qint32 registerWidget::value() | |
73 | { |
|
73 | { | |
74 | return p_value; |
|
74 | return p_value; | |
75 | } |
|
75 | } | |
76 |
|
76 | |||
77 | void registerWidget::setBitFieldAttribute(uint startIndex, uint stopIndex, const QString &name, const QString &description, bool rw) |
|
77 | void registerWidget::setBitFieldAttribute(uint startIndex, uint stopIndex, const QString &name, const QString &description, bool rw) | |
78 | { |
|
78 | { | |
79 | if(startIndex<=stopIndex && stopIndex<32) |
|
79 | if(startIndex<=stopIndex && stopIndex<32) | |
80 | { |
|
80 | { | |
81 | int index= p_fieldsEl->addAttribute(name,description,rw ); |
|
81 | int index= p_fieldsEl->addAttribute(name,description,rw ); | |
82 | for(uint i=startIndex;i<=stopIndex;i++) |
|
82 | for(uint i=startIndex;i<=stopIndex;i++) | |
83 | { |
|
83 | { | |
84 | p_fieldsEl->setAttribute(i,index); |
|
84 | p_fieldsEl->setAttribute(i,index); | |
85 | } |
|
85 | } | |
86 | } |
|
86 | } | |
87 | } |
|
87 | } | |
88 |
|
88 | |||
89 | QString registerWidget::bitFieldDesc(int bitIndex) |
|
89 | QString registerWidget::bitFieldDesc(int bitIndex) | |
90 | { |
|
90 | { | |
91 | if(bitIndex>=0 && bitIndex<32) |
|
91 | if(bitIndex>=0 && bitIndex<32) | |
92 | { |
|
92 | { | |
93 | return p_fieldsEl->description(bitIndex); |
|
93 | return p_fieldsEl->description(bitIndex); | |
94 | } |
|
94 | } | |
95 | return QString("Out of range"); |
|
95 | return QString("Out of range"); | |
96 | } |
|
96 | } | |
97 |
|
97 | |||
98 | QString registerWidget::bitFieldName(int bitIndex) |
|
98 | QString registerWidget::bitFieldName(int bitIndex) | |
99 | { |
|
99 | { | |
100 | if(bitIndex>=0 && bitIndex<32) |
|
100 | if(bitIndex>=0 && bitIndex<32) | |
101 | { |
|
101 | { | |
102 | return p_fieldsEl->name(bitIndex); |
|
102 | return p_fieldsEl->name(bitIndex); | |
103 | } |
|
103 | } | |
104 | return QString("Out of range"); |
|
104 | return QString("Out of range"); | |
105 | } |
|
105 | } | |
106 |
|
106 | |||
107 | QString registerWidget::bitFieldToHex(int bitIndex) |
|
107 | QString registerWidget::bitFieldToHex(int bitIndex) | |
108 | { |
|
108 | { | |
109 | if(bitIndex>=0 && bitIndex<32) |
|
109 | if(bitIndex>=0 && bitIndex<32) | |
110 | { |
|
110 | { | |
111 | return p_fieldsEl->valueHex(bitIndex); |
|
111 | return p_fieldsEl->valueHex(bitIndex); | |
112 | } |
|
112 | } | |
113 | return QString("Out of range"); |
|
113 | return QString("Out of range"); | |
114 | } |
|
114 | } | |
115 |
|
115 | |||
116 | QString registerWidget::bitFieldToDec(int bitIndex) |
|
116 | QString registerWidget::bitFieldToDec(int bitIndex) | |
117 | { |
|
117 | { | |
118 | if(bitIndex>=0 && bitIndex<32) |
|
118 | if(bitIndex>=0 && bitIndex<32) | |
119 | { |
|
119 | { | |
120 | return p_fieldsEl->valueDec(bitIndex); |
|
120 | return p_fieldsEl->valueDec(bitIndex); | |
121 | } |
|
121 | } | |
122 | return QString("Out of range"); |
|
122 | return QString("Out of range"); | |
123 | } |
|
123 | } | |
124 |
|
124 | |||
125 | QString registerWidget::bitFieldToBin(int bitIndex) |
|
125 | QString registerWidget::bitFieldToBin(int bitIndex) | |
126 | { |
|
126 | { | |
127 | if(bitIndex>=0 && bitIndex<32) |
|
127 | if(bitIndex>=0 && bitIndex<32) | |
128 | { |
|
128 | { | |
129 | // TODO do the convertion |
|
129 | // TODO do the convertion | |
130 | return p_fieldsEl->valueDec(bitIndex); |
|
130 | return p_fieldsEl->valueDec(bitIndex); | |
131 | } |
|
131 | } | |
132 | return QString("Out of range"); |
|
132 | return QString("Out of range"); | |
133 | } |
|
133 | } | |
134 |
|
134 | |||
135 | void registerWidget::setValue(qint32 value) |
|
135 | void registerWidget::setValue(qint32 value, bool updated) | |
136 | { |
|
136 | { | |
137 | this->p_value = value; |
|
137 | this->p_value = value; | |
138 | this->p_fieldsEl->setValue(QString("%1").arg((uint)p_value,32,2).replace(" ","0")); |
|
138 | this->p_fieldsEl->setValue(QString("%1").arg((uint)p_value,32,2).replace(" ","0")); | |
|
139 | this->p_fieldsEl->setUpdated(updated); | |||
139 | emit this->repaint(); |
|
140 | emit this->repaint(); | |
140 | } |
|
141 | } | |
141 |
|
142 | |||
142 | void registerWidget::blinkCursor() |
|
143 | void registerWidget::blinkCursor() | |
143 | { |
|
144 | { | |
144 | p_fieldsEl->blinkCursor(); |
|
145 | p_fieldsEl->blinkCursor(); | |
145 | //repaint(); |
|
146 | //repaint(); | |
146 | } |
|
147 | } | |
147 |
|
148 | |||
148 | void registerWidget::moveCursorLeft(int count) |
|
149 | void registerWidget::moveCursorLeft(int count) | |
149 | { |
|
150 | { | |
150 | p_fieldsEl->moveCursorLeft(count); |
|
151 | p_fieldsEl->moveCursorLeft(count); | |
151 | p_fieldsEl->blinkCursor(); |
|
152 | p_fieldsEl->blinkCursor(); | |
152 | } |
|
153 | } | |
153 |
|
154 | |||
154 | void registerWidget::moveCursorRight(int count) |
|
155 | void registerWidget::moveCursorRight(int count) | |
155 | { |
|
156 | { | |
156 | p_fieldsEl->moveCursorRight(count); |
|
157 | p_fieldsEl->moveCursorRight(count); | |
157 | p_fieldsEl->blinkCursor(); |
|
158 | p_fieldsEl->blinkCursor(); | |
158 | } |
|
159 | } | |
159 |
|
160 | |||
160 | void registerWidget::enter(int index) |
|
161 | void registerWidget::enter(int index) | |
161 | { |
|
162 | { | |
162 | p_fieldsEl->enter(index); |
|
163 | p_fieldsEl->enter(index); | |
163 | } |
|
164 | } | |
164 |
|
165 | |||
165 | void registerWidget::leave() |
|
166 | void registerWidget::leave() | |
166 | { |
|
167 | { | |
167 | p_fieldsEl->leave(); |
|
168 | p_fieldsEl->leave(); | |
168 | } |
|
169 | } | |
169 |
|
170 | |||
170 | void registerWidget::clear(int index) |
|
171 | void registerWidget::clear(int index) | |
171 | { |
|
172 | { | |
172 | p_value &= ~(1<<index); |
|
173 | if(!this->p_fieldsEl->readonly(index)) | |
173 | this->p_fieldsEl->setValue(QString("%1").arg((uint)p_value,32,2).replace(" ","0")); |
|
174 | { | |
174 | emit this->repaint(); |
|
175 | qint32 old = p_value; | |
|
176 | p_value &= ~(1<<index); | |||
|
177 | if(old!=p_value) | |||
|
178 | p_fieldsEl->setUpdated(false); | |||
|
179 | this->p_fieldsEl->setValue(QString("%1").arg((uint)p_value,32,2).replace(" ","0")); | |||
|
180 | emit this->repaint(); | |||
|
181 | } | |||
175 | } |
|
182 | } | |
176 |
|
183 | |||
177 | void registerWidget::set(int index) |
|
184 | void registerWidget::set(int index) | |
178 | { |
|
185 | { | |
179 | if(!this->p_fieldsEl->readonly(index)) |
|
186 | if(!this->p_fieldsEl->readonly(index)) | |
180 | { |
|
187 | { | |
|
188 | qint32 old = p_value; | |||
181 | p_value |= 1<<index; |
|
189 | p_value |= 1<<index; | |
|
190 | if(old!=p_value) | |||
|
191 | p_fieldsEl->setUpdated(false); | |||
182 | this->p_fieldsEl->setValue(QString("%1").arg((uint)p_value,32,2).replace(" ","0")); |
|
192 | this->p_fieldsEl->setValue(QString("%1").arg((uint)p_value,32,2).replace(" ","0")); | |
183 | emit this->repaint(); |
|
193 | emit this->repaint(); | |
184 | } |
|
194 | } | |
185 | } |
|
195 | } | |
186 |
|
196 | |||
187 | void registerWidget::updateBoundingRect() |
|
197 | void registerWidget::updateBoundingRect() | |
188 | { |
|
198 | { | |
189 | p_boundingRect.setHeight(p_fieldsEl->boundingRect().height()+(p_yMargins*2)); |
|
199 | p_boundingRect.setHeight(p_fieldsEl->boundingRect().height()+(p_yMargins*2)); | |
190 | p_boundingRect.setWidth(p_fieldsEl->boundingRect().width()+p_addressEl->boundingRect().width()+p_nameEl->boundingRect().width()+(p_xMargins*2)); |
|
200 | p_boundingRect.setWidth(p_fieldsEl->boundingRect().width()+p_addressEl->boundingRect().width()+p_nameEl->boundingRect().width()+(p_xMargins*2)); | |
191 | } |
|
201 | } | |
192 |
|
202 | |||
193 |
|
203 | |||
194 |
|
204 | |||
195 | bitfieldsElement::bitfieldsElement(const QString &value, QFont font, int xMargin, int yMargin) |
|
205 | bitfieldsElement::bitfieldsElement(const QString &value, QFont font, int xMargin, int yMargin) | |
196 | :regWidgetElement(value,font,xMargin,yMargin) |
|
206 | :regWidgetElement(value,font,xMargin,yMargin) | |
197 | { |
|
207 | { | |
198 | this->attributesLUT.append(new bitFieldAttribute(false,"UNSUSED","UNSUSED")); |
|
208 | this->attributesLUT.append(new bitFieldAttribute(false,"UNSUSED","UNSUSED")); | |
199 | for(int i=0;i<32;i++) |
|
209 | for(int i=0;i<32;i++) | |
200 | { |
|
210 | { | |
201 | attributesIndex[i] = 0; |
|
211 | attributesIndex[i] = 0; | |
202 | } |
|
212 | } | |
203 | p_startSelectionIndex = -1; |
|
213 | p_startSelectionIndex = -1; | |
204 | p_stopSelectionIndex = -1; |
|
214 | p_stopSelectionIndex = -1; | |
205 | p_cursorIndex = -1; |
|
215 | p_cursorIndex = -1; | |
206 | p_dx=QFontMetrics(p_font).width("0")+4; |
|
216 | p_dx=QFontMetrics(p_font).width("0")+4; | |
207 | p_blinkTextBgColor = QColor(Qt::black); |
|
217 | p_blinkTextBgColor = QColor(Qt::black); | |
208 | p_blinkTextColor = QColor(Qt::white); |
|
218 | p_blinkTextColor = QColor(Qt::white); | |
|
219 | p_outdated = QColor(Qt::red); | |||
209 | p_cursorBlinkEnable = false; |
|
220 | p_cursorBlinkEnable = false; | |
|
221 | p_changed = false; | |||
210 | updateBoundingRect(); |
|
222 | updateBoundingRect(); | |
211 | } |
|
223 | } | |
212 |
|
224 | |||
213 | QPoint bitfieldsElement::paint(QPainter *painter) |
|
225 | QPoint bitfieldsElement::paint(QPainter *painter) | |
214 | { |
|
226 | { | |
215 | painter->fillRect(4,4,p_boundingRec.width(),p_boundingRec.height(),Qt::darkGray); |
|
227 | painter->fillRect(4,4,p_boundingRec.width(),p_boundingRec.height(),Qt::darkGray); | |
216 | painter->fillRect(0,0,p_boundingRec.width(),p_boundingRec.height(),Qt::white); |
|
228 | painter->fillRect(0,0,p_boundingRec.width(),p_boundingRec.height(),Qt::white); | |
217 | painter->setFont(p_font); |
|
229 | painter->setFont(p_font); | |
218 | int lastAttributeIndex = attributesIndex[31]; |
|
230 | int lastAttributeIndex = attributesIndex[31]; | |
219 | int xpos=p_xMargins; |
|
231 | int xpos=p_xMargins; | |
220 | for(int i=0;i<(32/4);i++) |
|
232 | for(int i=0;i<(32/4);i++) | |
221 | { |
|
233 | { | |
222 | for(int l = 0;l<4;l++) |
|
234 | for(int l = 0;l<4;l++) | |
223 | { |
|
235 | { | |
224 | if(p_cursorBlinkEnable == false || (31-(int)p_cursorIndex) != ((i*4)+l)) |
|
236 | if(p_cursorBlinkEnable == false || (31-(int)p_cursorIndex) != ((i*4)+l)) | |
225 | { |
|
237 | { | |
226 | if((int)p_startSelectionIndex!=-1 && (int)p_stopSelectionIndex!=-1 && p_startSelectionIndex <=(uint)31-(uint)((i*4)+l) && p_stopSelectionIndex >=(uint)31-(uint)((i*4)+l)) |
|
238 | if((int)p_startSelectionIndex!=-1 && (int)p_stopSelectionIndex!=-1 && p_startSelectionIndex <=(uint)31-(uint)((i*4)+l) && p_stopSelectionIndex >=(uint)31-(uint)((i*4)+l)) | |
227 | { |
|
239 | { | |
228 | QPen svg = painter->pen(); |
|
240 | QPen svg = painter->pen(); | |
229 | painter->setPen(p_blinkTextColor); |
|
241 | painter->setPen(p_blinkTextColor); | |
230 | painter->fillRect(xpos-1,0,p_dx,p_boundingRec.height(),Qt::blue); |
|
242 | painter->fillRect(xpos-1,0,p_dx,p_boundingRec.height(),Qt::blue); | |
231 | painter->drawText(xpos,QFontMetrics(p_font).ascent()+p_yMargins,p_valueStr.at((i*4)+l)); |
|
243 | painter->drawText(xpos,QFontMetrics(p_font).ascent()+p_yMargins,p_valueStr.at((i*4)+l)); | |
232 | painter->setPen(svg); |
|
244 | painter->setPen(svg); | |
233 | } |
|
245 | } | |
234 | else |
|
246 | else | |
235 | { |
|
247 | { | |
236 | if(attributesLUT[attributesIndex[31-((i*4)+l)]]->rw==false) |
|
248 | if(attributesLUT[attributesIndex[31-((i*4)+l)]]->rw==false) | |
237 | { |
|
249 | { | |
238 | painter->fillRect(xpos-1,0,p_dx,p_boundingRec.height(),Qt::lightGray); |
|
250 | painter->fillRect(xpos-1,0,p_dx,p_boundingRec.height(),Qt::lightGray); | |
239 | } |
|
251 | } | |
240 | else |
|
252 | else | |
241 | { |
|
253 | { | |
242 | painter->fillRect(xpos-1,0,p_dx,p_boundingRec.height(),Qt::white); |
|
254 | painter->fillRect(xpos-1,0,p_dx,p_boundingRec.height(),Qt::white); | |
243 | } |
|
255 | } | |
244 | painter->drawText(xpos,QFontMetrics(p_font).ascent()+p_yMargins,p_valueStr.at((i*4)+l)); |
|
256 | painter->drawText(xpos,QFontMetrics(p_font).ascent()+p_yMargins,p_valueStr.at((i*4)+l)); | |
245 | } |
|
257 | } | |
246 | } |
|
258 | } | |
247 | else |
|
259 | else | |
248 | { |
|
260 | { | |
249 | QPen svg = painter->pen(); |
|
261 | QPen svg = painter->pen(); | |
250 | painter->setPen(p_blinkTextColor); |
|
262 | painter->setPen(p_blinkTextColor); | |
251 | painter->fillRect(xpos-1,0,p_dx,p_boundingRec.height(),p_blinkTextBgColor); |
|
263 | painter->fillRect(xpos-1,0,p_dx,p_boundingRec.height(),p_blinkTextBgColor); | |
252 | painter->drawText(xpos,QFontMetrics(p_font).ascent()+p_yMargins,p_valueStr.at((i*4)+l)); |
|
264 | painter->drawText(xpos,QFontMetrics(p_font).ascent()+p_yMargins,p_valueStr.at((i*4)+l)); | |
253 | painter->setPen(svg); |
|
265 | painter->setPen(svg); | |
254 | } |
|
266 | } | |
255 | if(lastAttributeIndex!=attributesIndex[31-((i*4)+l)]) |
|
267 | if(lastAttributeIndex!=attributesIndex[31-((i*4)+l)]) | |
256 | painter->drawLine(xpos-(p_xMargins/2),0,xpos-(p_xMargins/2),p_boundingRec.height()); |
|
268 | painter->drawLine(xpos-(p_xMargins/2),0,xpos-(p_xMargins/2),p_boundingRec.height()); | |
257 | lastAttributeIndex=attributesIndex[31-((i*4)+l)]; |
|
269 | lastAttributeIndex=attributesIndex[31-((i*4)+l)]; | |
258 | xpos+=p_dx; |
|
270 | xpos+=p_dx; | |
259 | } |
|
271 | } | |
260 | if(i==3) |
|
272 | if(i==3) | |
261 | painter->drawLine(xpos+(p_xMargins/2),p_boundingRec.height()-6,xpos+(p_xMargins/2),p_boundingRec.height()+12); |
|
273 | painter->drawLine(xpos+(p_xMargins/2),p_boundingRec.height()-6,xpos+(p_xMargins/2),p_boundingRec.height()+12); | |
262 | else if(i<7) |
|
274 | else if(i<7) | |
263 | painter->drawLine(xpos+(p_xMargins/2),p_boundingRec.height()-6,xpos+(p_xMargins/2),p_boundingRec.height()+6); |
|
275 | painter->drawLine(xpos+(p_xMargins/2),p_boundingRec.height()-6,xpos+(p_xMargins/2),p_boundingRec.height()+6); | |
264 | xpos+=p_xMargins; |
|
276 | xpos+=p_xMargins; | |
265 | } |
|
277 | } | |
|
278 | QPen svg = painter->pen(); | |||
|
279 | if(p_changed) | |||
|
280 | { | |||
|
281 | painter->setPen(p_outdated); | |||
|
282 | } | |||
266 | painter->drawRect(0,0,p_boundingRec.width(),p_boundingRec.height()); |
|
283 | painter->drawRect(0,0,p_boundingRec.width(),p_boundingRec.height()); | |
|
284 | painter->setPen(svg); | |||
267 | return QPoint(p_boundingRec.width()+4+p_xMargins,0); |
|
285 | return QPoint(p_boundingRec.width()+4+p_xMargins,0); | |
268 | } |
|
286 | } | |
269 |
|
287 | |||
270 | void bitfieldsElement::updateBoundingRect() |
|
288 | void bitfieldsElement::updateBoundingRect() | |
271 | { |
|
289 | { | |
272 | p_boundingRec.setHeight(QFontMetrics(p_font).boundingRect(p_valueStr).height()+(p_yMargins*2)); |
|
290 | p_boundingRec.setHeight(QFontMetrics(p_font).boundingRect(p_valueStr).height()+(p_yMargins*2)); | |
273 | int width = (((4*(p_dx)) + p_xMargins) * 8) + (p_xMargins); |
|
291 | int width = (((4*(p_dx)) + p_xMargins) * 8) + (p_xMargins); | |
274 | p_boundingRec.setWidth(width); |
|
292 | p_boundingRec.setWidth(width); | |
275 | } |
|
293 | } | |
276 |
|
294 | |||
277 | void bitfieldsElement::setValue(const QString &value) |
|
295 | void bitfieldsElement::setValue(const QString &value) | |
278 | { |
|
296 | { | |
279 | p_valueStr = value; |
|
297 | p_valueStr = value; | |
280 | updateBoundingRect(); |
|
298 | updateBoundingRect(); | |
281 | } |
|
299 | } | |
282 |
|
300 | |||
283 | void bitfieldsElement::blinkCursor() |
|
301 | void bitfieldsElement::blinkCursor() | |
284 | { |
|
302 | { | |
285 | p_cursorBlinkEnable = !p_cursorBlinkEnable; |
|
303 | p_cursorBlinkEnable = !p_cursorBlinkEnable; | |
286 | } |
|
304 | } | |
287 |
|
305 | |||
288 | void bitfieldsElement::moveCursorLeft(int count) |
|
306 | void bitfieldsElement::moveCursorLeft(int count) | |
289 | { |
|
307 | { | |
290 | p_cursorIndex+=count; |
|
308 | p_cursorIndex+=count; | |
291 | if(31<p_cursorIndex) |
|
309 | if(31<p_cursorIndex) | |
292 | { |
|
310 | { | |
293 | p_cursorIndex = 31; |
|
311 | p_cursorIndex = 31; | |
294 | } |
|
312 | } | |
295 | p_startSelectionIndex = p_cursorIndex; |
|
313 | p_startSelectionIndex = p_cursorIndex; | |
296 | p_stopSelectionIndex = p_cursorIndex; |
|
314 | p_stopSelectionIndex = p_cursorIndex; | |
297 |
|
315 | |||
298 | } |
|
316 | } | |
299 |
|
317 | |||
300 | void bitfieldsElement::moveCursorRight(int count) |
|
318 | void bitfieldsElement::moveCursorRight(int count) | |
301 | { |
|
319 | { | |
302 | p_cursorIndex -= count; |
|
320 | p_cursorIndex -= count; | |
303 | if(31<p_cursorIndex) |
|
321 | if(31<p_cursorIndex) | |
304 | { |
|
322 | { | |
305 | p_cursorIndex = 0; |
|
323 | p_cursorIndex = 0; | |
306 | } |
|
324 | } | |
307 | p_startSelectionIndex = p_cursorIndex; |
|
325 | p_startSelectionIndex = p_cursorIndex; | |
308 | p_stopSelectionIndex = p_cursorIndex; |
|
326 | p_stopSelectionIndex = p_cursorIndex; | |
309 | } |
|
327 | } | |
310 |
|
328 | |||
311 | void bitfieldsElement::enter(int index) |
|
329 | void bitfieldsElement::enter(int index) | |
312 | { |
|
330 | { | |
313 | p_cursorIndex = index; |
|
331 | p_cursorIndex = index; | |
314 | p_cursorBlinkEnable = true; |
|
332 | p_cursorBlinkEnable = true; | |
315 | p_startSelectionIndex = -1; |
|
333 | p_startSelectionIndex = -1; | |
316 | p_stopSelectionIndex = -1; |
|
334 | p_stopSelectionIndex = -1; | |
317 | } |
|
335 | } | |
318 |
|
336 | |||
319 | void bitfieldsElement::leave() |
|
337 | void bitfieldsElement::leave() | |
320 | { |
|
338 | { | |
321 | p_cursorBlinkEnable = false; |
|
339 | p_cursorBlinkEnable = false; | |
322 | p_cursorIndex = -1; |
|
340 | p_cursorIndex = -1; | |
323 | p_startSelectionIndex = -1; |
|
341 | p_startSelectionIndex = -1; | |
324 | p_stopSelectionIndex = -1; |
|
342 | p_stopSelectionIndex = -1; | |
325 | } |
|
343 | } | |
326 |
|
344 | |||
327 | uint bitfieldsElement::cursorIndex() |
|
345 | uint bitfieldsElement::cursorIndex() | |
328 | { |
|
346 | { | |
329 | return p_cursorIndex; |
|
347 | return p_cursorIndex; | |
330 | } |
|
348 | } | |
331 |
|
349 | |||
332 | uint bitfieldsElement::cursorIndex(int xPos) |
|
350 | uint bitfieldsElement::cursorIndex(int xPos) | |
333 | { |
|
351 | { | |
334 | uint index=0; |
|
352 | uint index=0; | |
335 | xPos-=p_xMargins; |
|
353 | xPos-=p_xMargins; | |
336 | if(xPos<p_boundingRec.width()) |
|
354 | if(xPos<p_boundingRec.width()) | |
337 | { |
|
355 | { | |
338 | index = 31 - ((4*xPos)/((4*p_dx)+p_xMargins)); |
|
356 | index = 31 - ((4*xPos)/((4*p_dx)+p_xMargins)); | |
339 | } |
|
357 | } | |
340 | return index; |
|
358 | return index; | |
341 | } |
|
359 | } | |
342 |
|
360 | |||
343 | void bitfieldsElement::setFont(QFont font) |
|
361 | void bitfieldsElement::setFont(QFont font) | |
344 | { |
|
362 | { | |
345 | p_font = font; |
|
363 | p_font = font; | |
346 | p_dx=QFontMetrics(p_font).width("0")+2; |
|
364 | p_dx=QFontMetrics(p_font).width("0")+2; | |
347 | updateBoundingRect(); |
|
365 | updateBoundingRect(); | |
348 | } |
|
366 | } | |
349 |
|
367 | |||
350 | void bitfieldsElement::updateSelection(int index) |
|
368 | void bitfieldsElement::updateSelection(int index) | |
351 | { |
|
369 | { | |
352 | if((int)p_cursorIndex!=-1) |
|
370 | if((int)p_cursorIndex!=-1) | |
353 | { |
|
371 | { | |
354 | if((int)p_startSelectionIndex!=-1 && (int)p_stopSelectionIndex!= -1) |
|
372 | if((int)p_startSelectionIndex!=-1 && (int)p_stopSelectionIndex!= -1) | |
355 | { |
|
373 | { | |
356 | if((uint)index>=p_stopSelectionIndex) |
|
374 | if((uint)index>=p_stopSelectionIndex) | |
357 | { |
|
375 | { | |
358 | p_stopSelectionIndex = index; |
|
376 | p_stopSelectionIndex = index; | |
359 | p_cursorIndex = index; |
|
377 | p_cursorIndex = index; | |
360 | } |
|
378 | } | |
361 | else |
|
379 | else | |
362 | { |
|
380 | { | |
363 | p_startSelectionIndex = index; |
|
381 | p_startSelectionIndex = index; | |
364 | p_cursorIndex = index; |
|
382 | p_cursorIndex = index; | |
365 | } |
|
383 | } | |
366 | } |
|
384 | } | |
367 | else |
|
385 | else | |
368 | { |
|
386 | { | |
369 | if((uint)index>p_cursorIndex) |
|
387 | if((uint)index>p_cursorIndex) | |
370 | { |
|
388 | { | |
371 | p_startSelectionIndex = p_cursorIndex; |
|
389 | p_startSelectionIndex = p_cursorIndex; | |
372 | p_stopSelectionIndex = index; |
|
390 | p_stopSelectionIndex = index; | |
373 | } |
|
391 | } | |
374 | else |
|
392 | else | |
375 | { |
|
393 | { | |
376 | p_startSelectionIndex = index; |
|
394 | p_startSelectionIndex = index; | |
377 | p_stopSelectionIndex = p_cursorIndex; |
|
395 | p_stopSelectionIndex = p_cursorIndex; | |
378 | } |
|
396 | } | |
379 | } |
|
397 | } | |
380 | } |
|
398 | } | |
381 | } |
|
399 | } | |
382 |
|
400 | |||
383 |
|
401 | |||
384 |
|
402 | |||
385 |
|
403 | |||
386 |
|
404 | |||
387 |
|
405 | |||
388 |
|
406 | |||
389 |
|
407 | |||
390 |
|
408 | |||
391 |
|
409 | |||
392 |
|
410 | |||
393 |
|
411 |
@@ -1,226 +1,235 | |||||
1 | #ifndef REGISTERWIDGET_H |
|
1 | #ifndef REGISTERWIDGET_H | |
2 | #define REGISTERWIDGET_H |
|
2 | #define REGISTERWIDGET_H | |
3 | #include <QtWidgets> |
|
3 | #include <QtWidgets> | |
4 | #include <QWidget> |
|
4 | #include <QWidget> | |
5 | #include <QTimer> |
|
5 | #include <QTimer> | |
6 | #if defined(LPPMON_SDK_BUILD) |
|
6 | #if defined(LPPMON_SDK_BUILD) | |
7 | # define LPPMON_SDK_EXPORT Q_DECL_EXPORT |
|
7 | # define LPPMON_SDK_EXPORT Q_DECL_EXPORT | |
8 | #else |
|
8 | #else | |
9 | # define LPPMON_SDK_EXPORT Q_DECL_IMPORT |
|
9 | # define LPPMON_SDK_EXPORT Q_DECL_IMPORT | |
10 | #endif |
|
10 | #endif | |
11 |
|
11 | |||
12 | class LPPMON_SDK_EXPORT regWidgetElement |
|
12 | class LPPMON_SDK_EXPORT regWidgetElement | |
13 | { |
|
13 | { | |
14 | public: |
|
14 | public: | |
15 | regWidgetElement(const QString& value,QFont font,int xMargin,int yMargin) |
|
15 | regWidgetElement(const QString& value,QFont font,int xMargin,int yMargin) | |
16 | { |
|
16 | { | |
17 | p_valueStr = value; |
|
17 | p_valueStr = value; | |
18 | p_font = font; |
|
18 | p_font = font; | |
19 | p_xMargins = xMargin; |
|
19 | p_xMargins = xMargin; | |
20 | p_yMargins = yMargin; |
|
20 | p_yMargins = yMargin; | |
21 | updateBoundingRect(); |
|
21 | updateBoundingRect(); | |
22 | } |
|
22 | } | |
23 | void setValue(const QString& value) |
|
23 | void setValue(const QString& value) | |
24 | { |
|
24 | { | |
25 | p_valueStr = value; |
|
25 | p_valueStr = value; | |
26 | updateBoundingRect(); |
|
26 | updateBoundingRect(); | |
27 | } |
|
27 | } | |
28 | void setFont(QFont font) |
|
28 | void setFont(QFont font) | |
29 | { |
|
29 | { | |
30 | p_font = font; |
|
30 | p_font = font; | |
31 | updateBoundingRect(); |
|
31 | updateBoundingRect(); | |
32 | } |
|
32 | } | |
33 | QSize boundingRect(){return p_boundingRec;} |
|
33 | QSize boundingRect(){return p_boundingRec;} | |
34 | QString value(){return p_valueStr;} |
|
34 | QString value(){return p_valueStr;} | |
35 | const QChar at ( int position ) const{return p_valueStr.at(position);} |
|
35 | const QChar at ( int position ) const{return p_valueStr.at(position);} | |
36 | QFont font(){return p_font;} |
|
36 | QFont font(){return p_font;} | |
37 | int xMargin(){return p_xMargins;} |
|
37 | int xMargin(){return p_xMargins;} | |
38 | int yMargin(){return p_yMargins;} |
|
38 | int yMargin(){return p_yMargins;} | |
39 | QFontMetrics fontMetrics(){return QFontMetrics(p_font);} |
|
39 | QFontMetrics fontMetrics(){return QFontMetrics(p_font);} | |
40 | QPoint paint(QPainter* painter) |
|
40 | QPoint paint(QPainter* painter) | |
41 | { |
|
41 | { | |
42 | painter->setFont(p_font); |
|
42 | painter->setFont(p_font); | |
43 | painter->drawText(0,QFontMetrics(p_font).ascent()+p_yMargins,p_valueStr); |
|
43 | painter->drawText(0,QFontMetrics(p_font).ascent()+p_yMargins,p_valueStr); | |
44 | return QPoint(p_boundingRec.width(),0); |
|
44 | return QPoint(p_boundingRec.width(),0); | |
45 | } |
|
45 | } | |
46 | void updateBoundingRect() |
|
46 | void updateBoundingRect() | |
47 | { |
|
47 | { | |
48 | p_boundingRec.setHeight(QFontMetrics(p_font).boundingRect(p_valueStr).height()+(p_yMargins*2)); |
|
48 | p_boundingRec.setHeight(QFontMetrics(p_font).boundingRect(p_valueStr).height()+(p_yMargins*2)); | |
49 | p_boundingRec.setWidth(QFontMetrics(p_font).boundingRect(p_valueStr).width()+(p_xMargins*2)); |
|
49 | p_boundingRec.setWidth(QFontMetrics(p_font).boundingRect(p_valueStr).width()+(p_xMargins*2)); | |
50 | } |
|
50 | } | |
51 |
|
51 | |||
52 | protected: |
|
52 | protected: | |
53 | QString p_valueStr; |
|
53 | QString p_valueStr; | |
54 | QFont p_font; |
|
54 | QFont p_font; | |
55 | QSize p_boundingRec; |
|
55 | QSize p_boundingRec; | |
56 | int p_xMargins; |
|
56 | int p_xMargins; | |
57 | int p_yMargins; |
|
57 | int p_yMargins; | |
58 | }; |
|
58 | }; | |
59 |
|
59 | |||
60 | class LPPMON_SDK_EXPORT bitfieldsElement: public regWidgetElement |
|
60 | class LPPMON_SDK_EXPORT bitfieldsElement: public regWidgetElement | |
61 | { |
|
61 | { | |
62 | class bitFieldAttribute |
|
62 | class bitFieldAttribute | |
63 | { |
|
63 | { | |
64 | public: |
|
64 | public: | |
65 | bitFieldAttribute(bool rw,QString name,QString description) |
|
65 | bitFieldAttribute(bool rw,QString name,QString description) | |
66 | { |
|
66 | { | |
67 | this->rw = rw; |
|
67 | this->rw = rw; | |
68 | this->Name = name; |
|
68 | this->Name = name; | |
69 | this->description = description; |
|
69 | this->description = description; | |
70 | } |
|
70 | } | |
71 | bool rw; |
|
71 | bool rw; | |
72 | QString description; |
|
72 | QString description; | |
73 | QString Name; |
|
73 | QString Name; | |
74 | }; |
|
74 | }; | |
75 | public: |
|
75 | public: | |
76 | bitfieldsElement(const QString& value,QFont font,int xMargin,int yMargin); |
|
76 | bitfieldsElement(const QString& value,QFont font,int xMargin,int yMargin); | |
77 | QPoint paint(QPainter* painter); |
|
77 | QPoint paint(QPainter* painter); | |
78 |
|
78 | |||
79 | void updateBoundingRect(); |
|
79 | void updateBoundingRect(); | |
80 | void setValue(const QString& value); |
|
80 | void setValue(const QString& value); | |
81 | void blinkCursor(); |
|
81 | void blinkCursor(); | |
82 | void moveCursorLeft(int count); |
|
82 | void moveCursorLeft(int count); | |
83 | void moveCursorRight(int count); |
|
83 | void moveCursorRight(int count); | |
84 | void enter(int index); |
|
84 | void enter(int index); | |
85 | void leave(); |
|
85 | void leave(); | |
86 | uint cursorIndex(); |
|
86 | uint cursorIndex(); | |
87 | uint cursorIndex(int xPos); |
|
87 | uint cursorIndex(int xPos); | |
88 | void setFont(QFont font); |
|
88 | void setFont(QFont font); | |
89 | void updateSelection(int index); |
|
89 | void updateSelection(int index); | |
90 | int addAttribute(const QString& name,const QString& description,bool rw) |
|
90 | int addAttribute(const QString& name,const QString& description,bool rw) | |
91 | { |
|
91 | { | |
92 | attributesLUT.append(new bitFieldAttribute(rw,name,description)); |
|
92 | attributesLUT.append(new bitFieldAttribute(rw,name,description)); | |
93 | return attributesLUT.count()-1; |
|
93 | return attributesLUT.count()-1; | |
94 | } |
|
94 | } | |
95 |
|
95 | |||
96 | int setAttribute(int bitIndex,int attributeIndex) |
|
96 | int setAttribute(int bitIndex,int attributeIndex) | |
97 | { |
|
97 | { | |
98 | if(bitIndex>=0 && bitIndex<32 && attributeIndex>=0 && attributeIndex<(attributesLUT.count())) |
|
98 | if(bitIndex>=0 && bitIndex<32 && attributeIndex>=0 && attributeIndex<(attributesLUT.count())) | |
99 | { |
|
99 | { | |
100 | attributesIndex[bitIndex]=attributeIndex; |
|
100 | attributesIndex[bitIndex]=attributeIndex; | |
101 | return 0; |
|
101 | return 0; | |
102 | } |
|
102 | } | |
103 | return -1; |
|
103 | return -1; | |
104 | } |
|
104 | } | |
105 |
|
105 | |||
106 | QString description(int bitIndex) |
|
106 | QString description(int bitIndex) | |
107 | { |
|
107 | { | |
108 | if(bitIndex>=0 && bitIndex<32) |
|
108 | if(bitIndex>=0 && bitIndex<32) | |
109 | return attributesLUT.at(attributesIndex[bitIndex])->description; |
|
109 | return attributesLUT.at(attributesIndex[bitIndex])->description; | |
110 | return QString(""); |
|
110 | return QString(""); | |
111 | } |
|
111 | } | |
112 | QString name(int bitIndex) |
|
112 | QString name(int bitIndex) | |
113 | { |
|
113 | { | |
114 | if(bitIndex>=0 && bitIndex<32) |
|
114 | if(bitIndex>=0 && bitIndex<32) | |
115 | return attributesLUT.at(attributesIndex[bitIndex])->Name; |
|
115 | return attributesLUT.at(attributesIndex[bitIndex])->Name; | |
116 | return QString(""); |
|
116 | return QString(""); | |
117 | } |
|
117 | } | |
118 | bool readonly(int bitIndex) |
|
118 | bool readonly(int bitIndex) | |
119 | { |
|
119 | { | |
120 | if(bitIndex>=0 && bitIndex<32) |
|
120 | if(bitIndex>=0 && bitIndex<32) | |
121 | return !attributesLUT.at(attributesIndex[bitIndex])->rw; |
|
121 | return !attributesLUT.at(attributesIndex[bitIndex])->rw; | |
122 | return false; |
|
122 | return false; | |
123 | } |
|
123 | } | |
124 | QString valueHex(int index) |
|
124 | QString valueHex(int index) | |
125 | { |
|
125 | { | |
126 | if(index>=0 && index<32) |
|
126 | if(index>=0 && index<32) | |
127 | { |
|
127 | { | |
128 | return "0x" + QString::number(p_valueUint(index),16); |
|
128 | return "0x" + QString::number(p_valueUint(index),16); | |
129 | } |
|
129 | } | |
130 | return QString(""); |
|
130 | return QString(""); | |
131 | } |
|
131 | } | |
132 | QString valueDec(int index) |
|
132 | QString valueDec(int index) | |
133 | { |
|
133 | { | |
134 | if(index>=0 && index<32) |
|
134 | if(index>=0 && index<32) | |
135 | { |
|
135 | { | |
136 | return QString::number(p_valueUint(index),10); |
|
136 | return QString::number(p_valueUint(index),10); | |
137 | } |
|
137 | } | |
138 | return QString(""); |
|
138 | return QString(""); | |
139 | } |
|
139 | } | |
|
140 | void setUpdated(bool updated=true) | |||
|
141 | { | |||
|
142 | this->p_changed = !updated; | |||
|
143 | } | |||
140 | private: |
|
144 | private: | |
141 | uint p_valueUint(int index) |
|
145 | uint p_valueUint(int index) | |
142 | { |
|
146 | { | |
143 | uint value; |
|
147 | uint value; | |
144 | int attributeIndex = attributesIndex[index]; |
|
148 | int attributeIndex = attributesIndex[index]; | |
145 | int startIndex = index; |
|
149 | int startIndex = index; | |
146 | int stopIndex=0; |
|
150 | int stopIndex=0; | |
147 | while (startIndex>0) |
|
151 | while (startIndex>0) | |
148 | { |
|
152 | { | |
149 | if(attributesIndex[startIndex-1]==attributeIndex) |
|
153 | if(attributesIndex[startIndex-1]==attributeIndex) | |
150 | startIndex--; |
|
154 | startIndex--; | |
151 | else |
|
155 | else | |
152 | break; |
|
156 | break; | |
153 | } |
|
157 | } | |
154 | stopIndex = startIndex; |
|
158 | stopIndex = startIndex; | |
155 | while (stopIndex<32) |
|
159 | while (stopIndex<32) | |
156 | { |
|
160 | { | |
157 | if(attributesIndex[stopIndex+1]==attributeIndex) |
|
161 | if(attributesIndex[stopIndex+1]==attributeIndex) | |
158 | stopIndex++; |
|
162 | stopIndex++; | |
159 | else |
|
163 | else | |
160 | break; |
|
164 | break; | |
161 | } |
|
165 | } | |
162 | bool ok; |
|
166 | bool ok; | |
163 | value = p_valueStr.toUInt(&ok,2); |
|
167 | value = p_valueStr.toUInt(&ok,2); | |
164 | value = (uint)0xFFFFFFFF & (value<<(31-stopIndex)); |
|
168 | value = (uint)0xFFFFFFFF & (value<<(31-stopIndex)); | |
165 | value = (uint)0xFFFFFFFF & (value>>(31-stopIndex+startIndex)); |
|
169 | value = (uint)0xFFFFFFFF & (value>>(31-stopIndex+startIndex)); | |
166 | return value; |
|
170 | return value; | |
167 | } |
|
171 | } | |
168 | int attributesIndex[32]; |
|
172 | int attributesIndex[32]; | |
169 | uint p_cursorIndex; |
|
173 | uint p_cursorIndex; | |
170 | uint p_startSelectionIndex; |
|
174 | uint p_startSelectionIndex; | |
171 | uint p_stopSelectionIndex; |
|
175 | uint p_stopSelectionIndex; | |
172 | bool p_cursorBlinkEnable; |
|
176 | bool p_cursorBlinkEnable; | |
|
177 | bool p_changed; | |||
173 | int p_dx; |
|
178 | int p_dx; | |
174 | QList<bitFieldAttribute*> attributesLUT; |
|
179 | QList<bitFieldAttribute*> attributesLUT; | |
175 | QColor p_blinkTextColor,p_blinkTextBgColor; |
|
180 | QColor p_blinkTextColor,p_blinkTextBgColor,p_outdated; | |
176 |
|
181 | |||
177 | }; |
|
182 | }; | |
178 |
|
183 | |||
179 |
|
184 | |||
180 | class LPPMON_SDK_EXPORT registerWidget : public QObject |
|
185 | class LPPMON_SDK_EXPORT registerWidget : public QObject | |
181 | { |
|
186 | { | |
182 | Q_OBJECT |
|
187 | Q_OBJECT | |
183 | public: |
|
188 | public: | |
184 | explicit registerWidget(const QString& name,qint32 address,QObject *parent = 0); |
|
189 | explicit registerWidget(const QString& name,qint32 address,QObject *parent = 0); | |
185 | ~registerWidget(); |
|
190 | ~registerWidget(); | |
186 | int contains(const QPointF &point); |
|
191 | int contains(const QPointF &point); | |
187 | QPoint paint(QPainter* painter,QPoint offset); |
|
192 | QPoint paint(QPainter* painter,QPoint offset); | |
188 | QRect boundingRect(); |
|
193 | QRect boundingRect(); | |
189 | uint cursorIndex(); |
|
194 | uint cursorIndex(); | |
190 | uint cursorIndex(int xPos); |
|
195 | uint cursorIndex(int xPos); | |
191 | void updateSelection(int index); |
|
196 | void updateSelection(int index); | |
192 | qint32 address(); |
|
197 | qint32 address(); | |
193 | qint32 value(); |
|
198 | qint32 value(); | |
194 | void setBitFieldAttribute(uint startIndex,uint stopIndex,const QString& name,const QString& description,bool rw); |
|
199 | void setBitFieldAttribute(uint startIndex,uint stopIndex,const QString& name,const QString& description,bool rw); | |
195 | QString bitFieldDesc(int bitIndex); |
|
200 | QString bitFieldDesc(int bitIndex); | |
196 | QString bitFieldName(int bitIndex); |
|
201 | QString bitFieldName(int bitIndex); | |
197 | QString bitFieldToHex(int bitIndex); |
|
202 | QString bitFieldToHex(int bitIndex); | |
198 | QString bitFieldToDec(int bitIndex); |
|
203 | QString bitFieldToDec(int bitIndex); | |
199 | QString bitFieldToBin(int bitIndex); |
|
204 | QString bitFieldToBin(int bitIndex); | |
|
205 | void setUpdated(bool updated=true) | |||
|
206 | { | |||
|
207 | this->p_fieldsEl->setUpdated(updated); | |||
|
208 | } | |||
200 | signals: |
|
209 | signals: | |
201 | void cursorUp(int pos); |
|
210 | void cursorUp(int pos); | |
202 | void cursorDown(int pos); |
|
211 | void cursorDown(int pos); | |
203 | void valueChanged(qint32 value); |
|
212 | void valueChanged(qint32 value); | |
204 | void repaint(); |
|
213 | void repaint(); | |
205 |
|
214 | |||
206 | public slots: |
|
215 | public slots: | |
207 | void setValue(qint32 value); |
|
216 | void setValue(qint32 value,bool updated=true); | |
208 | void blinkCursor(); |
|
217 | void blinkCursor(); | |
209 | void moveCursorLeft(int count); |
|
218 | void moveCursorLeft(int count); | |
210 | void moveCursorRight(int count); |
|
219 | void moveCursorRight(int count); | |
211 | void enter(int index=0); |
|
220 | void enter(int index=0); | |
212 | void leave(); |
|
221 | void leave(); | |
213 | void clear(int index); |
|
222 | void clear(int index); | |
214 | void set(int index); |
|
223 | void set(int index); | |
215 | private: |
|
224 | private: | |
216 | void updateBoundingRect(); |
|
225 | void updateBoundingRect(); | |
217 | qint32 p_address; |
|
226 | qint32 p_address; | |
218 | qint32 p_value; |
|
227 | qint32 p_value; | |
219 | QRect p_boundingRect; |
|
228 | QRect p_boundingRect; | |
220 | int p_xMargins; |
|
229 | int p_xMargins; | |
221 | int p_yMargins; |
|
230 | int p_yMargins; | |
222 | regWidgetElement* p_addressEl,*p_nameEl; |
|
231 | regWidgetElement* p_addressEl,*p_nameEl; | |
223 | bitfieldsElement* p_fieldsEl; |
|
232 | bitfieldsElement* p_fieldsEl; | |
224 | }; |
|
233 | }; | |
225 |
|
234 | |||
226 | #endif // REGISTERWIDGET_H |
|
235 | #endif // REGISTERWIDGET_H |
General Comments 0
You need to be logged in to leave comments.
Login now