2015-12-07 13:05:00 +00:00
|
|
|
/*
|
|
|
|
This file is part of Telegram Desktop,
|
|
|
|
the official desktop version of Telegram messaging app, see https://telegram.org
|
|
|
|
|
|
|
|
Telegram Desktop is free software: you can redistribute it and/or modify
|
|
|
|
it under the terms of the GNU General Public License as published by
|
|
|
|
the Free Software Foundation, either version 3 of the License, or
|
|
|
|
(at your option) any later version.
|
|
|
|
|
|
|
|
It is distributed in the hope that it will be useful,
|
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
GNU General Public License for more details.
|
|
|
|
|
|
|
|
In addition, as a special exception, the copyright holders give permission
|
|
|
|
to link the code of portions of this program with the OpenSSL library.
|
|
|
|
|
|
|
|
Full license: https://github.com/telegramdesktop/tdesktop/blob/master/LICENSE
|
2016-02-08 10:56:18 +00:00
|
|
|
Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org
|
2015-12-07 13:05:00 +00:00
|
|
|
*/
|
|
|
|
#pragma once
|
|
|
|
|
|
|
|
class LayeredWidget;
|
|
|
|
|
|
|
|
namespace App {
|
|
|
|
|
|
|
|
void sendBotCommand(const QString &cmd, MsgId replyTo = 0);
|
2015-12-31 18:34:56 +00:00
|
|
|
bool insertBotCommand(const QString &cmd, bool specialGif = false);
|
2015-12-07 13:05:00 +00:00
|
|
|
void searchByHashtag(const QString &tag, PeerData *inPeer);
|
2016-02-17 16:37:21 +00:00
|
|
|
void openPeerByName(const QString &username, MsgId msgId = ShowAtUnreadMsgId, const QString &startToken = QString());
|
2015-12-07 13:05:00 +00:00
|
|
|
void joinGroupByHash(const QString &hash);
|
|
|
|
void stickersBox(const QString &name);
|
|
|
|
void openLocalUrl(const QString &url);
|
|
|
|
bool forward(const PeerId &peer, ForwardWhatMessages what);
|
|
|
|
void removeDialog(History *history);
|
|
|
|
void showSettings();
|
|
|
|
|
2016-02-16 11:21:39 +00:00
|
|
|
void activateTextLink(TextLinkPtr link, Qt::MouseButton button);
|
|
|
|
|
2015-12-07 13:05:00 +00:00
|
|
|
};
|
|
|
|
|
2016-01-11 15:43:29 +00:00
|
|
|
namespace Ui {
|
2015-12-07 13:05:00 +00:00
|
|
|
|
|
|
|
void showStickerPreview(DocumentData *sticker);
|
|
|
|
void hideStickerPreview();
|
|
|
|
|
2015-12-07 18:09:05 +00:00
|
|
|
void showLayer(LayeredWidget *box, ShowLayerOptions options = CloseOtherLayers);
|
|
|
|
void hideLayer(bool fast = false);
|
|
|
|
bool isLayerShown();
|
2015-12-25 13:09:14 +00:00
|
|
|
bool isMediaViewShown();
|
2015-12-30 19:09:20 +00:00
|
|
|
bool isInlineItemBeingChosen();
|
2015-12-07 18:09:05 +00:00
|
|
|
|
2015-12-27 21:37:48 +00:00
|
|
|
void repaintHistoryItem(const HistoryItem *item);
|
2015-12-30 19:09:20 +00:00
|
|
|
void repaintInlineItem(const LayoutInlineItem *layout);
|
|
|
|
bool isInlineItemVisible(const LayoutInlineItem *reader);
|
2016-03-19 16:55:15 +00:00
|
|
|
void autoplayMediaInlineAsync(const FullMsgId &msgId);
|
2015-12-13 11:17:15 +00:00
|
|
|
|
2015-12-12 22:29:33 +00:00
|
|
|
void showPeerHistory(const PeerId &peer, MsgId msgId, bool back = false);
|
2015-12-13 11:36:08 +00:00
|
|
|
inline void showPeerHistory(const PeerData *peer, MsgId msgId, bool back = false) {
|
|
|
|
showPeerHistory(peer->id, msgId, back);
|
|
|
|
}
|
|
|
|
inline void showPeerHistory(const History *history, MsgId msgId, bool back = false) {
|
|
|
|
showPeerHistory(history->peer->id, msgId, back);
|
|
|
|
}
|
|
|
|
inline void showPeerHistoryAtItem(const HistoryItem *item) {
|
|
|
|
showPeerHistory(item->history()->peer->id, item->id);
|
|
|
|
}
|
2015-12-13 11:17:15 +00:00
|
|
|
void showPeerHistoryAsync(const PeerId &peer, MsgId msgId);
|
2015-12-13 11:36:08 +00:00
|
|
|
inline void showChatsList() {
|
|
|
|
showPeerHistory(PeerId(0), 0);
|
|
|
|
}
|
2016-03-23 13:21:26 +00:00
|
|
|
inline void showChatsListAsync() {
|
|
|
|
showPeerHistoryAsync(PeerId(0), 0);
|
|
|
|
}
|
2015-12-12 22:29:33 +00:00
|
|
|
|
2016-02-10 11:39:48 +00:00
|
|
|
bool hideWindowNoQuit();
|
|
|
|
|
2015-12-07 13:05:00 +00:00
|
|
|
};
|
|
|
|
|
2015-12-27 21:37:48 +00:00
|
|
|
enum ClipStopperType {
|
|
|
|
ClipStopperMediaview,
|
|
|
|
ClipStopperSavedGifsPanel,
|
|
|
|
};
|
|
|
|
|
2015-12-07 13:05:00 +00:00
|
|
|
namespace Notify {
|
|
|
|
|
|
|
|
void userIsBotChanged(UserData *user);
|
2015-12-13 11:17:15 +00:00
|
|
|
void userIsContactChanged(UserData *user, bool fromThisApp = false);
|
2015-12-07 13:05:00 +00:00
|
|
|
void botCommandsChanged(UserData *user);
|
2015-12-22 08:01:02 +00:00
|
|
|
|
2016-01-01 09:58:05 +00:00
|
|
|
void inlineBotRequesting(bool requesting);
|
|
|
|
|
2015-12-07 13:05:00 +00:00
|
|
|
void migrateUpdated(PeerData *peer);
|
2015-12-22 08:01:02 +00:00
|
|
|
|
2015-12-27 21:37:48 +00:00
|
|
|
void clipStopperHidden(ClipStopperType type);
|
2015-12-25 13:09:14 +00:00
|
|
|
|
2015-12-12 22:29:33 +00:00
|
|
|
void historyItemLayoutChanged(const HistoryItem *item);
|
2015-12-07 13:05:00 +00:00
|
|
|
|
2015-12-31 15:27:21 +00:00
|
|
|
void automaticLoadSettingsChangedGif();
|
|
|
|
|
2016-03-19 16:55:15 +00:00
|
|
|
// handle pending resize() / paint() on history items
|
|
|
|
void handlePendingHistoryUpdate();
|
|
|
|
|
2015-12-07 13:05:00 +00:00
|
|
|
};
|
2016-01-09 11:24:16 +00:00
|
|
|
|
2016-02-08 14:54:55 +00:00
|
|
|
#define DeclareReadOnlyVar(Type, Name) const Type &Name();
|
|
|
|
#define DeclareRefVar(Type, Name) DeclareReadOnlyVar(Type, Name) \
|
|
|
|
Type &Ref##Name();
|
|
|
|
#define DeclareVar(Type, Name) DeclareRefVar(Type, Name) \
|
|
|
|
void Set##Name(const Type &Name);
|
|
|
|
|
|
|
|
namespace Sandbox {
|
2016-01-09 11:24:16 +00:00
|
|
|
|
2016-01-11 15:43:29 +00:00
|
|
|
bool CheckBetaVersionDir();
|
|
|
|
void WorkingDirReady();
|
|
|
|
|
|
|
|
void start();
|
|
|
|
void finish();
|
2016-01-09 11:24:16 +00:00
|
|
|
|
2016-02-15 15:52:11 +00:00
|
|
|
uint64 UserTag();
|
|
|
|
|
2016-02-08 14:54:55 +00:00
|
|
|
DeclareReadOnlyVar(QString, LangSystemISO);
|
|
|
|
DeclareReadOnlyVar(int32, LangSystem);
|
|
|
|
DeclareVar(QByteArray, LastCrashDump);
|
|
|
|
DeclareVar(ConnectionProxy, PreLaunchProxy);
|
2016-01-11 15:43:29 +00:00
|
|
|
|
|
|
|
}
|
|
|
|
|
2016-02-08 14:54:55 +00:00
|
|
|
namespace Adaptive {
|
|
|
|
enum Layout {
|
|
|
|
OneColumnLayout,
|
|
|
|
NormalLayout,
|
|
|
|
WideLayout,
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
2016-03-17 18:03:08 +00:00
|
|
|
namespace DebugLogging {
|
|
|
|
enum Flags {
|
|
|
|
FileLoaderFlag = 0x00000001,
|
|
|
|
};
|
|
|
|
}
|
|
|
|
|
2016-03-19 16:55:15 +00:00
|
|
|
namespace Stickers {
|
|
|
|
static const uint64 DefaultSetId = 0; // for backward compatibility
|
|
|
|
static const uint64 CustomSetId = 0xFFFFFFFFFFFFFFFFULL, RecentSetId = 0xFFFFFFFFFFFFFFFEULL;
|
|
|
|
static const uint64 NoneSetId = 0xFFFFFFFFFFFFFFFDULL; // for emoji/stickers panel
|
|
|
|
struct Set {
|
|
|
|
Set(uint64 id, uint64 access, const QString &title, const QString &shortName, int32 count, int32 hash, MTPDstickerSet::Flags flags) : id(id), access(access), title(title), shortName(shortName), count(count), hash(hash), flags(flags) {
|
|
|
|
}
|
|
|
|
uint64 id, access;
|
|
|
|
QString title, shortName;
|
|
|
|
int32 count, hash;
|
|
|
|
MTPDstickerSet::Flags flags;
|
|
|
|
StickerPack stickers;
|
|
|
|
StickersByEmojiMap emoji;
|
|
|
|
};
|
|
|
|
typedef QMap<uint64, Set> Sets;
|
|
|
|
typedef QList<uint64> Order;
|
|
|
|
}
|
|
|
|
|
2016-02-08 14:54:55 +00:00
|
|
|
namespace Global {
|
2016-01-11 15:43:29 +00:00
|
|
|
|
2016-01-30 16:31:10 +00:00
|
|
|
bool started();
|
2016-01-11 15:43:29 +00:00
|
|
|
void start();
|
|
|
|
void finish();
|
|
|
|
|
2016-02-08 14:54:55 +00:00
|
|
|
DeclareReadOnlyVar(uint64, LaunchId);
|
2016-03-19 16:55:15 +00:00
|
|
|
DeclareRefVar(SingleDelayedCall, HandleHistoryUpdate);
|
2016-02-21 17:01:37 +00:00
|
|
|
|
2016-02-08 14:54:55 +00:00
|
|
|
DeclareVar(Adaptive::Layout, AdaptiveLayout);
|
2016-02-21 14:27:54 +00:00
|
|
|
DeclareVar(bool, AdaptiveForWide);
|
2016-01-09 11:24:16 +00:00
|
|
|
|
2016-03-17 18:03:08 +00:00
|
|
|
DeclareVar(int32, DebugLoggingFlags);
|
|
|
|
|
2016-02-18 16:36:33 +00:00
|
|
|
// config
|
|
|
|
DeclareVar(int32, ChatSizeMax);
|
|
|
|
DeclareVar(int32, MegagroupSizeMax);
|
|
|
|
DeclareVar(int32, ForwardedCountMax);
|
|
|
|
DeclareVar(int32, OnlineUpdatePeriod);
|
|
|
|
DeclareVar(int32, OfflineBlurTimeout);
|
|
|
|
DeclareVar(int32, OfflineIdleTimeout);
|
|
|
|
DeclareVar(int32, OnlineFocusTimeout); // not from config
|
|
|
|
DeclareVar(int32, OnlineCloudTimeout);
|
|
|
|
DeclareVar(int32, NotifyCloudDelay);
|
|
|
|
DeclareVar(int32, NotifyDefaultDelay);
|
|
|
|
DeclareVar(int32, ChatBigSize);
|
|
|
|
DeclareVar(int32, PushChatPeriod);
|
|
|
|
DeclareVar(int32, PushChatLimit);
|
|
|
|
DeclareVar(int32, SavedGifsLimit);
|
|
|
|
DeclareVar(int32, EditTimeLimit);
|
|
|
|
|
2016-03-10 10:15:21 +00:00
|
|
|
typedef QMap<PeerId, MsgId> HiddenPinnedMessagesMap;
|
|
|
|
DeclareVar(HiddenPinnedMessagesMap, HiddenPinnedMessages);
|
|
|
|
|
2016-03-18 19:05:08 +00:00
|
|
|
typedef OrderedSet<HistoryItem*> PendingItemsMap;
|
|
|
|
DeclareRefVar(PendingItemsMap, PendingRepaintItems);
|
|
|
|
|
2016-03-19 16:55:15 +00:00
|
|
|
DeclareVar(Stickers::Sets, StickerSets);
|
|
|
|
DeclareVar(Stickers::Order, StickerSetsOrder);
|
|
|
|
DeclareVar(uint64, LastStickersUpdate);
|
|
|
|
|
|
|
|
DeclareVar(MTP::DcOptions, DcOptions);
|
|
|
|
|
2016-03-18 10:18:30 +00:00
|
|
|
typedef QMap<uint64, QPixmap> CircleMasksMap;
|
|
|
|
DeclareRefVar(CircleMasksMap, CircleMasks);
|
|
|
|
|
2016-01-09 11:24:16 +00:00
|
|
|
};
|
2016-02-08 14:54:55 +00:00
|
|
|
|
|
|
|
namespace Adaptive {
|
|
|
|
inline bool OneColumn() {
|
|
|
|
return Global::AdaptiveLayout() == OneColumnLayout;
|
|
|
|
}
|
|
|
|
inline bool Normal() {
|
|
|
|
return Global::AdaptiveLayout() == NormalLayout;
|
|
|
|
}
|
|
|
|
inline bool Wide() {
|
2016-02-21 14:27:54 +00:00
|
|
|
return Global::AdaptiveForWide() && (Global::AdaptiveLayout() == WideLayout);
|
2016-02-08 14:54:55 +00:00
|
|
|
}
|
|
|
|
}
|
2016-03-17 18:03:08 +00:00
|
|
|
|
|
|
|
namespace DebugLogging {
|
|
|
|
inline bool FileLoader() {
|
|
|
|
return (Global::DebugLoggingFlags() | FileLoaderFlag) != 0;
|
|
|
|
}
|
|
|
|
}
|