Reformat again sigh

This commit is contained in:
ArsenArsen 2017-06-14 23:34:58 +02:00
parent 15d7897b9c
commit 7802f0e9fb
15 changed files with 45 additions and 33 deletions

View File

@ -11,7 +11,7 @@
#include <screenshotutil.hpp> #include <screenshotutil.hpp>
class ColorPickerScene : public QGraphicsScene, public QGraphicsView { class ColorPickerScene : public QGraphicsScene, public QGraphicsView {
public: public:
ColorPickerScene(QPixmap *pixmap, QWidget *parentWidget); ColorPickerScene(QPixmap *pixmap, QWidget *parentWidget);
void mouseMoveEvent(QGraphicsSceneMouseEvent *event) override; void mouseMoveEvent(QGraphicsSceneMouseEvent *event) override;
void keyPressEvent(QKeyEvent *event) override; void keyPressEvent(QKeyEvent *event) override;
@ -25,7 +25,7 @@ class ColorPickerScene : public QGraphicsScene, public QGraphicsView {
}); });
} }
private: private:
QColor color; QColor color;
QGraphicsEllipseItem *ellipse = 0; QGraphicsEllipseItem *ellipse = 0;
QGraphicsPixmapItem *pItem = 0; QGraphicsPixmapItem *pItem = 0;

View File

@ -10,13 +10,13 @@
class CropEditor : public QObject { class CropEditor : public QObject {
Q_OBJECT Q_OBJECT
public: public:
CropEditor(QPixmap *image, QObject *parent = 0); CropEditor(QPixmap *image, QObject *parent = 0);
~CropEditor(); ~CropEditor();
signals: signals:
QPixmap *cropped(QPixmap *pixmap); QPixmap *cropped(QPixmap *pixmap);
private: private:
void crop(QRect rect); void crop(QRect rect);
CropScene *scene = nullptr; CropScene *scene = nullptr;
CropView *view = nullptr; CropView *view = nullptr;

View File

@ -15,7 +15,7 @@ class CropScene;
class CropScene : public QGraphicsScene { class CropScene : public QGraphicsScene {
Q_OBJECT Q_OBJECT
public: public:
CropScene(QObject *parent, QPixmap *pixmap); CropScene(QObject *parent, QPixmap *pixmap);
~CropScene(); ~CropScene();
QPen &pen(); QPen &pen();
@ -26,20 +26,20 @@ class CropScene : public QGraphicsScene {
return _pixmap; return _pixmap;
} }
public slots: public slots:
void fontAsk(); void fontAsk();
signals: signals:
void closedWithRect(QRect rect); void closedWithRect(QRect rect);
protected: protected:
void mouseMoveEvent(QGraphicsSceneMouseEvent *e) override; void mouseMoveEvent(QGraphicsSceneMouseEvent *e) override;
void mouseReleaseEvent(QGraphicsSceneMouseEvent *e) override; void mouseReleaseEvent(QGraphicsSceneMouseEvent *e) override;
void contextMenuEvent(QGraphicsSceneContextMenuEvent *e) override; void contextMenuEvent(QGraphicsSceneContextMenuEvent *e) override;
void keyReleaseEvent(QKeyEvent *e) override; void keyReleaseEvent(QKeyEvent *e) override;
private: private:
void addDrawingAction(QMenu &menu, QString name, std::function<DrawItem *()> item); void addDrawingAction(QMenu &menu, QString name, std::function<DrawItem *()> item);
void done(); void done();
std::function<DrawItem *()> drawingSelectionMaker; std::function<DrawItem *()> drawingSelectionMaker;

View File

@ -5,10 +5,10 @@
#include <QKeyEvent> #include <QKeyEvent>
class CropView : public QGraphicsView { class CropView : public QGraphicsView {
public: public:
CropView(QGraphicsScene *scene); CropView(QGraphicsScene *scene);
protected: protected:
void keyPressEvent(QKeyEvent *e) override; void keyPressEvent(QKeyEvent *e) override;
}; };

View File

@ -6,7 +6,7 @@
#include <QGraphicsEffect> #include <QGraphicsEffect>
class BlurItem : public DrawItem { class BlurItem : public DrawItem {
public: public:
QString name() { QString name() {
return "Blur"; return "Blur";
} }
@ -17,7 +17,7 @@ class BlurItem : public DrawItem {
void mouseDragEvent(QGraphicsSceneMouseEvent *e, CropScene *scene) override; void mouseDragEvent(QGraphicsSceneMouseEvent *e, CropScene *scene) override;
void mouseDragEndEvent(QGraphicsSceneMouseEvent *, CropScene *) override; void mouseDragEndEvent(QGraphicsSceneMouseEvent *, CropScene *) override;
private: private:
QGraphicsBlurEffect *effect; QGraphicsBlurEffect *effect;
QPointF pos; QPointF pos;
QGraphicsRectItem *rect; QGraphicsRectItem *rect;

View File

@ -5,7 +5,7 @@
#include "drawitem.hpp" #include "drawitem.hpp"
class DotItem : public DrawItem { class DotItem : public DrawItem {
public: public:
DotItem(); DotItem();
~DotItem(); ~DotItem();
QString name() { QString name() {

View File

@ -7,7 +7,7 @@ class DrawItem;
#include <cropeditor/cropscene.hpp> #include <cropeditor/cropscene.hpp>
class DrawItem { class DrawItem {
public: public:
virtual ~DrawItem() { virtual ~DrawItem() {
} }
virtual QString name() = 0; virtual QString name() = 0;

View File

@ -4,7 +4,7 @@
#include "drawitem.hpp" #include "drawitem.hpp"
class LineItem : public DrawItem { class LineItem : public DrawItem {
public: public:
LineItem(); LineItem();
QString name() override { QString name() override {
return "Straight line"; return "Straight line";
@ -12,7 +12,7 @@ class LineItem : public DrawItem {
void mouseDragEvent(QGraphicsSceneMouseEvent *e, CropScene *scene) override; void mouseDragEvent(QGraphicsSceneMouseEvent *e, CropScene *scene) override;
void mouseDragEndEvent(QGraphicsSceneMouseEvent *, CropScene *) override; void mouseDragEndEvent(QGraphicsSceneMouseEvent *, CropScene *) override;
private: private:
QPointF init; QPointF init;
QGraphicsLineItem *line; QGraphicsLineItem *line;
}; };

View File

@ -5,7 +5,7 @@
#include "drawitem.hpp" #include "drawitem.hpp"
class PathItem : public DrawItem { class PathItem : public DrawItem {
public: public:
PathItem(); PathItem();
~PathItem(); ~PathItem();
QString name() { QString name() {
@ -14,7 +14,7 @@ class PathItem : public DrawItem {
void mouseDragEvent(QGraphicsSceneMouseEvent *e, CropScene *scene); void mouseDragEvent(QGraphicsSceneMouseEvent *e, CropScene *scene);
void mouseDragEndEvent(QGraphicsSceneMouseEvent *e, CropScene *scene); void mouseDragEndEvent(QGraphicsSceneMouseEvent *e, CropScene *scene);
private: private:
QPainterPath *path = nullptr; QPainterPath *path = nullptr;
QGraphicsPathItem *pathItem = nullptr; QGraphicsPathItem *pathItem = nullptr;
}; };

View File

@ -15,7 +15,8 @@ void TextItem::mouseDragEvent(QGraphicsSceneMouseEvent *e, CropScene *scene) {
textItem->setPen(scene->pen()); textItem->setPen(scene->pen());
textItem->setBrush(scene->brush()); textItem->setBrush(scene->brush());
} else { } else {
auto ee = 180 + qRadiansToDegrees(qAtan2((textItem->pos().y() - e->scenePos().y()), (textItem->pos().x() - e->scenePos().x()))); auto ee
= 180 + qRadiansToDegrees(qAtan2((textItem->pos().y() - e->scenePos().y()), (textItem->pos().x() - e->scenePos().x())));
textItem->setRotation(ee); textItem->setRotation(ee);
} }
} }

View File

@ -5,13 +5,13 @@
#include <QGraphicsSimpleTextItem> #include <QGraphicsSimpleTextItem>
class TextItem : public DrawItem { class TextItem : public DrawItem {
public: public:
QString name() override; QString name() override;
bool init(CropScene *) override; bool init(CropScene *) override;
void mouseDragEvent(QGraphicsSceneMouseEvent *e, CropScene *scene) override; void mouseDragEvent(QGraphicsSceneMouseEvent *e, CropScene *scene) override;
void mouseDragEndEvent(QGraphicsSceneMouseEvent *, CropScene *) override; void mouseDragEndEvent(QGraphicsSceneMouseEvent *, CropScene *) override;
private: private:
QGraphicsSimpleTextItem *textItem = nullptr; QGraphicsSimpleTextItem *textItem = nullptr;
QString text; QString text;
}; };

View File

@ -11,15 +11,15 @@ class BlurDialog;
class BlurDialog : public QDialog { class BlurDialog : public QDialog {
Q_OBJECT Q_OBJECT
public: public:
explicit BlurDialog(QGraphicsBlurEffect *effect, QWidget *parent = 0); explicit BlurDialog(QGraphicsBlurEffect *effect, QWidget *parent = 0);
~BlurDialog(); ~BlurDialog();
private slots: private slots:
void on_radSpinner_valueChanged(double arg1); void on_radSpinner_valueChanged(double arg1);
void on_radSlider_sliderMoved(int position); void on_radSlider_sliderMoved(int position);
private: private:
Ui::BlurDialog *ui; Ui::BlurDialog *ui;
QGraphicsBlurEffect *effect; QGraphicsBlurEffect *effect;
}; };

View File

@ -11,11 +11,11 @@ class BrushPenSelection;
class BrushPenSelection : public QDialog { class BrushPenSelection : public QDialog {
Q_OBJECT Q_OBJECT
public: public:
explicit BrushPenSelection(CropScene *scene); explicit BrushPenSelection(CropScene *scene);
~BrushPenSelection(); ~BrushPenSelection();
private slots: private slots:
void on_penColor_clicked(bool); void on_penColor_clicked(bool);
void on_brushColor_clicked(bool); void on_brushColor_clicked(bool);
@ -25,7 +25,7 @@ class BrushPenSelection : public QDialog {
void on_widthSlider_sliderMoved(int position); void on_widthSlider_sliderMoved(int position);
void on_widthSpinner_valueChanged(double arg1); void on_widthSpinner_valueChanged(double arg1);
private: private:
Ui::BrushPenSelection *ui; Ui::BrushPenSelection *ui;
CropScene *scene; CropScene *scene;
QColor brush, pen; QColor brush, pen;

View File

@ -8,7 +8,9 @@ namespace ioutils {
QNetworkAccessManager networkManager; QNetworkAccessManager networkManager;
} }
void ioutils::getJson(QUrl target, QList<QPair<QString, QString>> headers, std::function<void(QJsonDocument, QByteArray, QNetworkReply *)> callback) { void ioutils::getJson(QUrl target,
QList<QPair<QString, QString>> headers,
std::function<void(QJsonDocument, QByteArray, QNetworkReply *)> callback) {
QNetworkRequest req(target); QNetworkRequest req(target);
for (auto header : headers) { for (auto header : headers) {
req.setRawHeader(header.first.toUtf8(), header.second.toUtf8()); req.setRawHeader(header.first.toUtf8(), header.second.toUtf8());
@ -21,7 +23,10 @@ void ioutils::getJson(QUrl target, QList<QPair<QString, QString>> headers, std::
}); });
} }
void ioutils::postJson(QUrl target, QList<QPair<QString, QString>> headers, QByteArray body, std::function<void(QJsonDocument, QByteArray, QNetworkReply *)> callback) { void ioutils::postJson(QUrl target,
QList<QPair<QString, QString>> headers,
QByteArray body,
std::function<void(QJsonDocument, QByteArray, QNetworkReply *)> callback) {
QNetworkRequest req(target); QNetworkRequest req(target);
for (auto header : headers) { for (auto header : headers) {
req.setRawHeader(header.first.toUtf8(), header.second.toUtf8()); req.setRawHeader(header.first.toUtf8(), header.second.toUtf8());
@ -46,7 +51,10 @@ void ioutils::getData(QUrl target, QList<QPair<QString, QString>> headers, std::
}); });
} }
void ioutils::postData(QUrl target, QList<QPair<QString, QString>> headers, QByteArray body, std::function<void(QByteArray, QNetworkReply *)> callback) { void ioutils::postData(QUrl target,
QList<QPair<QString, QString>> headers,
QByteArray body,
std::function<void(QByteArray, QNetworkReply *)> callback) {
QNetworkRequest req(target); QNetworkRequest req(target);
for (auto header : headers) { for (auto header : headers) {
req.setRawHeader(header.first.toUtf8(), header.second.toUtf8()); req.setRawHeader(header.first.toUtf8(), header.second.toUtf8());

View File

@ -10,7 +10,10 @@
namespace ioutils { namespace ioutils {
extern QNetworkAccessManager networkManager; extern QNetworkAccessManager networkManager;
void getJson(QUrl target, QList<QPair<QString, QString>> headers, std::function<void(QJsonDocument, QByteArray, QNetworkReply *)> callback); void getJson(QUrl target, QList<QPair<QString, QString>> headers, std::function<void(QJsonDocument, QByteArray, QNetworkReply *)> callback);
void postJson(QUrl target, QList<QPair<QString, QString>> headers, QByteArray body, std::function<void(QJsonDocument, QByteArray, QNetworkReply *)> callback); void postJson(QUrl target,
QList<QPair<QString, QString>> headers,
QByteArray body,
std::function<void(QJsonDocument, QByteArray, QNetworkReply *)> callback);
void getData(QUrl target, QList<QPair<QString, QString>> headers, std::function<void(QByteArray, QNetworkReply *)> callback); void getData(QUrl target, QList<QPair<QString, QString>> headers, std::function<void(QByteArray, QNetworkReply *)> callback);
void postData(QUrl target, QList<QPair<QString, QString>> headers, QByteArray body, std::function<void(QByteArray, QNetworkReply *)> callback); void postData(QUrl target, QList<QPair<QString, QString>> headers, QByteArray body, std::function<void(QByteArray, QNetworkReply *)> callback);
} }