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
|
2017-01-11 18:31:31 +00:00
|
|
|
Copyright (c) 2014-2017 John Preston, https://desktop.telegram.org
|
2015-12-07 13:05:00 +00:00
|
|
|
*/
|
|
|
|
#pragma once
|
|
|
|
|
2016-10-14 17:10:15 +00:00
|
|
|
#include "core/type_traits.h"
|
2016-10-14 18:27:42 +00:00
|
|
|
#include "core/observer.h"
|
2016-10-14 17:10:15 +00:00
|
|
|
|
2016-08-16 16:53:10 +00:00
|
|
|
class LayerWidget;
|
2016-12-13 17:07:56 +00:00
|
|
|
class BoxContent;
|
2016-10-14 18:27:42 +00:00
|
|
|
|
2016-08-27 04:49:18 +00:00
|
|
|
namespace InlineBots {
|
|
|
|
namespace Layout {
|
|
|
|
class ItemBase;
|
|
|
|
} // namespace Layout
|
|
|
|
} // namespace InlineBots
|
|
|
|
|
2015-12-07 13:05:00 +00:00
|
|
|
namespace App {
|
2016-12-09 18:56:01 +00:00
|
|
|
namespace internal {
|
2015-12-07 13:05:00 +00:00
|
|
|
|
2017-02-26 11:32:13 +00:00
|
|
|
void CallDelayed(int duration, base::lambda_once<void()> &&lambda);
|
2016-12-02 19:16:35 +00:00
|
|
|
|
2016-12-09 18:56:01 +00:00
|
|
|
} // namespace internal
|
|
|
|
|
|
|
|
template <int N, typename Lambda>
|
2017-02-26 11:32:13 +00:00
|
|
|
inline void CallDelayed(int duration, base::lambda_internal::guard<N, Lambda> &&guarded) {
|
2017-02-21 13:45:56 +00:00
|
|
|
return internal::CallDelayed(duration, [guarded = std::move(guarded)] { guarded(); });
|
2016-12-09 18:56:01 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
template <typename Pointer, typename ...PointersAndLambda>
|
|
|
|
inline void CallDelayed(int duration, Pointer &&qobject, PointersAndLambda&&... qobjectsAndLambda) {
|
2017-02-21 13:45:56 +00:00
|
|
|
auto guarded = base::lambda_guarded(std::forward<Pointer>(qobject), std::forward<PointersAndLambda>(qobjectsAndLambda)...);
|
|
|
|
return CallDelayed(duration, std::move(guarded));
|
2016-12-09 18:56:01 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
template <typename ...PointersAndLambda>
|
|
|
|
inline base::lambda<void()> LambdaDelayed(int duration, PointersAndLambda&&... qobjectsAndLambda) {
|
2017-02-21 13:45:56 +00:00
|
|
|
auto guarded = base::lambda_guarded(std::forward<PointersAndLambda>(qobjectsAndLambda)...);
|
|
|
|
return [guarded = std::move(guarded), duration] {
|
2017-02-26 11:32:13 +00:00
|
|
|
internal::CallDelayed(duration, [guarded] { guarded(); });
|
|
|
|
};
|
|
|
|
}
|
|
|
|
|
|
|
|
template <typename ...PointersAndLambda>
|
|
|
|
inline base::lambda_once<void()> LambdaDelayedOnce(int duration, PointersAndLambda&&... qobjectsAndLambda) {
|
|
|
|
auto guarded = base::lambda_guarded(std::forward<PointersAndLambda>(qobjectsAndLambda)...);
|
|
|
|
return [guarded = std::move(guarded), duration]() mutable {
|
|
|
|
internal::CallDelayed(duration, [guarded = std::move(guarded)] { guarded(); });
|
2016-12-09 18:56:01 +00:00
|
|
|
};
|
|
|
|
}
|
|
|
|
|
2016-04-14 19:24:42 +00:00
|
|
|
void sendBotCommand(PeerData *peer, UserData *bot, const QString &cmd, MsgId replyTo = 0);
|
2016-04-11 10:59:01 +00:00
|
|
|
bool insertBotCommand(const QString &cmd, bool specialGif = false);
|
|
|
|
void activateBotCommand(const HistoryItem *msg, int row, int col);
|
|
|
|
void searchByHashtag(const QString &tag, PeerData *inPeer);
|
|
|
|
void openPeerByName(const QString &username, MsgId msgId = ShowAtUnreadMsgId, const QString &startToken = QString());
|
|
|
|
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-03-31 14:06:40 +00:00
|
|
|
|
2016-04-11 10:59:01 +00:00
|
|
|
void activateClickHandler(ClickHandlerPtr handler, Qt::MouseButton button);
|
|
|
|
|
|
|
|
void logOutDelayed();
|
|
|
|
|
|
|
|
} // namespace App
|
2015-12-07 13:05:00 +00:00
|
|
|
|
2016-01-11 15:43:29 +00:00
|
|
|
namespace Ui {
|
2016-12-13 17:07:56 +00:00
|
|
|
namespace internal {
|
|
|
|
|
|
|
|
void showBox(object_ptr<BoxContent> content, ShowLayerOptions options);
|
|
|
|
|
|
|
|
} // namespace internal
|
2015-12-07 13:05:00 +00:00
|
|
|
|
2016-04-11 10:59:01 +00:00
|
|
|
void showMediaPreview(DocumentData *document);
|
|
|
|
void showMediaPreview(PhotoData *photo);
|
|
|
|
void hideMediaPreview();
|
2015-12-07 13:05:00 +00:00
|
|
|
|
2016-12-13 17:07:56 +00:00
|
|
|
template <typename BoxType>
|
|
|
|
QPointer<BoxType> show(object_ptr<BoxType> content, ShowLayerOptions options = CloseOtherLayers) {
|
|
|
|
auto result = QPointer<BoxType>(content.data());
|
2017-02-21 13:45:56 +00:00
|
|
|
internal::showBox(std::move(content), options);
|
2016-12-13 17:07:56 +00:00
|
|
|
return result;
|
|
|
|
}
|
|
|
|
|
2016-04-11 10:59:01 +00:00
|
|
|
void hideLayer(bool fast = false);
|
2016-08-17 15:14:08 +00:00
|
|
|
void hideSettingsAndLayer(bool fast = false);
|
2016-04-11 10:59:01 +00:00
|
|
|
bool isLayerShown();
|
|
|
|
bool isMediaViewShown();
|
|
|
|
bool isInlineItemBeingChosen();
|
2015-12-07 18:09:05 +00:00
|
|
|
|
2016-04-11 10:59:01 +00:00
|
|
|
void repaintHistoryItem(const HistoryItem *item);
|
|
|
|
void repaintInlineItem(const InlineBots::Layout::ItemBase *layout);
|
|
|
|
bool isInlineItemVisible(const InlineBots::Layout::ItemBase *reader);
|
|
|
|
void autoplayMediaInlineAsync(const FullMsgId &msgId);
|
2015-12-13 11:17:15 +00:00
|
|
|
|
2016-04-30 17:04:14 +00:00
|
|
|
void showPeerProfile(const PeerId &peer);
|
|
|
|
inline void showPeerProfile(const PeerData *peer) {
|
|
|
|
showPeerProfile(peer->id);
|
|
|
|
}
|
|
|
|
inline void showPeerProfile(const History *history) {
|
|
|
|
showPeerProfile(history->peer->id);
|
|
|
|
}
|
|
|
|
|
2016-05-19 12:03:51 +00:00
|
|
|
void showPeerOverview(const PeerId &peer, MediaOverviewType type);
|
|
|
|
inline void showPeerOverview(const PeerData *peer, MediaOverviewType type) {
|
|
|
|
showPeerOverview(peer->id, type);
|
|
|
|
}
|
|
|
|
inline void showPeerOverview(const History *history, MediaOverviewType type) {
|
|
|
|
showPeerOverview(history->peer->id, type);
|
|
|
|
}
|
|
|
|
|
2016-07-05 14:48:36 +00:00
|
|
|
enum class ShowWay {
|
|
|
|
ClearStack,
|
|
|
|
Forward,
|
|
|
|
Backward,
|
|
|
|
};
|
|
|
|
void showPeerHistory(const PeerId &peer, MsgId msgId, ShowWay way = ShowWay::ClearStack);
|
|
|
|
inline void showPeerHistory(const PeerData *peer, MsgId msgId, ShowWay way = ShowWay::ClearStack) {
|
|
|
|
showPeerHistory(peer->id, msgId, way);
|
2016-04-11 10:59:01 +00:00
|
|
|
}
|
2016-07-05 14:48:36 +00:00
|
|
|
inline void showPeerHistory(const History *history, MsgId msgId, ShowWay way = ShowWay::ClearStack) {
|
|
|
|
showPeerHistory(history->peer->id, msgId, way);
|
2016-04-11 10:59:01 +00:00
|
|
|
}
|
2016-07-05 14:48:36 +00:00
|
|
|
inline void showPeerHistoryAtItem(const HistoryItem *item, ShowWay way = ShowWay::ClearStack) {
|
|
|
|
showPeerHistory(item->history()->peer->id, item->id, way);
|
2016-04-11 10:59:01 +00:00
|
|
|
}
|
2016-07-05 14:48:36 +00:00
|
|
|
void showPeerHistoryAsync(const PeerId &peer, MsgId msgId, ShowWay way = ShowWay::ClearStack);
|
2016-04-11 10:59:01 +00:00
|
|
|
inline void showChatsList() {
|
2016-07-05 14:48:36 +00:00
|
|
|
showPeerHistory(PeerId(0), 0, ShowWay::ClearStack);
|
2016-04-11 10:59:01 +00:00
|
|
|
}
|
|
|
|
inline void showChatsListAsync() {
|
2016-07-05 14:48:36 +00:00
|
|
|
showPeerHistoryAsync(PeerId(0), 0, ShowWay::ClearStack);
|
2016-04-11 10:59:01 +00:00
|
|
|
}
|
|
|
|
PeerData *getPeerForMouseAction();
|
2015-12-12 22:29:33 +00:00
|
|
|
|
2016-04-11 10:59:01 +00:00
|
|
|
bool hideWindowNoQuit();
|
2016-02-10 11:39:48 +00:00
|
|
|
|
2016-05-12 16:05:20 +00:00
|
|
|
bool skipPaintEvent(QWidget *widget, QPaintEvent *event);
|
|
|
|
|
2016-04-11 10:59:01 +00:00
|
|
|
} // namespace Ui
|
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 {
|
|
|
|
|
2016-04-11 10:59:01 +00:00
|
|
|
void userIsBotChanged(UserData *user);
|
|
|
|
void userIsContactChanged(UserData *user, bool fromThisApp = false);
|
|
|
|
void botCommandsChanged(UserData *user);
|
2015-12-22 08:01:02 +00:00
|
|
|
|
2016-04-11 10:59:01 +00:00
|
|
|
void inlineBotRequesting(bool requesting);
|
|
|
|
void replyMarkupUpdated(const HistoryItem *item);
|
|
|
|
void inlineKeyboardMoved(const HistoryItem *item, int oldKeyboardTop, int newKeyboardTop);
|
2016-08-12 16:28:10 +00:00
|
|
|
bool switchInlineBotButtonReceived(const QString &query, UserData *samePeerBot = nullptr, MsgId samePeerReplyTo = 0);
|
2016-01-01 09:58:05 +00:00
|
|
|
|
2016-04-11 10:59:01 +00:00
|
|
|
void migrateUpdated(PeerData *peer);
|
2015-12-22 08:01:02 +00:00
|
|
|
|
2016-04-11 10:59:01 +00:00
|
|
|
void clipStopperHidden(ClipStopperType type);
|
2015-12-25 13:09:14 +00:00
|
|
|
|
2016-04-11 10:59:01 +00:00
|
|
|
void historyItemLayoutChanged(const HistoryItem *item);
|
|
|
|
void inlineItemLayoutChanged(const InlineBots::Layout::ItemBase *layout);
|
|
|
|
void historyMuteUpdated(History *history);
|
2015-12-07 13:05:00 +00:00
|
|
|
|
2016-04-11 10:59:01 +00:00
|
|
|
// handle pending resize() / paint() on history items
|
|
|
|
void handlePendingHistoryUpdate();
|
2016-04-14 19:24:42 +00:00
|
|
|
void unreadCounterUpdated();
|
2016-03-19 16:55:15 +00:00
|
|
|
|
2016-08-27 04:49:18 +00:00
|
|
|
enum class ChangeType {
|
|
|
|
SoundEnabled,
|
|
|
|
IncludeMuted,
|
|
|
|
DesktopEnabled,
|
|
|
|
ViewParams,
|
2016-10-06 16:41:09 +00:00
|
|
|
MaxCount,
|
|
|
|
Corner,
|
|
|
|
DemoIsShown,
|
2016-08-27 04:49:18 +00:00
|
|
|
};
|
|
|
|
|
2016-10-06 16:41:09 +00:00
|
|
|
enum class ScreenCorner {
|
|
|
|
TopLeft = 0,
|
|
|
|
TopRight = 1,
|
|
|
|
BottomRight = 2,
|
|
|
|
BottomLeft = 3,
|
|
|
|
};
|
|
|
|
|
|
|
|
inline bool IsLeftCorner(ScreenCorner corner) {
|
|
|
|
return (corner == ScreenCorner::TopLeft) || (corner == ScreenCorner::BottomLeft);
|
|
|
|
}
|
|
|
|
|
|
|
|
inline bool IsTopCorner(ScreenCorner corner) {
|
|
|
|
return (corner == ScreenCorner::TopLeft) || (corner == ScreenCorner::TopRight);
|
|
|
|
}
|
|
|
|
|
2016-04-11 10:59:01 +00:00
|
|
|
} // namespace Notify
|
2016-01-09 11:24:16 +00:00
|
|
|
|
2016-10-17 08:46:43 +00:00
|
|
|
namespace base {
|
|
|
|
|
2016-10-14 17:10:15 +00:00
|
|
|
template <>
|
2017-02-21 13:45:56 +00:00
|
|
|
struct custom_is_fast_copy_type<Notify::ChangeType> : public std::true_type {
|
2016-10-14 17:10:15 +00:00
|
|
|
};
|
|
|
|
|
2016-10-17 08:46:43 +00:00
|
|
|
} // namespace base
|
|
|
|
|
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-04-11 10:59:01 +00:00
|
|
|
bool CheckBetaVersionDir();
|
|
|
|
void WorkingDirReady();
|
2016-01-11 15:43:29 +00:00
|
|
|
|
2016-12-23 13:21:01 +00:00
|
|
|
void MainThreadTaskAdded();
|
|
|
|
|
2016-04-11 10:59:01 +00:00
|
|
|
void start();
|
2016-12-20 13:03:51 +00:00
|
|
|
bool started();
|
2016-04-11 10:59:01 +00:00
|
|
|
void finish();
|
2016-01-09 11:24:16 +00:00
|
|
|
|
2016-04-11 10:59:01 +00:00
|
|
|
uint64 UserTag();
|
2016-02-15 15:52:11 +00:00
|
|
|
|
2016-04-11 10:59:01 +00:00
|
|
|
DeclareReadOnlyVar(QString, LangSystemISO);
|
|
|
|
DeclareReadOnlyVar(int32, LangSystem);
|
|
|
|
DeclareVar(QByteArray, LastCrashDump);
|
2016-08-27 04:49:18 +00:00
|
|
|
DeclareVar(ProxyData, PreLaunchProxy);
|
2016-01-11 15:43:29 +00:00
|
|
|
|
2016-04-11 10:59:01 +00:00
|
|
|
} // namespace Sandbox
|
2016-01-11 15:43:29 +00:00
|
|
|
|
2016-02-08 14:54:55 +00:00
|
|
|
namespace Adaptive {
|
2017-01-14 18:50:16 +00:00
|
|
|
|
|
|
|
enum class WindowLayout {
|
|
|
|
OneColumn,
|
|
|
|
SmallColumn,
|
|
|
|
Normal,
|
|
|
|
};
|
|
|
|
|
|
|
|
enum class ChatLayout {
|
|
|
|
Normal,
|
|
|
|
Wide,
|
2016-02-08 14:54:55 +00:00
|
|
|
};
|
2017-01-14 18:50:16 +00:00
|
|
|
|
2016-04-11 10:59:01 +00:00
|
|
|
} // namespace Adaptive
|
2016-02-08 14:54:55 +00:00
|
|
|
|
2016-03-17 18:03:08 +00:00
|
|
|
namespace DebugLogging {
|
2016-04-11 10:59:01 +00:00
|
|
|
enum Flags {
|
|
|
|
FileLoaderFlag = 0x00000001,
|
|
|
|
};
|
|
|
|
} // namespace DebugLogging
|
2016-03-17 18:03:08 +00:00
|
|
|
|
2016-03-19 16:55:15 +00:00
|
|
|
namespace Stickers {
|
2016-04-11 10:59:01 +00:00
|
|
|
|
2016-09-09 15:52:46 +00:00
|
|
|
constexpr uint64 DefaultSetId = 0; // for backward compatibility
|
|
|
|
constexpr uint64 CustomSetId = 0xFFFFFFFFFFFFFFFFULL;
|
|
|
|
constexpr uint64 RecentSetId = 0xFFFFFFFFFFFFFFFEULL; // for emoji/stickers panel, should not appear in Sets
|
|
|
|
constexpr uint64 NoneSetId = 0xFFFFFFFFFFFFFFFDULL; // for emoji/stickers panel, should not appear in Sets
|
|
|
|
constexpr uint64 CloudRecentSetId = 0xFFFFFFFFFFFFFFFCULL; // for cloud-stored recent stickers
|
|
|
|
constexpr uint64 FeaturedSetId = 0xFFFFFFFFFFFFFFFBULL; // for emoji/stickers panel, should not appear in Sets
|
2016-04-11 10:59:01 +00:00
|
|
|
struct Set {
|
2016-06-27 16:25:21 +00:00
|
|
|
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) {
|
2016-04-11 10:59:01 +00:00
|
|
|
}
|
|
|
|
uint64 id, access;
|
|
|
|
QString title, shortName;
|
|
|
|
int32 count, hash;
|
|
|
|
MTPDstickerSet::Flags flags;
|
|
|
|
StickerPack stickers;
|
|
|
|
StickersByEmojiMap emoji;
|
|
|
|
};
|
|
|
|
using Sets = QMap<uint64, Set>;
|
|
|
|
using Order = QList<uint64>;
|
|
|
|
|
2016-06-28 18:05:38 +00:00
|
|
|
inline MTPInputStickerSet inputSetId(const Set &set) {
|
|
|
|
if (set.id && set.access) {
|
|
|
|
return MTP_inputStickerSetID(MTP_long(set.id), MTP_long(set.access));
|
|
|
|
}
|
|
|
|
return MTP_inputStickerSetShortName(MTP_string(set.shortName));
|
|
|
|
}
|
2016-04-11 10:59:01 +00:00
|
|
|
|
2016-07-18 15:39:10 +00:00
|
|
|
Set *feedSet(const MTPDstickerSet &set);
|
|
|
|
|
2016-04-11 10:59:01 +00:00
|
|
|
} // namespace Stickers
|
2016-03-19 16:55:15 +00:00
|
|
|
|
2016-02-08 14:54:55 +00:00
|
|
|
namespace Global {
|
2016-01-11 15:43:29 +00:00
|
|
|
|
2016-04-11 10:59:01 +00:00
|
|
|
bool started();
|
|
|
|
void start();
|
|
|
|
void finish();
|
2016-01-11 15:43:29 +00:00
|
|
|
|
2016-04-11 10:59:01 +00:00
|
|
|
DeclareReadOnlyVar(uint64, LaunchId);
|
|
|
|
DeclareRefVar(SingleDelayedCall, HandleHistoryUpdate);
|
2016-04-14 19:24:42 +00:00
|
|
|
DeclareRefVar(SingleDelayedCall, HandleUnreadCounterUpdate);
|
2016-05-25 17:59:21 +00:00
|
|
|
DeclareRefVar(SingleDelayedCall, HandleFileDialogQueue);
|
2016-06-02 13:02:55 +00:00
|
|
|
DeclareRefVar(SingleDelayedCall, HandleDelayedPeerUpdates);
|
2016-08-18 19:27:43 +00:00
|
|
|
DeclareRefVar(SingleDelayedCall, HandleObservables);
|
2016-02-21 17:01:37 +00:00
|
|
|
|
2017-01-14 18:50:16 +00:00
|
|
|
DeclareVar(Adaptive::WindowLayout, AdaptiveWindowLayout);
|
|
|
|
DeclareVar(Adaptive::ChatLayout, AdaptiveChatLayout);
|
2016-04-11 10:59:01 +00:00
|
|
|
DeclareVar(bool, AdaptiveForWide);
|
2016-08-27 04:49:18 +00:00
|
|
|
DeclareRefVar(base::Observable<void>, AdaptiveChanged);
|
|
|
|
|
2016-04-11 10:59:01 +00:00
|
|
|
DeclareVar(bool, DialogsModeEnabled);
|
|
|
|
DeclareVar(Dialogs::Mode, DialogsMode);
|
2016-06-22 18:41:13 +00:00
|
|
|
DeclareVar(bool, ModerateModeEnabled);
|
2016-01-09 11:24:16 +00:00
|
|
|
|
2016-07-07 16:15:34 +00:00
|
|
|
DeclareVar(bool, ScreenIsLocked);
|
|
|
|
|
2016-04-11 10:59:01 +00:00
|
|
|
DeclareVar(int32, DebugLoggingFlags);
|
2016-03-17 18:03:08 +00:00
|
|
|
|
2016-10-12 19:34:25 +00:00
|
|
|
constexpr float64 kDefaultVolume = 0.9;
|
|
|
|
|
|
|
|
DeclareVar(float64, RememberedSongVolume);
|
2016-07-12 14:11:59 +00:00
|
|
|
DeclareVar(float64, SongVolume);
|
2016-10-12 19:34:25 +00:00
|
|
|
DeclareRefVar(base::Observable<void>, SongVolumeChanged);
|
2016-07-12 14:11:59 +00:00
|
|
|
DeclareVar(float64, VideoVolume);
|
2016-10-12 19:34:25 +00:00
|
|
|
DeclareRefVar(base::Observable<void>, VideoVolumeChanged);
|
2016-07-12 14:11:59 +00:00
|
|
|
|
2016-04-11 10:59:01 +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-07-18 15:39:10 +00:00
|
|
|
DeclareVar(int32, StickersRecentLimit);
|
2016-12-13 07:59:57 +00:00
|
|
|
DeclareVar(int32, PinnedDialogsCountMax);
|
2016-02-18 16:36:33 +00:00
|
|
|
|
2016-04-11 10:59:01 +00:00
|
|
|
typedef QMap<PeerId, MsgId> HiddenPinnedMessagesMap;
|
|
|
|
DeclareVar(HiddenPinnedMessagesMap, HiddenPinnedMessages);
|
2016-03-10 10:15:21 +00:00
|
|
|
|
2016-04-11 10:59:01 +00:00
|
|
|
typedef OrderedSet<HistoryItem*> PendingItemsMap;
|
|
|
|
DeclareRefVar(PendingItemsMap, PendingRepaintItems);
|
2016-03-18 19:05:08 +00:00
|
|
|
|
2016-04-11 10:59:01 +00:00
|
|
|
DeclareVar(Stickers::Sets, StickerSets);
|
|
|
|
DeclareVar(Stickers::Order, StickerSetsOrder);
|
2016-12-01 19:20:33 +00:00
|
|
|
DeclareVar(TimeMs, LastStickersUpdate);
|
|
|
|
DeclareVar(TimeMs, LastRecentStickersUpdate);
|
2016-06-27 16:25:21 +00:00
|
|
|
DeclareVar(Stickers::Order, FeaturedStickerSetsOrder);
|
2016-06-28 18:05:38 +00:00
|
|
|
DeclareVar(int, FeaturedStickerSetsUnreadCount);
|
2016-11-22 09:48:13 +00:00
|
|
|
DeclareRefVar(base::Observable<void>, FeaturedStickerSetsUnreadCountChanged);
|
2016-12-01 19:20:33 +00:00
|
|
|
DeclareVar(TimeMs, LastFeaturedStickersUpdate);
|
2016-07-21 13:57:31 +00:00
|
|
|
DeclareVar(Stickers::Order, ArchivedStickerSetsOrder);
|
2016-03-19 16:55:15 +00:00
|
|
|
|
2016-04-11 10:59:01 +00:00
|
|
|
typedef QMap<uint64, QPixmap> CircleMasksMap;
|
|
|
|
DeclareRefVar(CircleMasksMap, CircleMasks);
|
2016-03-18 10:18:30 +00:00
|
|
|
|
2016-08-27 04:49:18 +00:00
|
|
|
DeclareRefVar(base::Observable<void>, SelfChanged);
|
|
|
|
|
|
|
|
DeclareVar(bool, AskDownloadPath);
|
|
|
|
DeclareVar(QString, DownloadPath);
|
|
|
|
DeclareVar(QByteArray, DownloadPathBookmark);
|
|
|
|
DeclareRefVar(base::Observable<void>, DownloadPathChanged);
|
|
|
|
|
|
|
|
DeclareVar(bool, SoundNotify);
|
|
|
|
DeclareVar(bool, DesktopNotify);
|
|
|
|
DeclareVar(bool, RestoreSoundNotifyFromTray);
|
|
|
|
DeclareVar(bool, IncludeMuted);
|
|
|
|
DeclareVar(DBINotifyView, NotifyView);
|
2016-10-03 15:07:50 +00:00
|
|
|
DeclareVar(bool, NativeNotifications);
|
2016-10-06 16:41:09 +00:00
|
|
|
DeclareVar(int, NotificationsCount);
|
|
|
|
DeclareVar(Notify::ScreenCorner, NotificationsCorner);
|
|
|
|
DeclareVar(bool, NotificationsDemoIsShown);
|
2016-08-27 04:49:18 +00:00
|
|
|
DeclareRefVar(base::Observable<Notify::ChangeType>, NotifySettingsChanged);
|
|
|
|
|
|
|
|
DeclareVar(DBIConnectionType, ConnectionType);
|
|
|
|
DeclareVar(bool, TryIPv6);
|
|
|
|
DeclareVar(ProxyData, ConnectionProxy);
|
|
|
|
DeclareRefVar(base::Observable<void>, ConnectionTypeChanged);
|
|
|
|
|
2016-08-27 17:52:05 +00:00
|
|
|
DeclareRefVar(base::Observable<void>, ChooseCustomLang);
|
|
|
|
|
2016-08-28 19:16:23 +00:00
|
|
|
DeclareVar(int, AutoLock);
|
|
|
|
DeclareVar(bool, LocalPasscode);
|
|
|
|
DeclareRefVar(base::Observable<void>, LocalPasscodeChanged);
|
|
|
|
|
2016-10-14 17:10:15 +00:00
|
|
|
DeclareRefVar(base::Observable<HistoryItem*>, ItemRemoved);
|
2016-11-06 17:23:13 +00:00
|
|
|
DeclareRefVar(base::Observable<void>, UnreadCounterUpdate);
|
|
|
|
DeclareRefVar(base::Observable<void>, PeerChooseCancel);
|
2016-10-14 17:10:15 +00:00
|
|
|
|
2017-01-14 18:50:16 +00:00
|
|
|
DeclareVar(float64, DialogsWidthRatio);
|
|
|
|
DeclareRefVar(base::Variable<bool>, DialogsListFocused);
|
|
|
|
DeclareRefVar(base::Variable<bool>, DialogsListDisplayForced);
|
|
|
|
|
2016-04-11 10:59:01 +00:00
|
|
|
} // namespace Global
|
2016-02-08 14:54:55 +00:00
|
|
|
|
|
|
|
namespace Adaptive {
|
2016-04-11 10:59:01 +00:00
|
|
|
|
2016-08-27 04:49:18 +00:00
|
|
|
inline base::Observable<void> &Changed() {
|
|
|
|
return Global::RefAdaptiveChanged();
|
|
|
|
}
|
|
|
|
|
2016-04-11 10:59:01 +00:00
|
|
|
inline bool OneColumn() {
|
2017-01-14 18:50:16 +00:00
|
|
|
return Global::AdaptiveWindowLayout() == WindowLayout::OneColumn;
|
2016-04-11 10:59:01 +00:00
|
|
|
}
|
2017-01-14 18:50:16 +00:00
|
|
|
|
|
|
|
inline bool SmallColumn() {
|
|
|
|
return Global::AdaptiveWindowLayout() == WindowLayout::SmallColumn;
|
|
|
|
}
|
|
|
|
|
2016-04-11 10:59:01 +00:00
|
|
|
inline bool Normal() {
|
2017-01-14 18:50:16 +00:00
|
|
|
return Global::AdaptiveWindowLayout() == WindowLayout::Normal;
|
2016-04-11 10:59:01 +00:00
|
|
|
}
|
2017-01-14 18:50:16 +00:00
|
|
|
|
|
|
|
inline bool ChatNormal() {
|
|
|
|
return !Global::AdaptiveForWide() || (Global::AdaptiveChatLayout() == ChatLayout::Normal);
|
|
|
|
}
|
|
|
|
|
|
|
|
inline bool ChatWide() {
|
|
|
|
return !ChatNormal();
|
2016-02-08 14:54:55 +00:00
|
|
|
}
|
2016-03-17 18:03:08 +00:00
|
|
|
|
2016-04-11 10:59:01 +00:00
|
|
|
} // namespace Adaptive
|
|
|
|
|
2016-03-17 18:03:08 +00:00
|
|
|
namespace DebugLogging {
|
2016-04-11 10:59:01 +00:00
|
|
|
|
|
|
|
inline bool FileLoader() {
|
2016-08-27 17:52:05 +00:00
|
|
|
return (Global::DebugLoggingFlags() & FileLoaderFlag) != 0;
|
2016-03-17 18:03:08 +00:00
|
|
|
}
|
2016-04-11 10:59:01 +00:00
|
|
|
|
|
|
|
} // namespace DebugLogging
|