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

bot description displayed in message history, bot commands are highlighted and sent by click

This commit is contained in:
John Preston
2015-06-10 18:54:24 +03:00
parent 85635dbefd
commit 83744e77d1
15 changed files with 286 additions and 50 deletions

View File

@@ -31,11 +31,12 @@ enum {
TextParseRichText = 0x004,
TextParseMentions = 0x008,
TextParseHashtags = 0x010,
TextParseBotCommands = 0x020,
TextTwitterMentions = 0x020,
TextTwitterHashtags = 0x040,
TextInstagramMentions = 0x080,
TextInstagramHashtags = 0x100,
TextTwitterMentions = 0x040,
TextTwitterHashtags = 0x080,
TextInstagramMentions = 0x100,
TextInstagramHashtags = 0x200,
};
struct LinkRange {
@@ -385,6 +386,32 @@ private:
};
class BotCommandLink : public ITextLink {
public:
BotCommandLink(const QString &cmd) : _cmd(cmd) {
}
const QString &text() const {
return _cmd;
}
void onClick(Qt::MouseButton button) const;
const QString &readable() const {
return _cmd;
}
QString encoded() const {
return _cmd;
}
private:
QString _cmd;
};
static const QChar TextCommand(0x0010);
enum TextCommands {
TextCommandBold = 0x01,
@@ -512,6 +539,7 @@ const QSet<int32> &validTopDomains();
const QRegularExpression &reDomain();
const QRegularExpression &reMailName();
const QRegularExpression &reHashtag();
const QRegularExpression &reBotCommand();
// text style
const style::textStyle *textstyleCurrent();