-
Notifications
You must be signed in to change notification settings - Fork 118
Minimap for hexedit #266
base: master
Are you sure you want to change the base?
Minimap for hexedit #266
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- Please make it visible by default
- When both minimap and node tree are open resizing minimap is not too convenient (because it resizes both panels).
@@ -48,10 +48,11 @@ class VisualizationMinimap : public QOpenGLWidget, | |||
ENTROPY | |||
}; | |||
|
|||
explicit VisualizationMinimap(QWidget *parent = 0); | |||
explicit VisualizationMinimap(bool size_control = true, QWidget *parent = 0); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
parent
should be the first argument (same as you did in MinimapPanel ctor)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
so it is wrong in MinimapPanel , all qt things have it as last argmunet
src/ui/hexeditwidget.cc
Outdated
@@ -62,6 +62,10 @@ HexEditWidget::HexEditWidget(MainWindowWithDetachableDockWidgets *main_window, | |||
connect(hex_edit_, &HexEdit::selectionChanged, | |||
this, &HexEditWidget::selectionChanged); | |||
|
|||
connect(hex_edit_, &HexEdit::visibleRegionChanged, [this] (qint64 start_addr, qint64 region_size) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
no space after ]
src/ui/hexeditwidget.cc
Outdated
// show_minimap_act_->setChecked(false); | ||
// connect(show_minimap_act_, SIGNAL(toggled(bool)), this, | ||
// SIGNAL(showMinimap(bool))); | ||
//Currently not implemented |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
space after //
src/ui/hexeditwidget.cc
Outdated
// SIGNAL(showMinimap(bool))); | ||
//Currently not implemented | ||
show_minimap_act_ = ShortcutsModel::ShortcutsModel::getShortcutsModel()->createQAction( | ||
util::settings::shortcuts::SHOW_MINIMAP, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
indent with 4 spaces
@@ -44,6 +44,8 @@ | |||
namespace veles { | |||
namespace ui { | |||
|
|||
const float k_minimap_selection_factor = 10; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
consts should be in uppercase
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
convention from this component, see trigram.cc
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We'll refactor this old convention in few days (after fixing Jenkins), so insert new code in Google C++ Style
size_t minimap_size = std::min(static_cast<size_t>(selection_size * grow_factor), full_size); | ||
minimap_sizes.append(minimap_size); | ||
|
||
size_t offset = start_position % minimap_size; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this will crash for an empty file
src/visualization/minimap_panel.cc
Outdated
|
||
size_t offset = start_position % minimap_size; | ||
|
||
// jump to begin if selection overflows bar |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
begin
-> beginning
jump
-> Jump
bar
-> bar.
src/visualization/minimap_panel.cc
Outdated
offset = 0; | ||
} | ||
|
||
// fit end of bar to end of data |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fit
, data.
src/visualization/minimap_panel.cc
Outdated
} while (selection_size < full_size); | ||
|
||
int index = 0; | ||
while(index < minimap_sizes.size()) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
space after while
src/visualization/minimap_panel.cc
Outdated
do { | ||
selection_size = std::min(full_size, selection_size); | ||
minimap_selection_sizes.append(selection_size); | ||
size_t minimap_size = std::min(static_cast<size_t>(selection_size * grow_factor), full_size); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
AFAIR we use uint64_t in other places for file pos, this won't work well on 32-bit. Please fix this also in other places in this PR.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
no for minimaps size, see other methods in this file
I will prefer to not enable this by defualt:
|
This change is