Files
flameshot/src/widgets/capture/capturetoolbutton.h
crackcat df20c7ec8f Add a tool to take an inverted screenshot (#1849)
* Add invert tool to build commands

* Add icons for invert tool

* Integrate invert tool

* Add shortcut for invert tool

* Add invert tool

* Add translation for invert tool

* Run clang-format

* Update tool to invert a region instead of everything

* Update shortcut for invert tool

* Update button order of inverter and counter

* Update translations for invert tool

* Run clang-format

* Revert "Update translations for invert tool"

This reverts commit c1fd5a162be6c64b26790d53eab3749b3a124bcf.

* Revert "Add translation for invert tool"

This reverts commit b0c1da5f36e844fa8b5f1492f5f507d85bb7aa7b.

* Update drawSearchArea to match pixelate

* Update invert icon to one from Material Design

Co-authored-by: crackcat <>
2021-09-01 06:45:20 -05:00

83 lines
2.0 KiB
C++

// SPDX-License-Identifier: GPL-3.0-or-later
// SPDX-FileCopyrightText: 2017-2019 Alejandro Sirgo Rica & Contributors
#pragma once
#include "capturebutton.h"
#include <QMap>
#include <QVector>
class QWidget;
class QPropertyAnimation;
class CaptureTool;
class CaptureToolButton : public CaptureButton
{
Q_OBJECT
public:
// Don't forget to add the new types to CaptureButton::iterableButtonTypes
// in the .cpp and the order value in the private array buttonTypeOrder
enum ButtonType
{
TYPE_PENCIL = 0,
TYPE_DRAWER = 1,
TYPE_ARROW = 2,
TYPE_SELECTION = 3,
TYPE_RECTANGLE = 4,
TYPE_CIRCLE = 5,
TYPE_MARKER = 6,
TYPE_SELECTIONINDICATOR = 7,
TYPE_MOVESELECTION = 8,
TYPE_UNDO = 9,
TYPE_COPY = 10,
TYPE_SAVE = 11,
TYPE_INVERT = 12,
TYPE_EXIT = 13,
TYPE_IMAGEUPLOADER = 14,
TYPE_OPEN_APP = 15,
TYPE_PIXELATE = 16,
TYPE_REDO = 17,
TYPE_PIN = 18,
TYPE_TEXT = 19,
TYPE_CIRCLECOUNT = 20,
TYPE_SIZEINCREASE = 21,
TYPE_SIZEDECREASE = 22,
};
Q_ENUM(ButtonType)
explicit CaptureToolButton(const ButtonType, QWidget* parent = nullptr);
~CaptureToolButton();
static QVector<CaptureToolButton::ButtonType> getIterableButtonTypes();
static int getPriorityByButton(CaptureToolButton::ButtonType);
QString name() const;
QString description() const;
QIcon icon() const;
CaptureTool* tool() const;
void setColor(const QColor& c);
void animatedShow();
protected:
void mousePressEvent(QMouseEvent* e) override;
static QVector<ButtonType> iterableButtonTypes;
CaptureTool* m_tool;
signals:
void pressedButton(CaptureToolButton*);
private:
CaptureToolButton(QWidget* parent = nullptr);
ButtonType m_buttonType;
QPropertyAnimation* m_emergeAnimation;
static QColor m_mainColor;
void initButton();
void updateIcon();
};