2
0
mirror of https://github.com/kotatogram/kotatogram-desktop synced 2025-08-31 06:35:14 +00:00

Inline switch to pm and back support added for inline bots.

This commit is contained in:
John Preston
2016-04-08 18:16:52 +04:00
parent 8e89486fbc
commit fa0c700ca6
18 changed files with 430 additions and 193 deletions

View File

@@ -173,6 +173,16 @@ using InlineResult = InlineBots::Result;
using InlineResults = QList<InlineBots::Result*>;
using InlineItem = InlineBots::Layout::ItemBase;
struct InlineCacheEntry {
~InlineCacheEntry() {
clearResults();
}
QString nextOffset;
QString switchPmText, switchPmStartToken;
InlineResults results; // owns this results list
void clearResults();
};
class EmojiColorPicker : public TWidget {
Q_OBJECT
@@ -358,7 +368,7 @@ public:
void refreshStickers();
void refreshRecentStickers(bool resize = true);
void refreshSavedGifs();
int32 refreshInlineRows(UserData *bot, const InlineResults &results, bool resultsDeleted);
int refreshInlineRows(UserData *bot, const InlineCacheEntry *results, bool resultsDeleted);
void refreshRecent();
void inlineBotChanged();
void hideInlineRowsPanel();
@@ -384,12 +394,13 @@ public:
~StickerPanInner();
public slots:
private slots:
void updateSelected();
void onSettings();
void onPreview();
void onUpdateInlineItems();
void onSwitchPm();
signals:
@@ -416,13 +427,15 @@ private:
void paintInlineItems(Painter &p, const QRect &r);
void paintStickers(Painter &p, const QRect &r);
int32 _maxHeight;
void refreshSwitchPmButton(const InlineCacheEntry *entry);
void appendSet(uint64 setId);
void selectEmoji(EmojiPtr emoji);
QRect stickerRect(int tab, int sel);
int32 _maxHeight;
typedef QMap<int32, uint64> Animations; // index - showing, -index - hiding
Animations _animations;
Animation _a_selected;
@@ -449,6 +462,9 @@ private:
QTimer _updateInlineItems;
bool _inlineWithThumb;
UniquePointer<BoxButton> _switchPmButton;
QString _switchPmStartToken;
typedef QVector<InlineItem*> InlineItems;
struct InlineRow {
InlineRow() : height(0) {
@@ -705,16 +721,7 @@ private:
QTimer _saveConfigTimer;
// inline bots
struct InlineCacheEntry {
~InlineCacheEntry() {
clearResults();
}
QString nextOffset;
QString switchPmText, switchPmStartParam;
internal::InlineResults results;
void clearResults();
};
typedef QMap<QString, InlineCacheEntry*> InlineCache;
typedef QMap<QString, internal::InlineCacheEntry*> InlineCache;
InlineCache _inlineCache;
QTimer _inlineRequestTimer;