2014-08-06 14:40:21 +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.
|
2014-08-06 14:40:21 +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
|
2014-08-06 14:40:21 +00:00
|
|
|
*/
|
|
|
|
#pragma once
|
|
|
|
|
2016-10-26 16:43:13 +00:00
|
|
|
#include "ui/widgets/dropdown_menu.h"
|
2016-09-28 10:15:03 +00:00
|
|
|
#include "ui/effects/radial_animation.h"
|
2017-11-06 07:31:18 +00:00
|
|
|
#include "data/data_shared_media.h"
|
|
|
|
#include "data/data_user_photos.h"
|
2015-04-11 10:04:10 +00:00
|
|
|
|
2016-07-11 18:05:46 +00:00
|
|
|
namespace Media {
|
2017-01-24 21:24:39 +00:00
|
|
|
namespace Player {
|
|
|
|
struct TrackState;
|
|
|
|
} // namespace Player
|
2016-07-11 18:05:46 +00:00
|
|
|
namespace Clip {
|
|
|
|
class Controller;
|
|
|
|
} // namespace Clip
|
2017-12-28 13:06:06 +00:00
|
|
|
namespace View {
|
|
|
|
class GroupThumbs;
|
|
|
|
} // namespace View
|
2016-07-11 18:05:46 +00:00
|
|
|
} // namespace Media
|
|
|
|
|
2016-10-26 16:43:13 +00:00
|
|
|
namespace Ui {
|
2016-10-01 12:34:23 +00:00
|
|
|
class PopupMenu;
|
2016-11-11 13:46:04 +00:00
|
|
|
class LinkButton;
|
2016-12-23 13:21:01 +00:00
|
|
|
class RoundButton;
|
2016-10-26 16:43:13 +00:00
|
|
|
} // namespace Ui
|
2016-10-01 12:34:23 +00:00
|
|
|
|
2016-12-23 13:21:01 +00:00
|
|
|
namespace Window {
|
|
|
|
namespace Theme {
|
|
|
|
struct Preview;
|
|
|
|
} // namespace Theme
|
|
|
|
} // namespace Window
|
|
|
|
|
2017-01-01 16:45:20 +00:00
|
|
|
namespace Notify {
|
|
|
|
struct PeerUpdate;
|
|
|
|
} // namespace Notify
|
|
|
|
|
2017-12-28 13:06:06 +00:00
|
|
|
class MediaView : public TWidget, private base::Subscriber, public ClickHandlerHost {
|
2014-08-06 14:40:21 +00:00
|
|
|
Q_OBJECT
|
|
|
|
|
|
|
|
public:
|
2017-08-08 09:31:48 +00:00
|
|
|
MediaView();
|
2014-08-06 14:40:21 +00:00
|
|
|
|
2016-07-24 08:53:09 +00:00
|
|
|
void setVisible(bool visible) override;
|
2014-08-15 11:19:32 +00:00
|
|
|
|
2017-08-18 19:14:31 +00:00
|
|
|
void showPhoto(not_null<PhotoData*> photo, HistoryItem *context);
|
2017-08-29 15:15:54 +00:00
|
|
|
void showPhoto(not_null<PhotoData*> photo, not_null<PeerData*> context);
|
2017-08-18 19:14:31 +00:00
|
|
|
void showDocument(not_null<DocumentData*> document, HistoryItem *context);
|
2015-04-11 10:04:10 +00:00
|
|
|
|
2016-06-17 18:18:01 +00:00
|
|
|
void leaveToChildEvent(QEvent *e, QWidget *child) override { // e -- from enterEvent() of child TWidget
|
2015-04-11 10:04:10 +00:00
|
|
|
updateOverState(OverNone);
|
|
|
|
}
|
2016-06-17 18:18:01 +00:00
|
|
|
void enterFromChildEvent(QEvent *e, QWidget *child) override { // e -- from leaveEvent() of child TWidget
|
2015-04-11 10:04:10 +00:00
|
|
|
updateOver(mapFromGlobal(QCursor::pos()));
|
|
|
|
}
|
2014-08-11 09:03:45 +00:00
|
|
|
|
2015-04-11 10:04:10 +00:00
|
|
|
void close();
|
|
|
|
|
|
|
|
void activateControls();
|
2015-04-19 10:29:19 +00:00
|
|
|
void onDocClick();
|
2014-10-17 12:57:14 +00:00
|
|
|
|
2016-06-24 10:37:29 +00:00
|
|
|
void clipCallback(Media::Clip::Notification notification);
|
2016-03-29 17:17:00 +00:00
|
|
|
PeerData *ui_getPeerForMouseAction();
|
2015-12-22 08:01:02 +00:00
|
|
|
|
2016-06-26 15:37:47 +00:00
|
|
|
void clearData();
|
|
|
|
|
2014-08-11 09:03:45 +00:00
|
|
|
~MediaView();
|
|
|
|
|
2016-03-29 17:17:00 +00:00
|
|
|
// ClickHandlerHost interface
|
|
|
|
void clickHandlerActiveChanged(const ClickHandlerPtr &p, bool active) override;
|
|
|
|
void clickHandlerPressedChanged(const ClickHandlerPtr &p, bool pressed) override;
|
|
|
|
|
2016-11-05 08:36:24 +00:00
|
|
|
protected:
|
|
|
|
void paintEvent(QPaintEvent *e) override;
|
|
|
|
|
|
|
|
void keyPressEvent(QKeyEvent *e) override;
|
|
|
|
void wheelEvent(QWheelEvent *e) override;
|
|
|
|
void mousePressEvent(QMouseEvent *e) override;
|
|
|
|
void mouseDoubleClickEvent(QMouseEvent *e) override;
|
|
|
|
void mouseMoveEvent(QMouseEvent *e) override;
|
|
|
|
void mouseReleaseEvent(QMouseEvent *e) override;
|
|
|
|
void contextMenuEvent(QContextMenuEvent *e) override;
|
|
|
|
void touchEvent(QTouchEvent *e);
|
|
|
|
|
|
|
|
bool event(QEvent *e) override;
|
|
|
|
bool eventFilter(QObject *obj, QEvent *e) override;
|
|
|
|
|
2016-10-26 16:43:13 +00:00
|
|
|
private slots:
|
2015-04-11 10:04:10 +00:00
|
|
|
void onHideControls(bool force = false);
|
|
|
|
|
2016-06-22 13:39:54 +00:00
|
|
|
void onScreenResized(int screen);
|
|
|
|
|
2015-04-11 10:04:10 +00:00
|
|
|
void onToMessage();
|
2015-04-19 10:29:19 +00:00
|
|
|
void onSaveAs();
|
2014-10-17 12:57:14 +00:00
|
|
|
void onDownload();
|
2015-04-19 10:29:19 +00:00
|
|
|
void onSaveCancel();
|
2014-10-07 17:57:57 +00:00
|
|
|
void onShowInFolder();
|
2014-08-11 09:03:45 +00:00
|
|
|
void onForward();
|
|
|
|
void onDelete();
|
2014-10-17 12:57:14 +00:00
|
|
|
void onOverview();
|
2014-08-11 09:03:45 +00:00
|
|
|
void onCopy();
|
|
|
|
void onMenuDestroy(QObject *obj);
|
|
|
|
void receiveMouse();
|
|
|
|
|
2015-04-11 10:04:10 +00:00
|
|
|
void onDropdown();
|
|
|
|
|
2014-08-11 09:03:45 +00:00
|
|
|
void onTouchTimer();
|
2014-08-06 14:40:21 +00:00
|
|
|
|
2014-09-30 14:11:09 +00:00
|
|
|
void updateImage();
|
|
|
|
|
2016-07-13 11:24:31 +00:00
|
|
|
void onVideoPauseResume();
|
2016-12-01 19:20:33 +00:00
|
|
|
void onVideoSeekProgress(TimeMs positionMs);
|
|
|
|
void onVideoSeekFinished(TimeMs positionMs);
|
2016-07-11 18:05:46 +00:00
|
|
|
void onVideoVolumeChanged(float64 volume);
|
2016-07-14 11:20:46 +00:00
|
|
|
void onVideoToggleFullScreen();
|
2016-07-12 11:38:16 +00:00
|
|
|
void onVideoPlayProgress(const AudioMsgId &audioId);
|
2016-07-11 18:05:46 +00:00
|
|
|
|
2014-08-06 14:40:21 +00:00
|
|
|
private:
|
2016-12-23 13:21:01 +00:00
|
|
|
enum OverState {
|
|
|
|
OverNone,
|
|
|
|
OverLeftNav,
|
|
|
|
OverRightNav,
|
|
|
|
OverClose,
|
|
|
|
OverHeader,
|
|
|
|
OverName,
|
|
|
|
OverDate,
|
|
|
|
OverSave,
|
|
|
|
OverMore,
|
|
|
|
OverIcon,
|
|
|
|
OverVideo,
|
|
|
|
};
|
|
|
|
|
2017-08-29 15:15:54 +00:00
|
|
|
void updateOver(QPoint mpos);
|
|
|
|
void moveToScreen();
|
2017-12-09 10:02:51 +00:00
|
|
|
bool moveToNext(int delta);
|
|
|
|
void preloadData(int delta);
|
2017-08-29 15:15:54 +00:00
|
|
|
struct Entity {
|
|
|
|
base::optional_variant<
|
|
|
|
not_null<PhotoData*>,
|
|
|
|
not_null<DocumentData*>> data;
|
|
|
|
HistoryItem *item;
|
|
|
|
};
|
2017-08-29 19:52:52 +00:00
|
|
|
Entity entityForUserPhotos(int index) const;
|
|
|
|
Entity entityForSharedMedia(int index) const;
|
|
|
|
Entity entityByIndex(int index) const;
|
2017-12-29 14:58:53 +00:00
|
|
|
Entity entityForItemId(const FullMsgId &itemId) const;
|
|
|
|
bool moveToEntity(const Entity &entity, int preloadDelta = 0);
|
2017-08-29 15:15:54 +00:00
|
|
|
void setContext(base::optional_variant<
|
|
|
|
not_null<HistoryItem*>,
|
|
|
|
not_null<PeerData*>> context);
|
|
|
|
|
2017-05-30 15:21:05 +00:00
|
|
|
void refreshLang();
|
2016-11-16 10:44:06 +00:00
|
|
|
void showSaveMsgFile();
|
2017-04-15 19:51:53 +00:00
|
|
|
void updateMixerVideoVolume() const;
|
2016-11-16 10:44:06 +00:00
|
|
|
|
2017-08-18 19:14:31 +00:00
|
|
|
struct SharedMedia;
|
2017-09-04 19:14:44 +00:00
|
|
|
using SharedMediaType = SharedMediaWithLastSlice::Type;
|
|
|
|
using SharedMediaKey = SharedMediaWithLastSlice::Key;
|
2017-08-18 19:14:31 +00:00
|
|
|
base::optional<SharedMediaType> sharedMediaType() const;
|
|
|
|
base::optional<SharedMediaKey> sharedMediaKey() const;
|
2017-12-28 10:11:50 +00:00
|
|
|
base::optional<SharedMediaType> computeOverviewType() const;
|
2017-08-18 19:14:31 +00:00
|
|
|
bool validSharedMedia() const;
|
2017-08-29 19:52:52 +00:00
|
|
|
void validateSharedMedia();
|
2017-09-04 19:14:44 +00:00
|
|
|
void handleSharedMediaUpdate(SharedMediaWithLastSlice &&update);
|
2017-08-29 19:52:52 +00:00
|
|
|
|
|
|
|
struct UserPhotos;
|
2017-09-06 14:50:11 +00:00
|
|
|
using UserPhotosKey = UserPhotosSlice::Key;
|
2017-08-29 19:52:52 +00:00
|
|
|
base::optional<UserPhotosKey> userPhotosKey() const;
|
|
|
|
bool validUserPhotos() const;
|
|
|
|
void validateUserPhotos();
|
2017-09-06 14:50:11 +00:00
|
|
|
void handleUserPhotosUpdate(UserPhotosSlice &&update);
|
2017-08-29 19:52:52 +00:00
|
|
|
|
2017-12-28 13:06:06 +00:00
|
|
|
void refreshCaption(HistoryItem *item);
|
2017-08-29 19:52:52 +00:00
|
|
|
void refreshMediaViewer();
|
2017-08-18 19:14:31 +00:00
|
|
|
void refreshNavVisibility();
|
2017-12-28 14:58:34 +00:00
|
|
|
void refreshGroupThumbs();
|
2017-08-18 19:14:31 +00:00
|
|
|
|
2016-11-05 08:36:24 +00:00
|
|
|
void dropdownHidden();
|
2016-10-26 16:43:13 +00:00
|
|
|
void updateDocSize();
|
|
|
|
void updateControls();
|
|
|
|
void updateActions();
|
2017-12-28 13:06:06 +00:00
|
|
|
void resizeCenteredControls();
|
2016-10-26 16:43:13 +00:00
|
|
|
|
2017-08-18 19:14:31 +00:00
|
|
|
void displayPhoto(not_null<PhotoData*> photo, HistoryItem *item);
|
|
|
|
void displayDocument(DocumentData *document, HistoryItem *item);
|
2016-10-19 13:31:18 +00:00
|
|
|
void displayFinished();
|
2015-04-11 10:04:10 +00:00
|
|
|
void findCurrent();
|
2014-08-11 09:03:45 +00:00
|
|
|
|
2016-07-24 08:53:09 +00:00
|
|
|
void updateCursor();
|
2016-07-14 11:20:46 +00:00
|
|
|
void setZoomLevel(int newZoom);
|
|
|
|
|
2017-01-24 21:24:39 +00:00
|
|
|
void updateVideoPlaybackState(const Media::Player::TrackState &state);
|
2016-07-12 12:28:07 +00:00
|
|
|
void updateSilentVideoPlaybackState();
|
2016-12-01 19:20:33 +00:00
|
|
|
void restartVideoAtSeekPosition(TimeMs positionMs);
|
2017-12-28 10:11:50 +00:00
|
|
|
void toggleVideoPaused();
|
2016-07-12 12:28:07 +00:00
|
|
|
|
2016-07-11 18:05:46 +00:00
|
|
|
void createClipController();
|
2017-12-28 14:58:34 +00:00
|
|
|
void refreshClipControllerGeometry();
|
|
|
|
void refreshCaptionGeometry();
|
2016-07-11 18:05:46 +00:00
|
|
|
|
|
|
|
void initAnimation();
|
|
|
|
void createClipReader();
|
2017-04-02 16:42:18 +00:00
|
|
|
Images::Options videoThumbOptions() const;
|
2016-07-11 18:05:46 +00:00
|
|
|
|
2016-12-23 13:21:01 +00:00
|
|
|
void initThemePreview();
|
|
|
|
void destroyThemePreview();
|
|
|
|
void updateThemePreviewGeometry();
|
|
|
|
|
2017-08-08 09:31:48 +00:00
|
|
|
void documentUpdated(DocumentData *doc);
|
2017-08-18 19:14:31 +00:00
|
|
|
void changingMsgId(not_null<HistoryItem*> row, MsgId newId);
|
2017-08-08 09:31:48 +00:00
|
|
|
|
2016-06-21 18:09:48 +00:00
|
|
|
// Radial animation interface.
|
|
|
|
float64 radialProgress() const;
|
|
|
|
bool radialLoading() const;
|
|
|
|
QRect radialRect() const;
|
|
|
|
void radialStart();
|
2016-12-01 19:20:33 +00:00
|
|
|
TimeMs radialTimeShift() const;
|
2016-06-21 18:09:48 +00:00
|
|
|
|
2014-08-11 09:03:45 +00:00
|
|
|
void updateHeader();
|
2014-10-07 17:57:57 +00:00
|
|
|
void snapXY();
|
2014-08-11 09:03:45 +00:00
|
|
|
|
2016-12-01 19:20:33 +00:00
|
|
|
void step_state(TimeMs ms, bool timer);
|
|
|
|
void step_radial(TimeMs ms, bool timer);
|
2015-12-24 19:26:28 +00:00
|
|
|
|
2016-08-18 15:35:39 +00:00
|
|
|
void zoomIn();
|
|
|
|
void zoomOut();
|
|
|
|
void zoomReset();
|
|
|
|
void zoomUpdate(int32 &newZoom);
|
|
|
|
|
2016-07-19 10:54:43 +00:00
|
|
|
void paintDocRadialLoading(Painter &p, bool radial, float64 radialOpacity);
|
2016-12-23 13:21:01 +00:00
|
|
|
void paintThemePreview(Painter &p, QRect clip);
|
|
|
|
|
|
|
|
void updateOverRect(OverState state);
|
|
|
|
bool updateOverState(OverState newState);
|
|
|
|
float64 overLevel(OverState control) const;
|
2016-07-19 10:54:43 +00:00
|
|
|
|
2017-12-28 14:58:34 +00:00
|
|
|
void checkGroupThumbsAnimation();
|
2017-12-29 14:58:53 +00:00
|
|
|
void initGroupThumbs();
|
2017-12-28 13:06:06 +00:00
|
|
|
|
2014-12-15 15:55:45 +00:00
|
|
|
QBrush _transparentBrush;
|
|
|
|
|
2016-05-20 16:01:06 +00:00
|
|
|
PhotoData *_photo = nullptr;
|
|
|
|
DocumentData *_doc = nullptr;
|
2017-08-18 19:14:31 +00:00
|
|
|
std::unique_ptr<SharedMedia> _sharedMedia;
|
2017-09-04 19:14:44 +00:00
|
|
|
base::optional<SharedMediaWithLastSlice> _sharedMediaData;
|
2017-10-29 15:32:01 +00:00
|
|
|
base::optional<SharedMediaWithLastSlice::Key> _sharedMediaDataKey;
|
2017-08-29 19:52:52 +00:00
|
|
|
std::unique_ptr<UserPhotos> _userPhotos;
|
|
|
|
base::optional<UserPhotosSlice> _userPhotosData;
|
2017-08-18 19:14:31 +00:00
|
|
|
|
2015-04-19 19:01:45 +00:00
|
|
|
QRect _closeNav, _closeNavIcon;
|
|
|
|
QRect _leftNav, _leftNavIcon, _rightNav, _rightNavIcon;
|
|
|
|
QRect _headerNav, _nameNav, _dateNav;
|
|
|
|
QRect _saveNav, _saveNavIcon, _moreNav, _moreNavIcon;
|
2016-05-20 16:01:06 +00:00
|
|
|
bool _leftNavVisible = false;
|
|
|
|
bool _rightNavVisible = false;
|
|
|
|
bool _saveVisible = false;
|
|
|
|
bool _headerHasLink = false;
|
2014-08-11 09:03:45 +00:00
|
|
|
QString _dateText;
|
2015-04-11 10:04:10 +00:00
|
|
|
QString _headerText;
|
2014-08-06 14:40:21 +00:00
|
|
|
|
2016-12-13 17:07:56 +00:00
|
|
|
object_ptr<Media::Clip::Controller> _clipController = { nullptr };
|
2016-07-13 11:24:31 +00:00
|
|
|
DocumentData *_autoplayVideoDocument = nullptr;
|
2016-07-14 11:20:46 +00:00
|
|
|
bool _fullScreenVideo = false;
|
|
|
|
int _fullScreenZoomCache = 0;
|
2016-07-11 18:05:46 +00:00
|
|
|
|
2017-12-28 13:06:06 +00:00
|
|
|
std::unique_ptr<Media::View::GroupThumbs> _groupThumbs;
|
2017-12-28 14:58:34 +00:00
|
|
|
QRect _groupThumbsRect;
|
|
|
|
int _groupThumbsAvailableWidth = 0;
|
2017-12-28 13:06:06 +00:00
|
|
|
int _groupThumbsLeft = 0;
|
|
|
|
int _groupThumbsTop = 0;
|
2015-05-20 19:28:24 +00:00
|
|
|
Text _caption;
|
|
|
|
QRect _captionRect;
|
|
|
|
|
2016-12-01 19:20:33 +00:00
|
|
|
TimeMs _animStarted;
|
2014-09-30 14:11:09 +00:00
|
|
|
|
2016-05-20 16:01:06 +00:00
|
|
|
int _width = 0;
|
|
|
|
int _x = 0, _y = 0, _w = 0, _h = 0;
|
|
|
|
int _xStart = 0, _yStart = 0;
|
|
|
|
int _zoom = 0; // < 0 - out, 0 - none, > 0 - in
|
|
|
|
float64 _zoomToScreen = 0.; // for documents
|
2014-10-07 17:57:57 +00:00
|
|
|
QPoint _mStart;
|
2016-05-20 16:01:06 +00:00
|
|
|
bool _pressed = false;
|
|
|
|
int32 _dragging = 0;
|
2014-08-11 09:03:45 +00:00
|
|
|
QPixmap _current;
|
2017-05-18 20:18:59 +00:00
|
|
|
Media::Clip::ReaderPointer _gif;
|
2016-05-20 16:01:06 +00:00
|
|
|
int32 _full = -1; // -1 - thumb, 0 - medium, 1 - full
|
2014-08-11 09:03:45 +00:00
|
|
|
|
2016-07-12 12:28:07 +00:00
|
|
|
// Video without audio stream playback information.
|
|
|
|
bool _videoIsSilent = false;
|
|
|
|
bool _videoPaused = false;
|
2016-07-14 11:20:46 +00:00
|
|
|
bool _videoStopped = false;
|
2016-12-01 19:20:33 +00:00
|
|
|
TimeMs _videoPositionMs = 0;
|
|
|
|
TimeMs _videoDurationMs = 0;
|
2016-07-12 12:28:07 +00:00
|
|
|
int32 _videoFrequencyMs = 1000; // 1000 ms per second.
|
|
|
|
|
2015-12-22 08:01:02 +00:00
|
|
|
bool fileShown() const;
|
|
|
|
bool gifShown() const;
|
2016-12-23 13:21:01 +00:00
|
|
|
bool fileBubbleShown() const;
|
2015-12-23 19:23:14 +00:00
|
|
|
void stopGif();
|
2015-12-22 08:01:02 +00:00
|
|
|
|
2016-09-30 16:40:00 +00:00
|
|
|
const style::icon *_docIcon = nullptr;
|
2016-12-23 13:21:01 +00:00
|
|
|
style::color _docIconColor;
|
2015-04-19 10:29:19 +00:00
|
|
|
QString _docName, _docSize, _docExt;
|
2016-05-20 16:01:06 +00:00
|
|
|
int _docNameWidth = 0, _docSizeWidth = 0, _docExtWidth = 0;
|
2015-04-19 10:29:19 +00:00
|
|
|
QRect _docRect, _docIconRect;
|
2016-05-20 16:01:06 +00:00
|
|
|
int _docThumbx = 0, _docThumby = 0, _docThumbw = 0;
|
2016-12-13 17:07:56 +00:00
|
|
|
object_ptr<Ui::LinkButton> _docDownload;
|
|
|
|
object_ptr<Ui::LinkButton> _docSaveAs;
|
|
|
|
object_ptr<Ui::LinkButton> _docCancel;
|
2015-04-11 10:04:10 +00:00
|
|
|
|
2016-06-21 18:09:48 +00:00
|
|
|
QRect _photoRadialRect;
|
2016-09-28 10:15:03 +00:00
|
|
|
Ui::RadialAnimation _radial;
|
2016-06-21 18:09:48 +00:00
|
|
|
|
2016-05-20 16:01:06 +00:00
|
|
|
History *_migrated = nullptr;
|
|
|
|
History *_history = nullptr; // if conversation photos or files overview
|
|
|
|
PeerData *_peer = nullptr;
|
|
|
|
UserData *_user = nullptr; // if user profile photos overview
|
|
|
|
|
2016-06-22 13:39:54 +00:00
|
|
|
// We save the information about the reason of the current mediaview show:
|
|
|
|
// did we open a peer profile photo or a photo from some message.
|
|
|
|
// We use it when trying to delete a photo: if we've opened a peer photo,
|
|
|
|
// then we'll delete group photo instead of the corresponding message.
|
|
|
|
bool _firstOpenedPeerPhoto = false;
|
|
|
|
|
2016-05-20 16:01:06 +00:00
|
|
|
PeerData *_from = nullptr;
|
2014-10-17 12:57:14 +00:00
|
|
|
Text _fromName;
|
2014-08-11 09:03:45 +00:00
|
|
|
|
2017-08-18 19:14:31 +00:00
|
|
|
base::optional<int> _index; // Index in current _sharedMedia data.
|
|
|
|
base::optional<int> _fullIndex; // Index in full shared media.
|
|
|
|
base::optional<int> _fullCount;
|
2017-08-27 11:59:08 +00:00
|
|
|
FullMsgId _msgid;
|
2017-08-29 19:52:52 +00:00
|
|
|
bool _canForwardItem = false;
|
|
|
|
bool _canDeleteItem = false;
|
2014-08-11 09:03:45 +00:00
|
|
|
|
2016-05-20 16:01:06 +00:00
|
|
|
mtpRequestId _loadRequest = 0;
|
2014-08-11 09:03:45 +00:00
|
|
|
|
2016-05-20 16:01:06 +00:00
|
|
|
OverState _over = OverNone;
|
|
|
|
OverState _down = OverNone;
|
2015-04-11 10:04:10 +00:00
|
|
|
QPoint _lastAction, _lastMouseMovePos;
|
2016-05-20 16:01:06 +00:00
|
|
|
bool _ignoringDropdown = false;
|
2015-04-11 10:04:10 +00:00
|
|
|
|
2016-12-07 13:32:25 +00:00
|
|
|
BasicAnimation _a_state;
|
2015-12-08 12:33:37 +00:00
|
|
|
|
2015-04-11 10:04:10 +00:00
|
|
|
enum ControlsState {
|
|
|
|
ControlsShowing,
|
|
|
|
ControlsShown,
|
|
|
|
ControlsHiding,
|
|
|
|
ControlsHidden,
|
|
|
|
};
|
2016-05-20 16:01:06 +00:00
|
|
|
ControlsState _controlsState = ControlsShown;
|
2016-12-01 19:20:33 +00:00
|
|
|
TimeMs _controlsAnimStarted = 0;
|
2015-04-11 10:04:10 +00:00
|
|
|
QTimer _controlsHideTimer;
|
2016-12-05 11:01:08 +00:00
|
|
|
anim::value a_cOpacity;
|
2016-07-12 14:11:59 +00:00
|
|
|
bool _mousePressed = false;
|
2014-08-11 09:03:45 +00:00
|
|
|
|
2016-10-26 16:43:13 +00:00
|
|
|
Ui::PopupMenu *_menu = nullptr;
|
2016-12-13 17:07:56 +00:00
|
|
|
object_ptr<Ui::DropdownMenu> _dropdown;
|
2016-12-31 15:19:22 +00:00
|
|
|
object_ptr<QTimer> _dropdownShowTimer;
|
2016-10-26 16:43:13 +00:00
|
|
|
|
|
|
|
struct ActionData {
|
|
|
|
QString text;
|
|
|
|
const char *member;
|
|
|
|
};
|
|
|
|
QList<ActionData> _actions;
|
2015-04-11 10:04:10 +00:00
|
|
|
|
2016-05-20 16:01:06 +00:00
|
|
|
bool _receiveMouse = true;
|
2014-08-11 09:03:45 +00:00
|
|
|
|
2016-05-20 16:01:06 +00:00
|
|
|
bool _touchPress = false, _touchMove = false, _touchRightButton = false;
|
2014-08-11 09:03:45 +00:00
|
|
|
QTimer _touchTimer;
|
|
|
|
QPoint _touchStart;
|
2014-12-17 17:55:32 +00:00
|
|
|
QPoint _accumScroll;
|
2014-08-11 09:03:45 +00:00
|
|
|
|
2014-10-17 12:57:14 +00:00
|
|
|
QString _saveMsgFilename;
|
2016-12-01 19:20:33 +00:00
|
|
|
TimeMs _saveMsgStarted = 0;
|
2016-12-05 11:01:08 +00:00
|
|
|
anim::value _saveMsgOpacity;
|
2014-10-17 12:57:14 +00:00
|
|
|
QRect _saveMsg;
|
|
|
|
QTimer _saveMsgUpdater;
|
|
|
|
Text _saveMsgText;
|
|
|
|
|
2016-12-01 19:20:33 +00:00
|
|
|
typedef QMap<OverState, TimeMs> Showing;
|
2014-08-11 09:03:45 +00:00
|
|
|
Showing _animations;
|
2016-12-05 11:01:08 +00:00
|
|
|
typedef QMap<OverState, anim::value> ShowingOpacities;
|
2014-08-11 09:03:45 +00:00
|
|
|
ShowingOpacities _animOpacities;
|
2014-08-06 14:40:21 +00:00
|
|
|
|
2016-09-14 16:05:40 +00:00
|
|
|
int _verticalWheelDelta = 0;
|
|
|
|
|
2016-12-23 13:21:01 +00:00
|
|
|
bool _themePreviewShown = false;
|
|
|
|
uint64 _themePreviewId = 0;
|
|
|
|
QRect _themePreviewRect;
|
2017-02-21 13:45:56 +00:00
|
|
|
std::unique_ptr<Window::Theme::Preview> _themePreview;
|
2016-12-23 13:21:01 +00:00
|
|
|
object_ptr<Ui::RoundButton> _themeApply = { nullptr };
|
|
|
|
object_ptr<Ui::RoundButton> _themeCancel = { nullptr };
|
2014-10-17 12:57:14 +00:00
|
|
|
|
2014-08-06 14:40:21 +00:00
|
|
|
};
|