tdesktop/Telegram/SourceFiles/boxes/photo_crop_box.h

46 lines
1.2 KiB
C
Raw Normal View History

/*
This file is part of Telegram Desktop,
the official desktop application for the Telegram messaging service.
For license and copyright information please follow this link:
https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
*/
#pragma once
2017-04-06 14:38:10 +00:00
#include "boxes/abstract_box.h"
class PhotoCropBox : public BoxContent {
public:
PhotoCropBox(QWidget*, const QImage &img, const PeerId &peer);
PhotoCropBox(QWidget*, const QImage &img, not_null<PeerData*> peer);
int32 mouseState(QPoint p);
2017-11-21 09:20:56 +00:00
rpl::producer<QImage> ready() const;
protected:
void prepare() override;
void keyPressEvent(QKeyEvent *e) override;
void paintEvent(QPaintEvent *e) override;
void mousePressEvent(QMouseEvent *e) override;
void mouseReleaseEvent(QMouseEvent *e) override;
void mouseMoveEvent(QMouseEvent *e) override;
private:
2015-11-09 09:51:22 +00:00
void init(const QImage &img, PeerData *peer);
void sendPhoto();
2015-11-09 09:51:22 +00:00
2015-09-16 13:04:08 +00:00
QString _title;
int32 _downState = 0;
int32 _thumbx, _thumby, _thumbw, _thumbh;
int32 _cropx, _cropy, _cropw;
int32 _fromposx, _fromposy, _fromcropx, _fromcropy, _fromcropw;
QImage _img;
QPixmap _thumb;
2016-11-24 19:28:23 +00:00
QImage _mask, _fade;
PeerId _peerId = 0;
rpl::event_stream<QImage> _readyImages;
};