##// END OF EJS Templates
Fixed some issues on elf parser and generic binary file widget work in progress.
Jeandet Alexis -
r4:00ff7d3b610f default
parent child
Show More
@@ -0,0 +1,6
1 <RCC>
2 <qresource prefix="/img">
3 <file>ressources/Gnome-list-add.svg</file>
4 <file>ressources/Gnome-user-trash.svg</file>
5 </qresource>
6 </RCC>
@@ -0,0 +1,102
1 <?xml version="1.0" encoding="UTF-8" standalone="no"?>
2 <!-- Created with Inkscape (http://www.inkscape.org/) -->
3 <svg
4 xmlns:dc="http://purl.org/dc/elements/1.1/"
5 xmlns:cc="http://web.resource.org/cc/"
6 xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
7 xmlns:svg="http://www.w3.org/2000/svg"
8 xmlns="http://www.w3.org/2000/svg"
9 xmlns:xlink="http://www.w3.org/1999/xlink"
10 xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
11 xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
12 width="48"
13 height="48"
14 id="svg4289"
15 sodipodi:version="0.32"
16 inkscape:version="0.45"
17 version="1.0"
18 sodipodi:docbase="/home/dobey/Projects/gnome-icon-theme/scalable/actions"
19 sodipodi:docname="list-add.svg"
20 inkscape:export-filename="/home/andreas/project/gnome-icon-theme/scalable/actions/list-add.png"
21 inkscape:export-xdpi="90"
22 inkscape:export-ydpi="90"
23 inkscape:output_extension="org.inkscape.output.svg.inkscape">
24 <defs
25 id="defs4291">
26 <linearGradient
27 inkscape:collect="always"
28 id="linearGradient4622">
29 <stop
30 style="stop-color:#b4b5b3;stop-opacity:1"
31 offset="0"
32 id="stop4624" />
33 <stop
34 style="stop-color:#d8d9d7;stop-opacity:1"
35 offset="1"
36 id="stop4626" />
37 </linearGradient>
38 <linearGradient
39 inkscape:collect="always"
40 xlink:href="#linearGradient4622"
41 id="linearGradient4320"
42 gradientUnits="userSpaceOnUse"
43 gradientTransform="matrix(2.810197,0,0,2.747234,1.562312,1.675085)"
44 x1="8.6790628"
45 y1="6.7354665"
46 x2="8.7223368"
47 y2="10.858153" />
48 </defs>
49 <sodipodi:namedview
50 id="base"
51 pagecolor="#ffffff"
52 bordercolor="#666666"
53 borderopacity="1.0"
54 inkscape:pageopacity="0.0"
55 inkscape:pageshadow="2"
56 inkscape:zoom="16"
57 inkscape:cx="28.380765"
58 inkscape:cy="26.638236"
59 inkscape:current-layer="layer1"
60 showgrid="false"
61 inkscape:grid-bbox="true"
62 inkscape:document-units="px"
63 width="48px"
64 height="48px"
65 showguides="true"
66 inkscape:guide-bbox="true"
67 inkscape:window-width="1673"
68 inkscape:window-height="968"
69 inkscape:window-x="1"
70 inkscape:window-y="27" />
71 <metadata
72 id="metadata4294">
73 <rdf:RDF>
74 <cc:Work
75 rdf:about="">
76 <dc:format>image/svg+xml</dc:format>
77 <dc:type
78 rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
79 </cc:Work>
80 </rdf:RDF>
81 </metadata>
82 <g
83 id="layer1"
84 inkscape:label="Layer 1"
85 inkscape:groupmode="layer">
86 <path
87 style="opacity:1;fill:url(#linearGradient4320);fill-opacity:1;stroke:#555753;stroke-width:1.00000048;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
88 d="M 8.4999995,21.548779 L 8.4999995,26.514266 L 21.542175,26.514266 L 21.542175,38.455753 L 26.527841,38.500024 L 26.499007,26.514266 L 39.499998,26.469995 L 39.499998,21.548779 L 26.478909,21.548779 L 26.482175,8.542935 L 21.498141,8.5000092 L 21.496508,21.55147 L 8.4999995,21.548779 z "
89 id="path4314"
90 sodipodi:nodetypes="ccccccccccccc" />
91 <path
92 style="opacity:0.2;fill:white;fill-opacity:1;stroke:none;stroke-width:0.99999994;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-opacity:1"
93 d="M 9,22.072045 L 22.070199,22.072045 L 22.065556,9 L 26.002778,9.1688851 L 25.957932,22.156486 L 38.906989,22.072045 L 38.906989,24.048454 L 9,24.048454 L 9,22.072045 z "
94 id="path4316"
95 sodipodi:nodetypes="ccccccccc" />
96 <path
97 style="opacity:0.4;fill:none;fill-opacity:1;stroke:white;stroke-width:1.00000024;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
98 d="M 9.5000012,22.518518 L 9.5000012,25.561981 L 22.540436,25.561981 L 22.540436,37.458666 L 25.525069,37.499986 L 25.498095,25.561981 L 38.500003,25.520661 L 38.500003,22.518518 L 25.567682,22.518518 L 25.570737,9.540046 L 22.499243,9.499982 L 22.497715,22.52103 L 9.5000012,22.518518 z "
99 id="path5202"
100 sodipodi:nodetypes="ccccccccccccc" />
101 </g>
102 </svg>
@@ -0,0 +1,266
1 <?xml version="1.0" encoding="UTF-8" standalone="no"?>
2 <!-- Created with Inkscape (http://www.inkscape.org/) -->
3 <svg
4 xmlns:dc="http://purl.org/dc/elements/1.1/"
5 xmlns:cc="http://web.resource.org/cc/"
6 xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
7 xmlns:svg="http://www.w3.org/2000/svg"
8 xmlns="http://www.w3.org/2000/svg"
9 xmlns:xlink="http://www.w3.org/1999/xlink"
10 xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
11 xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
12 width="48"
13 height="48"
14 id="svg1"
15 sodipodi:version="0.32"
16 inkscape:version="0.45"
17 sodipodi:docbase="/home/dobey/Projects/gnome-icon-theme/scalable/places"
18 sodipodi:docname="user-trash.svg"
19 version="1.0"
20 inkscape:output_extension="org.inkscape.output.svg.inkscape">
21 <defs
22 id="defs3">
23 <linearGradient
24 id="linearGradient4524">
25 <stop
26 style="stop-color:#417ac3;stop-opacity:1;"
27 offset="0"
28 id="stop4526" />
29 <stop
30 style="stop-color:#3465a4;stop-opacity:1;"
31 offset="1"
32 id="stop4528" />
33 </linearGradient>
34 <linearGradient
35 inkscape:collect="always"
36 id="linearGradient5411">
37 <stop
38 style="stop-color:#ffffff;stop-opacity:1;"
39 offset="0"
40 id="stop5413" />
41 <stop
42 style="stop-color:#ffffff;stop-opacity:0;"
43 offset="1"
44 id="stop5415" />
45 </linearGradient>
46 <linearGradient
47 inkscape:collect="always"
48 id="linearGradient4211">
49 <stop
50 style="stop-color:#000000;stop-opacity:1;"
51 offset="0"
52 id="stop4213" />
53 <stop
54 style="stop-color:#000000;stop-opacity:0;"
55 offset="1"
56 id="stop4215" />
57 </linearGradient>
58 <linearGradient
59 id="linearGradient1877">
60 <stop
61 style="stop-color:#000000;stop-opacity:0.17964073;"
62 offset="0.0000000"
63 id="stop1878" />
64 <stop
65 style="stop-color:#000000;stop-opacity:0.0000000;"
66 offset="1.0000000"
67 id="stop1879" />
68 </linearGradient>
69 <linearGradient
70 id="linearGradient1869">
71 <stop
72 style="stop-color:#eff3f4;stop-opacity:1.0000000;"
73 offset="0.0000000"
74 id="stop1870" />
75 <stop
76 style="stop-color:#939596;stop-opacity:1.0000000;"
77 offset="1.0000000"
78 id="stop1871" />
79 </linearGradient>
80 <linearGradient
81 inkscape:collect="always"
82 xlink:href="#linearGradient1869"
83 id="linearGradient1872"
84 gradientTransform="matrix(1.436131,0,0,0.475306,-6.508085,6.805509)"
85 x1="-4.6375198"
86 y1="104.38752"
87 x2="-4.523921"
88 y2="110.61378"
89 gradientUnits="userSpaceOnUse" />
90 <linearGradient
91 inkscape:collect="always"
92 xlink:href="#linearGradient1877"
93 id="linearGradient1894"
94 gradientUnits="userSpaceOnUse"
95 gradientTransform="matrix(-0.358726,0,0,1.867845,-36.85125,41.4295)"
96 x1="-84.334358"
97 y1="9.5548248"
98 x2="-84.334358"
99 y2="12.485031" />
100 <radialGradient
101 inkscape:collect="always"
102 xlink:href="#linearGradient4211"
103 id="radialGradient4217"
104 cx="18.738329"
105 cy="41.63604"
106 fx="18.738329"
107 fy="41.63604"
108 r="21.743534"
109 gradientTransform="matrix(1,0,0,0.333333,0,27.75736)"
110 gradientUnits="userSpaceOnUse" />
111 <linearGradient
112 inkscape:collect="always"
113 xlink:href="#linearGradient5411"
114 id="linearGradient5417"
115 x1="-17.000057"
116 y1="73.479156"
117 x2="-19.345716"
118 y2="98.479156"
119 gradientUnits="userSpaceOnUse"
120 gradientTransform="matrix(1,0,0,0.979216,0,1.222246)" />
121 <linearGradient
122 inkscape:collect="always"
123 xlink:href="#linearGradient4524"
124 id="linearGradient4530"
125 x1="-33.22401"
126 y1="71.791658"
127 x2="7.1282601"
128 y2="71.791658"
129 gradientUnits="userSpaceOnUse" />
130 </defs>
131 <sodipodi:namedview
132 inkscape:document-units="px"
133 id="base"
134 pagecolor="#ffffff"
135 bordercolor="#000000"
136 borderopacity="0.11372549"
137 inkscape:pageopacity="0.0"
138 inkscape:pageshadow="2"
139 inkscape:zoom="4"
140 inkscape:cx="32.887321"
141 inkscape:cy="22.661013"
142 inkscape:current-layer="g1623"
143 inkscape:window-width="872"
144 inkscape:window-height="695"
145 inkscape:window-x="790"
146 inkscape:window-y="365"
147 fill="#204a87"
148 inkscape:showpageshadow="false"
149 showgrid="false" />
150 <metadata
151 id="metadata4">
152 <rdf:RDF>
153 <cc:Work
154 rdf:about="">
155 <dc:format>image/svg+xml</dc:format>
156 <dc:type
157 rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
158 <dc:title>Trash</dc:title>
159 <dc:creator>
160 <cc:Agent>
161 <dc:title>Jakub Steiner</dc:title>
162 </cc:Agent>
163 </dc:creator>
164 <dc:date />
165 <dc:subject>
166 <rdf:Bag>
167 <rdf:li>trash</rdf:li>
168 <rdf:li>delete</rdf:li>
169 <rdf:li>wastebasket</rdf:li>
170 <rdf:li>empty</rdf:li>
171 </rdf:Bag>
172 </dc:subject>
173 <dc:description />
174 <cc:license
175 rdf:resource="http://creativecommons.org/licenses/GPL/2.0/" />
176 </cc:Work>
177 <cc:License
178 rdf:about="http://creativecommons.org/licenses/GPL/2.0/">
179 <cc:permits
180 rdf:resource="http://web.resource.org/cc/Reproduction" />
181 <cc:permits
182 rdf:resource="http://web.resource.org/cc/Distribution" />
183 <cc:requires
184 rdf:resource="http://web.resource.org/cc/Notice" />
185 <cc:permits
186 rdf:resource="http://web.resource.org/cc/DerivativeWorks" />
187 <cc:requires
188 rdf:resource="http://web.resource.org/cc/ShareAlike" />
189 <cc:requires
190 rdf:resource="http://web.resource.org/cc/SourceCode" />
191 </cc:License>
192 </rdf:RDF>
193 </metadata>
194 <g
195 inkscape:groupmode="layer"
196 id="layer2"
197 inkscape:label="Shadow">
198 <path
199 sodipodi:type="arc"
200 style="opacity:1;color:#000000;fill:url(#radialGradient4217);fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:0.99999982px;stroke-linecap:round;stroke-linejoin:round;marker:none;marker-start:none;marker-mid:none;marker-end:none;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;visibility:visible;display:inline;overflow:visible"
201 id="path3336"
202 sodipodi:cx="18.738329"
203 sodipodi:cy="41.63604"
204 sodipodi:rx="21.743534"
205 sodipodi:ry="7.2478447"
206 d="M 40.481863 41.63604 A 21.743534 7.2478447 0 1 1 -3.0052052,41.63604 A 21.743534 7.2478447 0 1 1 40.481863 41.63604 z"
207 transform="translate(5.303301,-0.707107)" />
208 </g>
209 <g
210 inkscape:label="Pixmap Background"
211 inkscape:groupmode="layer"
212 id="layer1" />
213 <g
214 inkscape:label="Layer 1"
215 inkscape:groupmode="layer"
216 id="g1623"
217 transform="translate(37.06885,-41.11763)">
218 <path
219 style="fill:url(#linearGradient4530);fill-opacity:1.0;fill-rule:evenodd;stroke:#204a87;stroke-width:1.02320302;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1"
220 d="M -32.711617,57.920772 C -32.75484,57.886856 -31.013657,82.319708 -31.013161,82.327116 C -30.849819,84.76715 -29.478625,85.658942 -27.943864,85.662576 C -27.889022,85.6627 0.84900065,85.659434 1.4612656,85.656892 C 4.0458711,85.64616 4.6790717,84.093225 4.8490952,82.396482 C 4.8627317,82.363025 6.603023,57.954228 6.6166586,57.920772 C -6.4927658,57.920772 -19.602191,57.920772 -32.711617,57.920772 z "
221 id="path1751"
222 sodipodi:nodetypes="ccccccc"
223 inkscape:r_cx="true"
224 inkscape:r_cy="true" />
225 <path
226 sodipodi:nodetypes="ccccccc"
227 id="path4536"
228 d="M -31.487684,58.804659 C -31.528216,58.773117 -29.957445,81.748687 -29.957445,81.748687 C -29.80427,84.018051 -29.080923,84.602662 -27.64169,84.606042 C -27.64169,84.606042 0.3590203,84.603118 0.93317605,84.600756 C 3.3569079,84.590774 3.6381962,83.207662 3.797637,81.629598 C 3.797637,81.629598 5.379895,58.835775 5.3926819,58.804659 C -6.9007726,58.804659 -19.194228,58.804659 -31.487684,58.804659 z "
229 style="opacity:0.32967033;fill:none;fill-opacity:1;fill-rule:evenodd;stroke:url(#linearGradient5417);stroke-width:1.02320278;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1"
230 inkscape:r_cx="true"
231 inkscape:r_cy="true" />
232 <path
233 style="fill:url(#linearGradient1872);fill-opacity:1;fill-rule:evenodd;stroke:#555555;stroke-width:1.02320313;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1"
234 d="M -29.082499,45.829563 C -30.106321,45.831929 -30.963179,45.85588 -31.429903,46.84186 C -31.511024,47.013232 -33.983709,53.968498 -34.102588,54.233742 C -35.120311,56.50448 -34.181763,59.364893 -32.216058,59.345744 C -31.84223,59.342218 6.518454,59.363478 7.1133033,59.345744 C 8.7866141,59.296726 9.0007434,55.984399 8.2803939,54.494337 C 8.2395836,54.40992 4.8963639,46.747074 4.8110968,46.611348 C 4.4167208,46.005189 3.5335502,45.739533 2.8775216,45.764414 C 2.7482894,45.769438 -28.954598,45.829269 -29.082499,45.829563 z "
235 id="path1841"
236 sodipodi:nodetypes="cssssscss"
237 inkscape:r_cx="true"
238 inkscape:r_cy="true" />
239 <path
240 style="color:#000000;fill:#204a87;fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:0;stroke-linecap:butt;stroke-linejoin:miter;marker:none;marker-start:none;marker-mid:none;marker-end:none;stroke-miterlimit:4;stroke-dashoffset:0;stroke-opacity:1;visibility:visible;display:block"
241 d="M -28.904114,47.210295 C -29.869702,47.197065 -29.932579,47.157501 -30.149937,47.881742 C -30.200113,48.048927 -32.221643,54.630972 -32.300884,54.88639 C -32.570366,55.755015 -32.189294,55.984256 -31.254099,55.966598 C -30.922809,55.960343 5.359423,55.966598 5.8868702,55.966598 C 6.6356452,55.966598 6.8577579,55.705163 6.6886176,55.088159 C 6.6198886,54.837443 3.8056452,47.809751 3.7300723,47.684596 C 3.3805322,47.125649 3.4411517,47.127276 2.8306245,47.119396 C 2.7160102,47.117916 -28.790763,47.211847 -28.904114,47.210295 z "
242 id="path1864"
243 sodipodi:nodetypes="cssssscss"
244 inkscape:r_cx="true"
245 inkscape:r_cy="true" />
246 <path
247 style="color:#000000;fill:#132c52;fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:0;stroke-linecap:butt;stroke-linejoin:miter;marker:none;marker-start:none;marker-mid:none;marker-end:none;stroke-miterlimit:4;stroke-dashoffset:0;stroke-opacity:1;visibility:visible;display:block"
248 d="M -29.42274,47.202148 C -29.786334,47.23159 -29.961217,47.34586 -30.113402,47.853333 C -30.163578,48.020644 -32.182887,54.597959 -32.262128,54.85357 C -32.531611,55.722851 -32.17412,55.956548 -31.238926,55.938879 C -31.222726,55.938575 -29.323942,55.939131 -29.144207,55.938879 L -29.42274,47.202148 z "
249 id="path1880"
250 sodipodi:nodetypes="cccccc"
251 inkscape:r_cx="true"
252 inkscape:r_cy="true" />
253 <path
254 style="color:#000000;fill:#729fcf;fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:0;stroke-linecap:butt;stroke-linejoin:miter;marker:none;marker-start:none;marker-mid:none;marker-end:none;stroke-miterlimit:4;stroke-dashoffset:0;stroke-opacity:1;visibility:visible;display:block"
255 d="M 2.8823282,47.11678 C 3.3242332,47.120782 3.4540015,47.111397 3.7365037,47.677324 C 3.7751374,47.754718 6.55447,54.735164 6.6542609,54.990551 C 6.9936352,55.974555 6.3472779,55.953979 5.3221031,55.982521 C 5.1273467,55.982217 2.8232902,55.959675 2.5969422,55.959422 L 2.8823282,47.11678 z "
256 id="path1888"
257 sodipodi:nodetypes="cscccc"
258 inkscape:r_cx="true"
259 inkscape:r_cy="true" />
260 <path
261 style="color:#000000;fill:url(#linearGradient1894);fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:0;stroke-linecap:butt;stroke-linejoin:miter;marker:none;marker-start:none;marker-mid:none;marker-end:none;stroke-miterlimit:4;stroke-dashoffset:0;stroke-opacity:1;visibility:visible;display:block"
262 d="M 5.8674719,59.783199 L -29.241178,59.84715 C -2.6592192,60.465334 2.5633795,63.385727 5.8035217,63.236509 L 5.8674719,59.783199 z "
263 id="path1893"
264 sodipodi:nodetypes="cccc" />
265 </g>
266 </svg>
@@ -62,9 +62,9 elfFileWidget::~elfFileWidget()
62
62
63
63
64
64
65 void elfFileWidget::setFile(ElfFile *file)
65 void elfFileWidget::setFile(abstractBinFile *file)
66 {
66 {
67 this->p_elf = file;
67 this->p_elf = (ElfFile*)file;
68 if(p_elf->isopened() && p_elf->iself())
68 if(p_elf->isopened() && p_elf->iself())
69 {
69 {
70 this->ui->classLabel->setText(p_elf->getClass());
70 this->ui->classLabel->setText(p_elf->getClass());
@@ -235,23 +235,27 void elfFileWidget::viewSymbolInHexViewe
235 {
235 {
236 int row=this->ui->symbolsList->item(this->ui->symbolsList->currentRow(),0)->text().toInt();
236 int row=this->ui->symbolsList->item(this->ui->symbolsList->currentRow(),0)->text().toInt();
237 int section = p_elf->getSectionIndex(p_elf->getSymbolSectionName(row));
237 int section = p_elf->getSectionIndex(p_elf->getSymbolSectionName(row));
238 qint64 address = p_elf->getSymbolAddress(row);
238 if(section!=-1)
239 qint64 secAddress = p_elf->getSectionPaddr(section);
240 qint64 size = p_elf->getSymbolSize(row);
241 char* buff=NULL;
242 char* symBuff=NULL;
243 if(size && !p_elf->sectionIsNobits(section))
244 {
239 {
245 if(section!=-1)
240 qint64 address = p_elf->getSymbolAddress(row);
241 qint64 secAddress = p_elf->getSectionPaddr(section);
242 qint64 size = p_elf->getSymbolSize(row);
243 char* buff=NULL;
244 char* symBuff=NULL;
245 if(size && !p_elf->sectionIsNobits(section))
246 {
246 {
247 symBuff = (char*)malloc(size);
247 if(section!=-1)
248 this->p_elf->getSectionData(section,&buff);
248 {
249 memcpy(symBuff,buff+(address-secAddress),size);
249 symBuff = (char*)malloc(size);
250 this->p_hexviewer->setData(QByteArray(symBuff,size));
250 this->p_elf->getSectionData(section,&buff);
251 this->p_hexviewer->setAddressOffset(address);
251 memcpy(symBuff,buff+(address-secAddress),size);
252 this->p_hexviewer->show();
252 this->p_hexviewer->setData(QByteArray(symBuff,size));
253 this->p_hexviewer->setAddressOffset(address);
254 this->p_hexviewer->show();
255 }
253 }
256 }
254 }
257 }
258
255 }
259 }
256
260
257 void elfFileWidget::filterSymbols(const QString &pattern)
261 void elfFileWidget::filterSymbols(const QString &pattern)
@@ -291,23 +295,27 QList<codeFragment *> elfFileWidget::get
291 {
295 {
292 int row=this->ui->symbolsList->item(items.at(i)->row(),0)->text().toInt();
296 int row=this->ui->symbolsList->item(items.at(i)->row(),0)->text().toInt();
293 int section = p_elf->getSectionIndex(p_elf->getSymbolSectionName(row));
297 int section = p_elf->getSectionIndex(p_elf->getSymbolSectionName(row));
294 qint64 address = p_elf->getSymbolAddress(row);
298 if(section!=-1)
295 qint64 secAddress = p_elf->getSectionPaddr(section);
296 qint64 size = p_elf->getSymbolSize(row);
297 char* buff=NULL;
298 if(size && !p_elf->sectionIsNobits(section))
299 {
299 {
300 if(section!=-1)
300 qint64 address = p_elf->getSymbolAddress(row);
301 qint64 secAddress = p_elf->getSectionPaddr(section);
302 qint64 size = p_elf->getSymbolSize(row);
303 char* buff=NULL;
304 if(size && !p_elf->sectionIsNobits(section))
301 {
305 {
302 fragment= new codeFragment();
306 if(section!=-1)
303 fragment->data = (char*)malloc(size);
307 {
304 fragment->address = address;
308 fragment= new codeFragment();
305 fragment->size = size;
309 fragment->data = (char*)malloc(size);
306 this->p_elf->getSectionData(section,&buff);
310 fragment->address = address;
307 memcpy(fragment->data,buff+(address-secAddress),size);
311 fragment->size = size;
308 fragments.append(fragment);
312 this->p_elf->getSectionData(section,&buff);
313 memcpy(fragment->data,buff+(address-secAddress),size);
314 fragments.append(fragment);
315 }
309 }
316 }
310 }
317 }
318
311 }
319 }
312 }
320 }
313 return fragments;
321 return fragments;
@@ -36,11 +36,11 class elfFileWidget : public abstractBin
36 Q_OBJECT
36 Q_OBJECT
37
37
38 public:
38 public:
39 elfFileWidget(QWidget *parent = 0);
39 explicit elfFileWidget(QWidget *parent = 0);
40 ~elfFileWidget();
40 ~elfFileWidget();
41
41
42 public slots:
42 public slots:
43 void setFile(ElfFile* file);
43 void setFile(abstractBinFile* file);
44 void reloadFile();
44 void reloadFile();
45 void updateSymbols();
45 void updateSymbols();
46 void updateSections();
46 void updateSections();
@@ -3,12 +3,21
3 #include <QFileDialog>
3 #include <QFileDialog>
4 #include <QFile>
4 #include <QFile>
5 #include "srec/srecfile.h"
5 #include "srec/srecfile.h"
6 #include "srec/srecfilewidget.h"
7 #include "BinFile/binaryfile.h"
8 #include "BinFile/binaryfilewidget.h"
9 #include "elf/elffile.h"
10 #include "elf/elffilewidget.h"
11
6
12
7 genericBinaryFileWidget::genericBinaryFileWidget(QWidget *parent) :
13 genericBinaryFileWidget::genericBinaryFileWidget(QWidget *parent) :
8 QWidget(parent),
14 QWidget(parent),
9 ui(new Ui::genericBinaryFileWidget)
15 ui(new Ui::genericBinaryFileWidget)
10 {
16 {
11 ui->setupUi(this);
17 ui->setupUi(this);
18 connect(this->ui->openFileQpb,SIGNAL(clicked()),this,SLOT(openFile()));
19 connect(this->ui->removeFileQpb,SIGNAL(clicked()),this,SLOT(removeFiles()));
20 connect(this->ui->fileList,SIGNAL(cellActivated(int,int)),this,SLOT(fileCellActivated(int,int)));
12 }
21 }
13
22
14 genericBinaryFileWidget::~genericBinaryFileWidget()
23 genericBinaryFileWidget::~genericBinaryFileWidget()
@@ -26,18 +35,26 void genericBinaryFileWidget::openFile()
26
35
27 for(int i=0;i<filesNames.count();i++)
36 for(int i=0;i<filesNames.count();i++)
28 {
37 {
38 bool fileOpened = false;
39 for(int l=0;l<files.count();l++)
40 {
41 if(filesNames.at(i)==files.at(l)->fileName)
42 {
43 fileOpened = true;
44 }
45 }
29 QFile file(filesNames.at(i));
46 QFile file(filesNames.at(i));
30 if(file.open(QIODevice::ReadOnly))
47 if(!fileOpened && file.open(QIODevice::ReadOnly))
31 {
48 {
32 char magic[4];
49 char magic[4];
33 file.read(magic,4);
50 file.read(magic,4);
34 QString line;
51 QString line;
35 switch((int)magic[0])
52 switch((int)magic[0])
36 {
53 {
37 case 'e':
54 case 0x7F:
38 if((magic[1]=='l') && (magic[2]=='f'))
55 if((magic[1]=='E') && (magic[2]=='L') && (magic[3]=='F'))
39 {
56 {
40 files.append(new FileListElement(filesNames.at(i),false,Type_Elf,NULL));
57 files.append(new FileListElement(filesNames.at(i),false,Type_Elf,NULL,NULL));
41 }
58 }
42 break;
59 break;
43 case 'S':
60 case 'S':
@@ -45,18 +62,124 void genericBinaryFileWidget::openFile()
45 line = file.readLine();
62 line = file.readLine();
46 if(srecFile::checkSum(line))
63 if(srecFile::checkSum(line))
47 {
64 {
48 files.append(new FileListElement(filesNames.at(i),false,Type_SREC,NULL));
65 files.append(new FileListElement(filesNames.at(i),false,Type_SREC,NULL,NULL));
49 }
66 }
50 break;
67 break;
51 default:
68 default:
52 files.append(new FileListElement(filesNames.at(i),false,Type_Bin,NULL));
69 files.append(new FileListElement(filesNames.at(i),false,Type_Bin,NULL,NULL));
53 break;
70 break;
54 }
71 }
55 }
72 }
56 }
73 }
74 updateFileList();
57
75
58 }
76 }
59
77
78 void genericBinaryFileWidget::updateFileList()
79 {
80 this->ui->fileList->clear();
81 this->ui->fileList->setRowCount(files.count());
82 this->ui->fileList->setHorizontalHeaderLabels(QStringList()<<"File"<<"Type");
83 for(int i=0;i<files.count();i++)
84 {
85 QTableWidgetItem *newItem = new QTableWidgetItem(files.at(i)->fileName);
86 newItem->setFlags(newItem->flags() ^ Qt::ItemIsEditable);
87 this->ui->fileList->setItem(i, 0, newItem);
88
89 newItem = new QTableWidgetItem(files.at(i)->type());
90 newItem->setFlags(newItem->flags() ^ Qt::ItemIsEditable);
91 this->ui->fileList->setItem(i, 1, newItem);
92 }
93 this->ui->fileList->resizeColumnsToContents();
94 }
95
96 void genericBinaryFileWidget::removeFiles()
97 {
98 QList<QTableWidgetItem*> items = this->ui->fileList->selectedItems();
99 for(int i=0;i<items.count();i++)
100 {
101 QString filename = this->ui->fileList->item(items.at(i)->row(),0)->text();
102 for(int l=0;l<files.count();l++)
103 {
104 if(files.at(l)->fileName==filename)
105 {
106 if(files.at(l)->isOpened)
107 {
108 for(int m=0;m<this->ui->fileViewerTab->count();m++)
109 {
110 if(this->ui->fileViewerTab->widget(m)==this->files.at(l)->viewer)
111 {
112 this->ui->fileViewerTab->removeTab(m);
113 }
114 }
115 delete this->files.at(l)->viewer;
116 delete this->files.at(l)->parser;
117 }
118 delete files.at(l);
119 files.removeAt(l);
120 }
121 }
122 }
123 updateFileList();
124 }
125
126 void genericBinaryFileWidget::fileCellActivated(int row, int column)
127 {
128 Q_UNUSED(column)
129 QString fileName = this->ui->fileList->item(row,0)->text();
130 if(fileName!="")
131 {
132 for(int l=0;l<files.count();l++)
133 {
134 FileListElement* file = files.at(l);
135 if(file->fileName==fileName)
136 {
137 if(!file->isOpened)
138 {
139 if(file->parser==NULL)
140 {
141 switch (file->FileType)
142 {
143 case Type_Bin:
144 file->parser = new binaryFile(file->fileName);
145 if(file->viewer==NULL)
146 {
147 file->viewer = new binaryFileWidget();
148 file->viewer->setFile(file->parser);
149 this->ui->fileViewerTab->addTab(file->viewer,file->fileName);
150 }
151 file->isOpened = true;
152 break;
153 case Type_Elf:
154 file->parser = new ElfFile(file->fileName);
155 if(file->viewer==NULL)
156 {
157 file->viewer = new elfFileWidget();
158 file->viewer->setFile(file->parser);
159 this->ui->fileViewerTab->addTab(file->viewer,file->fileName);
160 }
161 file->isOpened = true;
162 break;
163 case Type_SREC:
164 file->parser = new srecFile(file->fileName);
165 if(file->viewer==NULL)
166 {
167 file->viewer = new srecFileWidget();
168 file->viewer->setFile(file->parser);
169 this->ui->fileViewerTab->addTab(file->viewer,file->fileName);
170 }
171 file->isOpened = true;
172 break;
173 default:
174 break;
175 }
176 }
177 }
178 }
179 }
180 }
181 }
182
60
183
61
184
62
185
@@ -15,12 +15,30 class FileListElement
15 {
15 {
16 public:
16 public:
17 FileListElement() {}
17 FileListElement() {}
18 FileListElement(QString fileName,bool isOpened,FileTypeEnum FileType,abstractBinFileWidget* viewer)
18 FileListElement(QString fileName,bool isOpened,FileTypeEnum FileType,abstractBinFileWidget* viewer=0,abstractBinFile* parser=0)
19 :fileName(fileName),isOpened(isOpened),FileType(FileType),viewer(viewer){}
19 :fileName(fileName),isOpened(isOpened),FileType(FileType),viewer(viewer),parser(parser){}
20 QString type()
21 {
22 switch (this->FileType) {
23 case Type_SREC:
24 return "Srec";
25 break;
26 case Type_Bin:
27 return "Binary";
28 break;
29 case Type_Elf:
30 return "Elf";
31 break;
32 default:
33 return "Unknow";
34 break;
35 }
36 }
20 QString fileName;
37 QString fileName;
21 bool isOpened;
38 bool isOpened;
22 FileTypeEnum FileType;
39 FileTypeEnum FileType;
23 abstractBinFileWidget* viewer;
40 abstractBinFileWidget* viewer;
41 abstractBinFile* parser;
24 };
42 };
25
43
26 class genericBinaryFileWidget : public QWidget
44 class genericBinaryFileWidget : public QWidget
@@ -33,6 +51,9 public:
33
51
34 public slots:
52 public slots:
35 void openFile();
53 void openFile();
54 void updateFileList();
55 void removeFiles();
56 void fileCellActivated(int row, int column);
36
57
37 private:
58 private:
38 Ui::genericBinaryFileWidget *ui;
59 Ui::genericBinaryFileWidget *ui;
@@ -30,8 +30,8
30 <string/>
30 <string/>
31 </property>
31 </property>
32 <property name="icon">
32 <property name="icon">
33 <iconset resource="../SocExplorerCommon.qrc">
33 <iconset resource="genericBinaryFiles.qrc">
34 <normaloff>:/images/add.svg</normaloff>:/images/add.svg</iconset>
34 <normaloff>:/img/ressources/Gnome-list-add.svg</normaloff>:/img/ressources/Gnome-list-add.svg</iconset>
35 </property>
35 </property>
36 <property name="iconSize">
36 <property name="iconSize">
37 <size>
37 <size>
@@ -47,8 +47,8
47 <string/>
47 <string/>
48 </property>
48 </property>
49 <property name="icon">
49 <property name="icon">
50 <iconset resource="../SocExplorerCommon.qrc">
50 <iconset resource="genericBinaryFiles.qrc">
51 <normaloff>:/images/trash.svg</normaloff>:/images/trash.svg</iconset>
51 <normaloff>:/img/ressources/Gnome-user-trash.svg</normaloff>:/img/ressources/Gnome-user-trash.svg</iconset>
52 </property>
52 </property>
53 <property name="iconSize">
53 <property name="iconSize">
54 <size>
54 <size>
@@ -72,7 +72,7
72 </spacer>
72 </spacer>
73 </item>
73 </item>
74 <item row="0" column="0" colspan="3">
74 <item row="0" column="0" colspan="3">
75 <widget class="QTableWidget" name="tableWidget">
75 <widget class="QTableWidget" name="fileList">
76 <column>
76 <column>
77 <property name="text">
77 <property name="text">
78 <string>File</string>
78 <string>File</string>
@@ -97,7 +97,7
97 </layout>
97 </layout>
98 </widget>
98 </widget>
99 <resources>
99 <resources>
100 <include location="../SocExplorerCommon.qrc"/>
100 <include location="genericBinaryFiles.qrc"/>
101 </resources>
101 </resources>
102 <connections/>
102 <connections/>
103 </ui>
103 </ui>
General Comments 0
You need to be logged in to leave comments. Login now