Support multi-theme icons on debug

This commit is contained in:
itayc0hen 2019-12-07 16:15:09 +02:00 committed by Itay Cohen
parent a75533c3ae
commit e54ab621fc
9 changed files with 199 additions and 24 deletions

View File

@ -13,7 +13,7 @@
fill="none"
version="1.1"
id="svg5373"
sodipodi:docname="continue_unti_call.svg"
sodipodi:docname="continue_until_call.svg"
inkscape:version="0.92.4 5da689c313, 2019-01-14">
<metadata
id="metadata5379">
@ -23,7 +23,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>
@ -43,27 +43,27 @@
id="namedview5375"
showgrid="false"
inkscape:zoom="16"
inkscape:cx="21.588832"
inkscape:cx="12.213832"
inkscape:cy="7.0871542"
inkscape:window-x="1680"
inkscape:window-y="18"
inkscape:window-maximized="1"
inkscape:current-layer="svg5373" />
<path
d="M 0.5,2 H 2 V 2.24001 14 H 0.5 Z M 4,2.18094 V 14 L 13,8.06218 Z M 10.3148,8.06218 5.50023,5 v 6.1809 z"
d="m 0.125,2 h 1.5 V 2.24001 14 h -1.5 z m 3.5,0.18094 V 14 l 9,-5.93782 z M 9.9398,8.06218 5.12523,5 v 6.1809 z"
id="path5371"
inkscape:connector-curvature="0"
style="clip-rule:evenodd;fill:#75beff;fill-rule:evenodd" />
style="clip-rule:evenodd;fill:#63ebff;fill-rule:evenodd" />
<text
xml:space="preserve"
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:8px;line-height:1.25;font-family:arial;-inkscape-font-specification:arial;letter-spacing:0px;word-spacing:0px;fill:#999999;fill-opacity:0.94117647;stroke:none;stroke-width:0.44802567;stroke-linecap:round;stroke-linejoin:bevel;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1;paint-order:stroke fill markers"
x="8.8656101"
y="5.8233199"
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:8px;line-height:1.25;font-family:arial;-inkscape-font-specification:arial;letter-spacing:0px;word-spacing:0px;fill:#ffffff;fill-opacity:0.94117647;stroke:none;stroke-width:0.44802567;stroke-linecap:round;stroke-linejoin:bevel;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1;paint-order:stroke fill markers"
x="9.3777962"
y="5.8919601"
id="text5926"
transform="scale(1.0982407,0.91054721)"><tspan
sodipodi:role="line"
id="tspan5924"
x="8.8656101"
y="5.8233199"
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:10.66666698px;font-family:arial;-inkscape-font-specification:arial;fill:#999999;fill-opacity:0.94117647;stroke:none;stroke-width:0.44802567;stroke-linecap:round;stroke-linejoin:bevel;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1;paint-order:stroke fill markers">c</tspan></text>
x="9.3777962"
y="5.8919601"
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:10.66666698px;font-family:arial;-inkscape-font-specification:arial;fill:#ffffff;fill-opacity:0.94117647;stroke:none;stroke-width:0.44802567;stroke-linecap:round;stroke-linejoin:bevel;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1;paint-order:stroke fill markers">c</tspan></text>
</svg>

Before

Width:  |  Height:  |  Size: 2.7 KiB

After

Width:  |  Height:  |  Size: 2.7 KiB

View File

@ -0,0 +1,69 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<svg
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:cc="http://creativecommons.org/ns#"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns="http://www.w3.org/2000/svg"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
width="16"
height="16"
viewBox="0 0 16 16"
fill="none"
version="1.1"
id="svg5373"
sodipodi:docname="continue_until_main.svg"
inkscape:version="0.92.4 5da689c313, 2019-01-14">
<metadata
id="metadata5379">
<rdf:RDF>
<cc:Work
rdf:about="">
<dc:format>image/svg+xml</dc:format>
<dc:type
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
<dc:title />
</cc:Work>
</rdf:RDF>
</metadata>
<defs
id="defs5377" />
<sodipodi:namedview
pagecolor="#ffffff"
bordercolor="#666666"
borderopacity="1"
objecttolerance="10"
gridtolerance="10"
guidetolerance="10"
inkscape:pageopacity="0"
inkscape:pageshadow="2"
inkscape:window-width="1920"
inkscape:window-height="1033"
id="namedview5375"
showgrid="false"
inkscape:zoom="16"
inkscape:cx="16.142711"
inkscape:cy="16.05283"
inkscape:window-x="1680"
inkscape:window-y="18"
inkscape:window-maximized="1"
inkscape:current-layer="svg5373" />
<path
d="m 0.125,2 h 1.5 V 2.24001 14 h -1.5 z m 3.5,0.18094 V 14 l 9,-5.93782 z M 9.9398,8.06218 5.12523,5 v 6.1809 z"
id="path5371"
inkscape:connector-curvature="0"
style="clip-rule:evenodd;fill:#63ebff;fill-rule:evenodd" />
<text
xml:space="preserve"
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:8px;line-height:1.25;font-family:arial;-inkscape-font-specification:arial;letter-spacing:0px;word-spacing:0px;fill:#ffffff;fill-opacity:0.94117647;stroke:none;stroke-width:0.44802567;stroke-linecap:round;stroke-linejoin:bevel;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1;paint-order:stroke fill markers"
x="8.9794331"
y="5.1369224"
id="text5926"
transform="scale(1.0982407,0.91054721)"><tspan
sodipodi:role="line"
id="tspan5924"
x="8.9794331"
y="5.1369224"
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:7.33333349px;font-family:arial;-inkscape-font-specification:arial;fill:#ffffff;fill-opacity:0.94117647;stroke:none;stroke-width:0.44802567;stroke-linecap:round;stroke-linejoin:bevel;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1;paint-order:stroke fill markers">M</tspan></text>
</svg>

After

Width:  |  Height:  |  Size: 2.7 KiB

View File

@ -0,0 +1,69 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<svg
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:cc="http://creativecommons.org/ns#"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns="http://www.w3.org/2000/svg"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
width="16"
height="16"
viewBox="0 0 16 16"
fill="none"
version="1.1"
id="svg5373"
sodipodi:docname="continue_until_syscall.svg"
inkscape:version="0.92.4 5da689c313, 2019-01-14">
<metadata
id="metadata5379">
<rdf:RDF>
<cc:Work
rdf:about="">
<dc:format>image/svg+xml</dc:format>
<dc:type
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
<dc:title></dc:title>
</cc:Work>
</rdf:RDF>
</metadata>
<defs
id="defs5377" />
<sodipodi:namedview
pagecolor="#ffffff"
bordercolor="#666666"
borderopacity="1"
objecttolerance="10"
gridtolerance="10"
guidetolerance="10"
inkscape:pageopacity="0"
inkscape:pageshadow="2"
inkscape:window-width="1920"
inkscape:window-height="1033"
id="namedview5375"
showgrid="false"
inkscape:zoom="16"
inkscape:cx="25.517711"
inkscape:cy="16.05283"
inkscape:window-x="1680"
inkscape:window-y="18"
inkscape:window-maximized="1"
inkscape:current-layer="svg5373" />
<path
d="m 0.1875,2 h 1.5 V 2.24001 14 h -1.5 z m 3.5,0.18094 V 14 l 9,-5.93782 z M 10.0023,8.06218 5.18773,5 v 6.1809 z"
id="path5371"
inkscape:connector-curvature="0"
style="clip-rule:evenodd;fill:#63ebff;fill-rule:evenodd" />
<text
xml:space="preserve"
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:6.89985847px;line-height:1.25;font-family:arial;-inkscape-font-specification:arial;letter-spacing:0px;word-spacing:0px;fill:#ffffff;fill-opacity:0.94117647;stroke:none;stroke-width:0.3864142;stroke-linecap:round;stroke-linejoin:bevel;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1;paint-order:stroke fill markers"
x="12.225597"
y="5.3185167"
id="text5926"
transform="scale(0.94721314,1.0557286)"><tspan
sodipodi:role="line"
id="tspan5924"
x="12.225597"
y="5.3185167"
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:7.4666667px;font-family:arial;-inkscape-font-specification:arial;fill:#ffffff;fill-opacity:0.94117647;stroke:none;stroke-width:0.3864142;stroke-linecap:round;stroke-linejoin:bevel;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1;paint-order:stroke fill markers">S</tspan></text>
</svg>

After

Width:  |  Height:  |  Size: 2.8 KiB

View File

@ -0,0 +1,3 @@
<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
<path fill-rule="evenodd" clip-rule="evenodd" d="M7.99998 9.53198H8.54198L12.447 5.62698L11.386 4.56698L8.74898 7.17698L8.74898 0.999985H7.99998H7.25098L7.25098 7.17698L4.61398 4.56698L3.55298 5.62698L7.45798 9.53198H7.99998ZM9.95598 13.013C9.95598 14.1175 9.06055 15.013 7.95598 15.013C6.85141 15.013 5.95598 14.1175 5.95598 13.013C5.95598 11.9084 6.85141 11.013 7.95598 11.013C9.06055 11.013 9.95598 11.9084 9.95598 13.013Z" fill="#63ebff"/>
</svg>

After

Width:  |  Height:  |  Size: 547 B

View File

@ -0,0 +1,3 @@
<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
<path fill-rule="evenodd" clip-rule="evenodd" d="M7.99998 1H7.45798L3.55298 4.905L4.61398 5.965L7.25098 3.355V9.532H7.99998H8.74898V3.355L11.386 5.965L12.447 4.905L8.54198 1H7.99998ZM9.95598 13.013C9.95598 14.1176 9.06055 15.013 7.95598 15.013C6.85141 15.013 5.95598 14.1176 5.95598 13.013C5.95598 11.9084 6.85141 11.013 7.95598 11.013C9.06055 11.013 9.95598 11.9084 9.95598 13.013Z" fill="#63ebff"/>
</svg>

After

Width:  |  Height:  |  Size: 504 B

View File

@ -0,0 +1,3 @@
<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
<path fill-rule="evenodd" clip-rule="evenodd" d="M14.25 5.75V1.75H12.75V4.2916C11.605 2.93303 9.83899 2.08334 7.90914 2.08334C4.73316 2.08334 1.98941 4.39036 1.75072 7.48075L1.72992 7.75H3.231L3.25287 7.5241C3.46541 5.32932 5.45509 3.58334 7.90914 3.58334C9.6452 3.58334 11.1528 4.45925 11.9587 5.75H9.12986V7.25H13.292L14.2535 6.27493V5.75H14.25ZM7.99997 14C9.10454 14 9.99997 13.1046 9.99997 12C9.99997 10.8954 9.10454 10 7.99997 10C6.8954 10 5.99997 10.8954 5.99997 12C5.99997 13.1046 6.8954 14 7.99997 14Z" fill="#63ebff"/>
</svg>

After

Width:  |  Height:  |  Size: 631 B

View File

@ -29,12 +29,18 @@
<file>img/icons/media-suspend_light.svg</file>
<file>img/icons/media-skip-forward_light.svg</file>
<file>img/icons/continue_until_main.svg</file>
<file>img/icons/light/continue_until_main.svg</file>
<file>img/icons/continue_until_call.svg</file>
<file>img/icons/light/continue_until_call.svg</file>
<file>img/icons/continue_until_syscall.svg</file>
<file>img/icons/light/continue_until_syscall.svg</file>
<file>img/icons/detach_debugger.svg</file>
<file>img/icons/light/step_into.svg</file>
<file>img/icons/step_into.svg</file>
<file>img/icons/light/step_over.svg</file>
<file>img/icons/step_over.svg</file>
<file>img/icons/step_out.svg</file>
<file>img/icons/light/step_out.svg</file>
<file>img/icons/cloud.svg</file>
<file>img/icons/down.svg</file>
<file>img/icons/down_white.svg</file>

View File

@ -1,6 +1,8 @@
#include "DebugActions.h"
#include "core/MainWindow.h"
#include "dialogs/AttachProcDialog.h"
#include "common/Configuration.h"
#include "common/Helpers.h"
#include <QPainter>
#include <QMenu>
@ -22,12 +24,6 @@ DebugActions::DebugActions(QToolBar *toolBar, MainWindow *main) :
QIcon startAttachIcon = QIcon(":/img/icons/play_light_attach.svg");
QIcon startRemoteIcon = QIcon(":/img/icons/play_light_remote.svg");
stopIcon = QIcon(":/img/icons/media-stop_light.svg");
QIcon continueUntilMainIcon = QIcon(":/img/icons/continue_until_main.svg");
QIcon continueUntilCallIcon = QIcon(":/img/icons/continue_until_call.svg");
QIcon continueUntilSyscallIcon = QIcon(":/img/icons/continue_until_syscall.svg");
QIcon stepIcon = QIcon(":/img/icons/step_into.svg");
QIcon stepOverIcon = QIcon(":/img/icons/step_over.svg");
QIcon stepOutIcon = QIcon(":/img/icons/step_out.svg");
QIcon restartIcon = QIcon(":/img/icons/spin_light.svg");
detachIcon = QIcon(":/img/icons/detach_debugger.svg");
continueIcon = QIcon(":/img/icons/media-skip-forward_light.svg");
@ -60,14 +56,14 @@ DebugActions::DebugActions(QToolBar *toolBar, MainWindow *main) :
actionStop = new QAction(stopIcon, stopDebugLabel, this);
actionContinue = new QAction(continueIcon, continueLabel, this);
actionContinue->setShortcut(QKeySequence(Qt::Key_F5));
actionContinueUntilMain = new QAction(continueUntilMainIcon, continueUMLabel, this);
actionContinueUntilCall = new QAction(continueUntilCallIcon, continueUCLabel, this);
actionContinueUntilSyscall = new QAction(continueUntilSyscallIcon, continueUSLabel, this);
actionStep = new QAction(stepIcon, stepLabel, this);
actionContinueUntilMain = new QAction(continueUMLabel, this);
actionContinueUntilCall = new QAction(continueUCLabel, this);
actionContinueUntilSyscall = new QAction(continueUSLabel, this);
actionStep = new QAction(stepLabel, this);
actionStep->setShortcut(QKeySequence(Qt::Key_F7));
actionStepOver = new QAction(stepOverIcon, stepOverLabel, this);
actionStepOver = new QAction(stepOverLabel, this);
actionStepOver->setShortcut(QKeySequence(Qt::Key_F8));
actionStepOut = new QAction(stepOutIcon, stepOutLabel, this);
actionStepOut = new QAction(stepOutLabel, this);
actionStepOut->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_F8));
QToolButton *startButton = new QToolButton;
@ -109,7 +105,7 @@ DebugActions::DebugActions(QToolBar *toolBar, MainWindow *main) :
// Toggle all buttons except restart, suspend(=continue) and stop since those are
// necessary to avoid staying stuck
toggleActions = {actionStep, actionStepOver, actionStepOut, actionContinueUntilMain,
toggleActions = {actionStepOver, actionStep, actionStepOut, actionContinueUntilMain,
actionContinueUntilCall, actionContinueUntilSyscall};
toggleConnectionActions = {actionAttach, actionStart, actionStartRemote, actionStartEmul};
@ -199,6 +195,9 @@ DebugActions::DebugActions(QToolBar *toolBar, MainWindow *main) :
Core()->continueDebug();
}
});
connect(Config(), &Configuration::interfaceThemeChanged, this, &DebugActions::chooseThemeIcons);
chooseThemeIcons();
}
void DebugActions::setButtonVisibleIfMainExists()
@ -300,3 +299,25 @@ void DebugActions::setAllActionsVisible(bool visible)
action->setVisible(visible);
}
}
/**
* \brief When theme changed, change icons which have a special version for the theme.
*/
void DebugActions::chooseThemeIcons()
{
// List of QActions which have alternative icons in different themes
const QList<QPair<void*, QString>> kSupportedIconsNames {
{ actionStep, QStringLiteral("step_into.svg") },
{ actionStepOver, QStringLiteral("step_over.svg") },
{ actionStepOut, QStringLiteral("step_out.svg") },
{ actionContinueUntilMain, QStringLiteral("continue_until_main.svg") },
{ actionContinueUntilCall, QStringLiteral("continue_until_call.svg") },
{ actionContinueUntilSyscall, QStringLiteral("continue_until_syscall.svg") },
};
// Set the correct icon for the QAction
qhelpers::setThemeIcons(kSupportedIconsNames, [](void *obj, const QIcon &icon) {
static_cast<QAction*>(obj)->setIcon(icon);
});
}

View File

@ -62,4 +62,5 @@ private slots:
void onAttachedRemoteDebugger(bool successfully);
void setAllActionsVisible(bool visible);
void setButtonVisibleIfMainExists();
void chooseThemeIcons();
};