Sat, 05 Mar 2022 13:32:58 +0200
Add icons for tools
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/icons_svg/navigate-outline.svg Sat Mar 05 13:32:58 2022 +0200 @@ -0,0 +1,56 @@ +<?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="512" + height="512" + viewBox="0 0 512 512" + version="1.1" + id="svg6" + sodipodi:docname="navigate-outline.svg" + inkscape:version="1.0.2 (e86c870879, 2021-01-15)"> + <metadata + id="metadata12"> + <rdf:RDF> + <cc:Work + rdf:about=""> + <dc:format>image/svg+xml</dc:format> + <dc:type + rdf:resource="http://purl.org/dc/dcmitype/StillImage" /> + </cc:Work> + </rdf:RDF> + </metadata> + <defs + id="defs10" /> + <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="970" + id="namedview8" + showgrid="false" + inkscape:zoom="1.546875" + inkscape:cx="256" + inkscape:cy="256" + inkscape:window-x="0" + inkscape:window-y="29" + inkscape:window-maximized="1" + inkscape:current-layer="svg6" /> + <title + id="title2">ionicons-v5-f</title> + <path + d="M448,64,64,240.14H264a8,8,0,0,1,8,8V448Z" + style="fill:#ffffff;stroke:#000;stroke-linecap:round;stroke-linejoin:round;stroke-width:32px;fill-opacity:1" + id="path4" /> +</svg>
--- a/ldforge.qrc Sat Mar 05 13:19:59 2022 +0200 +++ b/ldforge.qrc Sat Mar 05 13:32:58 2022 +0200 @@ -26,5 +26,6 @@ <file>icons/warning-outline.png</file> <file>icons/linetype-conditionaledge.png</file> <file>icons/close-circle-outline.png</file> + <file>icons/navigate-outline.png</file> </qresource> </RCC>
--- a/src/document.cpp Sat Mar 05 13:19:59 2022 +0200 +++ b/src/document.cpp Sat Mar 05 13:32:58 2022 +0200 @@ -167,6 +167,7 @@ action->setCheckable(true); this->toolActions[toolInstance] = action; action->setToolTip(toolInstance->toolTip()); + action->setIcon(QPixmap{toolInstance->iconName()}); connect(action, &QAction::triggered, this, &Document::toolActionTriggered); this->toolsBar->addAction(action); QWidget* const widget = toolInstance->toolWidget();
--- a/src/tools/basetool.cpp Sat Mar 05 13:19:59 2022 +0200 +++ b/src/tools/basetool.cpp Sat Mar 05 13:32:58 2022 +0200 @@ -7,3 +7,8 @@ document{document} { } + +QString BaseTool::iconName() const +{ + return ""; +}
--- a/src/tools/basetool.h Sat Mar 05 13:19:59 2022 +0200 +++ b/src/tools/basetool.h Sat Mar 05 13:32:58 2022 +0200 @@ -22,6 +22,7 @@ virtual void selectionChanged(const QSet<ldraw::id_t>&) {} virtual void reset() {} virtual void overpaint(Canvas*, QPainter*) const {} + virtual QString iconName() const; protected: QWidget* const parentWidget; Document* const document;
--- a/src/tools/drawtool.cpp Sat Mar 05 13:19:59 2022 +0200 +++ b/src/tools/drawtool.cpp Sat Mar 05 13:32:58 2022 +0200 @@ -129,6 +129,11 @@ } } +QString DrawTool::iconName() const +{ + return ":/icons/pencil-outline.png"; +} + template<std::size_t N, typename T> std::array<T, N> vectorToArray(const std::vector<T>& x) {
--- a/src/tools/drawtool.h Sat Mar 05 13:19:59 2022 +0200 +++ b/src/tools/drawtool.h Sat Mar 05 13:32:58 2022 +0200 @@ -15,6 +15,7 @@ bool keyReleased(Document*, Canvas* canvas, QKeyEvent* event) override; void reset() override; void overpaint(Canvas*, QPainter*) const override; + QString iconName() const override; private: void closeShape(Document *document); std::vector<glm::vec3> polygon;
--- a/src/tools/selecttool.cpp Sat Mar 05 13:19:59 2022 +0200 +++ b/src/tools/selecttool.cpp Sat Mar 05 13:32:58 2022 +0200 @@ -53,3 +53,8 @@ this->objectEditor->setObjectId(ldraw::NULL_ID); } } + +QString SelectTool::iconName() const +{ + return ":/icons/navigate-outline.png"; +}
--- a/src/tools/selecttool.h Sat Mar 05 13:19:59 2022 +0200 +++ b/src/tools/selecttool.h Sat Mar 05 13:32:58 2022 +0200 @@ -13,5 +13,6 @@ bool mouseClick(Document*, Canvas*, QMouseEvent*) override; QWidget* toolWidget() override; void selectionChanged(const QSet<ldraw::id_t> &newSelection) override; + QString iconName() const override; ObjectEditor* objectEditor; };
--- a/src/tools/transformtool.cpp Sat Mar 05 13:19:59 2022 +0200 +++ b/src/tools/transformtool.cpp Sat Mar 05 13:32:58 2022 +0200 @@ -37,6 +37,11 @@ return this->widget; } +QString TransformTool::iconName() const +{ + return ":/icons/grid-outline.png"; +} + void TransformTool::applyButtonClicked() { std::unique_ptr<ModelEditor> editor = this->document->editModel();
--- a/src/tools/transformtool.h Sat Mar 05 13:19:59 2022 +0200 +++ b/src/tools/transformtool.h Sat Mar 05 13:32:58 2022 +0200 @@ -12,6 +12,7 @@ virtual QString toolTip() const override; void selectionChanged(const QSet<ldraw::id_t> &newSelection) override; QWidget *toolWidget() override; + QString iconName() const override; private: Q_SLOT void applyButtonClicked(); MatrixEditor* matrixEditor;