Skip to content

Commit

Permalink
Bundle debugger icons in the debugger UI binary. Fix Vector35#358
Browse files Browse the repository at this point in the history
  • Loading branch information
xusheng6 committed Nov 11, 2022
1 parent 475396b commit b06cf19
Show file tree
Hide file tree
Showing 7 changed files with 32 additions and 14 deletions.
18 changes: 18 additions & 0 deletions debuggerui.qrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<RCC>
<qresource prefix="/debugger_icons">
<file>icons/run.svg</file>
<file>icons/cancel.svg</file>
<file>icons/connect.svg</file>
<file>icons/disconnect.svg</file>
<file>icons/pause.svg</file>
<file>icons/restart.svg</file>
<file>icons/resume.svg</file>
<file>icons/stepinto.svg</file>
<file>icons/stepout.svg</file>
<file>icons/stepover.svg</file>
<file>icons/stop.svg</file>
<file>icons/debugger.svg</file>
<file>icons/breakpoint.svg</file>
<file>icons/menu.png</file>
</qresource>
</RCC>
Binary file added icons/menu.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion ui/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ set(CMAKE_AUTOMOC ON)
set(CMAKE_AUTORCC ON)
find_package(Qt6 COMPONENTS Core Gui Widgets REQUIRED)

file(GLOB SOURCES *.cpp *.h)
file(GLOB SOURCES *.cpp *.h ../debuggerui.qrc)
list(FILTER SOURCES EXCLUDE REGEX moc_.*)
list(FILTER SOURCES EXCLUDE REGEX qrc_.*)

Expand Down
20 changes: 10 additions & 10 deletions ui/controlswidget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -39,37 +39,37 @@ DebugControlsWidget::DebugControlsWidget(QWidget* parent, const std::string name
auto red = getThemeColor(RedStandardHighlightColor);
auto white = getThemeColor(WhiteStandardHighlightColor);

m_actionRun = addAction(getColoredIcon(":/icons/images/debugger/run.svg", red), "Run",
m_actionRun = addAction(getColoredIcon(":/debugger_icons/icons/run.svg", red), "Run",
[this](){ performLaunch(); });

m_actionPause = addAction(getColoredIcon(":/icons/images/debugger/pause.svg", white), "Pause",
m_actionPause = addAction(getColoredIcon(":/debugger_icons/icons/pause.svg", white), "Pause",
[this](){ performPause(); });

m_actionResume = addAction(getColoredIcon(":/icons/images/debugger/resume.svg", green), "Resume",
m_actionResume = addAction(getColoredIcon(":/debugger_icons/icons/resume.svg", green), "Resume",
[this](){ performResume(); });

// m_actionRun->setVisible(true);
m_actionPause->setVisible(false);
m_actionResume->setVisible(false);

// TODO: we need a different icon here
m_actionAttachPid = addAction(getColoredIcon(":/icons/images/debugger/connect.svg", white), "Attach to PID",
m_actionAttachPid = addAction(getColoredIcon(":/debugger_icons/icons/connect.svg", white), "Attach to PID",
[this](){ performAttachPID(); });
m_actionDetach = addAction(getColoredIcon(":/icons/images/debugger/disconnect.svg", red), "Detach",
m_actionDetach = addAction(getColoredIcon(":/debugger_icons/icons/disconnect.svg", red), "Detach",
[this](){ performDetach(); });
m_actionDetach->setVisible(false);

m_actionRestart = addAction(getColoredIcon(":/icons/images/debugger/restart.svg", red), "Restart",
m_actionRestart = addAction(getColoredIcon(":/debugger_icons/icons/restart.svg", red), "Restart",
[this](){ performRestart(); });
m_actionQuit = addAction(getColoredIcon(":/icons/images/debugger/cancel.svg", red), "Quit",
m_actionQuit = addAction(getColoredIcon(":/debugger_icons/icons/cancel.svg", red), "Quit",
[this](){ performQuit(); });
addSeparator();

m_actionStepInto = addAction(getColoredIcon(":/icons/images/debugger/stepinto.svg", cyan), "Step Into",
m_actionStepInto = addAction(getColoredIcon(":/debugger_icons/icons/stepinto.svg", cyan), "Step Into",
[this](){ performStepInto(); });
m_actionStepOver = addAction(getColoredIcon(":/icons/images/debugger/stepover.svg", cyan), "Step Over",
m_actionStepOver = addAction(getColoredIcon(":/debugger_icons/icons/stepover.svg", cyan), "Step Over",
[this](){ performStepOver(); });
m_actionStepReturn = addAction(getColoredIcon(":/icons/images/debugger/stepout.svg", cyan), "Step Out",
m_actionStepReturn = addAction(getColoredIcon(":/debugger_icons/icons/stepout.svg", cyan), "Step Out",
[this](){ performStepReturn(); });

updateButtons();
Expand Down
2 changes: 1 addition & 1 deletion ui/moduleswidget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -584,7 +584,7 @@ DebugModulesWithFilter::DebugModulesWithFilter(ViewFrame* view, BinaryViewRef da
headerLayout->setContentsMargins(0, 0, 0, 0);
headerLayout->addWidget(m_separateEdit, 1);

auto* icon = new ClickableIcon(QImage(":/icons/images/menu.png"), QSize(16, 16));
auto* icon = new ClickableIcon(QImage(":/debugger_icons/icons/menu.png"), QSize(16, 16));
connect(icon, &ClickableIcon::clicked, m_modules, &DebugModulesWidget::showContextMenu);
headerLayout->addWidget(icon);

Expand Down
2 changes: 1 addition & 1 deletion ui/registerswidget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -726,7 +726,7 @@ DebugRegistersContainer::DebugRegistersContainer(ViewFrame* view, BinaryViewRef
headerLayout->setContentsMargins(1, 1, 6, 0);
headerLayout->setAlignment(Qt::AlignBaseline);

ClickableIcon* icon = new ClickableIcon(QImage(":/icons/images/menu.png"), QSize(16, 16));
ClickableIcon* icon = new ClickableIcon(QImage(":/debugger_icons/icons/menu.png"), QSize(16, 16));
connect(icon, &ClickableIcon::clicked, m_register, &DebugRegistersWidget::showContextMenu);
headerLayout->addWidget(icon);

Expand Down
2 changes: 1 addition & 1 deletion ui/ui.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1185,7 +1185,7 @@ static bool ConnectedAndRunning(BinaryView* view, uint64_t addr)
void GlobalDebuggerUI::InitializeUI()
{
Sidebar::addSidebarWidgetType(
new DebuggerWidgetType(QImage(":/icons/images/debugger/debugger.svg"), "Debugger"));
new DebuggerWidgetType(QImage(":/debugger_icons/icons/debugger.svg"), "Debugger"));

// We must use the sequence of these four calls to do the job, otherwise the keybinding does not work.
// Though it really should be the case where I can specify the keybinding in the first registerAction() call.
Expand Down

0 comments on commit b06cf19

Please sign in to comment.