|
1 /* This file is part of the KDE project. |
|
2 |
|
3 Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). |
|
4 |
|
5 This library is free software: you can redistribute it and/or modify |
|
6 it under the terms of the GNU Lesser General Public License as published by |
|
7 the Free Software Foundation, either version 2.1 or 3 of the License. |
|
8 |
|
9 This library is distributed in the hope that it will be useful, |
|
10 but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
12 GNU Lesser General Public License for more details. |
|
13 |
|
14 You should have received a copy of the GNU Lesser General Public License |
|
15 along with this library. If not, see <http://www.gnu.org/licenses/>. |
|
16 |
|
17 */ |
|
18 |
|
19 #include <QTextStream> |
|
20 #include <QWidget> |
|
21 #include <coecntrl.h> |
|
22 #include "objectdump_symbian.h" |
|
23 |
|
24 #include <QtGui/private/qwidget_p.h> // to access QWExtra |
|
25 |
|
26 QT_BEGIN_NAMESPACE |
|
27 |
|
28 namespace ObjectDump |
|
29 { |
|
30 namespace Symbian |
|
31 { |
|
32 |
|
33 QList<QByteArray> QAnnotatorWidget::annotation(const QObject& object) |
|
34 { |
|
35 QList<QByteArray> result; |
|
36 |
|
37 const QWidget* widget = qobject_cast<const QWidget*>(&object); |
|
38 if (widget) { |
|
39 |
|
40 const QWExtra* extra = qt_widget_private(const_cast<QWidget *>(widget))->extraData(); |
|
41 |
|
42 if (extra) { |
|
43 |
|
44 QByteArray array; |
|
45 QTextStream stream(&array); |
|
46 |
|
47 stream << "widget (Symbian): "; |
|
48 stream << "activated " << extra->activated << ' '; |
|
49 stream << "nativePaintMode " << extra->nativePaintMode << ' '; |
|
50 |
|
51 stream.flush(); |
|
52 result.append(array); |
|
53 } |
|
54 } |
|
55 |
|
56 return result; |
|
57 } |
|
58 |
|
59 QList<QByteArray> QAnnotatorControl::annotation(const QObject& object) |
|
60 { |
|
61 QList<QByteArray> result; |
|
62 |
|
63 const QWidget* widget = qobject_cast<const QWidget*>(&object); |
|
64 if (widget) { |
|
65 |
|
66 const CCoeControl* control = widget->effectiveWinId(); |
|
67 if (control) { |
|
68 |
|
69 QByteArray array; |
|
70 QTextStream stream(&array); |
|
71 |
|
72 stream << "control: " << control << ' '; |
|
73 stream << "parent " << control->Parent() << ' '; |
|
74 |
|
75 if (control->IsVisible()) |
|
76 stream << "visible "; |
|
77 else |
|
78 stream << "invisible "; |
|
79 |
|
80 stream << control->Position().iX << ',' << control->Position().iY << ' '; |
|
81 stream << control->Size().iWidth << 'x' << control->Size().iHeight; |
|
82 |
|
83 if (control->OwnsWindow()) |
|
84 stream << " ownsWindow "; |
|
85 |
|
86 stream.flush(); |
|
87 result.append(array); |
|
88 } |
|
89 } |
|
90 |
|
91 return result; |
|
92 } |
|
93 |
|
94 QList<QByteArray> QAnnotatorWindow::annotation(const QObject& object) |
|
95 { |
|
96 QList<QByteArray> result; |
|
97 |
|
98 const QWidget* widget = qobject_cast<const QWidget*>(&object); |
|
99 if (widget) { |
|
100 |
|
101 const CCoeControl* control = widget->effectiveWinId(); |
|
102 |
|
103 if (control) { |
|
104 RDrawableWindow *const window = control->DrawableWindow(); |
|
105 if(window) { |
|
106 QByteArray array; |
|
107 QTextStream stream(&array); |
|
108 |
|
109 stream << "window: "; |
|
110 |
|
111 // Server-side address of CWsWindow object |
|
112 // This is useful for correlation with the window tree dumped by the window |
|
113 // server (see RWsSession::LogCommand). |
|
114 // Cast to a void pointer so that log output is in hexadecimal format. |
|
115 stream << "srv " << reinterpret_cast<const void*>(window->WsHandle()) << ' '; |
|
116 |
|
117 stream << "group " << window->WindowGroupId() << ' '; |
|
118 |
|
119 // Client-side handle to the parent window. |
|
120 // Cast to a void pointer so that log output is in hexadecimal format. |
|
121 stream << "parent " << reinterpret_cast<const void*>(window->Parent()) << ' '; |
|
122 |
|
123 stream << window->Position().iX << ',' << window->Position().iY << ' '; |
|
124 stream << '(' << window->AbsPosition().iX << ',' << window->AbsPosition().iY << ") "; |
|
125 stream << window->Size().iWidth << 'x' << window->Size().iHeight << ' '; |
|
126 |
|
127 const TDisplayMode displayMode = window->DisplayMode(); |
|
128 stream << "mode " << displayMode << ' '; |
|
129 |
|
130 stream << "ord " << window->OrdinalPosition(); |
|
131 |
|
132 stream.flush(); |
|
133 result.append(array); |
|
134 } |
|
135 } |
|
136 } |
|
137 |
|
138 return result; |
|
139 } |
|
140 |
|
141 } // namespace Symbian |
|
142 |
|
143 void addDefaultAnnotators_sys(QDumper& dumper) |
|
144 { |
|
145 dumper.addAnnotator(new Symbian::QAnnotatorWidget); |
|
146 dumper.addAnnotator(new Symbian::QAnnotatorControl); |
|
147 dumper.addAnnotator(new Symbian::QAnnotatorWindow); |
|
148 } |
|
149 |
|
150 void addDefaultAnnotators_sys(QVisitor& visitor) |
|
151 { |
|
152 visitor.addAnnotator(new Symbian::QAnnotatorWidget); |
|
153 visitor.addAnnotator(new Symbian::QAnnotatorControl); |
|
154 visitor.addAnnotator(new Symbian::QAnnotatorWindow); |
|
155 } |
|
156 |
|
157 } // namespace ObjectDump |
|
158 |
|
159 QT_END_NAMESPACE |
|
160 |