multi select started in media overview

This commit is contained in:
John Preston 2014-08-20 09:32:50 +04:00
parent c6423c0b65
commit dfb4d01015
10 changed files with 1144 additions and 198 deletions

View File

@ -115,7 +115,7 @@ void DialogsListWidget::mouseMoveEvent(QMouseEvent *e) {
lastMousePos = mapToGlobal(e->pos()); lastMousePos = mapToGlobal(e->pos());
selByMouse = true; selByMouse = true;
onUpdateSelected(true); onUpdateSelected(true);
repaint(); update();
} }
void DialogsListWidget::onUpdateSelected(bool force) { void DialogsListWidget::onUpdateSelected(bool force) {

View File

@ -404,8 +404,10 @@ bool ScrollArea::eventFilter(QObject *obj, QEvent *e) {
QTouchEvent *ev = static_cast<QTouchEvent*>(e); QTouchEvent *ev = static_cast<QTouchEvent*>(e);
if (_touchEnabled && ev->device()->type() == QTouchDevice::TouchScreen) { if (_touchEnabled && ev->device()->type() == QTouchDevice::TouchScreen) {
if (obj == widget()) { if (obj == widget()) {
touchEvent(ev); if (ev->type() != QEvent::TouchBegin || ev->touchPoints().isEmpty() || !widget() || !widget()->childAt(widget()->mapFromGlobal(ev->touchPoints().cbegin()->screenPos().toPoint()))) {
return true; touchEvent(ev);
return true;
}
} }
} }
} }
@ -416,8 +418,10 @@ bool ScrollArea::viewportEvent(QEvent *e) {
if (e->type() == QEvent::TouchBegin || e->type() == QEvent::TouchUpdate || e->type() == QEvent::TouchEnd || e->type() == QEvent::TouchCancel) { if (e->type() == QEvent::TouchBegin || e->type() == QEvent::TouchUpdate || e->type() == QEvent::TouchEnd || e->type() == QEvent::TouchCancel) {
QTouchEvent *ev = static_cast<QTouchEvent*>(e); QTouchEvent *ev = static_cast<QTouchEvent*>(e);
if (_touchEnabled && ev->device()->type() == QTouchDevice::TouchScreen) { if (_touchEnabled && ev->device()->type() == QTouchDevice::TouchScreen) {
touchEvent(ev); if (ev->type() != QEvent::TouchBegin || ev->touchPoints().isEmpty() || !widget() || !widget()->childAt(widget()->mapFromGlobal(ev->touchPoints().cbegin()->screenPos().toPoint()))) {
return true; touchEvent(ev);
return true;
}
} }
} }
return QScrollArea::viewportEvent(e); return QScrollArea::viewportEvent(e);

View File

@ -29,6 +29,8 @@ void historyInit();
class HistoryItem; class HistoryItem;
static const uint32 FullItemSel = 0xFFFFFFFF; static const uint32 FullItemSel = 0xFFFFFFFF;
typedef QMap<int32, HistoryItem*> SelectedItemSet;
extern TextParseOptions _textNameOptions; extern TextParseOptions _textNameOptions;
struct NotifySettings { struct NotifySettings {

View File

@ -323,7 +323,7 @@ void HistoryList::mouseMoveEvent(QMouseEvent *e) {
void HistoryList::dragActionUpdate(const QPoint &screenPos) { void HistoryList::dragActionUpdate(const QPoint &screenPos) {
_dragPos = screenPos; _dragPos = screenPos;
onUpdateSelected(true); onUpdateSelected();
} }
void HistoryList::touchScrollUpdated(const QPoint &screenPos) { void HistoryList::touchScrollUpdated(const QPoint &screenPos) {
@ -470,7 +470,7 @@ void HistoryList::itemRemoved(HistoryItem *item) {
update(); update();
} }
onUpdateSelected(true); onUpdateSelected();
if (_dragSelFrom == item) _dragSelFrom = 0; if (_dragSelFrom == item) _dragSelFrom = 0;
if (_dragSelTo == item) _dragSelTo = 0; if (_dragSelTo == item) _dragSelTo = 0;
@ -833,7 +833,7 @@ bool HistoryList::getVideoCoords(VideoData *video, int32 &x, int32 &y, int32 &w)
} }
void HistoryList::resizeEvent(QResizeEvent *e) { void HistoryList::resizeEvent(QResizeEvent *e) {
onUpdateSelected(true); onUpdateSelected();
} }
QString HistoryList::getSelectedText() const { QString HistoryList::getSelectedText() const {
@ -891,6 +891,7 @@ void HistoryList::updateSize() {
} }
void HistoryList::enterEvent(QEvent *e) { void HistoryList::enterEvent(QEvent *e) {
return QWidget::enterEvent(e);
} }
void HistoryList::leaveEvent(QEvent *e) { void HistoryList::leaveEvent(QEvent *e) {
@ -905,6 +906,7 @@ void HistoryList::leaveEvent(QEvent *e) {
setCursor(_cursor); setCursor(_cursor);
} }
} }
return QWidget::leaveEvent(e);
} }
HistoryList::~HistoryList() { HistoryList::~HistoryList() {
@ -991,7 +993,7 @@ void HistoryList::clearSelectedItems(bool onlyTextSelection) {
} }
} }
void HistoryList::fillSelectedItems(HistoryItemSet &sel, bool forDelete) { void HistoryList::fillSelectedItems(SelectedItemSet &sel, bool forDelete) {
if (_selected.isEmpty() || _selected.cbegin().value() != FullItemSel) return; if (_selected.isEmpty() || _selected.cbegin().value() != FullItemSel) return;
for (SelectedItems::const_iterator i = _selected.cbegin(), e = _selected.cend(); i != e; ++i) { for (SelectedItems::const_iterator i = _selected.cbegin(), e = _selected.cend(); i != e; ++i) {
@ -1007,7 +1009,7 @@ void HistoryList::onTouchSelect() {
dragActionStart(_touchPos); dragActionStart(_touchPos);
} }
void HistoryList::onUpdateSelected(bool force) { void HistoryList::onUpdateSelected() {
if (hist->isEmpty()) return; if (hist->isEmpty()) return;
QPoint mousePos(mapFromGlobal(_dragPos)); QPoint mousePos(mapFromGlobal(_dragPos));
@ -2195,13 +2197,8 @@ void HistoryWidget::onSend() {
_field.setFocus(); _field.setFocus();
} }
mtpRequestId HistoryWidget::onForward(const PeerId &peer, bool forwardSelected) { mtpRequestId HistoryWidget::onForward(const PeerId &peer, SelectedItemSet toForward) {
if (forwardSelected && !_list) return 0; if (toForward.isEmpty() && App::contextItem()) {
HistoryItemSet toForward;
if (forwardSelected) {
_list->fillSelectedItems(toForward, false);
} else if (App::contextItem()) {
toForward.insert(0, App::contextItem()); toForward.insert(0, App::contextItem());
} }
if (toForward.isEmpty()) return 0; if (toForward.isEmpty()) return 0;
@ -2247,7 +2244,7 @@ mtpRequestId HistoryWidget::onForward(const PeerId &peer, bool forwardSelected)
QVector<MTPint> ids; QVector<MTPint> ids;
ids.reserve(toForward.size()); ids.reserve(toForward.size());
for (HistoryItemSet::const_iterator i = toForward.cbegin(), e = toForward.cend(); i != e; ++i) { for (SelectedItemSet::const_iterator i = toForward.cbegin(), e = toForward.cend(); i != e; ++i) {
ids.push_back(MTP_int(i.value()->id)); ids.push_back(MTP_int(i.value()->id));
} }
return MTP::send(MTPmessages_ForwardMessages(toPeer->input, MTP_vector<MTPint>(ids)), App::main()->rpcDone(&MainWidget::forwardDone, peer)); return MTP::send(MTPmessages_ForwardMessages(toPeer->input, MTP_vector<MTPint>(ids)), App::main()->rpcDone(&MainWidget::forwardDone, peer));
@ -3013,7 +3010,7 @@ void HistoryWidget::onForwardSelected() {
void HistoryWidget::onDeleteSelected() { void HistoryWidget::onDeleteSelected() {
if (!_list) return; if (!_list) return;
HistoryItemSet sel; SelectedItemSet sel;
_list->fillSelectedItems(sel); _list->fillSelectedItems(sel);
if (sel.isEmpty()) return; if (sel.isEmpty()) return;
@ -3023,12 +3020,12 @@ void HistoryWidget::onDeleteSelected() {
void HistoryWidget::onDeleteSelectedSure() { void HistoryWidget::onDeleteSelectedSure() {
if (!_list) return; if (!_list) return;
HistoryItemSet sel; SelectedItemSet sel;
_list->fillSelectedItems(sel); _list->fillSelectedItems(sel);
if (sel.isEmpty()) return; if (sel.isEmpty()) return;
QVector<MTPint> ids; QVector<MTPint> ids;
for (HistoryItemSet::const_iterator i = sel.cbegin(), e = sel.cend(); i != e; ++i) { for (SelectedItemSet::const_iterator i = sel.cbegin(), e = sel.cend(); i != e; ++i) {
if (i.value()->id > 0) { if (i.value()->id > 0) {
ids.push_back(MTP_int(i.value()->id)); ids.push_back(MTP_int(i.value()->id));
} }
@ -3039,7 +3036,7 @@ void HistoryWidget::onDeleteSelectedSure() {
} }
onClearSelected(); onClearSelected();
for (HistoryItemSet::const_iterator i = sel.cbegin(), e = sel.cend(); i != e; ++i) { for (SelectedItemSet::const_iterator i = sel.cbegin(), e = sel.cend(); i != e; ++i) {
i.value()->destroy(); i.value()->destroy();
} }
App::wnd()->hideLayer(); App::wnd()->hideLayer();
@ -3078,6 +3075,10 @@ void HistoryWidget::stopAnimActive() {
_animActiveTimer.stop(); _animActiveTimer.stop();
} }
void HistoryWidget::fillSelectedItems(SelectedItemSet &sel, bool forDelete) {
if (_list) _list->fillSelectedItems(sel, forDelete);
}
void HistoryWidget::updateTopBarSelection() { void HistoryWidget::updateTopBarSelection() {
if (!_list) { if (!_list) {
App::main()->topBar()->showSelected(0); App::main()->topBar()->showSelected(0);

View File

@ -29,8 +29,6 @@ enum DragState {
DragStateImage = 0x03, DragStateImage = 0x03,
}; };
typedef QMap<int32, HistoryItem*> HistoryItemSet;
class HistoryWidget; class HistoryWidget;
class HistoryList : public QWidget { class HistoryList : public QWidget {
Q_OBJECT Q_OBJECT
@ -75,13 +73,13 @@ public:
void getSelectionState(int32 &selectedForForward, int32 &selectedForDelete) const; void getSelectionState(int32 &selectedForForward, int32 &selectedForDelete) const;
void clearSelectedItems(bool onlyTextSelection = false); void clearSelectedItems(bool onlyTextSelection = false);
void fillSelectedItems(HistoryItemSet &sel, bool forDelete = true); void fillSelectedItems(SelectedItemSet &sel, bool forDelete = true);
~HistoryList(); ~HistoryList();
public slots: public slots:
void onUpdateSelected(bool force = false); void onUpdateSelected();
void onParentGeometryChanged(); void onParentGeometryChanged();
void showLinkTip(); void showLinkTip();
@ -302,7 +300,7 @@ public:
void updateOnlineDisplay(int32 x, int32 w); void updateOnlineDisplay(int32 x, int32 w);
void updateOnlineDisplayTimer(); void updateOnlineDisplayTimer();
mtpRequestId onForward(const PeerId &peer, bool forwardSelected); mtpRequestId onForward(const PeerId &peer, SelectedItemSet toForward);
void onShareContact(const PeerId &peer, UserData *contact); void onShareContact(const PeerId &peer, UserData *contact);
void onSendPaths(const PeerId &peer); void onSendPaths(const PeerId &peer);
@ -328,6 +326,8 @@ public:
uint64 animActiveTime() const; uint64 animActiveTime() const;
void stopAnimActive(); void stopAnimActive();
void fillSelectedItems(SelectedItemSet &sel, bool forDelete = true);
~HistoryWidget(); ~HistoryWidget();
signals: signals:

View File

@ -294,7 +294,18 @@ MainWidget::MainWidget(Window *window) : QWidget(window), failedObjId(0), _dialo
} }
mtpRequestId MainWidget::onForward(const PeerId &peer, bool forwardSelected) { mtpRequestId MainWidget::onForward(const PeerId &peer, bool forwardSelected) {
return history.onForward(peer, forwardSelected); SelectedItemSet selected;
if (forwardSelected) {
if (overview) {
overview->fillSelectedItems(selected, false);
} else {
history.fillSelectedItems(selected, false);
}
if (selected.isEmpty()) {
return 0;
}
}
return history.onForward(peer, selected);
} }
void MainWidget::onShareContact(const PeerId &peer, UserData *contact) { void MainWidget::onShareContact(const PeerId &peer, UserData *contact) {
@ -322,9 +333,9 @@ void MainWidget::deleteLayer(int32 selectedCount) {
QString str(lang((selectedCount < -1) ? lng_selected_cancel_sure_this : (selectedCount < 0 ? lng_selected_delete_sure_this : (selectedCount > 1 ? lng_selected_delete_sure_5 : lng_selected_delete_sure_1)))); QString str(lang((selectedCount < -1) ? lng_selected_cancel_sure_this : (selectedCount < 0 ? lng_selected_delete_sure_this : (selectedCount > 1 ? lng_selected_delete_sure_5 : lng_selected_delete_sure_1))));
ConfirmBox *box = new ConfirmBox((selectedCount < 0) ? str : str.arg(selectedCount), lang(lng_selected_delete_confirm)); ConfirmBox *box = new ConfirmBox((selectedCount < 0) ? str : str.arg(selectedCount), lang(lng_selected_delete_confirm));
if (selectedCount < 0) { if (selectedCount < 0) {
connect(box, SIGNAL(confirmed()), &history, SLOT(onDeleteContextSure())); connect(box, SIGNAL(confirmed()), overview ? overview : static_cast<QWidget*>(&history), SLOT(onDeleteContextSure()));
} else { } else {
connect(box, SIGNAL(confirmed()), &history, SLOT(onDeleteSelectedSure())); connect(box, SIGNAL(confirmed()), overview ? overview : static_cast<QWidget*>(&history), SLOT(onDeleteSelectedSure()));
} }
App::wnd()->showLayer(box); App::wnd()->showLayer(box);
} }
@ -485,15 +496,27 @@ void MainWidget::checkedHistory(PeerData *peer, const MTPmessages_Messages &resu
} }
void MainWidget::forwardSelectedItems() { void MainWidget::forwardSelectedItems() {
history.onForwardSelected(); if (overview) {
overview->onForwardSelected();
} else {
history.onForwardSelected();
}
} }
void MainWidget::deleteSelectedItems() { void MainWidget::deleteSelectedItems() {
history.onDeleteSelected(); if (overview) {
overview->onDeleteSelected();
} else {
history.onDeleteSelected();
}
} }
void MainWidget::clearSelectedItems() { void MainWidget::clearSelectedItems() {
history.onClearSelected(); if (overview) {
overview->onClearSelected();
} else {
history.onClearSelected();
}
} }
DialogsIndexed &MainWidget::contactsList() { DialogsIndexed &MainWidget::contactsList() {
@ -903,11 +926,13 @@ void MainWidget::showPeer(const PeerId &peerId, MsgId msgId, bool back, bool for
if (force || !selectingPeer()) { if (force || !selectingPeer()) {
if (profile || overview) { if (profile || overview) {
if (profile) { if (profile) {
profile->hide();
profile->deleteLater(); profile->deleteLater();
profile->rpcInvalidate(); profile->rpcInvalidate();
profile = 0; profile = 0;
} }
if (overview) { if (overview) {
overview->hide();
overview->clear(); overview->clear();
overview->deleteLater(); overview->deleteLater();
overview->rpcInvalidate(); overview->rpcInvalidate();
@ -977,11 +1002,13 @@ void MainWidget::showMediaOverview(const PeerData *peer, MediaOverviewType type,
} }
} }
if (overview) { if (overview) {
overview->hide();
overview->clear(); overview->clear();
overview->deleteLater(); overview->deleteLater();
overview->rpcInvalidate(); overview->rpcInvalidate();
} }
if (profile) { if (profile) {
profile->hide();
profile->deleteLater(); profile->deleteLater();
profile->rpcInvalidate(); profile->rpcInvalidate();
profile = 0; profile = 0;
@ -1017,12 +1044,14 @@ void MainWidget::showPeerProfile(const PeerData *peer, bool back, int32 lastScro
} }
} }
if (overview) { if (overview) {
overview->hide();
overview->clear(); overview->clear();
overview->deleteLater(); overview->deleteLater();
overview->rpcInvalidate(); overview->rpcInvalidate();
overview = 0; overview = 0;
} }
if (profile) { if (profile) {
profile->hide();
profile->deleteLater(); profile->deleteLater();
profile->rpcInvalidate(); profile->rpcInvalidate();
} }

View File

@ -719,17 +719,10 @@ bool MediaView::event(QEvent *e) {
if (e->type() == QEvent::TouchBegin || e->type() == QEvent::TouchUpdate || e->type() == QEvent::TouchEnd || e->type() == QEvent::TouchCancel) { if (e->type() == QEvent::TouchBegin || e->type() == QEvent::TouchUpdate || e->type() == QEvent::TouchEnd || e->type() == QEvent::TouchCancel) {
QTouchEvent *ev = static_cast<QTouchEvent*>(e); QTouchEvent *ev = static_cast<QTouchEvent*>(e);
if (ev->device()->type() == QTouchDevice::TouchScreen) { if (ev->device()->type() == QTouchDevice::TouchScreen) {
if (!ev->touchPoints().isEmpty()) { if (ev->type() != QEvent::TouchBegin || ev->touchPoints().isEmpty() || !childAt(mapFromGlobal(ev->touchPoints().cbegin()->screenPos().toPoint()))) {
QPoint p(mapFromGlobal(ev->touchPoints().cbegin()->screenPos().toPoint())); touchEvent(ev);
if ((!_close.isHidden() && _close.geometry().contains(p)) || return true;
(!_save.isHidden() && _save.geometry().contains(p)) ||
(!_forward.isHidden() && _forward.geometry().contains(p)) ||
(!_delete.isHidden() && _delete.geometry().contains(p))) {
return QWidget::event(e);
}
} }
touchEvent(ev);
return true;
} }
} }
return QWidget::event(e); return QWidget::event(e);

File diff suppressed because it is too large Load Diff

View File

@ -18,7 +18,7 @@ Copyright (c) 2014 John Preston, https://tdesktop.com
#pragma once #pragma once
class OverviewWidget; class OverviewWidget;
class OverviewInner : public TWidget, public RPCSender { class OverviewInner : public QWidget, public RPCSender {
Q_OBJECT Q_OBJECT
public: public:
@ -28,6 +28,7 @@ public:
void clear(); void clear();
bool event(QEvent *e); bool event(QEvent *e);
void touchEvent(QTouchEvent *e);
void paintEvent(QPaintEvent *e); void paintEvent(QPaintEvent *e);
void mouseMoveEvent(QMouseEvent *e); void mouseMoveEvent(QMouseEvent *e);
void mousePressEvent(QMouseEvent *e); void mousePressEvent(QMouseEvent *e);
@ -35,9 +36,17 @@ public:
void keyPressEvent(QKeyEvent *e); void keyPressEvent(QKeyEvent *e);
void enterEvent(QEvent *e); void enterEvent(QEvent *e);
void leaveEvent(QEvent *e); void leaveEvent(QEvent *e);
void leaveToChildEvent(QEvent *e);
void resizeEvent(QResizeEvent *e); void resizeEvent(QResizeEvent *e);
void contextMenuEvent(QContextMenuEvent *e);
void showContextMenu(QContextMenuEvent *e, bool showFromTouch = false);
void dragActionStart(const QPoint &screenPos, Qt::MouseButton button = Qt::LeftButton);
void dragActionUpdate(const QPoint &screenPos);
void dragActionFinish(const QPoint &screenPos, Qt::MouseButton button = Qt::LeftButton);
void dragActionCancel();
void touchScrollUpdated(const QPoint &screenPos);
QPoint mapMouseToItem(QPoint p, MsgId itemId, int32 itemIndex);
int32 resizeToWidth(int32 nwidth, int32 scrollTop, int32 minHeight); // returns new scroll top int32 resizeToWidth(int32 nwidth, int32 scrollTop, int32 minHeight); // returns new scroll top
void dropResizeIndex(); void dropResizeIndex();
@ -49,11 +58,15 @@ public:
void mediaOverviewUpdated(); void mediaOverviewUpdated();
void msgUpdated(HistoryItem *msg); void msgUpdated(HistoryItem *msg);
void getSelectionState(int32 &selectedForForward, int32 &selectedForDelete) const;
void clearSelectedItems(bool onlyTextSelection = false);
void fillSelectedItems(SelectedItemSet &sel, bool forDelete = true);
~OverviewInner(); ~OverviewInner();
public slots: public slots:
void updateSelected(); void onUpdateSelected();
void openContextUrl(); void openContextUrl();
void cancelContextDownload(); void cancelContextDownload();
@ -66,9 +79,31 @@ public slots:
void forwardMessage(); void forwardMessage();
void onMenuDestroy(QObject *obj); void onMenuDestroy(QObject *obj);
void onTouchSelect();
void onTouchScrollTimer();
private: private:
void fixItemIndex(int32 &current, MsgId msgId) const;
bool itemHasPoint(MsgId msgId, int32 index, int32 x, int32 y) const;
int32 itemHeight(MsgId msgId, int32 index) const;
void moveToNextItem(MsgId &msgId, int32 &index, MsgId upTo, int32 delta) const;
void updateDragSelection(MsgId dragSelFrom, int32 dragSelFromIndex, MsgId dragSelTo, int32 dragSelToIndex, bool dragSelecting);
void updateMsg(HistoryItem *item);
void updateMsg(MsgId itemId, int32 itemIndex);
void touchResetSpeed();
void touchUpdateSpeed();
void touchDeaccelerate(int32 elapsed);
//void adjustCurrent(int32 y);
//HistoryItem *prevItem(HistoryItem *item);
//HistoryItem *nextItem(HistoryItem *item);
//void updateDragSelection(HistoryItem *dragSelFrom, HistoryItem *dragSelTo, bool dragSelecting, bool force = false);
void applyDragSelection();
QPixmap genPix(PhotoData *photo, int32 size); QPixmap genPix(PhotoData *photo, int32 size);
void showAll(); void showAll();
@ -79,12 +114,9 @@ private:
PeerData *_peer; PeerData *_peer;
MediaOverviewType _type; MediaOverviewType _type;
History *_hist; History *_hist;
QMenu *_menu;
TextLinkPtr _contextMenuLnk;
// photos // photos
int32 _photosInRow, _vsize; int32 _photosInRow, _photosToAdd, _vsize;
typedef struct { typedef struct {
int32 vsize; int32 vsize;
bool medium; bool medium;
@ -105,9 +137,45 @@ private:
} CachedItem; } CachedItem;
typedef QVector<CachedItem> CachedItems; typedef QVector<CachedItem> CachedItems;
CachedItems _items; CachedItems _items;
int32 _width, _height, _minHeight; int32 _width, _height, _minHeight, _addToY;
QPoint _lastPos; // selection support, like in HistoryWidget
Qt::CursorShape _cursor;
typedef QMap<MsgId, uint32> SelectedItems;
SelectedItems _selected;
enum DragAction {
NoDrag = 0x00,
PrepareDrag = 0x01,
Dragging = 0x02,
PrepareSelect = 0x03,
Selecting = 0x04,
};
DragAction _dragAction;
QPoint _dragStartPos, _dragPos;
MsgId _dragItem;
int32 _dragItemIndex;
MsgId _mousedItem;
int32 _mousedItemIndex;
uint16 _dragSymbol;
bool _dragWasInactive;
TextLinkPtr _contextMenuLnk;
MsgId _dragSelFrom, _dragSelTo;
int32 _dragSelFromIndex, _dragSelToIndex;
bool _dragSelecting;
bool _touchScroll, _touchSelect, _touchInProgress;
QPoint _touchStart, _touchPrevPos, _touchPos;
QTimer _touchSelectTimer;
TouchScrollState _touchScrollState;
bool _touchPrevPosValid, _touchWaitingAcceleration;
QPoint _touchSpeed;
uint64 _touchSpeedTime, _touchAccelerationTime, _touchTime;
QTimer _touchScrollTimer;
QMenu *_menu;
}; };
class OverviewWidget : public QWidget, public RPCSender, public Animated { class OverviewWidget : public QWidget, public RPCSender, public Animated {
@ -121,6 +189,7 @@ public:
void resizeEvent(QResizeEvent *e); void resizeEvent(QResizeEvent *e);
void paintEvent(QPaintEvent *e); void paintEvent(QPaintEvent *e);
void contextMenuEvent(QContextMenuEvent *e);
void scrollBy(int32 add); void scrollBy(int32 add);
@ -130,6 +199,8 @@ public:
PeerData *peer() const; PeerData *peer() const;
MediaOverviewType type() const; MediaOverviewType type() const;
void switchType(MediaOverviewType type); void switchType(MediaOverviewType type);
void updateTopBarSelection();
int32 lastWidth() const; int32 lastWidth() const;
int32 lastScrollTop() const; int32 lastScrollTop() const;
@ -139,6 +210,15 @@ public:
void mediaOverviewUpdated(PeerData *peer); void mediaOverviewUpdated(PeerData *peer);
void msgUpdated(PeerId peer, HistoryItem *msg); void msgUpdated(PeerId peer, HistoryItem *msg);
QPoint clampMousePosition(QPoint point);
void checkSelectingScroll(QPoint point);
void noSelectingScroll();
bool touchScroll(const QPoint &delta);
void fillSelectedItems(SelectedItemSet &sel, bool forDelete);
~OverviewWidget(); ~OverviewWidget();
public slots: public slots:
@ -146,6 +226,14 @@ public slots:
void activate(); void activate();
void onScroll(); void onScroll();
void onScrollTimer();
void onForwardSelected();
void onDeleteSelected();
void onDeleteSelectedSure();
void onDeleteContextSure();
void onClearSelected();
private: private:
ScrollArea _scroll; ScrollArea _scroll;
@ -163,5 +251,10 @@ private:
int32 _scrollSetAfterShow; int32 _scrollSetAfterShow;
QTimer _scrollTimer;
int32 _scrollDelta;
int32 _selCount;
}; };

View File

@ -627,7 +627,7 @@ void ProfileInner::onKickConfirm() {
void ProfileInner::keyPressEvent(QKeyEvent *e) { void ProfileInner::keyPressEvent(QKeyEvent *e) {
if (e->key() == Qt::Key_Escape) { if (e->key() == Qt::Key_Escape) {
App::main()->showPeer(0, 0, true); App::main()->showBackFromStack();
} }
} }