2017-12-22 05:16:23 +00:00
|
|
|
/*
|
|
|
|
This file is part of Telegram Desktop,
|
2018-01-03 10:23:14 +00:00
|
|
|
the official desktop application for the Telegram messaging service.
|
2017-12-22 05:16:23 +00:00
|
|
|
|
2018-01-03 10:23:14 +00:00
|
|
|
For license and copyright information please follow this link:
|
|
|
|
https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
2017-12-22 05:16:23 +00:00
|
|
|
*/
|
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include "boxes/abstract_box.h"
|
|
|
|
|
2018-05-26 14:58:21 +00:00
|
|
|
namespace Window {
|
|
|
|
class Controller;
|
|
|
|
} // namespace Window
|
|
|
|
|
2018-01-14 16:02:25 +00:00
|
|
|
namespace Data {
|
|
|
|
class Media;
|
|
|
|
} // namespace Data
|
2018-01-13 12:45:11 +00:00
|
|
|
|
2017-12-22 05:16:23 +00:00
|
|
|
namespace Ui {
|
2018-05-20 17:42:30 +00:00
|
|
|
class InputField;
|
2017-12-22 05:16:23 +00:00
|
|
|
} // namespace Ui
|
|
|
|
|
2018-04-06 16:23:09 +00:00
|
|
|
namespace Window {
|
|
|
|
class Controller;
|
|
|
|
} // namespace Window
|
|
|
|
|
2017-12-22 05:16:23 +00:00
|
|
|
class EditCaptionBox : public BoxContent, public RPCSender {
|
|
|
|
public:
|
2018-05-26 14:58:21 +00:00
|
|
|
EditCaptionBox(
|
|
|
|
QWidget*,
|
|
|
|
not_null<Window::Controller*> controller,
|
|
|
|
not_null<HistoryItem*> item);
|
2017-12-22 05:16:23 +00:00
|
|
|
|
|
|
|
protected:
|
|
|
|
void prepare() override;
|
|
|
|
void setInnerFocus() override;
|
|
|
|
|
|
|
|
void paintEvent(QPaintEvent *e) override;
|
|
|
|
void resizeEvent(QResizeEvent *e) override;
|
|
|
|
|
|
|
|
private:
|
|
|
|
void updateBoxSize();
|
2018-08-02 14:31:54 +00:00
|
|
|
void prepareGifPreview(not_null<DocumentData*> document);
|
2017-12-22 05:16:23 +00:00
|
|
|
void clipCallback(Media::Clip::Notification notification);
|
|
|
|
|
|
|
|
void save();
|
|
|
|
void captionResized();
|
|
|
|
|
|
|
|
void saveDone(const MTPUpdates &updates);
|
|
|
|
bool saveFail(const RPCError &error);
|
|
|
|
|
|
|
|
int errorTopSkip() const;
|
|
|
|
|
2018-05-26 14:58:21 +00:00
|
|
|
not_null<Window::Controller*> _controller;
|
2017-12-22 05:16:23 +00:00
|
|
|
FullMsgId _msgId;
|
2018-08-02 14:31:54 +00:00
|
|
|
ImagePtr _thumbnailImage;
|
|
|
|
bool _thumbnailImageLoaded = false;
|
|
|
|
Fn<void()> _refreshThumbnail;
|
2017-12-22 05:16:23 +00:00
|
|
|
bool _animated = false;
|
|
|
|
bool _photo = false;
|
|
|
|
bool _doc = false;
|
|
|
|
|
|
|
|
QPixmap _thumb;
|
|
|
|
Media::Clip::ReaderPointer _gifPreview;
|
|
|
|
|
2018-05-20 17:42:30 +00:00
|
|
|
object_ptr<Ui::InputField> _field = { nullptr };
|
2017-12-22 05:16:23 +00:00
|
|
|
|
|
|
|
int _thumbx = 0;
|
|
|
|
int _thumbw = 0;
|
|
|
|
int _thumbh = 0;
|
|
|
|
Text _name;
|
|
|
|
QString _status;
|
|
|
|
int _statusw = 0;
|
|
|
|
bool _isAudio = false;
|
|
|
|
bool _isImage = false;
|
|
|
|
|
|
|
|
bool _previewCancelled = false;
|
|
|
|
mtpRequestId _saveRequestId = 0;
|
|
|
|
|
|
|
|
QString _error;
|
|
|
|
|
|
|
|
};
|