mirror of https://github.com/procxx/kepka.git
Allow fix chats order and auto switch (support).
This commit is contained in:
parent
29432d5d6a
commit
25cefc6eab
|
@ -23,6 +23,8 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||||
#include "window/section_widget.h"
|
#include "window/section_widget.h"
|
||||||
#include "chat_helpers/tabbed_selector.h"
|
#include "chat_helpers/tabbed_selector.h"
|
||||||
#include "boxes/send_files_box.h"
|
#include "boxes/send_files_box.h"
|
||||||
|
#include "ui/widgets/input_fields.h"
|
||||||
|
#include "support/support_common.h"
|
||||||
#include "observer_peer.h"
|
#include "observer_peer.h"
|
||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
|
@ -35,7 +37,9 @@ AuthSessionSettings::Variables::Variables()
|
||||||
: sendFilesWay(SendFilesWay::Album)
|
: sendFilesWay(SendFilesWay::Album)
|
||||||
, selectorTab(ChatHelpers::SelectorTab::Emoji)
|
, selectorTab(ChatHelpers::SelectorTab::Emoji)
|
||||||
, floatPlayerColumn(Window::Column::Second)
|
, floatPlayerColumn(Window::Column::Second)
|
||||||
, floatPlayerCorner(RectPart::TopRight) {
|
, floatPlayerCorner(RectPart::TopRight)
|
||||||
|
, sendSubmitWay(Ui::InputSubmitSettings::Enter)
|
||||||
|
, supportSwitch(Support::SwitchSettings::None) {
|
||||||
}
|
}
|
||||||
|
|
||||||
QByteArray AuthSessionSettings::serialize() const {
|
QByteArray AuthSessionSettings::serialize() const {
|
||||||
|
@ -74,6 +78,9 @@ QByteArray AuthSessionSettings::serialize() const {
|
||||||
stream << qint32(_variables.thirdSectionExtendedBy);
|
stream << qint32(_variables.thirdSectionExtendedBy);
|
||||||
stream << qint32(_variables.sendFilesWay);
|
stream << qint32(_variables.sendFilesWay);
|
||||||
stream << qint32(_variables.callsPeerToPeer.current());
|
stream << qint32(_variables.callsPeerToPeer.current());
|
||||||
|
stream << qint32(_variables.sendSubmitWay);
|
||||||
|
stream << qint32(_variables.supportSwitch);
|
||||||
|
stream << qint32(_variables.supportFixChatsOrder ? 1 : 0);
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
@ -100,6 +107,10 @@ void AuthSessionSettings::constructFromSerialized(const QByteArray &serialized)
|
||||||
int thirdSectionExtendedBy = _variables.thirdSectionExtendedBy;
|
int thirdSectionExtendedBy = _variables.thirdSectionExtendedBy;
|
||||||
qint32 sendFilesWay = static_cast<qint32>(_variables.sendFilesWay);
|
qint32 sendFilesWay = static_cast<qint32>(_variables.sendFilesWay);
|
||||||
qint32 callsPeerToPeer = qint32(_variables.callsPeerToPeer.current());
|
qint32 callsPeerToPeer = qint32(_variables.callsPeerToPeer.current());
|
||||||
|
qint32 sendSubmitWay = static_cast<qint32>(_variables.sendSubmitWay);
|
||||||
|
qint32 supportSwitch = static_cast<qint32>(_variables.supportSwitch);
|
||||||
|
qint32 supportFixChatsOrder = _variables.supportFixChatsOrder ? 1 : 0;
|
||||||
|
|
||||||
stream >> selectorTab;
|
stream >> selectorTab;
|
||||||
stream >> lastSeenWarningSeen;
|
stream >> lastSeenWarningSeen;
|
||||||
if (!stream.atEnd()) {
|
if (!stream.atEnd()) {
|
||||||
|
@ -154,6 +165,11 @@ void AuthSessionSettings::constructFromSerialized(const QByteArray &serialized)
|
||||||
if (!stream.atEnd()) {
|
if (!stream.atEnd()) {
|
||||||
stream >> callsPeerToPeer;
|
stream >> callsPeerToPeer;
|
||||||
}
|
}
|
||||||
|
if (!stream.atEnd()) {
|
||||||
|
stream >> sendSubmitWay;
|
||||||
|
stream >> supportSwitch;
|
||||||
|
stream >> supportFixChatsOrder;
|
||||||
|
}
|
||||||
if (stream.status() != QDataStream::Ok) {
|
if (stream.status() != QDataStream::Ok) {
|
||||||
LOG(("App Error: "
|
LOG(("App Error: "
|
||||||
"Bad data for AuthSessionSettings::constructFromSerialized()"));
|
"Bad data for AuthSessionSettings::constructFromSerialized()"));
|
||||||
|
@ -206,6 +222,20 @@ void AuthSessionSettings::constructFromSerialized(const QByteArray &serialized)
|
||||||
case Calls::PeerToPeer::Contacts:
|
case Calls::PeerToPeer::Contacts:
|
||||||
case Calls::PeerToPeer::Nobody: _variables.callsPeerToPeer = uncheckedCallsPeerToPeer; break;
|
case Calls::PeerToPeer::Nobody: _variables.callsPeerToPeer = uncheckedCallsPeerToPeer; break;
|
||||||
}
|
}
|
||||||
|
auto uncheckedSendSubmitWay = static_cast<Ui::InputSubmitSettings>(
|
||||||
|
sendSubmitWay);
|
||||||
|
switch (uncheckedSendSubmitWay) {
|
||||||
|
case Ui::InputSubmitSettings::Enter:
|
||||||
|
case Ui::InputSubmitSettings::CtrlEnter: _variables.sendSubmitWay = uncheckedSendSubmitWay; break;
|
||||||
|
}
|
||||||
|
auto uncheckedSupportSwitch = static_cast<Support::SwitchSettings>(
|
||||||
|
supportSwitch);
|
||||||
|
switch (uncheckedSupportSwitch) {
|
||||||
|
case Support::SwitchSettings::None:
|
||||||
|
case Support::SwitchSettings::Next:
|
||||||
|
case Support::SwitchSettings::Previous: _variables.supportSwitch = uncheckedSupportSwitch; break;
|
||||||
|
}
|
||||||
|
_variables.supportFixChatsOrder = (supportFixChatsOrder ? 1 : 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
void AuthSessionSettings::setTabbedSelectorSectionEnabled(bool enabled) {
|
void AuthSessionSettings::setTabbedSelectorSectionEnabled(bool enabled) {
|
||||||
|
@ -392,8 +422,8 @@ void AuthSession::checkAutoLockIn(TimeMs time) {
|
||||||
}
|
}
|
||||||
|
|
||||||
bool AuthSession::supportMode() const {
|
bool AuthSession::supportMode() const {
|
||||||
// return true; AssertIsDebug();
|
return true; AssertIsDebug();
|
||||||
return false;
|
return _user->phone().startsWith(qstr("424"));
|
||||||
}
|
}
|
||||||
|
|
||||||
AuthSession::~AuthSession() = default;
|
AuthSession::~AuthSession() = default;
|
||||||
|
|
|
@ -15,6 +15,14 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||||
class ApiWrap;
|
class ApiWrap;
|
||||||
enum class SendFilesWay;
|
enum class SendFilesWay;
|
||||||
|
|
||||||
|
namespace Ui {
|
||||||
|
enum class InputSubmitSettings;
|
||||||
|
} // namespace Ui
|
||||||
|
|
||||||
|
namespace Support {
|
||||||
|
enum class SwitchSettings;
|
||||||
|
} // namespace Support
|
||||||
|
|
||||||
namespace Data {
|
namespace Data {
|
||||||
class Session;
|
class Session;
|
||||||
} // namespace Data
|
} // namespace Data
|
||||||
|
@ -68,6 +76,26 @@ public:
|
||||||
SendFilesWay sendFilesWay() const {
|
SendFilesWay sendFilesWay() const {
|
||||||
return _variables.sendFilesWay;
|
return _variables.sendFilesWay;
|
||||||
}
|
}
|
||||||
|
void setSendSubmitWay(Ui::InputSubmitSettings value) {
|
||||||
|
_variables.sendSubmitWay = value;
|
||||||
|
}
|
||||||
|
Ui::InputSubmitSettings sendSubmitWay() const {
|
||||||
|
return _variables.sendSubmitWay;
|
||||||
|
}
|
||||||
|
|
||||||
|
void setSupportSwitch(Support::SwitchSettings value) {
|
||||||
|
_variables.supportSwitch = value;
|
||||||
|
}
|
||||||
|
Support::SwitchSettings supportSwitch() const {
|
||||||
|
return _variables.supportSwitch;
|
||||||
|
}
|
||||||
|
void setSupportFixChatsOrder(bool fix) {
|
||||||
|
_variables.supportFixChatsOrder = fix;
|
||||||
|
}
|
||||||
|
bool supportFixChatsOrder() const {
|
||||||
|
return _variables.supportFixChatsOrder;
|
||||||
|
}
|
||||||
|
|
||||||
ChatHelpers::SelectorTab selectorTab() const {
|
ChatHelpers::SelectorTab selectorTab() const {
|
||||||
return _variables.selectorTab;
|
return _variables.selectorTab;
|
||||||
}
|
}
|
||||||
|
@ -183,6 +211,10 @@ private:
|
||||||
= kDefaultThirdColumnWidth; // per-window
|
= kDefaultThirdColumnWidth; // per-window
|
||||||
rpl::variable<Calls::PeerToPeer> callsPeerToPeer
|
rpl::variable<Calls::PeerToPeer> callsPeerToPeer
|
||||||
= Calls::PeerToPeer();
|
= Calls::PeerToPeer();
|
||||||
|
Ui::InputSubmitSettings sendSubmitWay;
|
||||||
|
|
||||||
|
Support::SwitchSettings supportSwitch;
|
||||||
|
bool supportFixChatsOrder = true;
|
||||||
};
|
};
|
||||||
|
|
||||||
rpl::event_stream<bool> _thirdSectionInfoEnabledValue;
|
rpl::event_stream<bool> _thirdSectionInfoEnabledValue;
|
||||||
|
|
|
@ -344,11 +344,6 @@ protected:
|
||||||
QString translitRusEng(const QString &rus);
|
QString translitRusEng(const QString &rus);
|
||||||
QString rusKeyboardLayoutSwitch(const QString &from);
|
QString rusKeyboardLayoutSwitch(const QString &from);
|
||||||
|
|
||||||
enum DBISendKey {
|
|
||||||
dbiskEnter = 0,
|
|
||||||
dbiskCtrlEnter = 1,
|
|
||||||
};
|
|
||||||
|
|
||||||
enum DBINotifyView {
|
enum DBINotifyView {
|
||||||
dbinvShowPreview = 0,
|
dbinvShowPreview = 0,
|
||||||
dbinvShowName = 1,
|
dbinvShowName = 1,
|
||||||
|
|
|
@ -10,6 +10,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||||
#include "dialogs/dialogs_key.h"
|
#include "dialogs/dialogs_key.h"
|
||||||
#include "dialogs/dialogs_indexed_list.h"
|
#include "dialogs/dialogs_indexed_list.h"
|
||||||
#include "mainwidget.h"
|
#include "mainwidget.h"
|
||||||
|
#include "auth_session.h"
|
||||||
#include "styles/style_dialogs.h"
|
#include "styles/style_dialogs.h"
|
||||||
#include "history/history_item.h"
|
#include "history/history_item.h"
|
||||||
#include "history/history.h"
|
#include "history/history.h"
|
||||||
|
@ -69,6 +70,11 @@ bool Entry::needUpdateInChatList() const {
|
||||||
}
|
}
|
||||||
|
|
||||||
void Entry::updateChatListSortPosition() {
|
void Entry::updateChatListSortPosition() {
|
||||||
|
if (Auth().supportMode()
|
||||||
|
&& _sortKeyInChatList != 0
|
||||||
|
&& Auth().settings().supportFixChatsOrder()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
_sortKeyInChatList = useProxyPromotion()
|
_sortKeyInChatList = useProxyPromotion()
|
||||||
? ProxyPromotedDialogPos()
|
? ProxyPromotedDialogPos()
|
||||||
: isPinnedDialog()
|
: isPinnedDialog()
|
||||||
|
|
|
@ -69,6 +69,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||||
#include "inline_bots/inline_results_widget.h"
|
#include "inline_bots/inline_results_widget.h"
|
||||||
#include "chat_helpers/emoji_suggestions_widget.h"
|
#include "chat_helpers/emoji_suggestions_widget.h"
|
||||||
#include "core/crash_reports.h"
|
#include "core/crash_reports.h"
|
||||||
|
#include "support/support_common.h"
|
||||||
#include "dialogs/dialogs_key.h"
|
#include "dialogs/dialogs_key.h"
|
||||||
#include "styles/style_history.h"
|
#include "styles/style_history.h"
|
||||||
#include "styles/style_dialogs.h"
|
#include "styles/style_dialogs.h"
|
||||||
|
@ -753,6 +754,7 @@ HistoryWidget::HistoryWidget(
|
||||||
if (cancelReply(lastKeyboardUsed) && !options.clearDraft) {
|
if (cancelReply(lastKeyboardUsed) && !options.clearDraft) {
|
||||||
onCloudDraftSave();
|
onCloudDraftSave();
|
||||||
}
|
}
|
||||||
|
handleSupportSwitch(options.history);
|
||||||
}, lifetime());
|
}, lifetime());
|
||||||
|
|
||||||
orderWidgets();
|
orderWidgets();
|
||||||
|
@ -1958,12 +1960,9 @@ void HistoryWidget::clearAllLoadRequests() {
|
||||||
}
|
}
|
||||||
|
|
||||||
void HistoryWidget::updateFieldSubmitSettings() {
|
void HistoryWidget::updateFieldSubmitSettings() {
|
||||||
auto settings = Ui::InputField::SubmitSettings::Enter;
|
const auto settings = _isInlineBot
|
||||||
if (_isInlineBot) {
|
? Ui::InputField::SubmitSettings::None
|
||||||
settings = Ui::InputField::SubmitSettings::None;
|
: Auth().settings().sendSubmitWay();
|
||||||
} else if (cCtrlEnter()) {
|
|
||||||
settings = Ui::InputField::SubmitSettings::CtrlEnter;
|
|
||||||
}
|
|
||||||
_field->setSubmitSettings(settings);
|
_field->setSubmitSettings(settings);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3682,6 +3681,15 @@ bool HistoryWidget::hasSilentToggle() const {
|
||||||
&& !Auth().data().notifySilentPostsUnknown(_peer);
|
&& !Auth().data().notifySilentPostsUnknown(_peer);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void HistoryWidget::handleSupportSwitch(not_null<History*> updated) {
|
||||||
|
if (_history != updated || !Auth().supportMode()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
crl::on_main(this, [to = Auth().settings().supportSwitch()] {
|
||||||
|
Support::PerformSwitch(to);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
void HistoryWidget::inlineBotResolveDone(
|
void HistoryWidget::inlineBotResolveDone(
|
||||||
const MTPcontacts_ResolvedPeer &result) {
|
const MTPcontacts_ResolvedPeer &result) {
|
||||||
Expects(result.type() == mtpc_contacts_resolvedPeer);
|
Expects(result.type() == mtpc_contacts_resolvedPeer);
|
||||||
|
|
|
@ -738,6 +738,8 @@ private:
|
||||||
bool readyToForward() const;
|
bool readyToForward() const;
|
||||||
bool hasSilentToggle() const;
|
bool hasSilentToggle() const;
|
||||||
|
|
||||||
|
void handleSupportSwitch(not_null<History*> updated);
|
||||||
|
|
||||||
PeerData *_peer = nullptr;
|
PeerData *_peer = nullptr;
|
||||||
|
|
||||||
ChannelId _channel = NoChannel;
|
ChannelId _channel = NoChannel;
|
||||||
|
|
|
@ -40,8 +40,6 @@ int32 gLastUpdateCheck = 0;
|
||||||
bool gNoStartUpdate = false;
|
bool gNoStartUpdate = false;
|
||||||
bool gStartToSettings = false;
|
bool gStartToSettings = false;
|
||||||
|
|
||||||
bool gCtrlEnter = false;
|
|
||||||
|
|
||||||
uint32 gConnectionsInSession = 1;
|
uint32 gConnectionsInSession = 1;
|
||||||
QString gLoggedPhoneNumber;
|
QString gLoggedPhoneNumber;
|
||||||
|
|
||||||
|
|
|
@ -64,7 +64,6 @@ DeclareSetting(QString, DialogHelperPath);
|
||||||
inline const QString &cDialogHelperPathFinal() {
|
inline const QString &cDialogHelperPathFinal() {
|
||||||
return cDialogHelperPath().isEmpty() ? cExeDir() : cDialogHelperPath();
|
return cDialogHelperPath().isEmpty() ? cExeDir() : cDialogHelperPath();
|
||||||
}
|
}
|
||||||
DeclareSetting(bool, CtrlEnter);
|
|
||||||
|
|
||||||
DeclareSetting(bool, AutoUpdate);
|
DeclareSetting(bool, AutoUpdate);
|
||||||
|
|
||||||
|
|
|
@ -15,6 +15,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||||
#include "boxes/local_storage_box.h"
|
#include "boxes/local_storage_box.h"
|
||||||
#include "ui/wrap/vertical_layout.h"
|
#include "ui/wrap/vertical_layout.h"
|
||||||
#include "ui/wrap/slide_wrap.h"
|
#include "ui/wrap/slide_wrap.h"
|
||||||
|
#include "ui/widgets/input_fields.h"
|
||||||
#include "ui/widgets/checkbox.h"
|
#include "ui/widgets/checkbox.h"
|
||||||
#include "ui/widgets/labels.h"
|
#include "ui/widgets/labels.h"
|
||||||
#include "ui/effects/radial_animation.h"
|
#include "ui/effects/radial_animation.h"
|
||||||
|
@ -25,6 +26,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||||
#include "storage/localstorage.h"
|
#include "storage/localstorage.h"
|
||||||
#include "core/file_utilities.h"
|
#include "core/file_utilities.h"
|
||||||
#include "data/data_session.h"
|
#include "data/data_session.h"
|
||||||
|
#include "support/support_common.h"
|
||||||
#include "auth_session.h"
|
#include "auth_session.h"
|
||||||
#include "mainwidget.h"
|
#include "mainwidget.h"
|
||||||
#include "styles/style_settings.h"
|
#include "styles/style_settings.h"
|
||||||
|
@ -491,14 +493,9 @@ void SetupMessages(not_null<Ui::VerticalLayout*> container) {
|
||||||
|
|
||||||
AddSkip(container, st::settingsSendTypeSkip);
|
AddSkip(container, st::settingsSendTypeSkip);
|
||||||
|
|
||||||
enum class SendByType {
|
using SendByType = Ui::InputSubmitSettings;
|
||||||
Enter,
|
|
||||||
CtrlEnter,
|
|
||||||
};
|
|
||||||
|
|
||||||
const auto skip = st::settingsSendTypeSkip;
|
const auto skip = st::settingsSendTypeSkip;
|
||||||
const auto group = std::make_shared<Ui::RadioenumGroup<SendByType>>(
|
|
||||||
cCtrlEnter() ? SendByType::CtrlEnter : SendByType::Enter);
|
|
||||||
auto wrap = object_ptr<Ui::VerticalLayout>(container);
|
auto wrap = object_ptr<Ui::VerticalLayout>(container);
|
||||||
const auto inner = wrap.data();
|
const auto inner = wrap.data();
|
||||||
container->add(
|
container->add(
|
||||||
|
@ -507,10 +504,9 @@ void SetupMessages(not_null<Ui::VerticalLayout*> container) {
|
||||||
std::move(wrap),
|
std::move(wrap),
|
||||||
QMargins(0, skip, 0, skip)));
|
QMargins(0, skip, 0, skip)));
|
||||||
|
|
||||||
const auto add = [&](
|
const auto group = std::make_shared<Ui::RadioenumGroup<SendByType>>(
|
||||||
SendByType value,
|
Auth().settings().sendSubmitWay());
|
||||||
LangKey key,
|
const auto add = [&](SendByType value, LangKey key) {
|
||||||
style::margins padding) {
|
|
||||||
inner->add(
|
inner->add(
|
||||||
object_ptr<Ui::Radioenum<SendByType>>(
|
object_ptr<Ui::Radioenum<SendByType>>(
|
||||||
inner,
|
inner,
|
||||||
|
@ -522,18 +518,15 @@ void SetupMessages(not_null<Ui::VerticalLayout*> container) {
|
||||||
};
|
};
|
||||||
const auto small = st::settingsSendTypePadding;
|
const auto small = st::settingsSendTypePadding;
|
||||||
const auto top = skip;
|
const auto top = skip;
|
||||||
add(
|
add(SendByType::Enter, lng_settings_send_enter);
|
||||||
SendByType::Enter,
|
|
||||||
lng_settings_send_enter,
|
|
||||||
{ small.left(), small.top() + top, small.right(), small.bottom() });
|
|
||||||
add(
|
add(
|
||||||
SendByType::CtrlEnter,
|
SendByType::CtrlEnter,
|
||||||
((cPlatform() == dbipMac || cPlatform() == dbipMacOld)
|
((cPlatform() == dbipMac || cPlatform() == dbipMacOld)
|
||||||
? lng_settings_send_cmdenter
|
? lng_settings_send_cmdenter
|
||||||
: lng_settings_send_ctrlenter),
|
: lng_settings_send_ctrlenter));
|
||||||
{ small.left(), small.top(), small.right(), small.bottom() + top });
|
|
||||||
group->setChangedCallback([](SendByType value) {
|
group->setChangedCallback([](SendByType value) {
|
||||||
cSetCtrlEnter(value == SendByType::CtrlEnter);
|
Auth().settings().setSendSubmitWay(value);
|
||||||
if (App::main()) {
|
if (App::main()) {
|
||||||
App::main()->ctrlEnterSubmitUpdated();
|
App::main()->ctrlEnterSubmitUpdated();
|
||||||
}
|
}
|
||||||
|
@ -912,6 +905,65 @@ void SetupThemeOptions(not_null<Ui::VerticalLayout*> container) {
|
||||||
AddSkip(container);
|
AddSkip(container);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void SetupSupport(not_null<Ui::VerticalLayout*> container) {
|
||||||
|
AddDivider(container);
|
||||||
|
AddSkip(container);
|
||||||
|
|
||||||
|
AddSubsectionTitle(container, rpl::single(qsl("Support settings")));
|
||||||
|
|
||||||
|
AddSkip(container, st::settingsSendTypeSkip);
|
||||||
|
|
||||||
|
using SwitchType = Support::SwitchSettings;
|
||||||
|
|
||||||
|
const auto skip = st::settingsSendTypeSkip;
|
||||||
|
auto wrap = object_ptr<Ui::VerticalLayout>(container);
|
||||||
|
const auto inner = wrap.data();
|
||||||
|
container->add(
|
||||||
|
object_ptr<Ui::OverrideMargins>(
|
||||||
|
container,
|
||||||
|
std::move(wrap),
|
||||||
|
QMargins(0, skip, 0, skip)));
|
||||||
|
|
||||||
|
const auto group = std::make_shared<Ui::RadioenumGroup<SwitchType>>(
|
||||||
|
Auth().settings().supportSwitch());
|
||||||
|
const auto add = [&](SwitchType value, const QString &label) {
|
||||||
|
inner->add(
|
||||||
|
object_ptr<Ui::Radioenum<SwitchType>>(
|
||||||
|
inner,
|
||||||
|
group,
|
||||||
|
value,
|
||||||
|
label,
|
||||||
|
st::settingsSendType),
|
||||||
|
st::settingsSendTypePadding);
|
||||||
|
};
|
||||||
|
add(SwitchType::None, "Just send the reply");
|
||||||
|
add(SwitchType::Next, "Send and switch to next");
|
||||||
|
add(SwitchType::Previous, "Send and switch to previous");
|
||||||
|
group->setChangedCallback([](SwitchType value) {
|
||||||
|
Auth().settings().setSupportSwitch(value);
|
||||||
|
Local::writeUserSettings();
|
||||||
|
});
|
||||||
|
|
||||||
|
AddSkip(inner, st::settingsCheckboxesSkip);
|
||||||
|
|
||||||
|
base::ObservableViewer(
|
||||||
|
inner->add(
|
||||||
|
object_ptr<Ui::Checkbox>(
|
||||||
|
inner,
|
||||||
|
"Fix chats order",
|
||||||
|
Auth().settings().supportFixChatsOrder(),
|
||||||
|
st::settingsSendType),
|
||||||
|
st::settingsSendTypePadding
|
||||||
|
)->checkedChanged
|
||||||
|
) | rpl::start_with_next([](bool fix) {
|
||||||
|
Auth().settings().setSupportFixChatsOrder(fix);
|
||||||
|
Local::writeUserSettings();
|
||||||
|
}, inner->lifetime());
|
||||||
|
|
||||||
|
|
||||||
|
AddSkip(inner, st::settingsCheckboxesSkip);
|
||||||
|
}
|
||||||
|
|
||||||
Chat::Chat(QWidget *parent, not_null<UserData*> self)
|
Chat::Chat(QWidget *parent, not_null<UserData*> self)
|
||||||
: Section(parent)
|
: Section(parent)
|
||||||
, _self(self) {
|
, _self(self) {
|
||||||
|
@ -925,6 +977,9 @@ void Chat::setupContent() {
|
||||||
SetupChatBackground(content);
|
SetupChatBackground(content);
|
||||||
SetupStickersEmoji(content);
|
SetupStickersEmoji(content);
|
||||||
SetupMessages(content);
|
SetupMessages(content);
|
||||||
|
if (Auth().supportMode()) {
|
||||||
|
SetupSupport(content);
|
||||||
|
}
|
||||||
|
|
||||||
Ui::ResizeFitChild(this, content);
|
Ui::ResizeFitChild(this, content);
|
||||||
}
|
}
|
||||||
|
|
|
@ -161,15 +161,21 @@ not_null<Button*> AddButtonWithLabel(
|
||||||
|
|
||||||
void AddSubsectionTitle(
|
void AddSubsectionTitle(
|
||||||
not_null<Ui::VerticalLayout*> container,
|
not_null<Ui::VerticalLayout*> container,
|
||||||
LangKey text) {
|
rpl::producer<QString> text) {
|
||||||
container->add(
|
container->add(
|
||||||
object_ptr<Ui::FlatLabel>(
|
object_ptr<Ui::FlatLabel>(
|
||||||
container,
|
container,
|
||||||
Lang::Viewer(text),
|
std::move(text),
|
||||||
st::settingsSubsectionTitle),
|
st::settingsSubsectionTitle),
|
||||||
st::settingsSubsectionTitlePadding);
|
st::settingsSubsectionTitlePadding);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void AddSubsectionTitle(
|
||||||
|
not_null<Ui::VerticalLayout*> container,
|
||||||
|
LangKey text) {
|
||||||
|
AddSubsectionTitle(container, Lang::Viewer(text));
|
||||||
|
}
|
||||||
|
|
||||||
void FillMenu(Fn<void(Type)> showOther, MenuCallback addAction) {
|
void FillMenu(Fn<void(Type)> showOther, MenuCallback addAction) {
|
||||||
addAction(
|
addAction(
|
||||||
lang(lng_settings_information),
|
lang(lng_settings_information),
|
||||||
|
|
|
@ -94,6 +94,9 @@ void CreateRightLabel(
|
||||||
rpl::producer<QString> label,
|
rpl::producer<QString> label,
|
||||||
const style::InfoProfileButton &st,
|
const style::InfoProfileButton &st,
|
||||||
LangKey buttonText);
|
LangKey buttonText);
|
||||||
|
void AddSubsectionTitle(
|
||||||
|
not_null<Ui::VerticalLayout*> container,
|
||||||
|
rpl::producer<QString> text);
|
||||||
void AddSubsectionTitle(
|
void AddSubsectionTitle(
|
||||||
not_null<Ui::VerticalLayout*> conatiner,
|
not_null<Ui::VerticalLayout*> conatiner,
|
||||||
LangKey text);
|
LangKey text);
|
||||||
|
|
|
@ -15,6 +15,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||||
#include "data/data_drafts.h"
|
#include "data/data_drafts.h"
|
||||||
#include "boxes/send_files_box.h"
|
#include "boxes/send_files_box.h"
|
||||||
#include "window/themes/window_theme.h"
|
#include "window/themes/window_theme.h"
|
||||||
|
#include "ui/widgets/input_fields.h"
|
||||||
#include "export/export_settings.h"
|
#include "export/export_settings.h"
|
||||||
#include "core/crash_reports.h"
|
#include "core/crash_reports.h"
|
||||||
#include "core/update_checker.h"
|
#include "core/update_checker.h"
|
||||||
|
@ -522,7 +523,7 @@ enum {
|
||||||
dbiDcOptionOldOld = 0x02,
|
dbiDcOptionOldOld = 0x02,
|
||||||
dbiChatSizeMax = 0x03,
|
dbiChatSizeMax = 0x03,
|
||||||
dbiMutePeer = 0x04,
|
dbiMutePeer = 0x04,
|
||||||
dbiSendKey = 0x05,
|
dbiSendKeyOld = 0x05,
|
||||||
dbiAutoStart = 0x06,
|
dbiAutoStart = 0x06,
|
||||||
dbiStartMinimized = 0x07,
|
dbiStartMinimized = 0x07,
|
||||||
dbiSoundNotify = 0x08,
|
dbiSoundNotify = 0x08,
|
||||||
|
@ -1432,13 +1433,19 @@ bool _readSetting(quint32 blockId, QDataStream &stream, int version, ReadSetting
|
||||||
if (!_checkStreamStatus(stream)) return false;
|
if (!_checkStreamStatus(stream)) return false;
|
||||||
} break;
|
} break;
|
||||||
|
|
||||||
case dbiSendKey: {
|
case dbiSendKeyOld: {
|
||||||
qint32 v;
|
qint32 v;
|
||||||
stream >> v;
|
stream >> v;
|
||||||
if (!_checkStreamStatus(stream)) return false;
|
if (!_checkStreamStatus(stream)) return false;
|
||||||
|
|
||||||
cSetCtrlEnter(v == dbiskCtrlEnter);
|
using SendSettings = Ui::InputSubmitSettings;
|
||||||
if (App::main()) App::main()->ctrlEnterSubmitUpdated();
|
const auto unchecked = static_cast<SendSettings>(v);
|
||||||
|
|
||||||
|
if (unchecked != SendSettings::Enter
|
||||||
|
&& unchecked != SendSettings::CtrlEnter) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
GetStoredAuthSessionCache().setSendSubmitWay(unchecked);
|
||||||
} break;
|
} break;
|
||||||
|
|
||||||
case dbiCatsAndDogs: { // deprecated
|
case dbiCatsAndDogs: { // deprecated
|
||||||
|
@ -1945,7 +1952,6 @@ void _writeUserSettings() {
|
||||||
}
|
}
|
||||||
|
|
||||||
EncryptedDescriptor data(size);
|
EncryptedDescriptor data(size);
|
||||||
data.stream << quint32(dbiSendKey) << qint32(cCtrlEnter() ? dbiskCtrlEnter : dbiskEnter);
|
|
||||||
data.stream
|
data.stream
|
||||||
<< quint32(dbiTileBackground)
|
<< quint32(dbiTileBackground)
|
||||||
<< qint32(Window::Theme::Background()->tileDay() ? 1 : 0)
|
<< qint32(Window::Theme::Background()->tileDay() ? 1 : 0)
|
||||||
|
|
|
@ -0,0 +1,27 @@
|
||||||
|
/*
|
||||||
|
This file is part of Telegram Desktop,
|
||||||
|
the official desktop application for the Telegram messaging service.
|
||||||
|
|
||||||
|
For license and copyright information please follow this link:
|
||||||
|
https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||||
|
*/
|
||||||
|
#include "support/support_common.h"
|
||||||
|
|
||||||
|
#include "shortcuts.h"
|
||||||
|
|
||||||
|
namespace Support {
|
||||||
|
|
||||||
|
void PerformSwitch(SwitchSettings value) {
|
||||||
|
switch (value) {
|
||||||
|
case SwitchSettings::Next:
|
||||||
|
Shortcuts::launch("next_chat");
|
||||||
|
break;
|
||||||
|
case SwitchSettings::Previous:
|
||||||
|
Shortcuts::launch("previous_chat");
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
} // namespace Support
|
|
@ -0,0 +1,20 @@
|
||||||
|
/*
|
||||||
|
This file is part of Telegram Desktop,
|
||||||
|
the official desktop application for the Telegram messaging service.
|
||||||
|
|
||||||
|
For license and copyright information please follow this link:
|
||||||
|
https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||||
|
*/
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
namespace Support {
|
||||||
|
|
||||||
|
enum class SwitchSettings {
|
||||||
|
None,
|
||||||
|
Next,
|
||||||
|
Previous,
|
||||||
|
};
|
||||||
|
|
||||||
|
void PerformSwitch(SwitchSettings value);
|
||||||
|
|
||||||
|
} // namespace Support
|
|
@ -33,6 +33,13 @@ struct InstantReplaces {
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
enum class InputSubmitSettings {
|
||||||
|
Enter,
|
||||||
|
CtrlEnter,
|
||||||
|
Both,
|
||||||
|
None,
|
||||||
|
};
|
||||||
|
|
||||||
class FlatInput : public TWidgetHelper<QLineEdit>, private base::Subscriber {
|
class FlatInput : public TWidgetHelper<QLineEdit>, private base::Subscriber {
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
|
@ -258,12 +265,7 @@ public:
|
||||||
bool isUndoAvailable() const;
|
bool isUndoAvailable() const;
|
||||||
bool isRedoAvailable() const;
|
bool isRedoAvailable() const;
|
||||||
|
|
||||||
enum class SubmitSettings {
|
using SubmitSettings = InputSubmitSettings;
|
||||||
None,
|
|
||||||
Enter,
|
|
||||||
CtrlEnter,
|
|
||||||
Both,
|
|
||||||
};
|
|
||||||
void setSubmitSettings(SubmitSettings settings);
|
void setSubmitSettings(SubmitSettings settings);
|
||||||
void customUpDown(bool isCustom);
|
void customUpDown(bool isCustom);
|
||||||
void customTab(bool isCustom);
|
void customTab(bool isCustom);
|
||||||
|
|
|
@ -576,6 +576,8 @@
|
||||||
<(src_loc)/storage/storage_sparse_ids_list.h
|
<(src_loc)/storage/storage_sparse_ids_list.h
|
||||||
<(src_loc)/storage/storage_user_photos.cpp
|
<(src_loc)/storage/storage_user_photos.cpp
|
||||||
<(src_loc)/storage/storage_user_photos.h
|
<(src_loc)/storage/storage_user_photos.h
|
||||||
|
<(src_loc)/support/support_common.cpp
|
||||||
|
<(src_loc)/support/support_common.h
|
||||||
<(src_loc)/ui/effects/cross_animation.cpp
|
<(src_loc)/ui/effects/cross_animation.cpp
|
||||||
<(src_loc)/ui/effects/cross_animation.h
|
<(src_loc)/ui/effects/cross_animation.h
|
||||||
<(src_loc)/ui/effects/fade_animation.cpp
|
<(src_loc)/ui/effects/fade_animation.cpp
|
||||||
|
|
Loading…
Reference in New Issue