mirror of
https://github.com/rizinorg/cutter.git
synced 2025-02-20 13:46:06 +00:00
WIP VisualNavbar
This commit is contained in:
parent
7e8e182f72
commit
f12118f4d4
@ -1545,6 +1545,9 @@ BlockStatistics CutterCore::getBlockStatistics(unsigned int blocksCount)
|
||||
ret.blocksize = statsObj["blocksize"].toVariant().toULongLong();
|
||||
|
||||
QJsonArray blocksArray = statsObj["blocks"].toArray();
|
||||
|
||||
printf("got %d blocks for requested %u\n", blocksArray.count(), blocksCount);
|
||||
|
||||
for (const QJsonValue &value : blocksArray) {
|
||||
QJsonObject blockObj = value.toObject();
|
||||
BlockDescription block;
|
||||
@ -1552,6 +1555,7 @@ BlockStatistics CutterCore::getBlockStatistics(unsigned int blocksCount)
|
||||
block.size = blockObj["size"].toVariant().toULongLong();
|
||||
block.flags = blockObj["flags"].toInt(0);
|
||||
block.functions = blockObj["functions"].toInt(0);
|
||||
block.inFunctions = blockObj["in_functions"].toInt(0);
|
||||
block.comments = blockObj["comments"].toInt(0);
|
||||
block.symbols = blockObj["symbols"].toInt(0);
|
||||
block.strings = blockObj["strings"].toInt(0);
|
||||
|
@ -280,6 +280,7 @@ struct BlockDescription {
|
||||
RVA size;
|
||||
int flags;
|
||||
int functions;
|
||||
int inFunctions;
|
||||
int comments;
|
||||
int symbols;
|
||||
int strings;
|
||||
|
@ -14,8 +14,8 @@
|
||||
viewBox="0 0 512.00001 512.00001"
|
||||
id="svg4254"
|
||||
version="1.1"
|
||||
inkscape:version="0.92.2 (5c3e80d, 2017-08-06)"
|
||||
sodipodi:docname="cutter_appicon.svg">
|
||||
inkscape:version="0.92.2 2405546, 2018-03-11"
|
||||
sodipodi:docname="cutter.svg">
|
||||
<defs
|
||||
id="defs4256" />
|
||||
<sodipodi:namedview
|
||||
@ -26,18 +26,18 @@
|
||||
inkscape:pageopacity="1"
|
||||
inkscape:pageshadow="2"
|
||||
inkscape:zoom="0.7"
|
||||
inkscape:cx="200.1373"
|
||||
inkscape:cy="199.03458"
|
||||
inkscape:cx="691.62586"
|
||||
inkscape:cy="305.9566"
|
||||
inkscape:document-units="px"
|
||||
inkscape:current-layer="layer1"
|
||||
showgrid="false"
|
||||
units="px"
|
||||
inkscape:snap-bbox="true"
|
||||
inkscape:window-width="1920"
|
||||
inkscape:window-height="985"
|
||||
inkscape:window-x="0"
|
||||
inkscape:window-y="22"
|
||||
inkscape:window-maximized="0" />
|
||||
inkscape:window-height="1024"
|
||||
inkscape:window-x="1920"
|
||||
inkscape:window-y="0"
|
||||
inkscape:window-maximized="1" />
|
||||
<metadata
|
||||
id="metadata4259">
|
||||
<rdf:RDF>
|
||||
@ -46,7 +46,7 @@
|
||||
<dc:format>image/svg+xml</dc:format>
|
||||
<dc:type
|
||||
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
|
||||
<dc:title></dc:title>
|
||||
<dc:title />
|
||||
</cc:Work>
|
||||
</rdf:RDF>
|
||||
</metadata>
|
||||
@ -70,5 +70,16 @@
|
||||
d="M 256.00271,572.36218 C 132.45491,572.36218 32.000055,672.8129 32,796.36215 c 2.7e-5,33.63902 7.491933,65.53883 20.82432,94.19185 L 69.68595,858.80902 C 63.130866,839.19082 59.529221,818.2119 59.529194,796.36215 59.529221,687.69096 147.33276,599.89171 256.00271,599.89171 c 57.4471,0 109.04798,24.54673 144.94228,63.73192 h -95.88977 l -73.12445,137.19058 73.32338,138.70687 h 85.35663 c -35.14099,33.04896 -82.45299,53.31159 -134.60807,53.31159 -48.23544,0 -92.33512,-17.3306 -126.4945,-46.07433 H 90.12319 c 41.00589,45.18743 100.17358,73.60386 165.87952,73.60386 C 379.55049,1020.3622 480,919.91141 480,796.36218 480,672.8129 379.55049,572.36221 256.00271,572.36221 Z M 189.35729,692.20165 68.76116,919.22881 h 194.62926 l -62.62353,-118.46834 57.85968,-108.5588 h -69.26926 z m 162.72874,50.55859 v 56.84417 l 38.07845,-28.42205 38.07309,-28.42209 v 56.84417 56.84418 l -38.07309,-28.4221 -38.07845,-28.42208 v 56.84418 l -38.07305,-28.4221 -38.0785,-28.42208 38.0785,-28.42208 38.07305,-28.42209 z"
|
||||
style="color:#000000;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:medium;line-height:normal;font-family:sans-serif;text-indent:0;text-align:start;text-decoration:none;text-decoration-line:none;text-decoration-style:solid;text-decoration-color:#000000;letter-spacing:normal;word-spacing:normal;text-transform:none;writing-mode:lr-tb;direction:ltr;baseline-shift:baseline;text-anchor:start;white-space:normal;clip-rule:nonzero;display:inline;overflow:visible;visibility:visible;opacity:1;isolation:auto;mix-blend-mode:normal;color-interpolation:sRGB;color-interpolation-filters:linearRGB;solid-color:#000000;solid-opacity:1;fill:#ffffff;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:10;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;color-rendering:auto;image-rendering:auto;shape-rendering:auto;text-rendering:auto;enable-background:accumulate" />
|
||||
</g>
|
||||
<text
|
||||
xml:space="preserve"
|
||||
style="font-style:normal;font-weight:normal;font-size:249.93745422px;line-height:1.25;font-family:sans-serif;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;stroke-width:6.24843645"
|
||||
x="548.21155"
|
||||
y="892.46075"
|
||||
id="text4574"><tspan
|
||||
sodipodi:role="line"
|
||||
id="tspan4572"
|
||||
x="548.21155"
|
||||
y="892.46075"
|
||||
style="stroke-width:6.24843645">Cutter</tspan></text>
|
||||
</g>
|
||||
</svg>
|
||||
|
Before Width: | Height: | Size: 4.0 KiB After Width: | Height: | Size: 4.5 KiB |
@ -71,7 +71,7 @@ void VisualNavbar::paintEvent(QPaintEvent *event)
|
||||
|
||||
QPainter painter(this);
|
||||
if (previousWidth != this->width()) {
|
||||
this->fillData();
|
||||
fetchAndPaintData();
|
||||
previousWidth = this->width();
|
||||
}
|
||||
}
|
||||
@ -107,6 +107,8 @@ void VisualNavbar::fillData()
|
||||
|
||||
RVA totalSize = stats.to - stats.from;
|
||||
|
||||
printf("from: %llu, to %llu, first: %llu\n", stats.from, stats.to, stats.blocks[0].addr);
|
||||
|
||||
double widthPerByte = (double)w / (double)totalSize;
|
||||
auto xFromAddr = [widthPerByte] (RVA addr) -> double {
|
||||
return addr * widthPerByte;
|
||||
@ -131,18 +133,23 @@ void VisualNavbar::fillData()
|
||||
xToAddress.append(x2a);
|
||||
|
||||
DataType dataType;
|
||||
if (block.functions > 0) {
|
||||
if (block.inFunctions > 0) {
|
||||
dataType = DataType::Code;
|
||||
} else if (block.strings > 0) {
|
||||
dataType = DataType::String;
|
||||
} else if (block.symbols > 0) {
|
||||
dataType = DataType::Symbol;
|
||||
} else {
|
||||
lastDataType = DataType::Empty;
|
||||
continue;
|
||||
}
|
||||
|
||||
if (dataType == lastDataType) {
|
||||
dataItemRect.setRight(xFromAddr(block.addr + block.size));
|
||||
double r = xFromAddr(block.addr + block.size);
|
||||
if (r > dataItemRect.right()) {
|
||||
dataItemRect.setRight(r);
|
||||
dataItem->setRect(dataItemRect);
|
||||
}
|
||||
dataItem->setRect(dataItemRect);
|
||||
continue;
|
||||
}
|
||||
@ -159,7 +166,7 @@ void VisualNavbar::fillData()
|
||||
}
|
||||
|
||||
// Update scene width
|
||||
graphicsScene->setSceneRect(graphicsScene->itemsBoundingRect());
|
||||
graphicsScene->setSceneRect(0, 0, w, h);
|
||||
|
||||
drawCursor();
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user