diff --git a/data/graphics.qrc b/data/graphics.qrc index 6d86a9da..ac8046a8 100644 --- a/data/graphics.qrc +++ b/data/graphics.qrc @@ -74,5 +74,9 @@ img/material/white/shortcut.svg img/material/black/filepath.svg img/material/white/filepath.svg + img/material/black/plus.svg + img/material/white/plus.svg + img/material/black/minus.svg + img/material/white/minus.svg - + \ No newline at end of file diff --git a/data/img/material/black/delete.svg b/data/img/material/black/delete.svg index 0fcbb634..5eb14767 100644 --- a/data/img/material/black/delete.svg +++ b/data/img/material/black/delete.svg @@ -1,7 +1,53 @@ - - - - - Svg Vector Icons : http://www.onlinewebfonts.com/icon - - \ No newline at end of file + + + Svg Vector Icons : http://www.onlinewebfonts.com/icon image/svg+xml + + diff --git a/data/img/material/white/delete.svg b/data/img/material/white/delete.svg new file mode 100644 index 00000000..e8af5064 --- /dev/null +++ b/data/img/material/white/delete.svg @@ -0,0 +1,56 @@ + + + Svg Vector Icons : http://www.onlinewebfonts.com/icon image/svg+xml + + diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 88672a02..838689f6 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -117,41 +117,43 @@ target_sources( main.cpp) target_include_directories( - flameshot - PUBLIC $ - $ - $ - $ - $ - $ - $ - $ - $ - $ - $ - $ - $ - $ - $ - $ - $ - $ - $ - $ - $ - $ - $ - $ - $ - $ - $ - $ - $ - $ - $ - $ - $ - $) + flameshot + PUBLIC $ + $ + $ + $ + $ + $ + $ + $ + $ + $ + $ + $ + $ + $ + $ + $ + $ + $ + $ + $ + $ + $ + $ + $ + $ + $ + $ + $ + $ + $ + $ + $ + $ + $ + $ + $) target_link_libraries( flameshot diff --git a/src/tools/CMakeLists.txt b/src/tools/CMakeLists.txt index ae8d96b6..82763014 100644 --- a/src/tools/CMakeLists.txt +++ b/src/tools/CMakeLists.txt @@ -4,6 +4,8 @@ target_sources(flameshot PRIVATE circle/circletool.h circle/circletool.cpp) target_sources(flameshot PRIVATE circlecount/circlecounttool.h circlecount/circlecounttool.cpp) target_sources(flameshot PRIVATE copy/copytool.h copy/copytool.cpp) target_sources(flameshot PRIVATE exit/exittool.h exit/exittool.cpp) +target_sources(flameshot PRIVATE sizeincrease/sizeincreasetool.h sizeincrease/sizeincreasetool.cpp) +target_sources(flameshot PRIVATE sizedecrease/sizedecreasetool.h sizedecrease/sizedecreasetool.cpp) target_sources( flameshot PRIVATE imgur/imguruploader.h diff --git a/src/tools/capturetool.h b/src/tools/capturetool.h index bc5ff69b..3f3160ab 100644 --- a/src/tools/capturetool.h +++ b/src/tools/capturetool.h @@ -31,7 +31,9 @@ enum class ToolType SIZEINDICATOR, TEXT, UNDO, - UPLOAD + UPLOAD, + SIZEINCREASE, + SIZEDECREASE }; class CaptureTool : public QObject @@ -79,6 +81,10 @@ public: REQ_INCREMENT_CIRCLE_COUNT, REQ_DECREMENT_CIRCLE_COUNT, + // increase tool size for all tools + REQ_INCREASE_TOOL_SIZE, + // decrease tool size for all tools + REQ_DECREASE_TOOL_SIZE }; explicit CaptureTool(QObject* parent = nullptr) diff --git a/src/tools/sizedecrease/sizedecreasetool.cpp b/src/tools/sizedecrease/sizedecreasetool.cpp new file mode 100644 index 00000000..8d639b14 --- /dev/null +++ b/src/tools/sizedecrease/sizedecreasetool.cpp @@ -0,0 +1,59 @@ +// Copyright(c) 2017-2019 Alejandro Sirgo Rica & Contributors +// +// This file is part of Flameshot. +// +// Flameshot is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Flameshot is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with Flameshot. If not, see . + +#include "sizedecreasetool.h" +#include + +SizeDecreaseTool::SizeDecreaseTool(QObject* parent) + : AbstractActionTool(parent) +{} + +bool SizeDecreaseTool::closeOnButtonPressed() const +{ + return false; +} + +QIcon SizeDecreaseTool::icon(const QColor& background, bool inEditor) const +{ + Q_UNUSED(inEditor); + return QIcon(iconPath(background) + "minus.svg"); +} +QString SizeDecreaseTool::name() const +{ + return tr("Increase Tool Size"); +} + +ToolType SizeDecreaseTool::nameID() const +{ + return ToolType::SIZEDECREASE; +} + +QString SizeDecreaseTool::description() const +{ + return tr("Decrease the size of the other tools"); +} + +CaptureTool* SizeDecreaseTool::copy(QObject* parent) +{ + return new SizeDecreaseTool(parent); +} + +void SizeDecreaseTool::pressed(const CaptureContext& context) +{ + Q_UNUSED(context); + emit requestAction(REQ_DECREASE_TOOL_SIZE); +} diff --git a/src/tools/sizedecrease/sizedecreasetool.h b/src/tools/sizedecrease/sizedecreasetool.h new file mode 100644 index 00000000..a2cf1346 --- /dev/null +++ b/src/tools/sizedecrease/sizedecreasetool.h @@ -0,0 +1,41 @@ +// Copyright(c) 2017-2019 Alejandro Sirgo Rica & Contributors +// +// This file is part of Flameshot. +// +// Flameshot is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Flameshot is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with Flameshot. If not, see . + +#pragma once + +#include "src/tools/abstractactiontool.h" + +class SizeDecreaseTool : public AbstractActionTool +{ + Q_OBJECT +public: + explicit SizeDecreaseTool(QObject* parent = nullptr); + + bool closeOnButtonPressed() const; + + QIcon icon(const QColor& background, bool inEditor) const override; + QString name() const override; + QString description() const override; + + CaptureTool* copy(QObject* parent = nullptr) override; + +protected: + ToolType nameID() const override; + +public slots: + void pressed(const CaptureContext& context) override; +}; diff --git a/src/tools/sizeincrease/sizeincreasetool.cpp b/src/tools/sizeincrease/sizeincreasetool.cpp new file mode 100644 index 00000000..4932ef1a --- /dev/null +++ b/src/tools/sizeincrease/sizeincreasetool.cpp @@ -0,0 +1,59 @@ +// Copyright(c) 2017-2019 Alejandro Sirgo Rica & Contributors +// +// This file is part of Flameshot. +// +// Flameshot is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Flameshot is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with Flameshot. If not, see . + +#include "sizeincreasetool.h" +#include + +SizeIncreaseTool::SizeIncreaseTool(QObject* parent) + : AbstractActionTool(parent) +{} + +bool SizeIncreaseTool::closeOnButtonPressed() const +{ + return false; +} + +QIcon SizeIncreaseTool::icon(const QColor& background, bool inEditor) const +{ + Q_UNUSED(inEditor); + return QIcon(iconPath(background) + "plus.svg"); +} +QString SizeIncreaseTool::name() const +{ + return tr("Increase Tool Size"); +} + +ToolType SizeIncreaseTool::nameID() const +{ + return ToolType::SIZEINCREASE; +} + +QString SizeIncreaseTool::description() const +{ + return tr("Increase the size of the other tools"); +} + +CaptureTool* SizeIncreaseTool::copy(QObject* parent) +{ + return new SizeIncreaseTool(parent); +} + +void SizeIncreaseTool::pressed(const CaptureContext& context) +{ + Q_UNUSED(context); + emit requestAction(REQ_INCREASE_TOOL_SIZE); +} diff --git a/src/tools/sizeincrease/sizeincreasetool.h b/src/tools/sizeincrease/sizeincreasetool.h new file mode 100644 index 00000000..e921cf33 --- /dev/null +++ b/src/tools/sizeincrease/sizeincreasetool.h @@ -0,0 +1,41 @@ +// Copyright(c) 2017-2019 Alejandro Sirgo Rica & Contributors +// +// This file is part of Flameshot. +// +// Flameshot is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Flameshot is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with Flameshot. If not, see . + +#pragma once + +#include "src/tools/abstractactiontool.h" + +class SizeIncreaseTool : public AbstractActionTool +{ + Q_OBJECT +public: + explicit SizeIncreaseTool(QObject* parent = nullptr); + + bool closeOnButtonPressed() const; + + QIcon icon(const QColor& background, bool inEditor) const override; + QString name() const override; + QString description() const override; + + CaptureTool* copy(QObject* parent = nullptr) override; + +protected: + ToolType nameID() const override; + +public slots: + void pressed(const CaptureContext& context) override; +}; diff --git a/src/tools/toolfactory.cpp b/src/tools/toolfactory.cpp index 3b8160b6..698ad97f 100644 --- a/src/tools/toolfactory.cpp +++ b/src/tools/toolfactory.cpp @@ -19,6 +19,8 @@ #include "redo/redotool.h" #include "save/savetool.h" #include "selection/selectiontool.h" +#include "sizedecrease/sizedecreasetool.h" +#include "sizeincrease/sizeincreasetool.h" #include "sizeindicator/sizeindicatortool.h" #include "src/utils/confighandler.h" #include "text/texttool.h" @@ -95,6 +97,12 @@ CaptureTool* ToolFactory::CreateTool(CaptureToolButton::ButtonType t, case CaptureToolButton::TYPE_CIRCLECOUNT: tool = new CircleCountTool(parent); break; + case CaptureToolButton::TYPE_SIZEINCREASE: + tool = new SizeIncreaseTool(parent); + break; + case CaptureToolButton::TYPE_SIZEDECREASE: + tool = new SizeDecreaseTool(parent); + break; default: tool = nullptr; break; diff --git a/src/widgets/capture/capturetoolbutton.cpp b/src/widgets/capture/capturetoolbutton.cpp index 901d41a4..57ccdfbc 100644 --- a/src/widgets/capture/capturetoolbutton.cpp +++ b/src/widgets/capture/capturetoolbutton.cpp @@ -126,6 +126,9 @@ static std::map buttonTypeOrder #else { CaptureToolButton::TYPE_EXIT, 17 }, { CaptureToolButton::TYPE_PIN, 18 }, #endif + + { CaptureToolButton::TYPE_SIZEINCREASE, 20 }, + { CaptureToolButton::TYPE_SIZEDECREASE, 21 }, }; int CaptureToolButton::getPriorityByButton(CaptureToolButton::ButtonType b) @@ -159,4 +162,6 @@ QVector #endif CaptureToolButton::TYPE_PIN, CaptureToolButton::TYPE_CIRCLECOUNT, + CaptureToolButton::TYPE_SIZEINCREASE, + CaptureToolButton::TYPE_SIZEDECREASE, }; diff --git a/src/widgets/capture/capturetoolbutton.h b/src/widgets/capture/capturetoolbutton.h index 4e211cc7..32a6260f 100644 --- a/src/widgets/capture/capturetoolbutton.h +++ b/src/widgets/capture/capturetoolbutton.h @@ -39,7 +39,9 @@ public: TYPE_REDO = 16, TYPE_PIN = 17, TYPE_TEXT = 18, - TYPE_CIRCLECOUNT = 19 + TYPE_CIRCLECOUNT = 19, + TYPE_SIZEINCREASE = 20, + TYPE_SIZEDECREASE = 21, }; Q_ENUM(ButtonType) diff --git a/src/widgets/capture/capturewidget.cpp b/src/widgets/capture/capturewidget.cpp index 1c9fbbaa..201c8656 100644 --- a/src/widgets/capture/capturewidget.cpp +++ b/src/widgets/capture/capturewidget.cpp @@ -958,6 +958,26 @@ void CaptureWidget::handleButtonSignal(CaptureTool::Request r) w->show(); } break; + case CaptureTool::REQ_INCREASE_TOOL_SIZE: + + // increase thickness + m_context.thickness = qBound(0, m_context.thickness + 1, 100); + + // show notifier circle + m_notifierBox->showMessage(QString::number(m_context.thickness)); + + emit thicknessChanged(m_context.thickness); + break; + case CaptureTool::REQ_DECREASE_TOOL_SIZE: + + // decrease thickness + m_context.thickness = qBound(0, m_context.thickness - 1, 100); + + // show notifier circle + m_notifierBox->showMessage(QString::number(m_context.thickness)); + + emit thicknessChanged(m_context.thickness); + break; default: break; }