mirror of https://github.com/procxx/kepka.git
Add support for requesting deep link info.
Also update API scheme. Also remove auth.checkPhone requests.
This commit is contained in:
parent
46af87a00a
commit
67e698a374
|
@ -1006,6 +1006,9 @@ account.authorizationForm#cb976d53 flags:# selfie_required:flags.1?true required
|
||||||
|
|
||||||
account.sentEmailCode#811f854f email_pattern:string length:int = account.SentEmailCode;
|
account.sentEmailCode#811f854f email_pattern:string length:int = account.SentEmailCode;
|
||||||
|
|
||||||
|
help.deepLinkInfoEmpty#66afa166 = help.DeepLinkInfo;
|
||||||
|
help.deepLinkInfo#6a4ee832 flags:# update_app:flags.0?true message:string entities:flags.1?Vector<MessageEntity> = help.DeepLinkInfo;
|
||||||
|
|
||||||
---functions---
|
---functions---
|
||||||
|
|
||||||
invokeAfterMsg#cb9f372d {X:Type} msg_id:long query:!X = X;
|
invokeAfterMsg#cb9f372d {X:Type} msg_id:long query:!X = X;
|
||||||
|
@ -1219,6 +1222,7 @@ help.getRecentMeUrls#3dc0f114 referer:string = help.RecentMeUrls;
|
||||||
help.getProxyData#3d7758e1 = help.ProxyData;
|
help.getProxyData#3d7758e1 = help.ProxyData;
|
||||||
help.getTermsOfServiceUpdate#2ca51fd1 = help.TermsOfServiceUpdate;
|
help.getTermsOfServiceUpdate#2ca51fd1 = help.TermsOfServiceUpdate;
|
||||||
help.acceptTermsOfService#ee72f79a id:DataJSON = Bool;
|
help.acceptTermsOfService#ee72f79a id:DataJSON = Bool;
|
||||||
|
help.getDeepLinkInfo#3fedc75f path:string = help.DeepLinkInfo;
|
||||||
|
|
||||||
channels.readHistory#cc104937 channel:InputChannel max_id:int = Bool;
|
channels.readHistory#cc104937 channel:InputChannel max_id:int = Bool;
|
||||||
channels.deleteMessages#84c1fd4e channel:InputChannel id:Vector<int> = messages.AffectedMessages;
|
channels.deleteMessages#84c1fd4e channel:InputChannel id:Vector<int> = messages.AffectedMessages;
|
||||||
|
|
|
@ -233,6 +233,22 @@ void ApiWrap::proxyPromotionDone(const MTPhelp_ProxyData &proxy) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void ApiWrap::requestDeepLinkInfo(
|
||||||
|
const QString &path,
|
||||||
|
base::lambda<void(const MTPDhelp_deepLinkInfo &result)> callback) {
|
||||||
|
request(_deepLinkInfoRequestId).cancel();
|
||||||
|
_deepLinkInfoRequestId = request(MTPhelp_GetDeepLinkInfo(
|
||||||
|
MTP_string(path)
|
||||||
|
)).done([=](const MTPhelp_DeepLinkInfo &result) {
|
||||||
|
_deepLinkInfoRequestId = 0;
|
||||||
|
if (result.type() == mtpc_help_deepLinkInfo) {
|
||||||
|
callback(result.c_help_deepLinkInfo());
|
||||||
|
}
|
||||||
|
}).fail([=](const RPCError &error) {
|
||||||
|
_deepLinkInfoRequestId = 0;
|
||||||
|
}).send();
|
||||||
|
}
|
||||||
|
|
||||||
void ApiWrap::applyUpdates(
|
void ApiWrap::applyUpdates(
|
||||||
const MTPUpdates &updates,
|
const MTPUpdates &updates,
|
||||||
uint64 sentMessageRandomId) {
|
uint64 sentMessageRandomId) {
|
||||||
|
|
|
@ -94,6 +94,9 @@ public:
|
||||||
const QString &sinceVersion,
|
const QString &sinceVersion,
|
||||||
base::lambda<void(const MTPUpdates &result)> callback);
|
base::lambda<void(const MTPUpdates &result)> callback);
|
||||||
void refreshProxyPromotion();
|
void refreshProxyPromotion();
|
||||||
|
void requestDeepLinkInfo(
|
||||||
|
const QString &path,
|
||||||
|
base::lambda<void(const MTPDhelp_deepLinkInfo &result)> callback);
|
||||||
|
|
||||||
void requestChannelMembersForAdd(
|
void requestChannelMembersForAdd(
|
||||||
not_null<ChannelData*> channel,
|
not_null<ChannelData*> channel,
|
||||||
|
@ -578,4 +581,6 @@ private:
|
||||||
base::flat_set<not_null<const PeerData*>> _updateNotifySettingsPeers;
|
base::flat_set<not_null<const PeerData*>> _updateNotifySettingsPeers;
|
||||||
base::Timer _updateNotifySettingsTimer;
|
base::Timer _updateNotifySettingsTimer;
|
||||||
|
|
||||||
|
mtpRequestId _deepLinkInfoRequestId = 0;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
|
@ -53,6 +53,16 @@ ConfirmBox::ConfirmBox(QWidget*, const QString &text, const QString &confirmText
|
||||||
init(text);
|
init(text);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ConfirmBox::ConfirmBox(QWidget*, const TextWithEntities &text, const QString &confirmText, base::lambda_once<void()> confirmedCallback, base::lambda_once<void()> cancelledCallback)
|
||||||
|
: _confirmText(confirmText)
|
||||||
|
, _cancelText(lang(lng_cancel))
|
||||||
|
, _confirmStyle(st::defaultBoxButton)
|
||||||
|
, _text(st::boxWidth - st::boxPadding.left() - st::boxButtonPadding.right())
|
||||||
|
, _confirmedCallback(std::move(confirmedCallback))
|
||||||
|
, _cancelledCallback(std::move(cancelledCallback)) {
|
||||||
|
init(text);
|
||||||
|
}
|
||||||
|
|
||||||
ConfirmBox::ConfirmBox(QWidget*, const QString &text, const QString &confirmText, const style::RoundButton &confirmStyle, base::lambda_once<void()> confirmedCallback, base::lambda_once<void()> cancelledCallback)
|
ConfirmBox::ConfirmBox(QWidget*, const QString &text, const QString &confirmText, const style::RoundButton &confirmStyle, base::lambda_once<void()> confirmedCallback, base::lambda_once<void()> cancelledCallback)
|
||||||
: _confirmText(confirmText)
|
: _confirmText(confirmText)
|
||||||
, _cancelText(lang(lng_cancel))
|
, _cancelText(lang(lng_cancel))
|
||||||
|
@ -93,6 +103,16 @@ ConfirmBox::ConfirmBox(const InformBoxTag &, const QString &text, const QString
|
||||||
init(text);
|
init(text);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ConfirmBox::ConfirmBox(const InformBoxTag &, const TextWithEntities &text, const QString &doneText, base::lambda<void()> closedCallback)
|
||||||
|
: _confirmText(doneText)
|
||||||
|
, _confirmStyle(st::defaultBoxButton)
|
||||||
|
, _informative(true)
|
||||||
|
, _text(st::boxWidth - st::boxPadding.left() - st::boxButtonPadding.right())
|
||||||
|
, _confirmedCallback(generateInformCallback(closedCallback))
|
||||||
|
, _cancelledCallback(generateInformCallback(closedCallback)) {
|
||||||
|
init(text);
|
||||||
|
}
|
||||||
|
|
||||||
base::lambda_once<void()> ConfirmBox::generateInformCallback(base::lambda<void()> closedCallback) {
|
base::lambda_once<void()> ConfirmBox::generateInformCallback(base::lambda<void()> closedCallback) {
|
||||||
return base::lambda_guarded(this, [this, closedCallback] {
|
return base::lambda_guarded(this, [this, closedCallback] {
|
||||||
closeBox();
|
closeBox();
|
||||||
|
@ -106,6 +126,10 @@ void ConfirmBox::init(const QString &text) {
|
||||||
_text.setText(st::boxLabelStyle, text, _informative ? _confirmBoxTextOptions : _textPlainOptions);
|
_text.setText(st::boxLabelStyle, text, _informative ? _confirmBoxTextOptions : _textPlainOptions);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void ConfirmBox::init(const TextWithEntities &text) {
|
||||||
|
_text.setMarkedText(st::boxLabelStyle, text, _confirmBoxTextOptions);
|
||||||
|
}
|
||||||
|
|
||||||
void ConfirmBox::prepare() {
|
void ConfirmBox::prepare() {
|
||||||
addButton([this] { return _confirmText; }, [this] { confirmed(); }, _confirmStyle);
|
addButton([this] { return _confirmText; }, [this] { confirmed(); }, _confirmStyle);
|
||||||
if (!_informative) {
|
if (!_informative) {
|
||||||
|
@ -223,6 +247,9 @@ InformBox::InformBox(QWidget*, const QString &text, base::lambda<void()> closedC
|
||||||
InformBox::InformBox(QWidget*, const QString &text, const QString &doneText, base::lambda<void()> closedCallback) : ConfirmBox(ConfirmBox::InformBoxTag(), text, doneText, std::move(closedCallback)) {
|
InformBox::InformBox(QWidget*, const QString &text, const QString &doneText, base::lambda<void()> closedCallback) : ConfirmBox(ConfirmBox::InformBoxTag(), text, doneText, std::move(closedCallback)) {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
InformBox::InformBox(QWidget*, const TextWithEntities &text, base::lambda<void()> closedCallback) : ConfirmBox(ConfirmBox::InformBoxTag(), text, lang(lng_box_ok), std::move(closedCallback)) {
|
||||||
|
}
|
||||||
|
|
||||||
MaxInviteBox::MaxInviteBox(QWidget*, not_null<ChannelData*> channel) : BoxContent()
|
MaxInviteBox::MaxInviteBox(QWidget*, not_null<ChannelData*> channel) : BoxContent()
|
||||||
, _channel(channel)
|
, _channel(channel)
|
||||||
, _text(st::boxLabelStyle, lng_participant_invite_sorry(lt_count, Global::ChatSizeMax()), _confirmBoxTextOptions, st::boxWidth - st::boxPadding.left() - st::boxButtonPadding.right()) {
|
, _text(st::boxLabelStyle, lng_participant_invite_sorry(lt_count, Global::ChatSizeMax()), _confirmBoxTextOptions, st::boxWidth - st::boxPadding.left() - st::boxButtonPadding.right()) {
|
||||||
|
|
|
@ -23,6 +23,7 @@ public:
|
||||||
ConfirmBox(QWidget*, const QString &text, const QString &confirmText, const style::RoundButton &confirmStyle, base::lambda_once<void()> confirmedCallback = base::lambda_once<void()>(), base::lambda_once<void()> cancelledCallback = base::lambda_once<void()>());
|
ConfirmBox(QWidget*, const QString &text, const QString &confirmText, const style::RoundButton &confirmStyle, base::lambda_once<void()> confirmedCallback = base::lambda_once<void()>(), base::lambda_once<void()> cancelledCallback = base::lambda_once<void()>());
|
||||||
ConfirmBox(QWidget*, const QString &text, const QString &confirmText, const QString &cancelText, base::lambda_once<void()> confirmedCallback = base::lambda_once<void()>(), base::lambda_once<void()> cancelledCallback = base::lambda_once<void()>());
|
ConfirmBox(QWidget*, const QString &text, const QString &confirmText, const QString &cancelText, base::lambda_once<void()> confirmedCallback = base::lambda_once<void()>(), base::lambda_once<void()> cancelledCallback = base::lambda_once<void()>());
|
||||||
ConfirmBox(QWidget*, const QString &text, const QString &confirmText, const style::RoundButton &confirmStyle, const QString &cancelText, base::lambda_once<void()> confirmedCallback = base::lambda_once<void()>(), base::lambda_once<void()> cancelledCallback = base::lambda_once<void()>());
|
ConfirmBox(QWidget*, const QString &text, const QString &confirmText, const style::RoundButton &confirmStyle, const QString &cancelText, base::lambda_once<void()> confirmedCallback = base::lambda_once<void()>(), base::lambda_once<void()> cancelledCallback = base::lambda_once<void()>());
|
||||||
|
ConfirmBox(QWidget*, const TextWithEntities &text, const QString &confirmText, base::lambda_once<void()> confirmedCallback = nullptr, base::lambda_once<void()> cancelledCallback = nullptr);
|
||||||
|
|
||||||
void updateLink();
|
void updateLink();
|
||||||
|
|
||||||
|
@ -51,11 +52,13 @@ private:
|
||||||
struct InformBoxTag {
|
struct InformBoxTag {
|
||||||
};
|
};
|
||||||
ConfirmBox(const InformBoxTag &, const QString &text, const QString &doneText, base::lambda<void()> closedCallback);
|
ConfirmBox(const InformBoxTag &, const QString &text, const QString &doneText, base::lambda<void()> closedCallback);
|
||||||
|
ConfirmBox(const InformBoxTag &, const TextWithEntities &text, const QString &doneText, base::lambda<void()> closedCallback);
|
||||||
base::lambda_once<void()> generateInformCallback(base::lambda<void()> closedCallback);
|
base::lambda_once<void()> generateInformCallback(base::lambda<void()> closedCallback);
|
||||||
friend class InformBox;
|
friend class InformBox;
|
||||||
|
|
||||||
void confirmed();
|
void confirmed();
|
||||||
void init(const QString &text);
|
void init(const QString &text);
|
||||||
|
void init(const TextWithEntities &text);
|
||||||
void textUpdated();
|
void textUpdated();
|
||||||
void updateHover();
|
void updateHover();
|
||||||
|
|
||||||
|
@ -81,8 +84,9 @@ private:
|
||||||
|
|
||||||
class InformBox : public ConfirmBox {
|
class InformBox : public ConfirmBox {
|
||||||
public:
|
public:
|
||||||
InformBox(QWidget*, const QString &text, base::lambda<void()> closedCallback = base::lambda<void()>());
|
InformBox(QWidget*, const QString &text, base::lambda<void()> closedCallback = nullptr);
|
||||||
InformBox(QWidget*, const QString &text, const QString &doneText, base::lambda<void()> closedCallback = base::lambda<void()>());
|
InformBox(QWidget*, const QString &text, const QString &doneText, base::lambda<void()> closedCallback = nullptr);
|
||||||
|
InformBox(QWidget*, const TextWithEntities &text, base::lambda<void()> closedCallback = nullptr);
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -14,6 +14,9 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||||
#include "storage/localstorage.h"
|
#include "storage/localstorage.h"
|
||||||
#include "messenger.h"
|
#include "messenger.h"
|
||||||
#include "mtproto/session.h"
|
#include "mtproto/session.h"
|
||||||
|
#include "mainwindow.h"
|
||||||
|
#include "core/click_handler_types.h"
|
||||||
|
#include "settings/settings_widget.h"
|
||||||
|
|
||||||
#include <openssl/rsa.h>
|
#include <openssl/rsa.h>
|
||||||
#include <openssl/pem.h>
|
#include <openssl/pem.h>
|
||||||
|
@ -2094,6 +2097,34 @@ bool checkReadyUpdate() {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void UpdateApplication() {
|
||||||
|
cSetLastUpdateCheck(0);
|
||||||
|
Core::UpdateChecker().start();
|
||||||
|
if (const auto window = App::wnd()) {
|
||||||
|
auto settings = Box<Settings::Widget>();
|
||||||
|
const auto weak = make_weak(settings.data());
|
||||||
|
window->showSpecialLayer(std::move(settings), anim::type::normal);
|
||||||
|
if (weak) {
|
||||||
|
weak->scrollToUpdateRow();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#else // !TDESKTOP_DISABLE_AUTOUPDATE
|
||||||
|
|
||||||
|
void UpdateApplication() {
|
||||||
|
const auto url = [&] {
|
||||||
|
#ifdef OS_WIN_STORE
|
||||||
|
return "https://www.microsoft.com/en-us/store/p/telegram-desktop/9nztwsqntd0s";
|
||||||
|
#elif defined OS_MAC_STORE // OS_WIN_STORE
|
||||||
|
return "https://itunes.apple.com/ae/app/telegram-desktop/id946399090";
|
||||||
|
#else // OS_WIN_STORE || OS_MAC_STORE
|
||||||
|
return "https://desktop.telegram.org";
|
||||||
|
#endif // OS_WIN_STORE || OS_MAC_STORE
|
||||||
|
}();
|
||||||
|
UrlClickHandler::doOpen(url);
|
||||||
|
}
|
||||||
|
|
||||||
#endif // !TDESKTOP_DISABLE_AUTOUPDATE
|
#endif // !TDESKTOP_DISABLE_AUTOUPDATE
|
||||||
|
|
||||||
QString countBetaVersionSignature(uint64 version) { // duplicated in packer.cpp
|
QString countBetaVersionSignature(uint64 version) { // duplicated in packer.cpp
|
||||||
|
|
|
@ -60,6 +60,7 @@ class UpdateChecker {
|
||||||
|
|
||||||
#endif // TDESKTOP_DISABLE_AUTOUPDATE
|
#endif // TDESKTOP_DISABLE_AUTOUPDATE
|
||||||
|
|
||||||
|
void UpdateApplication();
|
||||||
QString countBetaVersionSignature(uint64 version);
|
QString countBetaVersionSignature(uint64 version);
|
||||||
|
|
||||||
} // namespace Core
|
} // namespace Core
|
||||||
|
|
|
@ -7,11 +7,11 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||||
*/
|
*/
|
||||||
#include "messenger.h"
|
#include "messenger.h"
|
||||||
|
|
||||||
#include <rpl/complete.h>
|
|
||||||
#include "data/data_photo.h"
|
#include "data/data_photo.h"
|
||||||
#include "data/data_document.h"
|
#include "data/data_document.h"
|
||||||
#include "data/data_session.h"
|
#include "data/data_session.h"
|
||||||
#include "base/timer.h"
|
#include "base/timer.h"
|
||||||
|
#include "core/update_checker.h"
|
||||||
#include "storage/localstorage.h"
|
#include "storage/localstorage.h"
|
||||||
#include "platform/platform_specific.h"
|
#include "platform/platform_specific.h"
|
||||||
#include "mainwindow.h"
|
#include "mainwindow.h"
|
||||||
|
@ -940,6 +940,28 @@ bool Messenger::openLocalUrl(const QString &url) {
|
||||||
return showPassportForm(url_parse_params(
|
return showPassportForm(url_parse_params(
|
||||||
authMatch->captured(1),
|
authMatch->captured(1),
|
||||||
UrlParamNameTransform::ToLower));
|
UrlParamNameTransform::ToLower));
|
||||||
|
} else if (auto unknownMatch = regex_match(qsl("^([^\\?]+)(\\?|#|$)"), command, matchOptions)) {
|
||||||
|
if (_authSession) {
|
||||||
|
const auto request = unknownMatch->captured(1);
|
||||||
|
const auto callback = [=](const MTPDhelp_deepLinkInfo &result) {
|
||||||
|
const auto text = TextWithEntities{
|
||||||
|
qs(result.vmessage),
|
||||||
|
(result.has_entities()
|
||||||
|
? TextUtilities::EntitiesFromMTP(result.ventities.v)
|
||||||
|
: EntitiesInText())
|
||||||
|
};
|
||||||
|
if (result.is_update_app()) {
|
||||||
|
const auto box = std::make_shared<QPointer<BoxContent>>();
|
||||||
|
*box = Ui::show(Box<ConfirmBox>(
|
||||||
|
text,
|
||||||
|
lang(lng_menu_update),
|
||||||
|
[=] { Core::UpdateApplication(); if (*box) (*box)->closeBox(); }));
|
||||||
|
} else {
|
||||||
|
Ui::show(Box<InformBox>(text));
|
||||||
|
}
|
||||||
|
};
|
||||||
|
_authSession->api().requestDeepLinkInfo(request, callback);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
|
@ -168,6 +168,14 @@ GeneralWidget::GeneralWidget(QWidget *parent, UserData *self) : BlockWidget(pare
|
||||||
refreshControls();
|
refreshControls();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int GeneralWidget::getUpdateTop() const {
|
||||||
|
#ifndef TDESKTOP_DISABLE_AUTOUPDATE
|
||||||
|
return 0; // _updateRow->y(); // Just scroll to the top of the whole General widget
|
||||||
|
#else // !TDESKTOP_DISABLE_AUTOUPDATE
|
||||||
|
return -1;
|
||||||
|
#endif // !TDESKTOP_DISABLE_AUTOUPDATE
|
||||||
|
}
|
||||||
|
|
||||||
int GeneralWidget::resizeGetHeight(int newWidth) {
|
int GeneralWidget::resizeGetHeight(int newWidth) {
|
||||||
_changeLanguage->moveToRight(0, st::settingsBlockMarginTop + st::settingsBlockTitleTop + st::settingsBlockTitleFont->ascent - st::defaultLinkButton.font->ascent, newWidth);
|
_changeLanguage->moveToRight(0, st::settingsBlockMarginTop + st::settingsBlockTitleTop + st::settingsBlockTitleFont->ascent - st::defaultLinkButton.font->ascent, newWidth);
|
||||||
return BlockWidget::resizeGetHeight(newWidth);
|
return BlockWidget::resizeGetHeight(newWidth);
|
||||||
|
|
|
@ -68,6 +68,8 @@ class GeneralWidget : public BlockWidget {
|
||||||
public:
|
public:
|
||||||
GeneralWidget(QWidget *parent, UserData *self);
|
GeneralWidget(QWidget *parent, UserData *self);
|
||||||
|
|
||||||
|
int getUpdateTop() const;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
int resizeGetHeight(int newWidth) override;
|
int resizeGetHeight(int newWidth) override;
|
||||||
|
|
||||||
|
|
|
@ -35,6 +35,10 @@ void InnerWidget::fullRebuild() {
|
||||||
refreshBlocks();
|
refreshBlocks();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int InnerWidget::getUpdateTop() const {
|
||||||
|
return _getUpdateTop ? _getUpdateTop() : -1;
|
||||||
|
}
|
||||||
|
|
||||||
void InnerWidget::refreshBlocks() {
|
void InnerWidget::refreshBlocks() {
|
||||||
if (App::quitting()) {
|
if (App::quitting()) {
|
||||||
_cover.destroy();
|
_cover.destroy();
|
||||||
|
@ -51,7 +55,17 @@ void InnerWidget::refreshBlocks() {
|
||||||
_blocks->add(object_ptr<InfoWidget>(this, _self));
|
_blocks->add(object_ptr<InfoWidget>(this, _self));
|
||||||
_blocks->add(object_ptr<NotificationsWidget>(this, _self));
|
_blocks->add(object_ptr<NotificationsWidget>(this, _self));
|
||||||
}
|
}
|
||||||
_blocks->add(object_ptr<GeneralWidget>(this, _self));
|
const auto general = make_weak(_blocks->add(object_ptr<GeneralWidget>(
|
||||||
|
this,
|
||||||
|
_self)));
|
||||||
|
_getUpdateTop = [=] {
|
||||||
|
if (!general) {
|
||||||
|
return -1;
|
||||||
|
} else if (const auto top = general->getUpdateTop(); top >= 0) {
|
||||||
|
return _blocks->y() + general->y() + top;
|
||||||
|
}
|
||||||
|
return -1;
|
||||||
|
};
|
||||||
if (!cRetina()) {
|
if (!cRetina()) {
|
||||||
_blocks->add(object_ptr<ScaleWidget>(this, _self));
|
_blocks->add(object_ptr<ScaleWidget>(this, _self));
|
||||||
}
|
}
|
||||||
|
|
|
@ -25,6 +25,8 @@ public:
|
||||||
return TWidget::resizeToWidth(newWidth);
|
return TWidget::resizeToWidth(newWidth);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int getUpdateTop() const;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
int resizeGetHeight(int newWidth) override;
|
int resizeGetHeight(int newWidth) override;
|
||||||
void visibleTopBottomUpdated(
|
void visibleTopBottomUpdated(
|
||||||
|
@ -41,6 +43,7 @@ private:
|
||||||
UserData *_self = nullptr;
|
UserData *_self = nullptr;
|
||||||
|
|
||||||
int _contentLeft = 0;
|
int _contentLeft = 0;
|
||||||
|
base::lambda<int()> _getUpdateTop;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -113,4 +113,8 @@ void Layer::setTitle(const QString &title) {
|
||||||
_fixedBar->setText(title);
|
_fixedBar->setText(title);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Layer::scrollToY(int y) {
|
||||||
|
_scroll->scrollToY(y);
|
||||||
|
}
|
||||||
|
|
||||||
} // namespace Settings
|
} // namespace Settings
|
||||||
|
|
|
@ -52,6 +52,7 @@ protected:
|
||||||
void setRoundedCorners(bool roundedCorners) {
|
void setRoundedCorners(bool roundedCorners) {
|
||||||
_roundedCorners = roundedCorners;
|
_roundedCorners = roundedCorners;
|
||||||
}
|
}
|
||||||
|
void scrollToY(int y);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void doSetInnerWidget(object_ptr<LayerInner> widget);
|
void doSetInnerWidget(object_ptr<LayerInner> widget);
|
||||||
|
|
|
@ -208,6 +208,12 @@ void Widget::refreshLang() {
|
||||||
update();
|
update();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Widget::scrollToUpdateRow() {
|
||||||
|
if (const auto top = _inner->getUpdateTop(); top >= 0) {
|
||||||
|
scrollToY(top);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void Widget::keyPressEvent(QKeyEvent *e) {
|
void Widget::keyPressEvent(QKeyEvent *e) {
|
||||||
codesFeedString(e->text());
|
codesFeedString(e->text());
|
||||||
return LayerWidget::keyPressEvent(e);
|
return LayerWidget::keyPressEvent(e);
|
||||||
|
|
|
@ -18,6 +18,7 @@ public:
|
||||||
Widget(QWidget*);
|
Widget(QWidget*);
|
||||||
|
|
||||||
void refreshLang();
|
void refreshLang();
|
||||||
|
void scrollToUpdateRow();
|
||||||
|
|
||||||
void parentResized() override;
|
void parentResized() override;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue