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
|
|
|
*/
|
2016-05-19 12:03:51 +00:00
|
|
|
#include "profile/profile_section_memento.h"
|
2016-05-24 16:13:07 +00:00
|
|
|
#include "core/click_handler_types.h"
|
2017-05-22 15:25:49 +00:00
|
|
|
#include "media/media_clip_reader.h"
|
2016-06-01 20:05:37 +00:00
|
|
|
#include "observer_peer.h"
|
2016-04-12 21:31:28 +00:00
|
|
|
#include "mainwindow.h"
|
2015-12-07 13:05:00 +00:00
|
|
|
#include "mainwidget.h"
|
2017-02-23 10:59:19 +00:00
|
|
|
#include "messenger.h"
|
2017-06-21 23:54:38 +00:00
|
|
|
#include "auth_session.h"
|
2017-04-06 14:38:10 +00:00
|
|
|
#include "boxes/confirm_box.h"
|
2015-12-24 20:29:33 +00:00
|
|
|
#include "layerwidget.h"
|
2017-04-13 08:27:10 +00:00
|
|
|
#include "lang/lang_keys.h"
|
2017-04-06 14:38:10 +00:00
|
|
|
#include "base/observer.h"
|
2017-04-06 16:49:42 +00:00
|
|
|
#include "base/task_queue.h"
|
2017-06-22 15:11:41 +00:00
|
|
|
#include "history/history_media.h"
|
2015-12-24 20:29:33 +00:00
|
|
|
|
2016-03-29 17:17:00 +00:00
|
|
|
Q_DECLARE_METATYPE(ClickHandlerPtr);
|
2016-02-16 13:33:33 +00:00
|
|
|
Q_DECLARE_METATYPE(Qt::MouseButton);
|
2016-07-05 14:48:36 +00:00
|
|
|
Q_DECLARE_METATYPE(Ui::ShowWay);
|
2016-02-16 13:33:33 +00:00
|
|
|
|
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) {
|
2017-08-03 13:06:29 +00:00
|
|
|
Messenger::Instance().callDelayed(duration, std::move(lambda));
|
2016-12-02 19:16:35 +00:00
|
|
|
}
|
|
|
|
|
2016-12-09 18:56:01 +00:00
|
|
|
} // namespace internal
|
|
|
|
|
2016-04-14 19:24:42 +00:00
|
|
|
void sendBotCommand(PeerData *peer, UserData *bot, const QString &cmd, MsgId replyTo) {
|
|
|
|
if (auto m = main()) {
|
|
|
|
m->sendBotCommand(peer, bot, cmd, replyTo);
|
|
|
|
}
|
2016-04-11 10:59:01 +00:00
|
|
|
}
|
2016-03-29 17:17:00 +00:00
|
|
|
|
2016-11-20 12:54:07 +00:00
|
|
|
void hideSingleUseKeyboard(const HistoryItem *msg) {
|
|
|
|
if (auto m = main()) {
|
|
|
|
m->hideSingleUseKeyboard(msg->history()->peer, msg->id);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2017-03-27 18:11:51 +00:00
|
|
|
bool insertBotCommand(const QString &cmd) {
|
2016-04-14 19:24:42 +00:00
|
|
|
if (auto m = main()) {
|
2017-03-27 18:11:51 +00:00
|
|
|
return m->insertBotCommand(cmd);
|
2016-04-14 19:24:42 +00:00
|
|
|
}
|
2016-04-11 10:59:01 +00:00
|
|
|
return false;
|
|
|
|
}
|
2015-12-07 13:05:00 +00:00
|
|
|
|
2016-04-11 10:59:01 +00:00
|
|
|
void activateBotCommand(const HistoryItem *msg, int row, int col) {
|
|
|
|
const HistoryMessageReplyMarkup::Button *button = nullptr;
|
|
|
|
if (auto markup = msg->Get<HistoryMessageReplyMarkup>()) {
|
|
|
|
if (row < markup->rows.size()) {
|
2016-09-15 19:15:49 +00:00
|
|
|
auto &buttonRow = markup->rows[row];
|
2016-04-11 10:59:01 +00:00
|
|
|
if (col < buttonRow.size()) {
|
|
|
|
button = &buttonRow.at(col);
|
2016-04-06 17:02:22 +00:00
|
|
|
}
|
|
|
|
}
|
2016-04-11 10:59:01 +00:00
|
|
|
}
|
|
|
|
if (!button) return;
|
|
|
|
|
2016-09-02 16:11:23 +00:00
|
|
|
using ButtonType = HistoryMessageReplyMarkup::Button::Type;
|
2016-04-11 10:59:01 +00:00
|
|
|
switch (button->type) {
|
2016-09-02 16:11:23 +00:00
|
|
|
case ButtonType::Default: {
|
2016-04-11 10:59:01 +00:00
|
|
|
// Copy string before passing it to the sending method
|
|
|
|
// because the original button can be destroyed inside.
|
|
|
|
MsgId replyTo = (msg->id > 0) ? msg->id : 0;
|
2016-04-14 19:24:42 +00:00
|
|
|
sendBotCommand(msg->history()->peer, msg->fromOriginal()->asUser(), QString(button->text), replyTo);
|
2016-04-11 10:59:01 +00:00
|
|
|
} break;
|
|
|
|
|
2016-09-02 16:11:23 +00:00
|
|
|
case ButtonType::Callback:
|
|
|
|
case ButtonType::Game: {
|
2016-09-07 09:04:57 +00:00
|
|
|
if (auto m = main()) {
|
2016-04-11 10:59:01 +00:00
|
|
|
m->app_sendBotCallback(button, msg, row, col);
|
|
|
|
}
|
|
|
|
} break;
|
|
|
|
|
2017-03-05 13:39:10 +00:00
|
|
|
case ButtonType::Buy: {
|
|
|
|
Ui::show(Box<InformBox>(lang(lng_payments_not_supported)));
|
|
|
|
} break;
|
|
|
|
|
2016-09-02 16:11:23 +00:00
|
|
|
case ButtonType::Url: {
|
2016-04-11 10:59:01 +00:00
|
|
|
auto url = QString::fromUtf8(button->data);
|
2016-12-20 13:03:51 +00:00
|
|
|
auto skipConfirmation = false;
|
|
|
|
if (auto bot = msg->getMessageBot()) {
|
|
|
|
if (bot->isVerified()) {
|
|
|
|
skipConfirmation = true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (skipConfirmation) {
|
|
|
|
UrlClickHandler::doOpen(url);
|
|
|
|
} else {
|
|
|
|
HiddenUrlClickHandler::doOpen(url);
|
|
|
|
}
|
2016-04-11 10:59:01 +00:00
|
|
|
} break;
|
|
|
|
|
2016-09-02 16:11:23 +00:00
|
|
|
case ButtonType::RequestLocation: {
|
2016-11-20 12:54:07 +00:00
|
|
|
hideSingleUseKeyboard(msg);
|
2016-12-13 17:07:56 +00:00
|
|
|
Ui::show(Box<InformBox>(lang(lng_bot_share_location_unavailable)));
|
2016-04-11 10:59:01 +00:00
|
|
|
} break;
|
|
|
|
|
2016-09-02 16:11:23 +00:00
|
|
|
case ButtonType::RequestPhone: {
|
2016-11-20 12:54:07 +00:00
|
|
|
hideSingleUseKeyboard(msg);
|
2016-12-13 17:07:56 +00:00
|
|
|
Ui::show(Box<ConfirmBox>(lang(lng_bot_share_phone), lang(lng_bot_share_phone_confirm), [peerId = msg->history()->peer->id] {
|
|
|
|
if (auto m = App::main()) {
|
|
|
|
m->onShareContact(peerId, App::self());
|
|
|
|
}
|
|
|
|
}));
|
2016-04-11 10:59:01 +00:00
|
|
|
} break;
|
|
|
|
|
2016-09-02 16:11:23 +00:00
|
|
|
case ButtonType::SwitchInlineSame:
|
|
|
|
case ButtonType::SwitchInline: {
|
2016-04-20 12:27:38 +00:00
|
|
|
if (auto m = App::main()) {
|
2016-09-19 10:18:21 +00:00
|
|
|
if (auto bot = msg->getMessageBot()) {
|
2016-08-12 16:28:10 +00:00
|
|
|
auto tryFastSwitch = [bot, &button, msgId = msg->id]() -> bool {
|
2016-09-02 16:11:23 +00:00
|
|
|
auto samePeer = (button->type == ButtonType::SwitchInlineSame);
|
2016-08-12 16:28:10 +00:00
|
|
|
if (samePeer) {
|
|
|
|
Notify::switchInlineBotButtonReceived(QString::fromUtf8(button->data), bot, msgId);
|
|
|
|
return true;
|
|
|
|
} else if (bot->botInfo && bot->botInfo->inlineReturnPeerId) {
|
2016-04-11 10:59:01 +00:00
|
|
|
if (Notify::switchInlineBotButtonReceived(QString::fromUtf8(button->data))) {
|
|
|
|
return true;
|
2016-04-10 20:59:07 +00:00
|
|
|
}
|
|
|
|
}
|
2016-04-11 10:59:01 +00:00
|
|
|
return false;
|
|
|
|
};
|
|
|
|
if (!tryFastSwitch()) {
|
|
|
|
m->inlineSwitchLayer('@' + bot->username + ' ' + QString::fromUtf8(button->data));
|
2016-04-08 14:16:52 +00:00
|
|
|
}
|
|
|
|
}
|
2016-03-29 17:17:00 +00:00
|
|
|
}
|
2016-04-11 10:59:01 +00:00
|
|
|
} break;
|
2016-03-28 12:51:22 +00:00
|
|
|
}
|
2016-04-11 10:59:01 +00:00
|
|
|
}
|
2016-03-28 12:51:22 +00:00
|
|
|
|
2016-04-11 10:59:01 +00:00
|
|
|
void searchByHashtag(const QString &tag, PeerData *inPeer) {
|
|
|
|
if (MainWidget *m = main()) m->searchMessages(tag + ' ', (inPeer && inPeer->isChannel() && !inPeer->isMegagroup()) ? inPeer : 0);
|
|
|
|
}
|
2015-12-07 13:05:00 +00:00
|
|
|
|
2016-04-11 10:59:01 +00:00
|
|
|
void openPeerByName(const QString &username, MsgId msgId, const QString &startToken) {
|
|
|
|
if (MainWidget *m = main()) m->openPeerByName(username, msgId, startToken);
|
|
|
|
}
|
2015-12-07 13:05:00 +00:00
|
|
|
|
2016-04-11 10:59:01 +00:00
|
|
|
void joinGroupByHash(const QString &hash) {
|
|
|
|
if (MainWidget *m = main()) m->joinGroupByHash(hash);
|
|
|
|
}
|
2015-12-07 13:05:00 +00:00
|
|
|
|
2016-04-11 10:59:01 +00:00
|
|
|
void stickersBox(const QString &name) {
|
|
|
|
if (MainWidget *m = main()) m->stickersBox(MTP_inputStickerSetShortName(MTP_string(name)));
|
|
|
|
}
|
2015-12-07 13:05:00 +00:00
|
|
|
|
2016-04-11 10:59:01 +00:00
|
|
|
void removeDialog(History *history) {
|
|
|
|
if (MainWidget *m = main()) {
|
|
|
|
m->removeDialog(history);
|
2015-12-07 13:05:00 +00:00
|
|
|
}
|
2016-04-11 10:59:01 +00:00
|
|
|
}
|
2015-12-07 13:05:00 +00:00
|
|
|
|
2016-04-11 10:59:01 +00:00
|
|
|
void showSettings() {
|
2016-04-12 21:31:28 +00:00
|
|
|
if (auto w = wnd()) {
|
2016-04-11 10:59:01 +00:00
|
|
|
w->showSettings();
|
2016-02-16 11:21:39 +00:00
|
|
|
}
|
2016-04-11 10:59:01 +00:00
|
|
|
}
|
2016-02-16 11:21:39 +00:00
|
|
|
|
2016-04-11 10:59:01 +00:00
|
|
|
void activateClickHandler(ClickHandlerPtr handler, Qt::MouseButton button) {
|
2016-04-12 21:31:28 +00:00
|
|
|
if (auto w = wnd()) {
|
2016-04-11 10:59:01 +00:00
|
|
|
qRegisterMetaType<ClickHandlerPtr>();
|
|
|
|
qRegisterMetaType<Qt::MouseButton>();
|
|
|
|
QMetaObject::invokeMethod(w, "app_activateClickHandler", Qt::QueuedConnection, Q_ARG(ClickHandlerPtr, handler), Q_ARG(Qt::MouseButton, button));
|
2015-12-07 13:05:00 +00:00
|
|
|
}
|
2016-04-11 10:59:01 +00:00
|
|
|
}
|
2015-12-07 13:05:00 +00:00
|
|
|
|
2016-04-11 10:59:01 +00:00
|
|
|
void logOutDelayed() {
|
2017-08-04 14:54:32 +00:00
|
|
|
InvokeQueued(QCoreApplication::instance(), [] {
|
2017-01-07 11:55:05 +00:00
|
|
|
App::logOut();
|
|
|
|
});
|
2015-12-07 13:05:00 +00:00
|
|
|
}
|
|
|
|
|
2016-04-11 10:59:01 +00:00
|
|
|
} // namespace App
|
|
|
|
|
2015-12-07 13:05:00 +00:00
|
|
|
namespace Ui {
|
2016-12-13 17:07:56 +00:00
|
|
|
namespace internal {
|
|
|
|
|
|
|
|
void showBox(object_ptr<BoxContent> content, ShowLayerOptions options) {
|
|
|
|
if (auto w = App::wnd()) {
|
2017-02-21 13:45:56 +00:00
|
|
|
w->ui_showBox(std::move(content), options);
|
2016-12-13 17:07:56 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
} // namespace internal
|
2015-12-07 13:05:00 +00:00
|
|
|
|
2016-04-11 10:59:01 +00:00
|
|
|
void showMediaPreview(DocumentData *document) {
|
2016-04-12 21:31:28 +00:00
|
|
|
if (auto w = App::wnd()) {
|
2016-04-11 10:59:01 +00:00
|
|
|
w->ui_showMediaPreview(document);
|
2015-12-07 13:05:00 +00:00
|
|
|
}
|
2016-04-11 10:59:01 +00:00
|
|
|
}
|
2015-12-07 13:05:00 +00:00
|
|
|
|
2016-04-11 10:59:01 +00:00
|
|
|
void showMediaPreview(PhotoData *photo) {
|
2016-04-12 21:31:28 +00:00
|
|
|
if (auto w = App::wnd()) {
|
2016-04-11 10:59:01 +00:00
|
|
|
w->ui_showMediaPreview(photo);
|
2016-04-10 18:18:26 +00:00
|
|
|
}
|
2016-04-11 10:59:01 +00:00
|
|
|
}
|
2016-04-10 18:18:26 +00:00
|
|
|
|
2016-04-11 10:59:01 +00:00
|
|
|
void hideMediaPreview() {
|
2016-04-12 21:31:28 +00:00
|
|
|
if (auto w = App::wnd()) {
|
2016-04-11 10:59:01 +00:00
|
|
|
w->ui_hideMediaPreview();
|
2015-12-07 13:05:00 +00:00
|
|
|
}
|
2016-04-11 10:59:01 +00:00
|
|
|
}
|
2015-12-07 13:05:00 +00:00
|
|
|
|
2016-12-13 17:07:56 +00:00
|
|
|
void hideLayer(bool fast) {
|
2016-04-12 21:31:28 +00:00
|
|
|
if (auto w = App::wnd()) {
|
2016-12-13 17:07:56 +00:00
|
|
|
w->ui_showBox({ nullptr }, CloseOtherLayers | (fast ? ForceFastShowLayer : AnimatedShowLayer));
|
2015-12-07 18:09:05 +00:00
|
|
|
}
|
2016-04-11 10:59:01 +00:00
|
|
|
}
|
2015-12-07 18:09:05 +00:00
|
|
|
|
2016-08-17 15:14:08 +00:00
|
|
|
void hideSettingsAndLayer(bool fast) {
|
2016-12-13 17:07:56 +00:00
|
|
|
if (auto w = App::wnd()) {
|
|
|
|
w->ui_hideSettingsAndLayer(fast ? ForceFastShowLayer : AnimatedShowLayer);
|
|
|
|
}
|
2016-04-11 10:59:01 +00:00
|
|
|
}
|
2015-12-07 18:09:05 +00:00
|
|
|
|
2016-04-11 10:59:01 +00:00
|
|
|
bool isLayerShown() {
|
2016-04-12 21:31:28 +00:00
|
|
|
if (auto w = App::wnd()) return w->ui_isLayerShown();
|
2016-04-11 10:59:01 +00:00
|
|
|
return false;
|
|
|
|
}
|
2015-12-07 18:09:05 +00:00
|
|
|
|
2017-08-17 08:31:24 +00:00
|
|
|
void repaintHistoryItem(not_null<const HistoryItem*> item) {
|
2016-10-13 15:04:40 +00:00
|
|
|
if (auto main = App::main()) {
|
|
|
|
main->ui_repaintHistoryItem(item);
|
|
|
|
}
|
2016-04-11 10:59:01 +00:00
|
|
|
}
|
2015-12-27 21:37:48 +00:00
|
|
|
|
2016-04-11 10:59:01 +00:00
|
|
|
void autoplayMediaInlineAsync(const FullMsgId &msgId) {
|
2016-10-13 15:04:40 +00:00
|
|
|
if (auto main = App::main()) {
|
|
|
|
QMetaObject::invokeMethod(main, "ui_autoplayMediaInlineAsync", Qt::QueuedConnection, Q_ARG(qint32, msgId.channel), Q_ARG(qint32, msgId.msg));
|
2016-03-19 16:55:15 +00:00
|
|
|
}
|
2016-04-11 10:59:01 +00:00
|
|
|
}
|
2016-03-19 16:55:15 +00:00
|
|
|
|
2016-04-30 17:04:14 +00:00
|
|
|
void showPeerProfile(const PeerId &peer) {
|
2016-10-13 15:04:40 +00:00
|
|
|
if (auto main = App::main()) {
|
|
|
|
main->showWideSection(Profile::SectionMemento(App::peer(peer)));
|
2016-05-19 12:03:51 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void showPeerOverview(const PeerId &peer, MediaOverviewType type) {
|
|
|
|
if (auto m = App::main()) {
|
|
|
|
m->showMediaOverview(App::peer(peer), type);
|
|
|
|
}
|
2016-04-30 17:04:14 +00:00
|
|
|
}
|
|
|
|
|
2016-07-05 14:48:36 +00:00
|
|
|
void showPeerHistory(const PeerId &peer, MsgId msgId, ShowWay way) {
|
|
|
|
if (MainWidget *m = App::main()) m->ui_showPeerHistory(peer, msgId, way);
|
2016-04-11 10:59:01 +00:00
|
|
|
}
|
2015-12-12 22:29:33 +00:00
|
|
|
|
2016-07-05 14:48:36 +00:00
|
|
|
void showPeerHistoryAsync(const PeerId &peer, MsgId msgId, ShowWay way) {
|
2016-04-11 10:59:01 +00:00
|
|
|
if (MainWidget *m = App::main()) {
|
2016-07-05 14:48:36 +00:00
|
|
|
qRegisterMetaType<Ui::ShowWay>();
|
|
|
|
QMetaObject::invokeMethod(m, "ui_showPeerHistoryAsync", Qt::QueuedConnection, Q_ARG(quint64, peer), Q_ARG(qint32, msgId), Q_ARG(Ui::ShowWay, way));
|
2015-12-13 11:17:15 +00:00
|
|
|
}
|
2016-04-11 10:59:01 +00:00
|
|
|
}
|
2015-12-13 11:17:15 +00:00
|
|
|
|
2016-04-11 10:59:01 +00:00
|
|
|
PeerData *getPeerForMouseAction() {
|
2017-08-08 09:31:48 +00:00
|
|
|
return Messenger::Instance().ui_getPeerForMouseAction();
|
2016-04-11 10:59:01 +00:00
|
|
|
}
|
2016-03-29 17:17:00 +00:00
|
|
|
|
2016-05-12 16:05:20 +00:00
|
|
|
bool skipPaintEvent(QWidget *widget, QPaintEvent *event) {
|
|
|
|
if (auto w = App::wnd()) {
|
|
|
|
if (w->contentOverlapped(widget, event)) {
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2016-04-11 10:59:01 +00:00
|
|
|
} // namespace Ui
|
|
|
|
|
2015-12-07 13:05:00 +00:00
|
|
|
namespace Notify {
|
|
|
|
|
2016-04-11 10:59:01 +00:00
|
|
|
void userIsBotChanged(UserData *user) {
|
|
|
|
if (MainWidget *m = App::main()) m->notify_userIsBotChanged(user);
|
|
|
|
}
|
2015-12-07 13:05:00 +00:00
|
|
|
|
2016-04-11 10:59:01 +00:00
|
|
|
void userIsContactChanged(UserData *user, bool fromThisApp) {
|
|
|
|
if (MainWidget *m = App::main()) m->notify_userIsContactChanged(user, fromThisApp);
|
|
|
|
}
|
2015-12-13 11:17:15 +00:00
|
|
|
|
2016-04-11 10:59:01 +00:00
|
|
|
void botCommandsChanged(UserData *user) {
|
2016-06-01 20:05:37 +00:00
|
|
|
if (MainWidget *m = App::main()) {
|
|
|
|
m->notify_botCommandsChanged(user);
|
|
|
|
}
|
|
|
|
peerUpdatedDelayed(user, PeerUpdate::Flag::BotCommandsChanged);
|
2016-04-11 10:59:01 +00:00
|
|
|
}
|
2015-12-07 13:05:00 +00:00
|
|
|
|
2016-04-11 10:59:01 +00:00
|
|
|
void inlineBotRequesting(bool requesting) {
|
|
|
|
if (MainWidget *m = App::main()) m->notify_inlineBotRequesting(requesting);
|
|
|
|
}
|
2016-01-01 09:58:05 +00:00
|
|
|
|
2016-04-11 10:59:01 +00:00
|
|
|
void replyMarkupUpdated(const HistoryItem *item) {
|
|
|
|
if (MainWidget *m = App::main()) {
|
|
|
|
m->notify_replyMarkupUpdated(item);
|
2016-04-01 15:32:26 +00:00
|
|
|
}
|
2016-04-11 10:59:01 +00:00
|
|
|
}
|
2016-04-01 15:32:26 +00:00
|
|
|
|
2016-04-11 10:59:01 +00:00
|
|
|
void inlineKeyboardMoved(const HistoryItem *item, int oldKeyboardTop, int newKeyboardTop) {
|
|
|
|
if (MainWidget *m = App::main()) {
|
|
|
|
m->notify_inlineKeyboardMoved(item, oldKeyboardTop, newKeyboardTop);
|
2016-04-08 09:20:10 +00:00
|
|
|
}
|
2016-04-11 10:59:01 +00:00
|
|
|
}
|
2016-04-08 09:20:10 +00:00
|
|
|
|
2016-08-12 16:28:10 +00:00
|
|
|
bool switchInlineBotButtonReceived(const QString &query, UserData *samePeerBot, MsgId samePeerReplyTo) {
|
2017-05-22 15:25:49 +00:00
|
|
|
if (auto main = App::main()) {
|
|
|
|
return main->notify_switchInlineBotButtonReceived(query, samePeerBot, samePeerReplyTo);
|
2016-04-08 14:16:52 +00:00
|
|
|
}
|
2016-04-11 10:59:01 +00:00
|
|
|
return false;
|
|
|
|
}
|
2016-04-08 14:16:52 +00:00
|
|
|
|
2016-04-11 10:59:01 +00:00
|
|
|
void migrateUpdated(PeerData *peer) {
|
|
|
|
if (MainWidget *m = App::main()) m->notify_migrateUpdated(peer);
|
|
|
|
}
|
2015-12-11 18:11:38 +00:00
|
|
|
|
2016-04-11 10:59:01 +00:00
|
|
|
void historyItemLayoutChanged(const HistoryItem *item) {
|
|
|
|
if (MainWidget *m = App::main()) m->notify_historyItemLayoutChanged(item);
|
|
|
|
}
|
2015-12-12 22:29:33 +00:00
|
|
|
|
2016-04-11 10:59:01 +00:00
|
|
|
void historyMuteUpdated(History *history) {
|
|
|
|
if (MainWidget *m = App::main()) m->notify_historyMuteUpdated(history);
|
|
|
|
}
|
2016-03-19 16:55:15 +00:00
|
|
|
|
2016-04-11 10:59:01 +00:00
|
|
|
void handlePendingHistoryUpdate() {
|
2017-07-13 14:44:45 +00:00
|
|
|
if (!AuthSession::Exists()) {
|
|
|
|
return;
|
|
|
|
}
|
2017-08-04 14:54:32 +00:00
|
|
|
Auth().data().pendingHistoryResize().notify(true);
|
2017-06-21 23:54:38 +00:00
|
|
|
|
2017-05-22 15:25:49 +00:00
|
|
|
for (auto item : base::take(Global::RefPendingRepaintItems())) {
|
2016-04-11 10:59:01 +00:00
|
|
|
Ui::repaintHistoryItem(item);
|
2017-05-22 15:25:49 +00:00
|
|
|
|
|
|
|
// Start the video if it is waiting for that.
|
|
|
|
if (item->pendingInitDimensions()) {
|
|
|
|
if (auto media = item->getMedia()) {
|
|
|
|
if (auto reader = media->getClipReader()) {
|
|
|
|
if (!reader->started() && reader->mode() == Media::Clip::Reader::Mode::Video) {
|
2017-06-21 21:38:31 +00:00
|
|
|
item->resizeGetHeight(item->width());
|
2017-05-22 15:25:49 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2016-04-11 10:59:01 +00:00
|
|
|
}
|
2015-12-07 13:05:00 +00:00
|
|
|
}
|
2016-01-09 11:24:16 +00:00
|
|
|
|
2016-04-14 19:24:42 +00:00
|
|
|
void unreadCounterUpdated() {
|
|
|
|
Global::RefHandleUnreadCounterUpdate().call();
|
|
|
|
}
|
|
|
|
|
2016-04-11 10:59:01 +00:00
|
|
|
} // namespace Notify
|
|
|
|
|
2016-02-08 14:54:55 +00:00
|
|
|
#define DefineReadOnlyVar(Namespace, Type, Name) const Type &Name() { \
|
2017-08-17 09:06:26 +00:00
|
|
|
AssertCustom(Namespace##Data != nullptr, #Namespace "Data != nullptr in " #Namespace "::" #Name); \
|
2016-02-08 14:54:55 +00:00
|
|
|
return Namespace##Data->Name; \
|
|
|
|
}
|
|
|
|
#define DefineRefVar(Namespace, Type, Name) DefineReadOnlyVar(Namespace, Type, Name) \
|
|
|
|
Type &Ref##Name() { \
|
2017-08-17 09:06:26 +00:00
|
|
|
AssertCustom(Namespace##Data != nullptr, #Namespace "Data != nullptr in " #Namespace "::Ref" #Name); \
|
2016-02-08 14:54:55 +00:00
|
|
|
return Namespace##Data->Name; \
|
|
|
|
}
|
|
|
|
#define DefineVar(Namespace, Type, Name) DefineRefVar(Namespace, Type, Name) \
|
|
|
|
void Set##Name(const Type &Name) { \
|
2017-08-17 09:06:26 +00:00
|
|
|
AssertCustom(Namespace##Data != nullptr, #Namespace "Data != nullptr in " #Namespace "::Set" #Name); \
|
2016-02-08 14:54:55 +00:00
|
|
|
Namespace##Data->Name = Name; \
|
|
|
|
}
|
|
|
|
|
2016-03-18 19:05:08 +00:00
|
|
|
namespace Sandbox {
|
2016-04-11 10:59:01 +00:00
|
|
|
namespace internal {
|
2016-01-21 06:58:58 +00:00
|
|
|
|
2016-04-11 10:59:01 +00:00
|
|
|
struct Data {
|
|
|
|
QByteArray LastCrashDump;
|
2016-08-27 04:49:18 +00:00
|
|
|
ProxyData PreLaunchProxy;
|
2016-04-11 10:59:01 +00:00
|
|
|
};
|
2016-03-18 19:05:08 +00:00
|
|
|
|
2016-04-11 10:59:01 +00:00
|
|
|
} // namespace internal
|
|
|
|
} // namespace Sandbox
|
2016-03-18 19:05:08 +00:00
|
|
|
|
2017-04-06 16:49:42 +00:00
|
|
|
std::unique_ptr<Sandbox::internal::Data> SandboxData;
|
2016-02-15 15:52:11 +00:00
|
|
|
uint64 SandboxUserTag = 0;
|
2016-01-11 15:43:29 +00:00
|
|
|
|
2016-02-08 14:54:55 +00:00
|
|
|
namespace Sandbox {
|
2016-01-09 11:24:16 +00:00
|
|
|
|
2016-04-11 10:59:01 +00:00
|
|
|
bool CheckBetaVersionDir() {
|
|
|
|
QFile beta(cExeDir() + qsl("TelegramBeta_data/tdata/beta"));
|
|
|
|
if (cBetaVersion()) {
|
|
|
|
cForceWorkingDir(cExeDir() + qsl("TelegramBeta_data/"));
|
|
|
|
QDir().mkpath(cWorkingDir() + qstr("tdata"));
|
|
|
|
if (*BetaPrivateKey) {
|
|
|
|
cSetBetaPrivateKey(QByteArray(BetaPrivateKey));
|
|
|
|
}
|
|
|
|
if (beta.open(QIODevice::WriteOnly)) {
|
|
|
|
QDataStream dataStream(&beta);
|
|
|
|
dataStream.setVersion(QDataStream::Qt_5_3);
|
|
|
|
dataStream << quint64(cRealBetaVersion()) << cBetaPrivateKey();
|
|
|
|
} else {
|
|
|
|
LOG(("FATAL: Could not open '%1' for writing private key!").arg(beta.fileName()));
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
} else if (beta.exists()) {
|
|
|
|
cForceWorkingDir(cExeDir() + qsl("TelegramBeta_data/"));
|
|
|
|
if (beta.open(QIODevice::ReadOnly)) {
|
|
|
|
QDataStream dataStream(&beta);
|
|
|
|
dataStream.setVersion(QDataStream::Qt_5_3);
|
|
|
|
|
|
|
|
quint64 v;
|
|
|
|
QByteArray k;
|
|
|
|
dataStream >> v >> k;
|
|
|
|
if (dataStream.status() == QDataStream::Ok) {
|
|
|
|
cSetBetaVersion(qMax(v, AppVersion * 1000ULL));
|
|
|
|
cSetBetaPrivateKey(k);
|
|
|
|
cSetRealBetaVersion(v);
|
2016-01-11 15:43:29 +00:00
|
|
|
} else {
|
2016-04-11 10:59:01 +00:00
|
|
|
LOG(("FATAL: '%1' is corrupted, reinstall private beta!").arg(beta.fileName()));
|
2016-01-11 15:43:29 +00:00
|
|
|
return false;
|
|
|
|
}
|
2016-04-11 10:59:01 +00:00
|
|
|
} else {
|
|
|
|
LOG(("FATAL: could not open '%1' for reading private key!").arg(beta.fileName()));
|
|
|
|
return false;
|
2016-01-11 15:43:29 +00:00
|
|
|
}
|
|
|
|
}
|
2016-04-11 10:59:01 +00:00
|
|
|
return true;
|
|
|
|
}
|
2016-01-09 11:24:16 +00:00
|
|
|
|
2016-04-11 10:59:01 +00:00
|
|
|
void WorkingDirReady() {
|
|
|
|
if (QFile(cWorkingDir() + qsl("tdata/withtestmode")).exists()) {
|
|
|
|
cSetTestMode(true);
|
|
|
|
}
|
|
|
|
if (!cDebug() && QFile(cWorkingDir() + qsl("tdata/withdebug")).exists()) {
|
|
|
|
cSetDebug(true);
|
|
|
|
}
|
|
|
|
if (cBetaVersion()) {
|
2016-04-27 12:02:17 +00:00
|
|
|
cSetAlphaVersion(false);
|
|
|
|
} else if (!cAlphaVersion() && QFile(cWorkingDir() + qsl("tdata/devversion")).exists()) {
|
|
|
|
cSetAlphaVersion(true);
|
|
|
|
} else if (AppAlphaVersion) {
|
2016-04-11 10:59:01 +00:00
|
|
|
QFile f(cWorkingDir() + qsl("tdata/devversion"));
|
|
|
|
if (!f.exists() && f.open(QIODevice::WriteOnly)) {
|
|
|
|
f.write("1");
|
2016-01-11 15:43:29 +00:00
|
|
|
}
|
2016-04-11 10:59:01 +00:00
|
|
|
}
|
2016-02-15 15:52:11 +00:00
|
|
|
|
2016-04-11 10:59:01 +00:00
|
|
|
srand((int32)time(NULL));
|
2016-02-15 15:52:11 +00:00
|
|
|
|
2016-04-11 10:59:01 +00:00
|
|
|
SandboxUserTag = 0;
|
|
|
|
QFile usertag(cWorkingDir() + qsl("tdata/usertag"));
|
|
|
|
if (usertag.open(QIODevice::ReadOnly)) {
|
|
|
|
if (usertag.read(reinterpret_cast<char*>(&SandboxUserTag), sizeof(uint64)) != sizeof(uint64)) {
|
|
|
|
SandboxUserTag = 0;
|
2016-02-15 15:52:11 +00:00
|
|
|
}
|
2016-04-11 10:59:01 +00:00
|
|
|
usertag.close();
|
2016-01-11 15:43:29 +00:00
|
|
|
}
|
2016-04-11 10:59:01 +00:00
|
|
|
if (!SandboxUserTag) {
|
|
|
|
do {
|
|
|
|
memsetrnd_bad(SandboxUserTag);
|
|
|
|
} while (!SandboxUserTag);
|
2016-01-09 11:24:16 +00:00
|
|
|
|
2016-04-11 10:59:01 +00:00
|
|
|
if (usertag.open(QIODevice::WriteOnly)) {
|
|
|
|
usertag.write(reinterpret_cast<char*>(&SandboxUserTag), sizeof(uint64));
|
|
|
|
usertag.close();
|
2016-01-11 15:43:29 +00:00
|
|
|
}
|
2016-01-09 11:24:16 +00:00
|
|
|
}
|
2016-04-11 10:59:01 +00:00
|
|
|
}
|
2016-01-09 11:24:16 +00:00
|
|
|
|
2017-04-06 16:49:42 +00:00
|
|
|
object_ptr<SingleQueuedInvokation> MainThreadTaskHandler = { nullptr };
|
2016-12-23 13:21:01 +00:00
|
|
|
|
|
|
|
void MainThreadTaskAdded() {
|
|
|
|
if (!started()) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
MainThreadTaskHandler->call();
|
|
|
|
}
|
|
|
|
|
2016-04-11 10:59:01 +00:00
|
|
|
void start() {
|
2017-04-06 16:49:42 +00:00
|
|
|
MainThreadTaskHandler.create([] {
|
|
|
|
base::TaskQueue::ProcessMainTasks();
|
|
|
|
});
|
|
|
|
SandboxData = std::make_unique<internal::Data>();
|
2016-04-11 10:59:01 +00:00
|
|
|
}
|
2016-02-15 15:52:11 +00:00
|
|
|
|
2016-12-20 13:03:51 +00:00
|
|
|
bool started() {
|
|
|
|
return (SandboxData != nullptr);
|
|
|
|
}
|
|
|
|
|
2016-04-11 10:59:01 +00:00
|
|
|
void finish() {
|
2017-04-06 16:49:42 +00:00
|
|
|
SandboxData.reset();
|
2016-12-23 13:21:01 +00:00
|
|
|
MainThreadTaskHandler.destroy();
|
2016-04-11 10:59:01 +00:00
|
|
|
}
|
2016-01-11 15:43:29 +00:00
|
|
|
|
2016-04-11 10:59:01 +00:00
|
|
|
uint64 UserTag() {
|
|
|
|
return SandboxUserTag;
|
2016-01-11 15:43:29 +00:00
|
|
|
}
|
|
|
|
|
2016-04-11 10:59:01 +00:00
|
|
|
DefineVar(Sandbox, QByteArray, LastCrashDump);
|
2016-08-27 04:49:18 +00:00
|
|
|
DefineVar(Sandbox, ProxyData, PreLaunchProxy);
|
2016-04-11 10:59:01 +00:00
|
|
|
|
|
|
|
} // namespace Sandbox
|
|
|
|
|
2016-03-18 19:05:08 +00:00
|
|
|
namespace Global {
|
2016-04-11 10:59:01 +00:00
|
|
|
namespace internal {
|
2016-02-21 17:01:37 +00:00
|
|
|
|
2016-04-11 10:59:01 +00:00
|
|
|
struct Data {
|
2017-08-04 14:54:32 +00:00
|
|
|
SingleQueuedInvokation HandleHistoryUpdate = { [] { Messenger::Instance().call_handleHistoryUpdate(); } };
|
|
|
|
SingleQueuedInvokation HandleUnreadCounterUpdate = { [] { Messenger::Instance().call_handleUnreadCounterUpdate(); } };
|
|
|
|
SingleQueuedInvokation HandleDelayedPeerUpdates = { [] { Messenger::Instance().call_handleDelayedPeerUpdates(); } };
|
|
|
|
SingleQueuedInvokation HandleObservables = { [] { Messenger::Instance().call_handleObservables(); } };
|
2016-02-18 16:36:33 +00:00
|
|
|
|
2017-01-14 18:50:16 +00:00
|
|
|
Adaptive::WindowLayout AdaptiveWindowLayout = Adaptive::WindowLayout::Normal;
|
|
|
|
Adaptive::ChatLayout AdaptiveChatLayout = Adaptive::ChatLayout::Normal;
|
2016-04-11 10:59:01 +00:00
|
|
|
bool AdaptiveForWide = true;
|
2016-08-27 04:49:18 +00:00
|
|
|
base::Observable<void> AdaptiveChanged;
|
|
|
|
|
2016-04-11 10:59:01 +00:00
|
|
|
bool DialogsModeEnabled = false;
|
|
|
|
Dialogs::Mode DialogsMode = Dialogs::Mode::All;
|
2016-06-22 18:41:13 +00:00
|
|
|
bool ModerateModeEnabled = false;
|
2016-03-17 18:03:08 +00:00
|
|
|
|
2016-07-07 16:15:34 +00:00
|
|
|
bool ScreenIsLocked = false;
|
|
|
|
|
2016-04-11 10:59:01 +00:00
|
|
|
int32 DebugLoggingFlags = 0;
|
2016-03-18 19:05:08 +00:00
|
|
|
|
2016-10-12 19:34:25 +00:00
|
|
|
float64 RememberedSongVolume = kDefaultVolume;
|
2016-09-23 16:04:26 +00:00
|
|
|
float64 SongVolume = kDefaultVolume;
|
2016-10-12 19:34:25 +00:00
|
|
|
base::Observable<void> SongVolumeChanged;
|
2016-09-23 16:04:26 +00:00
|
|
|
float64 VideoVolume = kDefaultVolume;
|
2016-10-12 19:34:25 +00:00
|
|
|
base::Observable<void> VideoVolumeChanged;
|
2016-07-12 14:11:59 +00:00
|
|
|
|
2016-04-11 10:59:01 +00:00
|
|
|
// config
|
|
|
|
int32 ChatSizeMax = 200;
|
2017-07-14 06:46:57 +00:00
|
|
|
int32 MegagroupSizeMax = 10000;
|
2016-04-11 10:59:01 +00:00
|
|
|
int32 ForwardedCountMax = 100;
|
|
|
|
int32 OnlineUpdatePeriod = 120000;
|
|
|
|
int32 OfflineBlurTimeout = 5000;
|
|
|
|
int32 OfflineIdleTimeout = 30000;
|
|
|
|
int32 OnlineFocusTimeout = 1000;
|
|
|
|
int32 OnlineCloudTimeout = 300000;
|
|
|
|
int32 NotifyCloudDelay = 30000;
|
|
|
|
int32 NotifyDefaultDelay = 1500;
|
|
|
|
int32 ChatBigSize = 10;
|
|
|
|
int32 PushChatPeriod = 60000;
|
|
|
|
int32 PushChatLimit = 2;
|
|
|
|
int32 SavedGifsLimit = 200;
|
|
|
|
int32 EditTimeLimit = 172800;
|
2016-07-18 15:39:10 +00:00
|
|
|
int32 StickersRecentLimit = 30;
|
2017-08-02 15:07:28 +00:00
|
|
|
int32 StickersFavedLimit = 30; // TODO
|
2016-12-13 07:59:57 +00:00
|
|
|
int32 PinnedDialogsCountMax = 5;
|
2017-03-10 17:25:43 +00:00
|
|
|
QString InternalLinksDomain = qsl("https://t.me/");
|
2017-04-28 17:16:14 +00:00
|
|
|
int32 CallReceiveTimeoutMs = 20000;
|
|
|
|
int32 CallRingTimeoutMs = 90000;
|
|
|
|
int32 CallConnectTimeoutMs = 30000;
|
|
|
|
int32 CallPacketTimeoutMs = 10000;
|
|
|
|
bool PhoneCallsEnabled = true;
|
|
|
|
base::Observable<void> PhoneCallsEnabledChanged;
|
2016-04-11 10:59:01 +00:00
|
|
|
|
|
|
|
HiddenPinnedMessagesMap HiddenPinnedMessages;
|
|
|
|
|
|
|
|
PendingItemsMap PendingRepaintItems;
|
|
|
|
|
|
|
|
Stickers::Sets StickerSets;
|
|
|
|
Stickers::Order StickerSetsOrder;
|
2016-12-01 19:20:33 +00:00
|
|
|
TimeMs LastStickersUpdate = 0;
|
|
|
|
TimeMs LastRecentStickersUpdate = 0;
|
2017-08-02 15:07:28 +00:00
|
|
|
TimeMs LastFavedStickersUpdate = 0;
|
2016-06-27 16:25:21 +00:00
|
|
|
Stickers::Order FeaturedStickerSetsOrder;
|
2016-06-28 18:05:38 +00:00
|
|
|
int FeaturedStickerSetsUnreadCount = 0;
|
2016-11-22 09:48:13 +00:00
|
|
|
base::Observable<void> FeaturedStickerSetsUnreadCountChanged;
|
2016-12-01 19:20:33 +00:00
|
|
|
TimeMs LastFeaturedStickersUpdate = 0;
|
2016-07-21 13:57:31 +00:00
|
|
|
Stickers::Order ArchivedStickerSetsOrder;
|
2016-04-11 10:59:01 +00:00
|
|
|
|
|
|
|
CircleMasksMap CircleMasks;
|
2016-08-27 04:49:18 +00:00
|
|
|
|
|
|
|
base::Observable<void> SelfChanged;
|
|
|
|
|
|
|
|
bool AskDownloadPath = false;
|
|
|
|
QString DownloadPath;
|
|
|
|
QByteArray DownloadPathBookmark;
|
|
|
|
base::Observable<void> DownloadPathChanged;
|
|
|
|
|
|
|
|
bool SoundNotify = true;
|
|
|
|
bool DesktopNotify = true;
|
|
|
|
bool RestoreSoundNotifyFromTray = false;
|
|
|
|
bool IncludeMuted = true;
|
|
|
|
DBINotifyView NotifyView = dbinvShowPreview;
|
2016-10-03 15:07:50 +00:00
|
|
|
bool NativeNotifications = false;
|
2016-10-06 16:41:09 +00:00
|
|
|
int NotificationsCount = 3;
|
|
|
|
Notify::ScreenCorner NotificationsCorner = Notify::ScreenCorner::BottomRight;
|
|
|
|
bool NotificationsDemoIsShown = false;
|
2016-08-27 04:49:18 +00:00
|
|
|
|
|
|
|
DBIConnectionType ConnectionType = dbictAuto;
|
2017-06-27 22:03:37 +00:00
|
|
|
DBIConnectionType LastProxyType = dbictAuto;
|
2016-08-27 04:49:18 +00:00
|
|
|
bool TryIPv6 = (cPlatform() == dbipWindows) ? false : true;
|
|
|
|
ProxyData ConnectionProxy;
|
|
|
|
base::Observable<void> ConnectionTypeChanged;
|
2016-08-27 17:52:05 +00:00
|
|
|
|
2016-08-28 19:16:23 +00:00
|
|
|
int AutoLock = 3600;
|
|
|
|
bool LocalPasscode = false;
|
|
|
|
base::Observable<void> LocalPasscodeChanged;
|
|
|
|
|
2017-03-04 19:36:59 +00:00
|
|
|
base::Variable<DBIWorkMode> WorkMode = { dbiwmWindowAndTray };
|
|
|
|
|
2016-10-14 17:10:15 +00:00
|
|
|
base::Observable<HistoryItem*> ItemRemoved;
|
2016-11-06 17:23:13 +00:00
|
|
|
base::Observable<void> UnreadCounterUpdate;
|
|
|
|
base::Observable<void> PeerChooseCancel;
|
2016-10-14 17:10:15 +00:00
|
|
|
|
2016-04-11 10:59:01 +00:00
|
|
|
};
|
2016-03-18 19:05:08 +00:00
|
|
|
|
2016-04-11 10:59:01 +00:00
|
|
|
} // namespace internal
|
|
|
|
} // namespace Global
|
2016-03-18 19:05:08 +00:00
|
|
|
|
2016-04-11 10:59:01 +00:00
|
|
|
Global::internal::Data *GlobalData = nullptr;
|
2016-03-18 19:05:08 +00:00
|
|
|
|
2016-04-11 10:59:01 +00:00
|
|
|
namespace Global {
|
2016-03-19 16:55:15 +00:00
|
|
|
|
2016-04-11 10:59:01 +00:00
|
|
|
bool started() {
|
|
|
|
return GlobalData != nullptr;
|
|
|
|
}
|
2016-03-19 16:55:15 +00:00
|
|
|
|
2016-04-11 10:59:01 +00:00
|
|
|
void start() {
|
|
|
|
GlobalData = new internal::Data();
|
2016-03-18 19:05:08 +00:00
|
|
|
}
|
|
|
|
|
2016-04-11 10:59:01 +00:00
|
|
|
void finish() {
|
|
|
|
delete GlobalData;
|
|
|
|
GlobalData = nullptr;
|
|
|
|
}
|
2016-01-11 15:43:29 +00:00
|
|
|
|
2017-04-06 16:49:42 +00:00
|
|
|
DefineRefVar(Global, SingleQueuedInvokation, HandleHistoryUpdate);
|
|
|
|
DefineRefVar(Global, SingleQueuedInvokation, HandleUnreadCounterUpdate);
|
|
|
|
DefineRefVar(Global, SingleQueuedInvokation, HandleDelayedPeerUpdates);
|
|
|
|
DefineRefVar(Global, SingleQueuedInvokation, HandleObservables);
|
2016-01-11 15:43:29 +00:00
|
|
|
|
2017-01-14 18:50:16 +00:00
|
|
|
DefineVar(Global, Adaptive::WindowLayout, AdaptiveWindowLayout);
|
|
|
|
DefineVar(Global, Adaptive::ChatLayout, AdaptiveChatLayout);
|
2016-04-11 10:59:01 +00:00
|
|
|
DefineVar(Global, bool, AdaptiveForWide);
|
2016-08-27 04:49:18 +00:00
|
|
|
DefineRefVar(Global, base::Observable<void>, AdaptiveChanged);
|
|
|
|
|
2016-04-11 10:59:01 +00:00
|
|
|
DefineVar(Global, bool, DialogsModeEnabled);
|
|
|
|
DefineVar(Global, Dialogs::Mode, DialogsMode);
|
2016-06-22 18:41:13 +00:00
|
|
|
DefineVar(Global, bool, ModerateModeEnabled);
|
2016-01-30 16:31:10 +00:00
|
|
|
|
2016-07-07 16:15:34 +00:00
|
|
|
DefineVar(Global, bool, ScreenIsLocked);
|
|
|
|
|
2016-04-11 10:59:01 +00:00
|
|
|
DefineVar(Global, int32, DebugLoggingFlags);
|
2016-01-11 15:43:29 +00:00
|
|
|
|
2016-10-12 19:34:25 +00:00
|
|
|
DefineVar(Global, float64, RememberedSongVolume);
|
2016-07-12 14:11:59 +00:00
|
|
|
DefineVar(Global, float64, SongVolume);
|
2016-10-12 19:34:25 +00:00
|
|
|
DefineRefVar(Global, base::Observable<void>, SongVolumeChanged);
|
2016-07-12 14:11:59 +00:00
|
|
|
DefineVar(Global, float64, VideoVolume);
|
2016-10-12 19:34:25 +00:00
|
|
|
DefineRefVar(Global, base::Observable<void>, VideoVolumeChanged);
|
2016-07-12 14:11:59 +00:00
|
|
|
|
2016-04-11 10:59:01 +00:00
|
|
|
// config
|
|
|
|
DefineVar(Global, int32, ChatSizeMax);
|
|
|
|
DefineVar(Global, int32, MegagroupSizeMax);
|
|
|
|
DefineVar(Global, int32, ForwardedCountMax);
|
|
|
|
DefineVar(Global, int32, OnlineUpdatePeriod);
|
|
|
|
DefineVar(Global, int32, OfflineBlurTimeout);
|
|
|
|
DefineVar(Global, int32, OfflineIdleTimeout);
|
|
|
|
DefineVar(Global, int32, OnlineFocusTimeout);
|
|
|
|
DefineVar(Global, int32, OnlineCloudTimeout);
|
|
|
|
DefineVar(Global, int32, NotifyCloudDelay);
|
|
|
|
DefineVar(Global, int32, NotifyDefaultDelay);
|
|
|
|
DefineVar(Global, int32, ChatBigSize);
|
|
|
|
DefineVar(Global, int32, PushChatPeriod);
|
|
|
|
DefineVar(Global, int32, PushChatLimit);
|
|
|
|
DefineVar(Global, int32, SavedGifsLimit);
|
|
|
|
DefineVar(Global, int32, EditTimeLimit);
|
2016-07-18 15:39:10 +00:00
|
|
|
DefineVar(Global, int32, StickersRecentLimit);
|
2017-08-02 15:07:28 +00:00
|
|
|
DefineVar(Global, int32, StickersFavedLimit);
|
2016-12-13 07:59:57 +00:00
|
|
|
DefineVar(Global, int32, PinnedDialogsCountMax);
|
2017-03-10 17:25:43 +00:00
|
|
|
DefineVar(Global, QString, InternalLinksDomain);
|
2017-04-28 17:16:14 +00:00
|
|
|
DefineVar(Global, int32, CallReceiveTimeoutMs);
|
|
|
|
DefineVar(Global, int32, CallRingTimeoutMs);
|
|
|
|
DefineVar(Global, int32, CallConnectTimeoutMs);
|
|
|
|
DefineVar(Global, int32, CallPacketTimeoutMs);
|
|
|
|
DefineVar(Global, bool, PhoneCallsEnabled);
|
|
|
|
DefineRefVar(Global, base::Observable<void>, PhoneCallsEnabledChanged);
|
2016-01-11 15:43:29 +00:00
|
|
|
|
2016-04-11 10:59:01 +00:00
|
|
|
DefineVar(Global, HiddenPinnedMessagesMap, HiddenPinnedMessages);
|
2016-01-11 15:43:29 +00:00
|
|
|
|
2016-04-11 10:59:01 +00:00
|
|
|
DefineRefVar(Global, PendingItemsMap, PendingRepaintItems);
|
2016-02-21 17:01:37 +00:00
|
|
|
|
2016-04-11 10:59:01 +00:00
|
|
|
DefineVar(Global, Stickers::Sets, StickerSets);
|
|
|
|
DefineVar(Global, Stickers::Order, StickerSetsOrder);
|
2016-12-01 19:20:33 +00:00
|
|
|
DefineVar(Global, TimeMs, LastStickersUpdate);
|
|
|
|
DefineVar(Global, TimeMs, LastRecentStickersUpdate);
|
2017-08-02 15:07:28 +00:00
|
|
|
DefineVar(Global, TimeMs, LastFavedStickersUpdate);
|
2016-06-27 16:25:21 +00:00
|
|
|
DefineVar(Global, Stickers::Order, FeaturedStickerSetsOrder);
|
2016-06-28 18:05:38 +00:00
|
|
|
DefineVar(Global, int, FeaturedStickerSetsUnreadCount);
|
2016-11-22 09:48:13 +00:00
|
|
|
DefineRefVar(Global, base::Observable<void>, FeaturedStickerSetsUnreadCountChanged);
|
2016-12-01 19:20:33 +00:00
|
|
|
DefineVar(Global, TimeMs, LastFeaturedStickersUpdate);
|
2016-07-21 13:57:31 +00:00
|
|
|
DefineVar(Global, Stickers::Order, ArchivedStickerSetsOrder);
|
2016-01-09 11:24:16 +00:00
|
|
|
|
2016-04-11 10:59:01 +00:00
|
|
|
DefineRefVar(Global, CircleMasksMap, CircleMasks);
|
2016-03-18 10:18:30 +00:00
|
|
|
|
2016-08-27 04:49:18 +00:00
|
|
|
DefineRefVar(Global, base::Observable<void>, SelfChanged);
|
|
|
|
|
|
|
|
DefineVar(Global, bool, AskDownloadPath);
|
|
|
|
DefineVar(Global, QString, DownloadPath);
|
|
|
|
DefineVar(Global, QByteArray, DownloadPathBookmark);
|
|
|
|
DefineRefVar(Global, base::Observable<void>, DownloadPathChanged);
|
|
|
|
|
|
|
|
DefineVar(Global, bool, SoundNotify);
|
|
|
|
DefineVar(Global, bool, DesktopNotify);
|
|
|
|
DefineVar(Global, bool, RestoreSoundNotifyFromTray);
|
|
|
|
DefineVar(Global, bool, IncludeMuted);
|
|
|
|
DefineVar(Global, DBINotifyView, NotifyView);
|
2016-10-03 15:07:50 +00:00
|
|
|
DefineVar(Global, bool, NativeNotifications);
|
2016-10-06 16:41:09 +00:00
|
|
|
DefineVar(Global, int, NotificationsCount);
|
|
|
|
DefineVar(Global, Notify::ScreenCorner, NotificationsCorner);
|
|
|
|
DefineVar(Global, bool, NotificationsDemoIsShown);
|
2016-08-27 04:49:18 +00:00
|
|
|
|
|
|
|
DefineVar(Global, DBIConnectionType, ConnectionType);
|
2017-06-27 22:03:37 +00:00
|
|
|
DefineVar(Global, DBIConnectionType, LastProxyType);
|
2016-08-27 04:49:18 +00:00
|
|
|
DefineVar(Global, bool, TryIPv6);
|
|
|
|
DefineVar(Global, ProxyData, ConnectionProxy);
|
|
|
|
DefineRefVar(Global, base::Observable<void>, ConnectionTypeChanged);
|
|
|
|
|
2016-08-28 19:16:23 +00:00
|
|
|
DefineVar(Global, int, AutoLock);
|
|
|
|
DefineVar(Global, bool, LocalPasscode);
|
|
|
|
DefineRefVar(Global, base::Observable<void>, LocalPasscodeChanged);
|
|
|
|
|
2017-03-04 19:36:59 +00:00
|
|
|
DefineRefVar(Global, base::Variable<DBIWorkMode>, WorkMode);
|
|
|
|
|
2016-10-14 17:10:15 +00:00
|
|
|
DefineRefVar(Global, base::Observable<HistoryItem*>, ItemRemoved);
|
2016-11-06 17:23:13 +00:00
|
|
|
DefineRefVar(Global, base::Observable<void>, UnreadCounterUpdate);
|
|
|
|
DefineRefVar(Global, base::Observable<void>, PeerChooseCancel);
|
2016-10-14 17:10:15 +00:00
|
|
|
|
2016-04-11 10:59:01 +00:00
|
|
|
} // namespace Global
|