mirror of
https://github.com/fergalmoran/flameshot.git
synced 2026-02-03 00:58:06 +00:00
Code refactoring - change code style to the new clang-format rules
This commit is contained in:
@@ -17,59 +17,69 @@
|
||||
|
||||
#include "abstractpathtool.h"
|
||||
|
||||
AbstractPathTool::AbstractPathTool(QObject *parent) :
|
||||
CaptureTool(parent), m_thickness(0), m_padding(0)
|
||||
AbstractPathTool::AbstractPathTool(QObject* parent)
|
||||
: CaptureTool(parent)
|
||||
, m_thickness(0)
|
||||
, m_padding(0)
|
||||
{}
|
||||
|
||||
bool AbstractPathTool::isValid() const
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
bool AbstractPathTool::isValid() const {
|
||||
return m_points.length() > 1;
|
||||
}
|
||||
|
||||
bool AbstractPathTool::closeOnButtonPressed() const {
|
||||
bool AbstractPathTool::closeOnButtonPressed() const
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
bool AbstractPathTool::isSelectable() const {
|
||||
bool AbstractPathTool::isSelectable() const
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
bool AbstractPathTool::showMousePreview() const {
|
||||
bool AbstractPathTool::showMousePreview() const
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
void AbstractPathTool::undo(QPixmap &pixmap) {
|
||||
void AbstractPathTool::undo(QPixmap& pixmap)
|
||||
{
|
||||
QPainter p(&pixmap);
|
||||
const int val = m_thickness + m_padding;
|
||||
QRect area = m_backupArea + QMargins(val, val, val, val);
|
||||
p.drawPixmap(area.intersected(pixmap.rect())
|
||||
.topLeft(), m_pixmapBackup);
|
||||
p.drawPixmap(area.intersected(pixmap.rect()).topLeft(), m_pixmapBackup);
|
||||
}
|
||||
|
||||
void AbstractPathTool::drawEnd(const QPoint &p) {
|
||||
void AbstractPathTool::drawEnd(const QPoint& p)
|
||||
{
|
||||
Q_UNUSED(p);
|
||||
}
|
||||
|
||||
void AbstractPathTool::drawMove(const QPoint &p) {
|
||||
void AbstractPathTool::drawMove(const QPoint& p)
|
||||
{
|
||||
addPoint(p);
|
||||
}
|
||||
|
||||
void AbstractPathTool::colorChanged(const QColor &c) {
|
||||
void AbstractPathTool::colorChanged(const QColor& c)
|
||||
{
|
||||
m_color = c;
|
||||
}
|
||||
|
||||
void AbstractPathTool::thicknessChanged(const int th) {
|
||||
void AbstractPathTool::thicknessChanged(const int th)
|
||||
{
|
||||
m_thickness = th;
|
||||
}
|
||||
|
||||
void AbstractPathTool::updateBackup(const QPixmap &pixmap) {
|
||||
void AbstractPathTool::updateBackup(const QPixmap& pixmap)
|
||||
{
|
||||
const int val = m_thickness + m_padding;
|
||||
QRect area = m_backupArea.normalized() + QMargins(val, val, val, val);
|
||||
m_pixmapBackup = pixmap.copy(area);
|
||||
}
|
||||
|
||||
void AbstractPathTool::addPoint(const QPoint &point) {
|
||||
void AbstractPathTool::addPoint(const QPoint& point)
|
||||
{
|
||||
if (m_backupArea.left() > point.x()) {
|
||||
m_backupArea.setLeft(point.x());
|
||||
} else if (m_backupArea.right() < point.x()) {
|
||||
|
||||
Reference in New Issue
Block a user