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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -15,7 +15,8 @@ void TextItem::mouseDragEvent(QGraphicsSceneMouseEvent *e, CropScene *scene) {
textItem->setPen(scene->pen());
textItem->setBrush(scene->brush());
} 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);
}
}

View File

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

View File

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

View File

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

View File

@ -8,7 +8,9 @@ namespace ioutils {
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);
for (auto header : headers) {
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);
for (auto header : headers) {
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);
for (auto header : headers) {
req.setRawHeader(header.first.toUtf8(), header.second.toUtf8());

View File

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