Remove unsupported tools
This commit is contained in:
@@ -37,7 +37,6 @@ DEFINES += QAPPLICATION_CLASS=QApplication
|
||||
|
||||
SOURCES += src/main.cpp\
|
||||
src/controller.cpp \
|
||||
src/capture/button.cpp \
|
||||
src/capture/buttonhandler.cpp \
|
||||
src/infowindow.cpp \
|
||||
src/config/configwindow.cpp \
|
||||
@@ -52,11 +51,12 @@ SOURCES += src/main.cpp\
|
||||
src/config/clickablelabel.cpp \
|
||||
src/config/filenameeditor.cpp \
|
||||
src/utils/filenamehandler.cpp \
|
||||
src/config/strftimechooserwidget.cpp
|
||||
src/config/strftimechooserwidget.cpp \
|
||||
src/capture/tools/capturetool.cpp \
|
||||
src/capture/capturebutton.cpp
|
||||
|
||||
HEADERS += \
|
||||
src/controller.h \
|
||||
src/capture/button.h \
|
||||
src/capture/buttonhandler.h \
|
||||
src/infowindow.h \
|
||||
src/config/configwindow.h \
|
||||
@@ -71,7 +71,9 @@ HEADERS += \
|
||||
src/config/clickablelabel.h \
|
||||
src/config/filenameeditor.h \
|
||||
src/utils/filenamehandler.h \
|
||||
src/config/strftimechooserwidget.h
|
||||
src/config/strftimechooserwidget.h \
|
||||
src/capture/tools/capturetool.h \
|
||||
src/capture/capturebutton.h
|
||||
|
||||
RESOURCES += \
|
||||
graphics.qrc
|
||||
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 254 B |
Binary file not shown.
|
Before Width: | Height: | Size: 387 B |
Binary file not shown.
|
Before Width: | Height: | Size: 336 B |
Binary file not shown.
|
Before Width: | Height: | Size: 394 B |
Binary file not shown.
|
Before Width: | Height: | Size: 340 B |
@@ -25,7 +25,7 @@ namespace {
|
||||
const int SEPARATION = 6;
|
||||
}
|
||||
|
||||
ButtonHandler::ButtonHandler(const QVector<Button*> &v, QObject *parent) :
|
||||
ButtonHandler::ButtonHandler(const QVector<CaptureButton*> &v, QObject *parent) :
|
||||
QObject(parent)
|
||||
{
|
||||
if (!v.isEmpty()) {
|
||||
@@ -40,11 +40,11 @@ ButtonHandler::ButtonHandler(QObject *parent) :
|
||||
}
|
||||
|
||||
void ButtonHandler::hide() {
|
||||
for (Button *b: m_vectorButtons) b->hide();
|
||||
for (CaptureButton *b: m_vectorButtons) b->hide();
|
||||
}
|
||||
|
||||
void ButtonHandler::show() {
|
||||
for (Button *b: m_vectorButtons) b->animatedShow();
|
||||
for (CaptureButton *b: m_vectorButtons) b->animatedShow();
|
||||
}
|
||||
|
||||
bool ButtonHandler::isVisible() const {
|
||||
@@ -63,13 +63,13 @@ size_t ButtonHandler::size() const {
|
||||
void ButtonHandler::updatePosition(const QRect &selection,
|
||||
const QRect &limits)
|
||||
{
|
||||
const QVector<Button*>::size_type vecLength = m_vectorButtons.size();
|
||||
const QVector<CaptureButton*>::size_type vecLength = m_vectorButtons.size();
|
||||
if (vecLength == 0) {
|
||||
return;
|
||||
}
|
||||
// button dimmensions
|
||||
const int baseHeight = Button::getButtonBaseSize();
|
||||
const int baseWidth = Button::getButtonBaseSize();
|
||||
const int baseHeight = CaptureButton::getButtonBaseSize();
|
||||
const int baseWidth = CaptureButton::getButtonBaseSize();
|
||||
// copy of the selection area for internal modifications
|
||||
QRect baseArea = selection;
|
||||
|
||||
@@ -104,7 +104,7 @@ void ButtonHandler::updatePosition(const QRect &selection,
|
||||
baseArea.setHeight(baseHeight);
|
||||
}
|
||||
// indicates the actual button to be moved
|
||||
QVector<Button*>::size_type elemIndicator = 0;
|
||||
QVector<CaptureButton*>::size_type elemIndicator = 0;
|
||||
|
||||
while (elemIndicator < vecLength) {
|
||||
// update of blocked sides
|
||||
@@ -263,9 +263,9 @@ QVector<QPoint> ButtonHandler::getHPoints(
|
||||
if (elements % 2 == 0) {
|
||||
shift = m_distance * (elements / 2) - (SEPARATION / 2);
|
||||
} else {
|
||||
shift = m_distance * ((elements-1) / 2) + Button::getButtonBaseSize() / 2;
|
||||
shift = m_distance * ((elements-1) / 2) + CaptureButton::getButtonBaseSize() / 2;
|
||||
}
|
||||
if (!leftToRight) { shift -= Button::getButtonBaseSize(); }
|
||||
if (!leftToRight) { shift -= CaptureButton::getButtonBaseSize(); }
|
||||
int x = leftToRight ? center.x() - shift :
|
||||
center.x() + shift;
|
||||
QPoint i(x, center.y());
|
||||
@@ -289,9 +289,9 @@ QVector<QPoint> ButtonHandler::getVPoints(
|
||||
if (elements % 2 == 0) {
|
||||
shift = m_distance * (elements / 2) - (SEPARATION / 2);
|
||||
} else {
|
||||
shift = m_distance * ((elements-1) / 2) + Button::getButtonBaseSize() / 2;
|
||||
shift = m_distance * ((elements-1) / 2) + CaptureButton::getButtonBaseSize() / 2;
|
||||
}
|
||||
if (!upToDown) { shift -= Button::getButtonBaseSize(); }
|
||||
if (!upToDown) { shift -= CaptureButton::getButtonBaseSize(); }
|
||||
int y = upToDown ? center.y() - shift :
|
||||
center.y() + shift;
|
||||
QPoint i(center.x(), y);
|
||||
@@ -303,8 +303,8 @@ QVector<QPoint> ButtonHandler::getVPoints(
|
||||
return res;
|
||||
}
|
||||
// setButtons redefines the buttons of the button handler
|
||||
void ButtonHandler::setButtons(const QVector<Button *> v) {
|
||||
for (Button *b: m_vectorButtons) delete(b);
|
||||
void ButtonHandler::setButtons(const QVector<CaptureButton *> v) {
|
||||
for (CaptureButton *b: m_vectorButtons) delete(b);
|
||||
m_vectorButtons = v;
|
||||
if (!v.isEmpty()) {
|
||||
m_distance = v[0]->getButtonBaseSize() + SEPARATION;
|
||||
|
||||
@@ -18,18 +18,18 @@
|
||||
#ifndef BUTTONHANDLER_H
|
||||
#define BUTTONHANDLER_H
|
||||
|
||||
#include "button.h"
|
||||
#include "capturebutton.h"
|
||||
#include <QVector>
|
||||
#include <QObject>
|
||||
|
||||
class Button;
|
||||
class CaptureButton;
|
||||
class QRect;
|
||||
class QPoint;
|
||||
|
||||
class ButtonHandler : public QObject {
|
||||
Q_OBJECT
|
||||
public:
|
||||
ButtonHandler(const QVector<Button*>&, QObject *parent = 0);
|
||||
ButtonHandler(const QVector<CaptureButton*>&, QObject *parent = 0);
|
||||
ButtonHandler(QObject *parent = 0);
|
||||
|
||||
void hide();
|
||||
@@ -39,14 +39,14 @@ public:
|
||||
size_t size() const;
|
||||
|
||||
void updatePosition(const QRect &selection, const QRect &limits);
|
||||
void setButtons(const QVector<Button*>);
|
||||
void setButtons(const QVector<CaptureButton*>);
|
||||
|
||||
private:
|
||||
QVector<QPoint> getHPoints(const QPoint ¢er, const int elements,
|
||||
const bool leftToRight) const;
|
||||
QVector<QPoint> getVPoints(const QPoint ¢er, const int elements,
|
||||
const bool upToDown) const;
|
||||
QVector<Button*> m_vectorButtons;
|
||||
QVector<CaptureButton*> m_vectorButtons;
|
||||
|
||||
int m_distance;
|
||||
};
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with Flameshot. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
#include "button.h"
|
||||
#include "capturebutton.h"
|
||||
#include "src/capture/capturewidget.h"
|
||||
#include <QIcon>
|
||||
#include <QPropertyAnimation>
|
||||
@@ -30,12 +30,12 @@ namespace {
|
||||
const int BUTTON_SIZE = 30;
|
||||
}
|
||||
|
||||
Button::Button(const Type t, QWidget *parent) : QPushButton(parent),
|
||||
CaptureButton::CaptureButton(const Type t, QWidget *parent) : QPushButton(parent),
|
||||
m_buttonType(t), m_pressed(false)
|
||||
{
|
||||
initButton();
|
||||
|
||||
if (t == Button::Type::selectionIndicator) {
|
||||
if (t == CaptureButton::Type::selectionIndicator) {
|
||||
QFont f = this->font();
|
||||
setFont(QFont(f.family(), 7, QFont::Bold));
|
||||
} else {
|
||||
@@ -43,12 +43,12 @@ Button::Button(const Type t, QWidget *parent) : QPushButton(parent),
|
||||
}
|
||||
}
|
||||
|
||||
Button::Button(const Button::Type t, const bool isWhite, QWidget *parent)
|
||||
CaptureButton::CaptureButton(const CaptureButton::Type t, const bool isWhite, QWidget *parent)
|
||||
: QPushButton(parent), m_buttonType(t), m_pressed(false)
|
||||
{
|
||||
initButton();
|
||||
|
||||
if (t == Button::Type::selectionIndicator) {
|
||||
if (t == CaptureButton::Type::selectionIndicator) {
|
||||
QFont f = this->font();
|
||||
setFont(QFont(f.family(), 7, QFont::Bold));
|
||||
} else {
|
||||
@@ -56,7 +56,7 @@ Button::Button(const Button::Type t, const bool isWhite, QWidget *parent)
|
||||
}
|
||||
}
|
||||
|
||||
void Button::initButton() {
|
||||
void CaptureButton::initButton() {
|
||||
setFocusPolicy(Qt::NoFocus);
|
||||
resize(BUTTON_SIZE, BUTTON_SIZE);
|
||||
setMouseTracking(true);
|
||||
@@ -73,7 +73,7 @@ void Button::initButton() {
|
||||
|
||||
// getIcon returns the icon for the type of button, this method lets
|
||||
// you choose between black or white icons (needed for the config menu)
|
||||
QIcon Button::getIcon(const Type t, bool isWhite) {
|
||||
QIcon CaptureButton::getIcon(const Type t, bool isWhite) {
|
||||
QString iconColor = "Black";
|
||||
if (isWhite) {
|
||||
iconColor = "White";
|
||||
@@ -87,9 +87,6 @@ QIcon Button::getIcon(const Type t, bool isWhite) {
|
||||
case Type::circle:
|
||||
path += "circle-outline.png";
|
||||
break;
|
||||
case Type::colorPicker:
|
||||
path += "square-outline.png";
|
||||
break;
|
||||
case Type::copy:
|
||||
path += "content-copy.png";
|
||||
break;
|
||||
@@ -114,9 +111,6 @@ QIcon Button::getIcon(const Type t, bool isWhite) {
|
||||
case Type::save:
|
||||
path += "content-save.png";
|
||||
break;
|
||||
case Type::text:
|
||||
path += "format-text.png";
|
||||
break;
|
||||
case Type::undo:
|
||||
path += "undo-variant.png";
|
||||
break;
|
||||
@@ -132,13 +126,13 @@ QIcon Button::getIcon(const Type t, bool isWhite) {
|
||||
return QIcon(path);
|
||||
}
|
||||
|
||||
QString Button::getStyle() {
|
||||
QString CaptureButton::getStyle() {
|
||||
QSettings settings;
|
||||
m_mainColor = settings.value("uiColor").value<QColor>();
|
||||
return getStyle(m_mainColor);
|
||||
}
|
||||
|
||||
QString Button::getStyle(const QColor &mainColor) {
|
||||
QString CaptureButton::getStyle(const QColor &mainColor) {
|
||||
m_mainColor = mainColor;
|
||||
QString baseSheet = "Button { border-radius: %3;"
|
||||
"background-color: %1; color: %4 }"
|
||||
@@ -160,22 +154,22 @@ QString Button::getStyle(const QColor &mainColor) {
|
||||
.arg(BUTTON_SIZE/2).arg(color);
|
||||
}
|
||||
// get icon returns the icon for the type of button
|
||||
QIcon Button::getIcon(const Type t) {
|
||||
QIcon CaptureButton::getIcon(const Type t) {
|
||||
return getIcon(t, iconIsWhite(m_mainColor));
|
||||
}
|
||||
|
||||
void Button::enterEvent(QEvent *e) {
|
||||
void CaptureButton::enterEvent(QEvent *e) {
|
||||
Q_EMIT hovered();
|
||||
QWidget::enterEvent(e);
|
||||
}
|
||||
|
||||
void Button::leaveEvent(QEvent *e) {
|
||||
void CaptureButton::leaveEvent(QEvent *e) {
|
||||
m_pressed = false;
|
||||
Q_EMIT mouseExited();
|
||||
QWidget::leaveEvent(e);
|
||||
}
|
||||
|
||||
void Button::mouseReleaseEvent(QMouseEvent *e) {
|
||||
void CaptureButton::mouseReleaseEvent(QMouseEvent *e) {
|
||||
CaptureWidget *parent = static_cast<CaptureWidget*>(this->parent());
|
||||
parent->mouseReleaseEvent(e);
|
||||
if (e->button() == Qt::LeftButton && m_pressed) {
|
||||
@@ -184,29 +178,29 @@ void Button::mouseReleaseEvent(QMouseEvent *e) {
|
||||
m_pressed = false;
|
||||
}
|
||||
|
||||
void Button::mousePressEvent(QMouseEvent *) {
|
||||
void CaptureButton::mousePressEvent(QMouseEvent *) {
|
||||
m_pressed = true;
|
||||
}
|
||||
|
||||
void Button::animatedShow() {
|
||||
void CaptureButton::animatedShow() {
|
||||
show();
|
||||
emergeAnimation->start();
|
||||
}
|
||||
|
||||
Button::Type Button::getButtonType() const {
|
||||
CaptureButton::Type CaptureButton::getButtonType() const {
|
||||
return m_buttonType;
|
||||
}
|
||||
|
||||
void Button::updateIconColor(const QColor &c) {
|
||||
void CaptureButton::updateIconColor(const QColor &c) {
|
||||
setIcon(getIcon(m_buttonType, iconIsWhite(c)));
|
||||
}
|
||||
|
||||
void Button::updateIconColor() {
|
||||
void CaptureButton::updateIconColor() {
|
||||
setIcon(getIcon(m_buttonType, iconIsWhite()));
|
||||
}
|
||||
// iconIsWhite returns true if the passed color would contain a white icon
|
||||
// if applied to a button, and false otherwise
|
||||
bool Button::iconIsWhite(const QColor &c) {
|
||||
bool CaptureButton::iconIsWhite(const QColor &c) {
|
||||
bool isWhite = false;
|
||||
if (c.value() < m_colorValueLimit ||
|
||||
c.saturation() > m_colorSaturationLimit) {
|
||||
@@ -215,69 +209,63 @@ bool Button::iconIsWhite(const QColor &c) {
|
||||
return isWhite;
|
||||
}
|
||||
|
||||
bool Button::iconIsWhite() const {
|
||||
bool CaptureButton::iconIsWhite() const {
|
||||
return iconIsWhite(m_mainColor);
|
||||
}
|
||||
// getButtonBaseSize returns the base size of the buttons
|
||||
size_t Button::getButtonBaseSize() {
|
||||
size_t CaptureButton::getButtonBaseSize() {
|
||||
return BUTTON_SIZE;
|
||||
}
|
||||
// getTypeByName receives a name and return the corresponding button type.
|
||||
// returns Button::Type::last when the corresponding button is not found.
|
||||
Button::Type Button::getTypeByName(const QString s) {
|
||||
Button::Type res = Type::last;
|
||||
CaptureButton::Type CaptureButton::getTypeByName(const QString s) {
|
||||
CaptureButton::Type res = Type::last;
|
||||
for (auto i: typeName.toStdMap())
|
||||
if (tr(i.second) == s)
|
||||
res = i.first;
|
||||
return res;
|
||||
}
|
||||
|
||||
QString Button::getTypeName(const Button::Type t) {
|
||||
QString CaptureButton::getTypeName(const CaptureButton::Type t) {
|
||||
return tr(typeName[t]);
|
||||
}
|
||||
|
||||
QString Button::getTypeTooltip(const Button::Type t) {
|
||||
QString CaptureButton::getTypeTooltip(const CaptureButton::Type t) {
|
||||
return tr(typeTooltip[t]);
|
||||
}
|
||||
|
||||
Button::typeData Button::typeTooltip = {
|
||||
{Button::Type::selectionIndicator, QT_TR_NOOP("Shows the dimensions of the selection (X Y)")},
|
||||
{Button::Type::mouseVisibility, QT_TR_NOOP("Sets the visibility of the mouse pointer")},
|
||||
{Button::Type::exit, QT_TR_NOOP("Leaves the capture screen")},
|
||||
{Button::Type::copy, QT_TR_NOOP("Copies the selecion into the clipboard")},
|
||||
{Button::Type::save, QT_TR_NOOP("Opens the save image window")},
|
||||
{Button::Type::pencil, QT_TR_NOOP("Sets the Pencil as the paint tool")},
|
||||
{Button::Type::line, QT_TR_NOOP("Sets the Line as the paint tool")},
|
||||
{Button::Type::arrow, QT_TR_NOOP("Sets the Arrow as the paint tool")},
|
||||
{Button::Type::rectangle, QT_TR_NOOP("Sets the Rectangle as the paint tool")},
|
||||
{Button::Type::circle, QT_TR_NOOP("Sets the Circle as the paint tool")},
|
||||
{Button::Type::marker, QT_TR_NOOP("Sets the Marker as the paint tool")},
|
||||
{Button::Type::text, QT_TR_NOOP("Sets the Text as the paint tool")},
|
||||
{Button::Type::colorPicker, QT_TR_NOOP("Opens the color picker widget")},
|
||||
{Button::Type::undo, QT_TR_NOOP("Undo the last modification")},
|
||||
{Button::Type::imageUploader, QT_TR_NOOP("Uploads the selection to Imgur")},
|
||||
{Button::Type::selection, QT_TR_NOOP("Sets the Selection as the paint tool")},
|
||||
{Button::Type::move, QT_TR_NOOP("Move the selection area")}
|
||||
CaptureButton::typeData CaptureButton::typeTooltip = {
|
||||
{CaptureButton::Type::selectionIndicator, QT_TR_NOOP("Shows the dimensions of the selection (X Y)")},
|
||||
{CaptureButton::Type::exit, QT_TR_NOOP("Leaves the capture screen")},
|
||||
{CaptureButton::Type::copy, QT_TR_NOOP("Copies the selecion into the clipboard")},
|
||||
{CaptureButton::Type::save, QT_TR_NOOP("Opens the save image window")},
|
||||
{CaptureButton::Type::pencil, QT_TR_NOOP("Sets the Pencil as the paint tool")},
|
||||
{CaptureButton::Type::line, QT_TR_NOOP("Sets the Line as the paint tool")},
|
||||
{CaptureButton::Type::arrow, QT_TR_NOOP("Sets the Arrow as the paint tool")},
|
||||
{CaptureButton::Type::rectangle, QT_TR_NOOP("Sets the Rectangle as the paint tool")},
|
||||
{CaptureButton::Type::circle, QT_TR_NOOP("Sets the Circle as the paint tool")},
|
||||
{CaptureButton::Type::marker, QT_TR_NOOP("Sets the Marker as the paint tool")},
|
||||
{CaptureButton::Type::undo, QT_TR_NOOP("Undo the last modification")},
|
||||
{CaptureButton::Type::imageUploader, QT_TR_NOOP("Uploads the selection to Imgur")},
|
||||
{CaptureButton::Type::selection, QT_TR_NOOP("Sets the Selection as the paint tool")},
|
||||
{CaptureButton::Type::move, QT_TR_NOOP("Move the selection area")}
|
||||
};
|
||||
|
||||
Button::typeData Button::typeName = {
|
||||
{Button::Type::selectionIndicator, QT_TR_NOOP("Selection Size Indicator")},
|
||||
{Button::Type::mouseVisibility, QT_TR_NOOP("Mouse Visibility")},
|
||||
{Button::Type::exit, QT_TR_NOOP("Exit")},
|
||||
{Button::Type::copy, QT_TR_NOOP("Copy")},
|
||||
{Button::Type::save, QT_TR_NOOP("Save")},
|
||||
{Button::Type::pencil, QT_TR_NOOP("Pencil")},
|
||||
{Button::Type::line, QT_TR_NOOP("Line")},
|
||||
{Button::Type::arrow, QT_TR_NOOP("Arrow")},
|
||||
{Button::Type::rectangle, QT_TR_NOOP("Rectangle")},
|
||||
{Button::Type::circle, QT_TR_NOOP("Circle")},
|
||||
{Button::Type::marker, QT_TR_NOOP("Marker")},
|
||||
{Button::Type::text, QT_TR_NOOP("Text")},
|
||||
{Button::Type::colorPicker, QT_TR_NOOP("Color Picker")},
|
||||
{Button::Type::undo, QT_TR_NOOP("Undo")},
|
||||
{Button::Type::imageUploader, QT_TR_NOOP("Image Uploader")},
|
||||
{Button::Type::selection, QT_TR_NOOP("Rectangular Selection")},
|
||||
{Button::Type::move, QT_TR_NOOP("Move")}
|
||||
CaptureButton::typeData CaptureButton::typeName = {
|
||||
{CaptureButton::Type::selectionIndicator, QT_TR_NOOP("Selection Size Indicator")},
|
||||
{CaptureButton::Type::exit, QT_TR_NOOP("Exit")},
|
||||
{CaptureButton::Type::copy, QT_TR_NOOP("Copy")},
|
||||
{CaptureButton::Type::save, QT_TR_NOOP("Save")},
|
||||
{CaptureButton::Type::pencil, QT_TR_NOOP("Pencil")},
|
||||
{CaptureButton::Type::line, QT_TR_NOOP("Line")},
|
||||
{CaptureButton::Type::arrow, QT_TR_NOOP("Arrow")},
|
||||
{CaptureButton::Type::rectangle, QT_TR_NOOP("Rectangle")},
|
||||
{CaptureButton::Type::circle, QT_TR_NOOP("Circle")},
|
||||
{CaptureButton::Type::marker, QT_TR_NOOP("Marker")},
|
||||
{CaptureButton::Type::undo, QT_TR_NOOP("Undo")},
|
||||
{CaptureButton::Type::imageUploader, QT_TR_NOOP("Image Uploader")},
|
||||
{CaptureButton::Type::selection, QT_TR_NOOP("Rectangular Selection")},
|
||||
{CaptureButton::Type::move, QT_TR_NOOP("Move")}
|
||||
};
|
||||
|
||||
QColor Button::m_mainColor = QSettings().value("uiColor").value<QColor>();
|
||||
QColor CaptureButton::m_mainColor = QSettings().value("uiColor").value<QColor>();
|
||||
@@ -24,7 +24,7 @@
|
||||
class QWidget;
|
||||
class QPropertyAnimation;
|
||||
|
||||
class Button : public QPushButton {
|
||||
class CaptureButton : public QPushButton {
|
||||
Q_OBJECT
|
||||
Q_ENUMS(Type)
|
||||
|
||||
@@ -47,17 +47,17 @@ public:
|
||||
last, // used for iteration over the enum
|
||||
};
|
||||
|
||||
explicit Button(const Type, QWidget *parent = 0);
|
||||
explicit Button(const Type, const bool isWhite, QWidget *parent = 0);
|
||||
explicit CaptureButton(const Type, QWidget *parent = 0);
|
||||
explicit CaptureButton(const Type, const bool isWhite, QWidget *parent = 0);
|
||||
|
||||
static QIcon getIcon(const Type);
|
||||
static QIcon getIcon(const Type, bool isWhite);
|
||||
static QString getStyle();
|
||||
static QString getStyle(const QColor &);
|
||||
static size_t getButtonBaseSize();
|
||||
static Button::Type getTypeByName(const QString);
|
||||
static QString getTypeName(const Button::Type);
|
||||
static QString getTypeTooltip(const Button::Type);
|
||||
static CaptureButton::Type getTypeByName(const QString);
|
||||
static QString getTypeName(const CaptureButton::Type);
|
||||
static QString getTypeTooltip(const CaptureButton::Type);
|
||||
|
||||
Type getButtonType() const;
|
||||
|
||||
@@ -78,10 +78,10 @@ protected:
|
||||
signals:
|
||||
void hovered();
|
||||
void mouseExited();
|
||||
void pressedButton(Button *);
|
||||
void pressedButton(CaptureButton *);
|
||||
|
||||
private:
|
||||
Button(QWidget *parent = 0);
|
||||
CaptureButton(QWidget *parent = 0);
|
||||
const Type m_buttonType;
|
||||
static const int m_colorValueLimit = 166;
|
||||
static const int m_colorSaturationLimit = 110;
|
||||
@@ -89,7 +89,7 @@ private:
|
||||
|
||||
QPropertyAnimation *emergeAnimation;
|
||||
|
||||
typedef QMap<Button::Type, const char *> typeData;
|
||||
typedef QMap<CaptureButton::Type, const char *> typeData;
|
||||
static typeData typeTooltip;
|
||||
static typeData typeName;
|
||||
static QColor m_mainColor;
|
||||
@@ -21,16 +21,16 @@
|
||||
// CaptureModification is a single modification in the screenshot drawn
|
||||
// by the user.
|
||||
|
||||
CaptureModification::CaptureModification(const Button::Type t, const QPoint p,
|
||||
CaptureModification::CaptureModification(const CaptureButton::Type t, const QPoint p,
|
||||
const QColor c) : m_color(c), m_type(t)
|
||||
{
|
||||
m_coords.append(p);
|
||||
if (m_type == Button::Type::circle
|
||||
|| m_type == Button::Type::rectangle
|
||||
|| m_type == Button::Type::arrow
|
||||
|| m_type == Button::Type::line
|
||||
|| m_type == Button::Type::marker
|
||||
|| m_type == Button::Type::selection) {
|
||||
if (m_type == CaptureButton::Type::circle
|
||||
|| m_type == CaptureButton::Type::rectangle
|
||||
|| m_type == CaptureButton::Type::arrow
|
||||
|| m_type == CaptureButton::Type::line
|
||||
|| m_type == CaptureButton::Type::marker
|
||||
|| m_type == CaptureButton::Type::selection) {
|
||||
m_coords.append(p);
|
||||
}
|
||||
}
|
||||
@@ -39,7 +39,7 @@ CaptureModification::CaptureModification() {
|
||||
|
||||
}
|
||||
|
||||
Button::Type CaptureModification::getType() const {
|
||||
CaptureButton::Type CaptureModification::getType() const {
|
||||
return m_type;
|
||||
}
|
||||
|
||||
@@ -52,12 +52,12 @@ QVector<QPoint> CaptureModification::getPoints() const {
|
||||
}
|
||||
// addPoint adds a point to the vector of points
|
||||
void CaptureModification::addPoint(const QPoint p) {
|
||||
if (m_type == Button::Type::circle
|
||||
|| m_type == Button::Type::rectangle
|
||||
|| m_type == Button::Type::arrow
|
||||
|| m_type == Button::Type::line
|
||||
|| m_type == Button::Type::marker
|
||||
|| m_type == Button::Type::selection) {
|
||||
if (m_type == CaptureButton::Type::circle
|
||||
|| m_type == CaptureButton::Type::rectangle
|
||||
|| m_type == CaptureButton::Type::arrow
|
||||
|| m_type == CaptureButton::Type::line
|
||||
|| m_type == CaptureButton::Type::marker
|
||||
|| m_type == CaptureButton::Type::selection) {
|
||||
m_coords[1] = p;
|
||||
} else {
|
||||
m_coords.append(p);
|
||||
|
||||
@@ -18,7 +18,7 @@
|
||||
#ifndef CAPTURECHANGE_H
|
||||
#define CAPTURECHANGE_H
|
||||
|
||||
#include "button.h"
|
||||
#include "capturebutton.h"
|
||||
#include <QVector>
|
||||
|
||||
class QPoint;
|
||||
@@ -26,15 +26,15 @@ class QPoint;
|
||||
class CaptureModification {
|
||||
public:
|
||||
CaptureModification();
|
||||
CaptureModification(const Button::Type, const QPoint, const QColor);
|
||||
Button::Type getType() const;
|
||||
CaptureModification(const CaptureButton::Type, const QPoint, const QColor);
|
||||
CaptureButton::Type getType() const;
|
||||
QColor getColor() const;
|
||||
QVector<QPoint> getPoints() const;
|
||||
void addPoint(const QPoint);
|
||||
|
||||
protected:
|
||||
QColor m_color;
|
||||
Button::Type m_type;
|
||||
CaptureButton::Type m_type;
|
||||
|
||||
private:
|
||||
QVector<QPoint> m_coords;
|
||||
|
||||
@@ -24,7 +24,7 @@
|
||||
#include "screenshot.h"
|
||||
#include "capturemodification.h"
|
||||
#include "capturewidget.h"
|
||||
#include "button.h"
|
||||
#include "capturebutton.h"
|
||||
#include "src/capture/colorpicker.h"
|
||||
#include <QScreen>
|
||||
#include <QWindow>
|
||||
@@ -55,7 +55,7 @@ CaptureWidget::CaptureWidget(bool enableSaveWindow, QWidget *parent) :
|
||||
QWidget(parent), m_mouseOverHandle(0), m_mouseIsClicked(false),
|
||||
m_rightClick(false), m_newSelection(false), m_grabbing(false),
|
||||
m_onButton(false), m_enableSaveWindow(enableSaveWindow),
|
||||
m_state(Button::Type::move)
|
||||
m_state(CaptureButton::Type::move)
|
||||
{
|
||||
m_showInitialMsg = QSettings().value("showHelp").toBool();
|
||||
|
||||
@@ -107,22 +107,22 @@ void CaptureWidget::updateButtons() {
|
||||
m_contrastUiColor = settings.value("contastUiColor").value<QColor>();
|
||||
|
||||
auto buttonsInt = settings.value("buttons").value<QList<int> >();
|
||||
QVector<Button*> vectorButtons;
|
||||
QVector<CaptureButton*> vectorButtons;
|
||||
|
||||
bool iconIsWhite = Button::iconIsWhite(m_uiColor);
|
||||
QString buttonStyle = Button::getStyle(m_uiColor);
|
||||
bool iconIsWhite = CaptureButton::iconIsWhite(m_uiColor);
|
||||
QString buttonStyle = CaptureButton::getStyle(m_uiColor);
|
||||
|
||||
for (auto i: buttonsInt) {
|
||||
auto t = static_cast<Button::Type>(i);
|
||||
Button *b = new Button(t, iconIsWhite, this);
|
||||
if (t == Button::Type::selectionIndicator) {
|
||||
auto t = static_cast<CaptureButton::Type>(i);
|
||||
CaptureButton *b = new CaptureButton(t, iconIsWhite, this);
|
||||
if (t == CaptureButton::Type::selectionIndicator) {
|
||||
m_sizeIndButton = b;
|
||||
}
|
||||
b->setStyleSheet(buttonStyle);
|
||||
|
||||
connect(b, &Button::hovered, this, &CaptureWidget::enterButton);
|
||||
connect(b, &Button::mouseExited, this, &CaptureWidget::leaveButton);
|
||||
connect(b, &Button::pressedButton, this, &CaptureWidget::setState);
|
||||
connect(b, &CaptureButton::hovered, this, &CaptureWidget::enterButton);
|
||||
connect(b, &CaptureButton::mouseExited, this, &CaptureWidget::leaveButton);
|
||||
connect(b, &CaptureButton::pressedButton, this, &CaptureWidget::setState);
|
||||
vectorButtons << b;
|
||||
}
|
||||
m_buttonHandler->setButtons(vectorButtons);
|
||||
@@ -138,7 +138,7 @@ void CaptureWidget::paintEvent(QPaintEvent *) {
|
||||
// if we are creating a new modification to the screenshot we just draw
|
||||
// a temporal modification without antialiasing in the pencil tool for
|
||||
// performance. When we are not drawing we just shot the modified screenshot
|
||||
if (m_mouseIsClicked && m_state != Button::Type::move) {
|
||||
if (m_mouseIsClicked && m_state != CaptureButton::Type::move) {
|
||||
painter.drawPixmap(0, 0, m_screenshot->paintTemporalModification(
|
||||
m_modifications.last()));
|
||||
} else {
|
||||
@@ -167,7 +167,7 @@ void CaptureWidget::paintEvent(QPaintEvent *) {
|
||||
//same text and options to get the boundingRect that the text will have.
|
||||
QColor rectColor = m_uiColor;
|
||||
rectColor.setAlpha(180);
|
||||
QColor textColor((Button::iconIsWhite(rectColor) ? Qt::white : Qt::black));
|
||||
QColor textColor((CaptureButton::iconIsWhite(rectColor) ? Qt::white : Qt::black));
|
||||
painter.setPen(QPen(textColor));
|
||||
painter.setBrush(QBrush(rectColor, Qt::SolidPattern));
|
||||
QRectF bRect = painter.boundingRect(helpRect, Qt::AlignCenter, helpTxt);
|
||||
@@ -213,7 +213,7 @@ void CaptureWidget::mousePressEvent(QMouseEvent *e) {
|
||||
if (e->button() == Qt::LeftButton) {
|
||||
m_showInitialMsg = false;
|
||||
m_mouseIsClicked = true;
|
||||
if (m_state != Button::Type::move) {
|
||||
if (m_state != CaptureButton::Type::move) {
|
||||
m_modifications.append(CaptureModification(m_state, e->pos(),
|
||||
m_colorPicker->getDrawColor()));
|
||||
return;
|
||||
@@ -233,7 +233,7 @@ void CaptureWidget::mousePressEvent(QMouseEvent *e) {
|
||||
}
|
||||
|
||||
void CaptureWidget::mouseMoveEvent(QMouseEvent *e) {
|
||||
if (m_mouseIsClicked && m_state == Button::Type::move) {
|
||||
if (m_mouseIsClicked && m_state == CaptureButton::Type::move) {
|
||||
m_mousePos = e->pos();
|
||||
|
||||
if (m_newSelection) {
|
||||
@@ -316,14 +316,14 @@ void CaptureWidget::mouseMoveEvent(QMouseEvent *e) {
|
||||
if (m_rightClick) {
|
||||
setCursor(Qt::ArrowCursor);
|
||||
} else if (m_selection.contains(e->pos()) && !m_onButton &&
|
||||
m_state == Button::Type::move) {
|
||||
m_state == CaptureButton::Type::move) {
|
||||
setCursor(Qt::OpenHandCursor);
|
||||
} else if (m_onButton) {
|
||||
setCursor(Qt::ArrowCursor);
|
||||
} else {
|
||||
setCursor(Qt::CrossCursor);
|
||||
}
|
||||
} else if (m_state == Button::Type::move){
|
||||
} else if (m_state == CaptureButton::Type::move){
|
||||
// cursor on the handlers
|
||||
if (m_mouseOverHandle == &m_TLHandle || m_mouseOverHandle == &m_BRHandle) {
|
||||
setCursor(Qt::SizeFDiagCursor);
|
||||
@@ -346,7 +346,7 @@ void CaptureWidget::mouseReleaseEvent(QMouseEvent *e) {
|
||||
return;
|
||||
// when we end the drawing of a modification in the capture we have to
|
||||
// register the last point and add the whole modification to the screenshot
|
||||
} else if (m_mouseIsClicked && m_state != Button::Type::move) {
|
||||
} else if (m_mouseIsClicked && m_state != CaptureButton::Type::move) {
|
||||
m_screenshot->paintModification(m_modifications.last());
|
||||
}
|
||||
|
||||
@@ -358,7 +358,7 @@ void CaptureWidget::mouseReleaseEvent(QMouseEvent *e) {
|
||||
m_mouseIsClicked = false;
|
||||
m_newSelection = false;
|
||||
|
||||
if (m_state == Button::Type::move && m_mouseOverHandle == 0 &&
|
||||
if (m_state == CaptureButton::Type::move && m_mouseOverHandle == 0 &&
|
||||
m_selection.contains(e->pos())) {
|
||||
setCursor(Qt::OpenHandCursor);
|
||||
}
|
||||
@@ -519,37 +519,36 @@ void CaptureWidget::downResize() {
|
||||
}
|
||||
}
|
||||
|
||||
void CaptureWidget::setState(Button *b) {
|
||||
Button::Type t = b->getButtonType();
|
||||
if(t == Button::Type::selectionIndicator ||
|
||||
t == Button::Type::colorPicker) {
|
||||
void CaptureWidget::setState(CaptureButton *b) {
|
||||
CaptureButton::Type t = b->getButtonType();
|
||||
if(t == CaptureButton::Type::selectionIndicator) {
|
||||
return;
|
||||
}
|
||||
Button::Type newState = t;
|
||||
CaptureButton::Type newState = t;
|
||||
if (m_state == t) {
|
||||
newState = Button::Type::move;
|
||||
newState = CaptureButton::Type::move;
|
||||
}
|
||||
if (t == Button::Type::save) {
|
||||
if (t == CaptureButton::Type::save) {
|
||||
m_enableSaveWindow ?
|
||||
saveScreenshot() :
|
||||
saveScreenshot(QSettings().value("savePath").toString());
|
||||
} else if (t == Button::Type::copy) {
|
||||
} else if (t == CaptureButton::Type::copy) {
|
||||
copyScreenshot();
|
||||
} else if (t == Button::Type::exit) {
|
||||
} else if (t == CaptureButton::Type::exit) {
|
||||
close();
|
||||
} else if (t == Button::Type::undo) {
|
||||
} else if (t == CaptureButton::Type::undo) {
|
||||
undo();
|
||||
} else if (t == Button::Type::imageUploader) {
|
||||
} else if (t == CaptureButton::Type::imageUploader) {
|
||||
uploadScreenshot();
|
||||
} else {
|
||||
m_state = newState;
|
||||
if (m_lastPressedButton) {
|
||||
m_lastPressedButton->setStyleSheet(Button::getStyle());
|
||||
m_lastPressedButton->setStyleSheet(CaptureButton::getStyle());
|
||||
m_lastPressedButton->updateIconColor();
|
||||
}
|
||||
m_lastPressedButton = b;
|
||||
if (m_state != Button::Type::move) {
|
||||
m_lastPressedButton->setStyleSheet(Button::getStyle(m_contrastUiColor));
|
||||
if (m_state != CaptureButton::Type::move) {
|
||||
m_lastPressedButton->setStyleSheet(CaptureButton::getStyle(m_contrastUiColor));
|
||||
m_lastPressedButton->updateIconColor(m_contrastUiColor);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -24,7 +24,7 @@
|
||||
#ifndef CAPTUREWIDGET_H
|
||||
#define CAPTUREWIDGET_H
|
||||
|
||||
#include "button.h"
|
||||
#include "capturebutton.h"
|
||||
#include "buttonhandler.h"
|
||||
#include <QWidget>
|
||||
#include <QPointer>
|
||||
@@ -41,7 +41,7 @@ class Screenshot;
|
||||
class CaptureWidget : public QWidget {
|
||||
Q_OBJECT
|
||||
|
||||
friend class Button;
|
||||
friend class CaptureButton;
|
||||
|
||||
public:
|
||||
explicit CaptureWidget(bool enableSaveWindow = true, QWidget *parent = 0);
|
||||
@@ -67,7 +67,7 @@ private slots:
|
||||
void upResize();
|
||||
void downResize();
|
||||
|
||||
void setState(Button *);
|
||||
void setState(CaptureButton *);
|
||||
|
||||
protected:
|
||||
void paintEvent(QPaintEvent *);
|
||||
@@ -115,10 +115,10 @@ private:
|
||||
|
||||
QRect getExtendedSelection() const;
|
||||
QVector<CaptureModification> m_modifications;
|
||||
QPointer<Button> m_sizeIndButton;
|
||||
QPointer<Button> m_lastPressedButton;
|
||||
QPointer<CaptureButton> m_sizeIndButton;
|
||||
QPointer<CaptureButton> m_lastPressedButton;
|
||||
|
||||
Button::Type m_state;
|
||||
CaptureButton::Type m_state;
|
||||
ButtonHandler *m_buttonHandler;
|
||||
|
||||
QColor m_uiColor;
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
// along with Flameshot. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
#include "screenshot.h"
|
||||
#include "button.h"
|
||||
#include "capturebutton.h"
|
||||
#include "capturemodification.h"
|
||||
#include "src/utils/filenamehandler.h"
|
||||
#include <QStandardPaths>
|
||||
@@ -184,7 +184,7 @@ QPixmap Screenshot::paintTemporalModification(
|
||||
{
|
||||
QPixmap tempPix = m_modifiedScreenshot;
|
||||
QPainter painter(&tempPix);
|
||||
if (modification.getType() != Button::Type::pencil) {
|
||||
if (modification.getType() != CaptureButton::Type::pencil) {
|
||||
painter.setRenderHint(QPainter::Antialiasing);
|
||||
}
|
||||
paintInPainter(painter, modification);
|
||||
@@ -252,30 +252,30 @@ void Screenshot::paintInPainter(QPainter &painter,
|
||||
painter.setPen(QPen(modification.getColor(), 2));
|
||||
QVector<QPoint> points = modification.getPoints();
|
||||
switch (modification.getType()) {
|
||||
case Button::Type::arrow:
|
||||
case CaptureButton::Type::arrow:
|
||||
painter.drawLine(getShorterLine(points[0], points[1]));
|
||||
painter.fillPath(getArrowHead(points[0], points[1]),
|
||||
QBrush(modification.getColor()));
|
||||
break;
|
||||
case Button::Type::circle:
|
||||
case CaptureButton::Type::circle:
|
||||
painter.drawEllipse(QRect(points[0], points[1]));
|
||||
break;
|
||||
case Button::Type::line:
|
||||
case CaptureButton::Type::line:
|
||||
painter.drawLine(points[0], points[1]);
|
||||
break;
|
||||
case Button::Type::marker:
|
||||
case CaptureButton::Type::marker:
|
||||
painter.setOpacity(0.35);
|
||||
painter.setPen(QPen(modification.getColor(), 14));
|
||||
painter.drawLine(points[0], points[1]);
|
||||
painter.setOpacity(1);
|
||||
break;
|
||||
case Button::Type::pencil:
|
||||
case CaptureButton::Type::pencil:
|
||||
painter.drawPolyline(points.data(), points.size());
|
||||
break;
|
||||
case Button::Type::selection:
|
||||
case CaptureButton::Type::selection:
|
||||
painter.drawRect(QRect(points[0], points[1]));
|
||||
break;
|
||||
case Button::Type::rectangle:
|
||||
case CaptureButton::Type::rectangle:
|
||||
painter.setBrush(QBrush(modification.getColor()));
|
||||
painter.drawRect(QRect(points[0], points[1]));
|
||||
break;
|
||||
|
||||
6
src/capture/tools/capturetool.cpp
Normal file
6
src/capture/tools/capturetool.cpp
Normal file
@@ -0,0 +1,6 @@
|
||||
#include "capturetool.h"
|
||||
|
||||
CaptureTool::CaptureTool(QObject *parent) : QObject(parent)
|
||||
{
|
||||
|
||||
}
|
||||
26
src/capture/tools/capturetool.h
Normal file
26
src/capture/tools/capturetool.h
Normal file
@@ -0,0 +1,26 @@
|
||||
#ifndef CAPTURETOOL_H
|
||||
#define CAPTURETOOL_H
|
||||
|
||||
#include <QObject>
|
||||
#include <QVector>
|
||||
|
||||
class CaptureTool : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
enum toolType{WORKER, PATH_DRAWER, LINE_DRAWER};
|
||||
|
||||
explicit CaptureTool(QObject *parent = nullptr);
|
||||
|
||||
virtual int getID() = 0;
|
||||
virtual bool isCheckable() = 0;
|
||||
virtual void drawChanges(QPixmap &pm, const QVector<QPoint> &points) = 0;
|
||||
virtual toolType getToolType() = 0;
|
||||
|
||||
signals:
|
||||
void requestAction();
|
||||
|
||||
public slots:
|
||||
};
|
||||
|
||||
#endif // CAPTURETOOL_H
|
||||
@@ -16,7 +16,7 @@
|
||||
// along with Flameshot. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
#include "buttonlistview.h"
|
||||
#include "src/capture/button.h"
|
||||
#include "src/capture/capturebutton.h"
|
||||
#include <QListWidgetItem>
|
||||
#include <QListWidgetItem>
|
||||
#include <QSettings>
|
||||
@@ -37,8 +37,8 @@ ButtonListView::ButtonListView(QWidget *parent) : QListWidget(parent) {
|
||||
}
|
||||
|
||||
void ButtonListView::initButtonList() {
|
||||
for (int i = 0; i != static_cast<int>(Button::Type::last); ++i) {
|
||||
auto t = static_cast<Button::Type>(i);
|
||||
for (int i = 0; i != static_cast<int>(CaptureButton::Type::last); ++i) {
|
||||
auto t = static_cast<CaptureButton::Type>(i);
|
||||
QListWidgetItem *buttonItem = new QListWidgetItem(this);
|
||||
|
||||
bool iconsAreWhite = false;
|
||||
@@ -47,13 +47,13 @@ void ButtonListView::initButtonList() {
|
||||
if (bgColor.valueF() < 0.6) {
|
||||
iconsAreWhite = true;
|
||||
}
|
||||
buttonItem->setIcon(Button::getIcon(t, iconsAreWhite));
|
||||
buttonItem->setIcon(CaptureButton::getIcon(t, iconsAreWhite));
|
||||
buttonItem->setFlags(Qt::ItemIsUserCheckable);
|
||||
QColor foregroundColor = this->palette().color(QWidget::foregroundRole());
|
||||
buttonItem->setTextColor(foregroundColor);
|
||||
|
||||
buttonItem->setText(Button::getTypeName(t));
|
||||
buttonItem->setToolTip(Button::getTypeTooltip(t));
|
||||
buttonItem->setText(CaptureButton::getTypeName(t));
|
||||
buttonItem->setToolTip(CaptureButton::getTypeTooltip(t));
|
||||
if (m_listButtons.contains(i)) {
|
||||
buttonItem->setCheckState(Qt::Checked);
|
||||
} else {
|
||||
@@ -63,7 +63,7 @@ void ButtonListView::initButtonList() {
|
||||
}
|
||||
|
||||
void ButtonListView::updateActiveButtons(QListWidgetItem *item) {
|
||||
int buttonIndex = static_cast<int>(Button::getTypeByName(item->text()));
|
||||
int buttonIndex = static_cast<int>(CaptureButton::getTypeByName(item->text()));
|
||||
|
||||
if (item->checkState() == Qt::Checked) {
|
||||
m_listButtons.append(buttonIndex);
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
// along with Flameshot. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
#include "configwindow.h"
|
||||
#include "src/capture/button.h"
|
||||
#include "src/capture/capturebutton.h"
|
||||
#include "src/config/buttonlistview.h"
|
||||
#include "src/config/uicoloreditor.h"
|
||||
#include "src/config/geneneralconf.h"
|
||||
|
||||
@@ -54,7 +54,7 @@ void UIcolorEditor::updateLocalColor(const QColor c) {
|
||||
} else {
|
||||
m_contrastColor = c;
|
||||
}
|
||||
QString style = Button::getStyle(c);
|
||||
QString style = CaptureButton::getStyle(c);
|
||||
m_lastButtonPressed->setStyleSheet(style);
|
||||
updateButtonIcon();
|
||||
}
|
||||
@@ -77,7 +77,7 @@ void UIcolorEditor::initColorWheel() {
|
||||
|
||||
void UIcolorEditor::initButtons() {
|
||||
const int extraSize = 10;
|
||||
int frameSize = Button::getButtonBaseSize() + extraSize;
|
||||
int frameSize = CaptureButton::getButtonBaseSize() + extraSize;
|
||||
|
||||
vLayout->addWidget(new QLabel(tr("Select a Button to modify it"), this));
|
||||
|
||||
@@ -86,7 +86,7 @@ void UIcolorEditor::initButtons() {
|
||||
frame->setFrameStyle(QFrame::StyledPanel);
|
||||
|
||||
|
||||
m_buttonMainColor = new Button(m_buttonIconType, frame);
|
||||
m_buttonMainColor = new CaptureButton(m_buttonIconType, frame);
|
||||
m_buttonMainColor->move(m_buttonMainColor->x() + extraSize/2, m_buttonMainColor->y() + extraSize/2);
|
||||
QHBoxLayout *h1 = new QHBoxLayout();
|
||||
h1->addWidget(frame);
|
||||
@@ -101,9 +101,9 @@ void UIcolorEditor::initButtons() {
|
||||
frame2->setFixedSize(frameSize, frameSize);
|
||||
frame2->setFrameStyle(QFrame::StyledPanel);
|
||||
|
||||
m_buttonContrast = new Button(m_buttonIconType, frame2);
|
||||
m_buttonContrast = new CaptureButton(m_buttonIconType, frame2);
|
||||
m_buttonContrast->setIcon(QIcon());
|
||||
m_buttonContrast->setStyleSheet(Button::getStyle(m_contrastColor));
|
||||
m_buttonContrast->setStyleSheet(CaptureButton::getStyle(m_contrastColor));
|
||||
m_buttonContrast->move(m_buttonContrast->x() + extraSize/2,
|
||||
m_buttonContrast->y() + extraSize/2);
|
||||
|
||||
@@ -118,9 +118,9 @@ void UIcolorEditor::initButtons() {
|
||||
" mode of the contrast color."));
|
||||
|
||||
m_lastButtonPressed = m_buttonMainColor;
|
||||
connect(m_buttonMainColor, &Button::pressedButton,
|
||||
connect(m_buttonMainColor, &CaptureButton::pressedButton,
|
||||
this, &UIcolorEditor::changeLastButton);
|
||||
connect(m_buttonContrast, &Button::pressedButton,
|
||||
connect(m_buttonContrast, &CaptureButton::pressedButton,
|
||||
this, &UIcolorEditor::changeLastButton);
|
||||
// clicking the labels chages the button too
|
||||
connect(m_labelMain, &ClickableLabel::clicked,
|
||||
@@ -130,11 +130,11 @@ void UIcolorEditor::initButtons() {
|
||||
}
|
||||
|
||||
void UIcolorEditor::updateButtonIcon() {
|
||||
m_lastButtonPressed->setIcon(Button::getIcon(m_buttonMainColor->getButtonType()));
|
||||
m_lastButtonPressed->setIcon(CaptureButton::getIcon(m_buttonMainColor->getButtonType()));
|
||||
}
|
||||
|
||||
// visual update for the selected button
|
||||
void UIcolorEditor::changeLastButton(Button *b) {
|
||||
void UIcolorEditor::changeLastButton(CaptureButton *b) {
|
||||
if (m_lastButtonPressed != b) {
|
||||
m_lastButtonPressed->setIcon(QIcon());
|
||||
m_lastButtonPressed = b;
|
||||
|
||||
@@ -19,12 +19,12 @@
|
||||
#define UICOLORPICKER_H
|
||||
|
||||
#include "color_wheel.hpp"
|
||||
#include "src/capture/button.h"
|
||||
#include "src/capture/capturebutton.h"
|
||||
#include <QFrame>
|
||||
|
||||
class QVBoxLayout;
|
||||
class QHBoxLayout;
|
||||
class Button;
|
||||
class CaptureButton;
|
||||
class ClickableLabel;
|
||||
|
||||
class UIcolorEditor : public QFrame {
|
||||
@@ -36,18 +36,18 @@ private slots:
|
||||
void updateUIcolor();
|
||||
void updateLocalColor(const QColor);
|
||||
void updateButtonIcon();
|
||||
void changeLastButton(Button *);
|
||||
void changeLastButton(CaptureButton *);
|
||||
|
||||
private:
|
||||
QColor m_uiColor, m_contrastColor;
|
||||
Button *m_buttonMainColor;
|
||||
CaptureButton *m_buttonMainColor;
|
||||
ClickableLabel *m_labelMain;
|
||||
Button *m_buttonContrast;
|
||||
CaptureButton *m_buttonContrast;
|
||||
ClickableLabel *m_labelContrast;
|
||||
Button *m_lastButtonPressed;
|
||||
CaptureButton *m_lastButtonPressed;
|
||||
color_widgets::ColorWheel *m_colorWheel;
|
||||
|
||||
static const Button::Type m_buttonIconType = Button::Type::circle;
|
||||
static const CaptureButton::Type m_buttonIconType = CaptureButton::Type::circle;
|
||||
|
||||
QHBoxLayout *hLayout;
|
||||
QVBoxLayout *vLayout;
|
||||
|
||||
@@ -19,7 +19,7 @@
|
||||
#include "capture/capturewidget.h"
|
||||
#include "infowindow.h"
|
||||
#include "config/configwindow.h"
|
||||
#include "capture/button.h"
|
||||
#include "capture/capturebutton.h"
|
||||
#include <QAction>
|
||||
#include <QApplication>
|
||||
#include <QMenu>
|
||||
@@ -41,7 +41,7 @@ Controller::Controller(QObject *parent) : QObject(parent),
|
||||
initDefaults();
|
||||
qApp->setQuitOnLastWindowClosed(false);
|
||||
|
||||
QString StyleSheet = Button::getStyle();
|
||||
QString StyleSheet = CaptureButton::getStyle();
|
||||
qApp->setStyleSheet(StyleSheet);
|
||||
|
||||
}
|
||||
@@ -101,13 +101,13 @@ void Controller::initDefaults() {
|
||||
settings.setValue("contastUiColor", QColor(86, 0, 120));
|
||||
|
||||
QList<int> buttons;
|
||||
for (int i = 0; i < static_cast<int>(Button::Type::last); ++i) {
|
||||
for (int i = 0; i < static_cast<int>(CaptureButton::Type::last); ++i) {
|
||||
buttons << i;
|
||||
}
|
||||
settings.setValue("buttons", QVariant::fromValue(buttons));
|
||||
} else {
|
||||
// disabled buttons cleanup
|
||||
int higherValue = static_cast<int>(Button::Type::last) - 1;
|
||||
int higherValue = static_cast<int>(CaptureButton::Type::last) - 1;
|
||||
QList<int> buttons = settings.value("buttons").value<QList<int> >();
|
||||
|
||||
QMutableListIterator<int> i(buttons);
|
||||
|
||||
Reference in New Issue
Block a user