From b06cf19288905567b24c84bc3d197260c93e81a7 Mon Sep 17 00:00:00 2001 From: Xusheng Date: Fri, 11 Nov 2022 11:13:07 +0800 Subject: [PATCH] Bundle debugger icons in the debugger UI binary. Fix https://github.com/Vector35/debugger/issues/358 --- debuggerui.qrc | 18 ++++++++++++++++++ icons/menu.png | Bin 0 -> 534 bytes ui/CMakeLists.txt | 2 +- ui/controlswidget.cpp | 20 ++++++++++---------- ui/moduleswidget.cpp | 2 +- ui/registerswidget.cpp | 2 +- ui/ui.cpp | 2 +- 7 files changed, 32 insertions(+), 14 deletions(-) create mode 100644 debuggerui.qrc create mode 100644 icons/menu.png diff --git a/debuggerui.qrc b/debuggerui.qrc new file mode 100644 index 00000000..3ab46ef4 --- /dev/null +++ b/debuggerui.qrc @@ -0,0 +1,18 @@ + + + icons/run.svg + icons/cancel.svg + icons/connect.svg + icons/disconnect.svg + icons/pause.svg + icons/restart.svg + icons/resume.svg + icons/stepinto.svg + icons/stepout.svg + icons/stepover.svg + icons/stop.svg + icons/debugger.svg + icons/breakpoint.svg + icons/menu.png + + diff --git a/icons/menu.png b/icons/menu.png new file mode 100644 index 0000000000000000000000000000000000000000..0c1c69a1163071a52634a14badd18cccd7474f09 GIT binary patch literal 534 zcmV+x0_pvUP)!h`EZ9RyHDy%v zLn@uogMP0vJ2$UXKT$;kt+e9|tA;i@H5H(&z29Q9;&rc8tNgitt#&DDs9>uR9#J(t zBRnn~Sj}h_Zwa@kiSUx}iLgtT3ku&@dZftD7RQVHX|Wy(`oP{Kti*qDm$0)7J#xNr@e3a`XT?TTt(*V=010qNS#tmY79{`x79{~mQY7#I0025kL_t(Y ziDO_G1p^HjkvaeW|EG?jj0j_ysA3`>F!U`L1*3p+Fq)GG-hxpu3MdDoIeFkM7zG0l Y0CK?z7BnY(2><{907*qoM6N<$f~+LiQ2+n{ literal 0 HcmV?d00001 diff --git a/ui/CMakeLists.txt b/ui/CMakeLists.txt index 0b8335fe..17eb71ae 100644 --- a/ui/CMakeLists.txt +++ b/ui/CMakeLists.txt @@ -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_.*) diff --git a/ui/controlswidget.cpp b/ui/controlswidget.cpp index 046db58b..eefdbcf7 100644 --- a/ui/controlswidget.cpp +++ b/ui/controlswidget.cpp @@ -39,13 +39,13 @@ 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); @@ -53,23 +53,23 @@ DebugControlsWidget::DebugControlsWidget(QWidget* parent, const std::string name 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(); diff --git a/ui/moduleswidget.cpp b/ui/moduleswidget.cpp index 6edaa678..312a0544 100644 --- a/ui/moduleswidget.cpp +++ b/ui/moduleswidget.cpp @@ -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); diff --git a/ui/registerswidget.cpp b/ui/registerswidget.cpp index 21286df0..61d22188 100644 --- a/ui/registerswidget.cpp +++ b/ui/registerswidget.cpp @@ -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); diff --git a/ui/ui.cpp b/ui/ui.cpp index af7384fe..729715ab 100644 --- a/ui/ui.cpp +++ b/ui/ui.cpp @@ -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.