1 | Fix initialization issues in libmyth |
---|
2 | |
---|
3 | From: Erik Hovland <erik@hovland.org> |
---|
4 | |
---|
5 | |
---|
6 | --- |
---|
7 | |
---|
8 | mythtv/libs/libmyth/managedlist.cpp | 25 ++-- |
---|
9 | mythtv/libs/libmyth/mythdialogs.cpp | 15 ++- |
---|
10 | mythtv/libs/libmyth/programinfo.cpp | 2 |
---|
11 | mythtv/libs/libmyth/uilistbtntype.cpp | 8 + |
---|
12 | mythtv/libs/libmyth/uitypes.cpp | 194 ++++++++++++++------------------- |
---|
13 | mythtv/libs/libmyth/uitypes.h | 13 +- |
---|
14 | 6 files changed, 120 insertions(+), 137 deletions(-) |
---|
15 | |
---|
16 | |
---|
17 | diff --git a/mythtv/libs/libmyth/managedlist.cpp b/mythtv/libs/libmyth/managedlist.cpp |
---|
18 | index 0015124..bfdf9b7 100644 |
---|
19 | --- a/mythtv/libs/libmyth/managedlist.cpp |
---|
20 | +++ b/mythtv/libs/libmyth/managedlist.cpp |
---|
21 | @@ -390,12 +390,15 @@ void ManagedListGroup::setParentList(ManagedList* _parent) |
---|
22 | // SelectManagedListItem |
---|
23 | // |
---|
24 | /////////////////////////////////////////////////////////////////////////////// |
---|
25 | -SelectManagedListItem::SelectManagedListItem( |
---|
26 | - const QString& baseTxt, ManagedListGroup* pGroup, ManagedList* pList, |
---|
27 | - QObject* _parent, const char* _name) |
---|
28 | - : ManagedListGroup(baseTxt, pGroup, pList, _parent, _name) |
---|
29 | +SelectManagedListItem::SelectManagedListItem(const QString& baseTxt, |
---|
30 | + ManagedListGroup* pGroup, |
---|
31 | + ManagedList* pList, |
---|
32 | + QObject* _parent, |
---|
33 | + const char* _name) |
---|
34 | + : ManagedListGroup(baseTxt, pGroup, pList, _parent, _name), |
---|
35 | + isSet(false), baseText(baseTxt), |
---|
36 | + lastItem(0) |
---|
37 | { |
---|
38 | - baseText = baseTxt; |
---|
39 | goBack->setText(QString("[ %1 ]").arg(QObject::tr("No Change"))); |
---|
40 | } |
---|
41 | |
---|
42 | @@ -588,14 +591,14 @@ void SelectManagedListItem::buttonSelected(ManagedListItem* itm) |
---|
43 | // ManagedList |
---|
44 | // |
---|
45 | /////////////////////////////////////////////////////////////////////////////// |
---|
46 | -ManagedList::ManagedList(MythDialog* parent, const char* name) : |
---|
47 | - QObject(parent) |
---|
48 | +ManagedList::ManagedList(MythDialog* parent, const char* name) |
---|
49 | + : QObject(parent), |
---|
50 | + curGroup(NULL), theme(NULL), |
---|
51 | + listSize(0), containerName(""), |
---|
52 | + listName(""), listRect(0, 0, 0, 0), |
---|
53 | + locked(false) |
---|
54 | { |
---|
55 | setObjectName(name); |
---|
56 | - listRect = QRect(0, 0, 0, 0); |
---|
57 | - theme = NULL; |
---|
58 | - curGroup = NULL; |
---|
59 | - locked = false; |
---|
60 | } |
---|
61 | |
---|
62 | ManagedListItem *ManagedList::getItem(const QString &itemName) |
---|
63 | diff --git a/mythtv/libs/libmyth/mythdialogs.cpp b/mythtv/libs/libmyth/mythdialogs.cpp |
---|
64 | index 9f84dc1..970296f 100644 |
---|
65 | --- a/mythtv/libs/libmyth/mythdialogs.cpp |
---|
66 | +++ b/mythtv/libs/libmyth/mythdialogs.cpp |
---|
67 | @@ -41,7 +41,12 @@ using namespace std; |
---|
68 | */ |
---|
69 | |
---|
70 | MythDialog::MythDialog(MythMainWindow *parent, const char *name, bool setsize) |
---|
71 | - : QFrame(parent), rescode(kDialogCodeAccepted) |
---|
72 | + : QFrame(parent), |
---|
73 | + wmult(1.0), hmult(1.0), |
---|
74 | + screenwidth(0), screenheight(0), |
---|
75 | + xbase(0), ybase(0), |
---|
76 | + m_parent(parent), rescode(kDialogCodeAccepted), |
---|
77 | + in_loop(false) |
---|
78 | { |
---|
79 | setObjectName(name); |
---|
80 | if (!parent) |
---|
81 | @@ -50,7 +55,6 @@ MythDialog::MythDialog(MythMainWindow *parent, const char *name, bool setsize) |
---|
82 | return; |
---|
83 | } |
---|
84 | |
---|
85 | - in_loop = false; |
---|
86 | MythUIHelper *ui = GetMythUI(); |
---|
87 | |
---|
88 | ui->GetScreenSettings(xbase, screenwidth, wmult, |
---|
89 | @@ -72,7 +76,6 @@ MythDialog::MythDialog(MythMainWindow *parent, const char *name, bool setsize) |
---|
90 | setAutoFillBackground(true); |
---|
91 | |
---|
92 | parent->attach(this); |
---|
93 | - m_parent = parent; |
---|
94 | } |
---|
95 | |
---|
96 | MythDialog::~MythDialog() |
---|
97 | @@ -1072,10 +1075,12 @@ MythThemedDialog::MythThemedDialog(MythMainWindow *parent, |
---|
98 | |
---|
99 | MythThemedDialog::MythThemedDialog(MythMainWindow *parent, const char* name, |
---|
100 | bool setsize) |
---|
101 | - : MythDialog(parent, name, setsize) |
---|
102 | + : MythDialog(parent, name, setsize), |
---|
103 | + widget_with_current_focus(NULL), my_background(), |
---|
104 | + my_foreground(), theme(NULL), |
---|
105 | + context(0), redrawRect(0, 0, 0, 0) |
---|
106 | { |
---|
107 | setNoErase(); |
---|
108 | - theme = NULL; |
---|
109 | } |
---|
110 | |
---|
111 | bool MythThemedDialog::loadThemedWindow(QString window_name, |
---|
112 | diff --git a/mythtv/libs/libmyth/programinfo.cpp b/mythtv/libs/libmyth/programinfo.cpp |
---|
113 | index 7b03977..bfc6f56 100644 |
---|
114 | --- a/mythtv/libs/libmyth/programinfo.cpp |
---|
115 | +++ b/mythtv/libs/libmyth/programinfo.cpp |
---|
116 | @@ -58,6 +58,7 @@ ProgramInfo::ProgramInfo(void) : |
---|
117 | chanstr(""), |
---|
118 | chansign(""), |
---|
119 | channame(""), |
---|
120 | + m_videoWidth(0), |
---|
121 | m_videoHeight(0), |
---|
122 | |
---|
123 | recpriority(0), |
---|
124 | @@ -149,6 +150,7 @@ ProgramInfo::ProgramInfo(const ProgramInfo &other) : |
---|
125 | chanstr(other.chanstr), |
---|
126 | chansign(other.chansign), |
---|
127 | channame(other.channame), |
---|
128 | + m_videoWidth(other.m_videoWidth), |
---|
129 | m_videoHeight(other.m_videoHeight), |
---|
130 | |
---|
131 | recpriority(other.recpriority), |
---|
132 | diff --git a/mythtv/libs/libmyth/uilistbtntype.cpp b/mythtv/libs/libmyth/uilistbtntype.cpp |
---|
133 | index fb7aeaa..85d4a5b 100644 |
---|
134 | --- a/mythtv/libs/libmyth/uilistbtntype.cpp |
---|
135 | +++ b/mythtv/libs/libmyth/uilistbtntype.cpp |
---|
136 | @@ -140,7 +140,7 @@ bool UIListGenericTree::movePositionUpDown(bool flag) |
---|
137 | UIListTreeType::UIListTreeType(const QString &name, const QRect &area, |
---|
138 | const QRect &levelsize, int levelspacing, |
---|
139 | int order) |
---|
140 | - : UIType(name) |
---|
141 | + : UIType(name, order, true) |
---|
142 | { |
---|
143 | m_totalarea = area; |
---|
144 | m_levelsize = levelsize; |
---|
145 | @@ -156,7 +156,7 @@ UIListTreeType::UIListTreeType(const QString &name, const QRect &area, |
---|
146 | |
---|
147 | m_active = NULL; |
---|
148 | m_inactive = NULL; |
---|
149 | - takes_focus = true; |
---|
150 | +// takes_focus = true; |
---|
151 | |
---|
152 | SetItemRegColor(Qt::black,QColor(80,80,80),100); |
---|
153 | SetItemSelColor(QColor(82,202,56),QColor(52,152,56),255); |
---|
154 | @@ -866,10 +866,9 @@ void UIListTreeType::looseFocus() |
---|
155 | |
---|
156 | UIListBtnType::UIListBtnType(const QString& name, const QRect& area, |
---|
157 | int order, bool showArrow, bool showScrollArrows) |
---|
158 | - : UIType(name) |
---|
159 | + : UIType(name, order, true) |
---|
160 | { |
---|
161 | m_parentListTree = NULL; |
---|
162 | - m_order = order; |
---|
163 | m_rect = area; |
---|
164 | |
---|
165 | m_showArrow = showArrow; |
---|
166 | @@ -877,7 +876,6 @@ UIListBtnType::UIListBtnType(const QString& name, const QRect& area, |
---|
167 | |
---|
168 | m_active = false; |
---|
169 | m_visible = true; |
---|
170 | - takes_focus = true; |
---|
171 | m_showUpArrow = false; |
---|
172 | m_showDnArrow = false; |
---|
173 | |
---|
174 | diff --git a/mythtv/libs/libmyth/uitypes.cpp b/mythtv/libs/libmyth/uitypes.cpp |
---|
175 | index c4d1982..e3a2a8a 100644 |
---|
176 | --- a/mythtv/libs/libmyth/uitypes.cpp |
---|
177 | +++ b/mythtv/libs/libmyth/uitypes.cpp |
---|
178 | @@ -186,20 +186,16 @@ void LayerSet::SetDrawFontShadow(bool state) |
---|
179 | |
---|
180 | // ************************************************************** |
---|
181 | |
---|
182 | -UIType::UIType(const QString &name) |
---|
183 | - : QObject(NULL) |
---|
184 | +UIType::UIType(const QString &name, int order, bool takes_focus, bool has_focus) |
---|
185 | + : QObject(NULL), |
---|
186 | + m_wmult(1.0), m_hmult(1.0), |
---|
187 | + m_context(-1), m_order(order), |
---|
188 | + m_debug(false), m_name(name), |
---|
189 | + m_parent(NULL), m_has_focus(has_focus), |
---|
190 | + m_takes_focus(takes_focus), screen_area(0, 0, 0, 0), |
---|
191 | + drawFontShadow(true), hidden(false) |
---|
192 | { |
---|
193 | setObjectName(name); |
---|
194 | - m_parent = NULL; |
---|
195 | - m_name = name; |
---|
196 | - m_debug = false; |
---|
197 | - m_context = -1; |
---|
198 | - m_order = -1; |
---|
199 | - has_focus = false; |
---|
200 | - takes_focus = false; |
---|
201 | - screen_area = QRect(0,0,0,0); |
---|
202 | - drawFontShadow = true; |
---|
203 | - hidden = false; |
---|
204 | } |
---|
205 | |
---|
206 | void UIType::SetOrder(int order) |
---|
207 | @@ -242,21 +238,21 @@ QString UIType::Name() |
---|
208 | |
---|
209 | bool UIType::takeFocus() |
---|
210 | { |
---|
211 | - if (takes_focus) |
---|
212 | + if (m_takes_focus) |
---|
213 | { |
---|
214 | - has_focus = true; |
---|
215 | + m_has_focus = true; |
---|
216 | refresh(); |
---|
217 | emit takingFocus(); |
---|
218 | return true; |
---|
219 | } |
---|
220 | - has_focus = false; |
---|
221 | + m_has_focus = false; |
---|
222 | return false; |
---|
223 | } |
---|
224 | |
---|
225 | void UIType::looseFocus() |
---|
226 | { |
---|
227 | emit loosingFocus(); |
---|
228 | - has_focus = false; |
---|
229 | + m_has_focus = false; |
---|
230 | refresh(); |
---|
231 | } |
---|
232 | |
---|
233 | @@ -356,22 +352,20 @@ QString UIType::cutDown(const QString &data, QFont *testFont, bool multiline, |
---|
234 | // ************************************************************** |
---|
235 | |
---|
236 | UIListType::UIListType(const QString &name, QRect area, int dorder) |
---|
237 | - : UIType(name) |
---|
238 | + : UIType(name, dorder, true), |
---|
239 | + m_selheight(0), m_justification(0), |
---|
240 | + m_columns(0), m_current(-1), |
---|
241 | + m_active(false), m_pad(0), |
---|
242 | + m_count(0), m_darrow(false), |
---|
243 | + m_uarrow(false), m_showSelAlways(true), |
---|
244 | + m_fill_area(), m_fill_color(), |
---|
245 | + m_fill_type(-1), m_selection(), |
---|
246 | + m_downarrow(), m_uparrow(), |
---|
247 | + m_leftarrow(), m_rightarrow(), |
---|
248 | + m_selection_loc(), m_downarrow_loc(), |
---|
249 | + m_uparrow_loc(), m_rightarrow_loc(), |
---|
250 | + m_leftarrow_loc(), m_area(area) |
---|
251 | { |
---|
252 | - m_name = name; |
---|
253 | - m_area = area; |
---|
254 | - m_order = dorder; |
---|
255 | - m_active = false; |
---|
256 | - m_columns = 0; |
---|
257 | - m_current = -1; |
---|
258 | - m_count = 0; |
---|
259 | - m_justification = 0; |
---|
260 | - m_uarrow = false; |
---|
261 | - m_darrow = false; |
---|
262 | - m_fill_type = -1; |
---|
263 | - m_showSelAlways = true; |
---|
264 | - has_focus = false; |
---|
265 | - takes_focus = true; |
---|
266 | } |
---|
267 | |
---|
268 | UIListType::~UIListType() |
---|
269 | @@ -680,7 +674,7 @@ void UIListType::looseFocus() |
---|
270 | // ***************************************************************** |
---|
271 | |
---|
272 | UIImageType::UIImageType(const QString &name, const QString &filename, int dorder, QPoint displaypos) |
---|
273 | - : UIType(name) |
---|
274 | + : UIType(name, dorder) |
---|
275 | { |
---|
276 | m_isvalid = false; |
---|
277 | m_flex = false; |
---|
278 | @@ -1028,28 +1022,30 @@ void UIRepeatedImageType::refresh() |
---|
279 | // ************************************************************** |
---|
280 | |
---|
281 | UIImageGridType::UIImageGridType(const QString &name, int order) |
---|
282 | - : UIType(name) |
---|
283 | + : UIType(name, order), |
---|
284 | + window(NULL), rowCount(0), |
---|
285 | + columnCount(0), itemCount(0), |
---|
286 | + currentItem(0), borderWidth(0), |
---|
287 | + padding(0), cellWidth(0), |
---|
288 | + cellHeight(0), topRow(0), |
---|
289 | + lastRow(0), lastColumn(0), |
---|
290 | + curColumn(0), curRow(0), |
---|
291 | + displayRect(), imageRect(), |
---|
292 | + checkRect(), textPos(UIImageGridType::textPosBottom), |
---|
293 | + textHeight(20), |
---|
294 | + activeFont(NULL), inactiveFont(NULL), |
---|
295 | + selectedFont(NULL), cutdown(true), |
---|
296 | + showCheck(false), showScrollArrows(false), |
---|
297 | + showSelected(false), showUpArrow(false), |
---|
298 | + showDnArrow(false), |
---|
299 | + normalImage(""), highlightedImage(""), |
---|
300 | + selectedImage(""), defaultImage(""), |
---|
301 | + normalPixmap(NULL), highlightedPixmap(NULL), |
---|
302 | + selectedPixmap(NULL), defaultPixmap(NULL), |
---|
303 | + allData(new QList<ImageGridItem*>) |
---|
304 | { |
---|
305 | - m_name = name; |
---|
306 | - m_order = order; |
---|
307 | - |
---|
308 | - activeFont = inactiveFont = selectedFont = NULL; |
---|
309 | - window = NULL; |
---|
310 | - defaultPixmap = normalPixmap = selectedPixmap = highlightedPixmap = NULL; |
---|
311 | - |
---|
312 | - topRow = rowCount = columnCount = itemCount = currentItem = |
---|
313 | - borderWidth = padding = cellWidth = cellHeight = |
---|
314 | - lastRow = lastColumn = curColumn = curRow = 0; |
---|
315 | - |
---|
316 | - textPos = UIImageGridType::textPosBottom; |
---|
317 | - textHeight = 20; |
---|
318 | - cutdown = true; |
---|
319 | setJustification((Qt::AlignLeft | Qt::AlignVCenter)); |
---|
320 | allowFocus(true); |
---|
321 | - showCheck = false; |
---|
322 | - showSelected = false; |
---|
323 | - |
---|
324 | - allData = new QList<ImageGridItem*>; |
---|
325 | } |
---|
326 | |
---|
327 | UIImageGridType::~UIImageGridType(void) |
---|
328 | @@ -1203,7 +1199,7 @@ void UIImageGridType::setJustification(int jst) |
---|
329 | |
---|
330 | bool UIImageGridType::handleKeyPress(QString action) |
---|
331 | { |
---|
332 | - if (!has_focus) |
---|
333 | + if (!m_has_focus) |
---|
334 | return false; |
---|
335 | |
---|
336 | if (action == "LEFT") |
---|
337 | @@ -1469,7 +1465,7 @@ void UIImageGridType::drawText(QPainter *p, int curPos, int xpos, int ypos) |
---|
338 | p->drawRect(textRect); |
---|
339 | } |
---|
340 | |
---|
341 | - fontProp *font = has_focus ? activeFont : inactiveFont; |
---|
342 | + fontProp *font = m_has_focus ? activeFont : inactiveFont; |
---|
343 | |
---|
344 | if (item && item->selected && showSelected) |
---|
345 | font = selectedFont; |
---|
346 | @@ -1603,10 +1599,9 @@ QSize UIImageGridType::getImageItemSize(void) |
---|
347 | UITextType::UITextType(const QString &name, fontProp *font, |
---|
348 | const QString &text, int dorder, QRect displayrect, |
---|
349 | QRect altdisplayrect) |
---|
350 | - : UIType(name) |
---|
351 | + : UIType(name, dorder) |
---|
352 | { |
---|
353 | |
---|
354 | - m_name = name; |
---|
355 | if (text.length()) |
---|
356 | m_message = text; |
---|
357 | else |
---|
358 | @@ -1618,7 +1613,6 @@ UITextType::UITextType(const QString &name, fontProp *font, |
---|
359 | m_origdisplaysize = displayrect; |
---|
360 | m_altdisplaysize = altdisplayrect; |
---|
361 | m_cutdown = true; |
---|
362 | - m_order = dorder; |
---|
363 | m_justification = (Qt::AlignLeft | Qt::AlignTop); |
---|
364 | } |
---|
365 | |
---|
366 | @@ -1731,14 +1725,12 @@ void UITextType::calculateScreenArea() |
---|
367 | |
---|
368 | UIRemoteEditType::UIRemoteEditType(const QString &name, fontProp *font, |
---|
369 | const QString &text, int dorder, QRect displayrect) |
---|
370 | - : UIType(name) |
---|
371 | + : UIType(name, dorder, true) |
---|
372 | { |
---|
373 | m_font = font; |
---|
374 | m_text = text; |
---|
375 | m_displaysize = displayrect; |
---|
376 | - m_order = dorder; |
---|
377 | edit = NULL; |
---|
378 | - takes_focus = true; |
---|
379 | } |
---|
380 | |
---|
381 | void UIRemoteEditType::createEdit(MythThemedDialog* parent) |
---|
382 | @@ -1896,13 +1888,12 @@ void UIRemoteEditType::editorChanged(QString value) |
---|
383 | // ****************************************************************** |
---|
384 | |
---|
385 | UIStatusBarType::UIStatusBarType(QString &name, QPoint loc, int dorder) |
---|
386 | - : UIType(name) |
---|
387 | + : UIType(name, dorder), |
---|
388 | + m_used(0), m_total(100), |
---|
389 | + m_fillerSpace(0), m_container(), |
---|
390 | + m_filler(), m_location(loc), |
---|
391 | + m_orientation(0) |
---|
392 | { |
---|
393 | - m_location = loc; |
---|
394 | - m_order = dorder; |
---|
395 | - m_orientation = 0; |
---|
396 | - m_used = 0; |
---|
397 | - m_total = 100; |
---|
398 | } |
---|
399 | |
---|
400 | UIStatusBarType::~UIStatusBarType() |
---|
401 | @@ -1991,37 +1982,26 @@ void UIStatusBarType::setOrientation(int x) |
---|
402 | // ********************************************************************* |
---|
403 | |
---|
404 | UIManagedTreeListType::UIManagedTreeListType(const QString & name) |
---|
405 | - : UIType(name) |
---|
406 | + : UIType(name), |
---|
407 | + area(), bins(0), |
---|
408 | + active_bin(0), my_tree_data(NULL), |
---|
409 | + current_node(NULL), active_parent(NULL), |
---|
410 | + active_node(NULL), tree_order(-1), |
---|
411 | + visual_order(-1), iconAttr(-1), |
---|
412 | + selectPadding(0), selectScale(false), |
---|
413 | + m_justification(Qt::AlignLeft | Qt::AlignVCenter), |
---|
414 | + highlight_image(), up_arrow_image(), |
---|
415 | + down_arrow_image(), left_arrow_image(), |
---|
416 | + right_arrow_image(), show_whole_tree(false), |
---|
417 | + scrambled_parents(false), color_selectables(false), |
---|
418 | + selectPoint(0, 0), upArrowOffset(0, 0), |
---|
419 | + downArrowOffset(0, 0), leftArrowOffset(0, 0), |
---|
420 | + rightArrowOffset(0, 0), incSearch(""), |
---|
421 | + bIncSearchContains(false) |
---|
422 | { |
---|
423 | - bins = 0; |
---|
424 | bin_corners.clear(); |
---|
425 | screen_corners.clear(); |
---|
426 | route_to_active.clear(); |
---|
427 | - my_tree_data = NULL; |
---|
428 | - current_node = NULL; |
---|
429 | - active_node = NULL; |
---|
430 | - active_parent = NULL; |
---|
431 | - m_justification = (Qt::AlignLeft | Qt::AlignVCenter); |
---|
432 | - active_bin = 0; |
---|
433 | - tree_order = -1; |
---|
434 | - visual_order = -1; |
---|
435 | - iconAttr = -1; |
---|
436 | - show_whole_tree = false; |
---|
437 | - scrambled_parents = false; |
---|
438 | - color_selectables = false; |
---|
439 | - selectPadding = 0; |
---|
440 | - selectScale = false; |
---|
441 | - selectPoint.setX(0); |
---|
442 | - selectPoint.setY(0); |
---|
443 | - upArrowOffset.setX(0); |
---|
444 | - upArrowOffset.setY(0); |
---|
445 | - downArrowOffset.setX(0); |
---|
446 | - downArrowOffset.setY(0); |
---|
447 | - leftArrowOffset.setX(0); |
---|
448 | - leftArrowOffset.setY(0); |
---|
449 | - rightArrowOffset.setX(0); |
---|
450 | - rightArrowOffset.setY(0); |
---|
451 | - incSearch = ""; |
---|
452 | } |
---|
453 | |
---|
454 | UIManagedTreeListType::~UIManagedTreeListType() |
---|
455 | @@ -3464,14 +3444,13 @@ void UIManagedTreeListType::calculateScreenArea() |
---|
456 | // ******************************************************************** |
---|
457 | |
---|
458 | UIPushButtonType::UIPushButtonType(const QString &name, QPixmap on, QPixmap off, QPixmap pushed, QPixmap pushedon) |
---|
459 | - : UIType(name) |
---|
460 | + : UIType(name, -1, true) |
---|
461 | { |
---|
462 | on_pixmap = on; |
---|
463 | off_pixmap = off; |
---|
464 | pushed_pixmap = pushed; |
---|
465 | pushedon_pixmap = pushedon; |
---|
466 | currently_pushed = false; |
---|
467 | - takes_focus = true; |
---|
468 | m_lockOn = false; |
---|
469 | connect(&push_timer, SIGNAL(timeout()), this, SLOT(unPush())); |
---|
470 | } |
---|
471 | @@ -3498,7 +3477,7 @@ void UIPushButtonType::Draw(QPainter *p, int drawlayer, int context) |
---|
472 | |
---|
473 | if (currently_pushed) |
---|
474 | { |
---|
475 | - if (has_focus && !pushedon_pixmap.isNull()) |
---|
476 | + if (m_has_focus && !pushedon_pixmap.isNull()) |
---|
477 | { |
---|
478 | p->drawPixmap(m_displaypos.x(), m_displaypos.y(), pushedon_pixmap); |
---|
479 | } |
---|
480 | @@ -3509,7 +3488,7 @@ void UIPushButtonType::Draw(QPainter *p, int drawlayer, int context) |
---|
481 | } |
---|
482 | else |
---|
483 | { |
---|
484 | - if (has_focus) |
---|
485 | + if (m_has_focus) |
---|
486 | { |
---|
487 | p->drawPixmap(m_displaypos.x(), m_displaypos.y(), on_pixmap); |
---|
488 | } |
---|
489 | @@ -3598,14 +3577,13 @@ void UIPushButtonType::calculateScreenArea() |
---|
490 | // ******************************************************************** |
---|
491 | |
---|
492 | UITextButtonType::UITextButtonType(const QString &name, QPixmap on, QPixmap off, QPixmap pushed) |
---|
493 | - : UIType(name) |
---|
494 | + : UIType(name, -1, true) |
---|
495 | { |
---|
496 | on_pixmap = on; |
---|
497 | off_pixmap = off; |
---|
498 | pushed_pixmap = pushed; |
---|
499 | m_text = ""; |
---|
500 | currently_pushed = false; |
---|
501 | - takes_focus = true; |
---|
502 | connect(&push_timer, SIGNAL(timeout()), this, SLOT(unPush())); |
---|
503 | } |
---|
504 | |
---|
505 | @@ -3635,7 +3613,7 @@ void UITextButtonType::Draw(QPainter *p, int drawlayer, int context) |
---|
506 | } |
---|
507 | else |
---|
508 | { |
---|
509 | - if (has_focus) |
---|
510 | + if (m_has_focus) |
---|
511 | { |
---|
512 | p->drawPixmap(m_displaypos.x(), m_displaypos.y(), on_pixmap); |
---|
513 | } |
---|
514 | @@ -3718,7 +3696,7 @@ void UITextButtonType::calculateScreenArea() |
---|
515 | UICheckBoxType::UICheckBoxType(const QString &name, |
---|
516 | QPixmap checkedp, QPixmap uncheckedp, |
---|
517 | QPixmap checked_highp, QPixmap unchecked_highp) |
---|
518 | - :UIType(name) |
---|
519 | + : UIType(name, -1, true) |
---|
520 | { |
---|
521 | checked_pixmap = checkedp; |
---|
522 | unchecked_pixmap = uncheckedp; |
---|
523 | @@ -3726,7 +3704,6 @@ UICheckBoxType::UICheckBoxType(const QString &name, |
---|
524 | unchecked_pixmap_high = unchecked_highp; |
---|
525 | checked = false; |
---|
526 | label = ""; |
---|
527 | - takes_focus = true; |
---|
528 | } |
---|
529 | |
---|
530 | void UICheckBoxType::Draw(QPainter *p, int drawlayer, int context) |
---|
531 | @@ -3747,7 +3724,7 @@ void UICheckBoxType::Draw(QPainter *p, int drawlayer, int context) |
---|
532 | return; |
---|
533 | } |
---|
534 | |
---|
535 | - if (has_focus) |
---|
536 | + if (m_has_focus) |
---|
537 | { |
---|
538 | if (checked) |
---|
539 | { |
---|
540 | @@ -3864,7 +3841,7 @@ void UISelectorType::Draw(QPainter *p, int drawlayer, int context) |
---|
541 | } |
---|
542 | else |
---|
543 | { |
---|
544 | - if (has_focus) |
---|
545 | + if (m_has_focus) |
---|
546 | { |
---|
547 | p->drawPixmap(m_displaypos.x(), m_displaypos.y(), on_pixmap); |
---|
548 | } |
---|
549 | @@ -4007,7 +3984,7 @@ void UIBlackHoleType::calculateScreenArea() |
---|
550 | // ******************************************************************** |
---|
551 | |
---|
552 | UIKeyType::UIKeyType(const QString &name) |
---|
553 | - : UIType(name) |
---|
554 | + : UIType(name, -1, true) |
---|
555 | { |
---|
556 | m_normalImg = m_focusedImg = m_downImg = m_downFocusedImg = NULL; |
---|
557 | m_normalFont = m_focusedFont = m_downFont = m_downFocusedFont = NULL; |
---|
558 | @@ -4018,8 +3995,6 @@ UIKeyType::UIKeyType(const QString &name) |
---|
559 | m_bShift = false; |
---|
560 | m_bAlt = false; |
---|
561 | m_bToggle = false; |
---|
562 | - |
---|
563 | - takes_focus = true; |
---|
564 | connect(&m_pushTimer, SIGNAL(timeout()), this, SLOT(unPush())); |
---|
565 | } |
---|
566 | |
---|
567 | @@ -4038,7 +4013,7 @@ void UIKeyType::Draw(QPainter *dr, int drawlayer, int context) |
---|
568 | // draw the button image |
---|
569 | if (!m_bDown) |
---|
570 | { |
---|
571 | - if (!has_focus) |
---|
572 | + if (!m_has_focus) |
---|
573 | { |
---|
574 | dr->drawPixmap(m_pos.x(), m_pos.y(), *m_normalImg); |
---|
575 | tempFont = m_normalFont; |
---|
576 | @@ -4051,7 +4026,7 @@ void UIKeyType::Draw(QPainter *dr, int drawlayer, int context) |
---|
577 | } |
---|
578 | else |
---|
579 | { |
---|
580 | - if (!has_focus) |
---|
581 | + if (!m_has_focus) |
---|
582 | { |
---|
583 | dr->drawPixmap(m_pos.x(), m_pos.y(), *m_downImg); |
---|
584 | tempFont = m_downFont; |
---|
585 | @@ -4327,9 +4302,8 @@ const QString comps[numcomps][3] = { |
---|
586 | }; |
---|
587 | |
---|
588 | UIKeyboardType::UIKeyboardType(const QString &name, int order) |
---|
589 | - : UIType(name) |
---|
590 | + : UIType(name, order) |
---|
591 | { |
---|
592 | - m_order = order; |
---|
593 | m_container = NULL; |
---|
594 | m_parentEdit = NULL; |
---|
595 | m_parentDialog = NULL; |
---|
596 | diff --git a/mythtv/libs/libmyth/uitypes.h b/mythtv/libs/libmyth/uitypes.h |
---|
597 | index c373cc3..d9c1833 100644 |
---|
598 | --- a/mythtv/libs/libmyth/uitypes.h |
---|
599 | +++ b/mythtv/libs/libmyth/uitypes.h |
---|
600 | @@ -85,7 +85,8 @@ class MPUBLIC UIType : public QObject |
---|
601 | Q_OBJECT |
---|
602 | |
---|
603 | public: |
---|
604 | - UIType(const QString &name); |
---|
605 | + UIType(const QString &name, int order = -1, bool takes_focus = false, |
---|
606 | + bool has_focus = false); |
---|
607 | virtual ~UIType(); |
---|
608 | |
---|
609 | void SetOrder(int order); |
---|
610 | @@ -94,12 +95,12 @@ class MPUBLIC UIType : public QObject |
---|
611 | void SetContext(int con) { m_context = con;} |
---|
612 | int GetContext(){return m_context;} |
---|
613 | void SetDebug(bool db) { m_debug = db; } |
---|
614 | - void allowFocus(bool yes_or_no){takes_focus = yes_or_no;} |
---|
615 | + void allowFocus(bool yes_or_no){m_takes_focus = yes_or_no;} |
---|
616 | void SetDrawFontShadow(bool state) { drawFontShadow = state; } |
---|
617 | QString Name(); |
---|
618 | |
---|
619 | |
---|
620 | - bool canTakeFocus(){ return takes_focus;} |
---|
621 | + bool canTakeFocus(){ return m_takes_focus;} |
---|
622 | int getOrder(){return m_order;} |
---|
623 | virtual void Draw(QPainter *, int, int); |
---|
624 | virtual void DrawRegion(QPainter *, QRect &, int, int); |
---|
625 | @@ -111,7 +112,7 @@ class MPUBLIC UIType : public QObject |
---|
626 | |
---|
627 | bool isShown(){return !hidden;} |
---|
628 | bool isHidden(){return hidden;} |
---|
629 | - bool isFocused(){return has_focus;} |
---|
630 | + bool isFocused(){return m_has_focus;} |
---|
631 | |
---|
632 | public slots: |
---|
633 | |
---|
634 | @@ -145,8 +146,8 @@ class MPUBLIC UIType : public QObject |
---|
635 | bool m_debug; |
---|
636 | QString m_name; |
---|
637 | LayerSet *m_parent; |
---|
638 | - bool has_focus; |
---|
639 | - bool takes_focus; |
---|
640 | + bool m_has_focus; |
---|
641 | + bool m_takes_focus; |
---|
642 | QRect screen_area; // The area, in real screen coordinates |
---|
643 | bool drawFontShadow; |
---|
644 | bool hidden; // Is this "widget" seen or hidden ? |
---|