2
0
mirror of https://github.com/telegramdesktop/tdesktop synced 2025-08-31 06:26:18 +00:00

sticker packs management done, conversations list context menu added

This commit is contained in:
John Preston
2015-12-02 20:17:53 +03:00
parent 2c95fa5e15
commit ed3601f883
27 changed files with 1773 additions and 278 deletions

View File

@@ -106,3 +106,136 @@ private:
BoxButton _add, _share, _cancel, _done;
QString _title;
};
class StickersInner : public TWidget {
Q_OBJECT
public:
StickersInner();
void paintEvent(QPaintEvent *e);
void mousePressEvent(QMouseEvent *e);
void mouseMoveEvent(QMouseEvent *e);
void mouseReleaseEvent(QMouseEvent *e);
void rebuild();
bool savingStart() {
if (_saving) return false;
_saving = true;
return true;
}
QVector<uint64> getOrder() const;
QVector<uint64> getDisabledSets() const;
void setVisibleScrollbar(int32 width);
~StickersInner();
signals:
void checkDraggingScroll(int localY);
void noDraggingScroll();
public slots:
void onUpdateSelected();
private:
bool animStep_shifting(float64 ms);
void paintRow(Painter &p, int32 index);
void clear();
void setRemoveSel(int32 removeSel);
float64 aboveShadowOpacity() const;
int32 _rowHeight;
struct StickerSetRow {
StickerSetRow(uint64 id, DocumentData *sticker, int32 count, const QString &title, bool disabled, int32 pixw, int32 pixh) : id(id)
, sticker(sticker)
, count(count)
, title(title)
, disabled(disabled)
, pixw(pixw)
, pixh(pixh)
, xadd(0, 0)
, yadd(0, 0) {
}
uint64 id;
DocumentData *sticker;
int32 count;
QString title;
bool disabled;
int32 pixw, pixh;
anim::ivalue xadd, yadd;
};
typedef QList<StickerSetRow*> StickerSetRows;
StickerSetRows _rows;
QList<uint64> _animStartTimes;
uint64 _aboveShadowFadeStart;
anim::fvalue _aboveShadowFadeOpacity;
Animation _a_shifting;
bool _saving;
int32 _removeSel, _removeDown, _removeWidth, _returnWidth;
QPoint _mouse;
int32 _selected;
QPoint _dragStart;
int32 _started, _dragging, _above;
BoxShadow _aboveShadow;
int32 _scrollbar;
};
class StickersBox : public ItemListBox, public RPCSender {
Q_OBJECT
public:
StickersBox();
void resizeEvent(QResizeEvent *e);
void paintEvent(QPaintEvent *e);
void closePressed();
public slots:
void onStickersUpdated();
void onCheckDraggingScroll(int localY);
void onNoDraggingScroll();
void onScrollTimer();
void onSave();
protected:
void hideAll();
void showAll();
private:
int32 countHeight() const;
void disenableDone(const MTPBool &result, mtpRequestId req);
bool disenableFail(const RPCError &error, mtpRequestId req);
void reorderDone(const MTPBool &result);
bool reorderFail(const RPCError &result);
void saveOrder();
StickersInner _inner;
BoxButton _save, _cancel;
QMap<mtpRequestId, NullType> _disenableRequests;
mtpRequestId _reorderRequest;
ScrollableBoxShadow _bottomShadow;
QTimer _scrollTimer;
int32 _scrollDelta;
};
int32 stickerPacksCount(bool includeDisabledOfficial = false);