mirror of https://github.com/procxx/kepka.git
Remove old settings.
This commit is contained in:
parent
7d8ba66211
commit
2f408cd773
|
@ -819,3 +819,10 @@ termsContent: FlatLabel(defaultFlatLabel) {
|
||||||
}
|
}
|
||||||
termsPadding: margins(23px, 4px, 16px, 16px);
|
termsPadding: margins(23px, 4px, 16px, 16px);
|
||||||
termsAgePadding: margins(23px, 16px, 16px, 0px);
|
termsAgePadding: margins(23px, 16px, 16px, 0px);
|
||||||
|
|
||||||
|
themesSmallSkip: 10px;
|
||||||
|
themesBackgroundSize: 120px;
|
||||||
|
themesScroll: ScrollArea(defaultScrollArea) {
|
||||||
|
bottomsh: 0px;
|
||||||
|
topsh: 0px;
|
||||||
|
}
|
||||||
|
|
|
@ -0,0 +1,357 @@
|
||||||
|
/*
|
||||||
|
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 "settings/settings_privacy_controllers.h"
|
||||||
|
|
||||||
|
#include "lang/lang_keys.h"
|
||||||
|
#include "apiwrap.h"
|
||||||
|
#include "observer_peer.h"
|
||||||
|
#include "mainwidget.h"
|
||||||
|
#include "auth_session.h"
|
||||||
|
#include "storage/localstorage.h"
|
||||||
|
#include "history/history.h"
|
||||||
|
#include "boxes/peer_list_controllers.h"
|
||||||
|
#include "boxes/confirm_box.h"
|
||||||
|
|
||||||
|
namespace Settings {
|
||||||
|
namespace {
|
||||||
|
|
||||||
|
constexpr auto kBlockedPerPage = 40;
|
||||||
|
|
||||||
|
class BlockUserBoxController : public ChatsListBoxController {
|
||||||
|
public:
|
||||||
|
void rowClicked(not_null<PeerListRow*> row) override;
|
||||||
|
|
||||||
|
void setBlockUserCallback(Fn<void(not_null<UserData*> user)> callback) {
|
||||||
|
_blockUserCallback = std::move(callback);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected:
|
||||||
|
void prepareViewHook() override;
|
||||||
|
std::unique_ptr<Row> createRow(not_null<History*> history) override;
|
||||||
|
void updateRowHook(not_null<Row*> row) override {
|
||||||
|
updateIsBlocked(row, row->peer()->asUser());
|
||||||
|
delegate()->peerListUpdateRow(row);
|
||||||
|
}
|
||||||
|
|
||||||
|
private:
|
||||||
|
void updateIsBlocked(not_null<PeerListRow*> row, UserData *user) const;
|
||||||
|
|
||||||
|
Fn<void(not_null<UserData*> user)> _blockUserCallback;
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
void BlockUserBoxController::prepareViewHook() {
|
||||||
|
delegate()->peerListSetTitle(langFactory(lng_blocked_list_add_title));
|
||||||
|
subscribe(Notify::PeerUpdated(), Notify::PeerUpdatedHandler(Notify::PeerUpdate::Flag::UserIsBlocked, [this](const Notify::PeerUpdate &update) {
|
||||||
|
if (auto user = update.peer->asUser()) {
|
||||||
|
if (auto row = delegate()->peerListFindRow(user->id)) {
|
||||||
|
updateIsBlocked(row, user);
|
||||||
|
delegate()->peerListUpdateRow(row);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}));
|
||||||
|
}
|
||||||
|
|
||||||
|
void BlockUserBoxController::updateIsBlocked(not_null<PeerListRow*> row, UserData *user) const {
|
||||||
|
auto blocked = user->isBlocked();
|
||||||
|
row->setDisabledState(blocked ? PeerListRow::State::DisabledChecked : PeerListRow::State::Active);
|
||||||
|
if (blocked) {
|
||||||
|
row->setCustomStatus(lang(lng_blocked_list_already_blocked));
|
||||||
|
} else {
|
||||||
|
row->clearCustomStatus();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void BlockUserBoxController::rowClicked(not_null<PeerListRow*> row) {
|
||||||
|
_blockUserCallback(row->peer()->asUser());
|
||||||
|
}
|
||||||
|
|
||||||
|
std::unique_ptr<BlockUserBoxController::Row> BlockUserBoxController::createRow(not_null<History*> history) {
|
||||||
|
if (history->peer->isSelf()) {
|
||||||
|
return nullptr;
|
||||||
|
}
|
||||||
|
if (auto user = history->peer->asUser()) {
|
||||||
|
auto row = std::make_unique<Row>(history);
|
||||||
|
updateIsBlocked(row.get(), user);
|
||||||
|
return row;
|
||||||
|
}
|
||||||
|
return nullptr;
|
||||||
|
}
|
||||||
|
|
||||||
|
} // namespace
|
||||||
|
|
||||||
|
void BlockedBoxController::prepare() {
|
||||||
|
delegate()->peerListSetTitle(langFactory(lng_blocked_list_title));
|
||||||
|
setDescriptionText(lang(lng_contacts_loading));
|
||||||
|
delegate()->peerListRefreshRows();
|
||||||
|
|
||||||
|
subscribe(Notify::PeerUpdated(), Notify::PeerUpdatedHandler(Notify::PeerUpdate::Flag::UserIsBlocked, [this](const Notify::PeerUpdate &update) {
|
||||||
|
if (auto user = update.peer->asUser()) {
|
||||||
|
handleBlockedEvent(user);
|
||||||
|
}
|
||||||
|
}));
|
||||||
|
|
||||||
|
loadMoreRows();
|
||||||
|
}
|
||||||
|
|
||||||
|
void BlockedBoxController::loadMoreRows() {
|
||||||
|
if (_loadRequestId || _allLoaded) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
_loadRequestId = request(MTPcontacts_GetBlocked(MTP_int(_offset), MTP_int(kBlockedPerPage))).done([this](const MTPcontacts_Blocked &result) {
|
||||||
|
_loadRequestId = 0;
|
||||||
|
|
||||||
|
if (!_offset) {
|
||||||
|
setDescriptionText(lang(lng_blocked_list_about));
|
||||||
|
}
|
||||||
|
|
||||||
|
auto handleContactsBlocked = [](auto &list) {
|
||||||
|
App::feedUsers(list.vusers);
|
||||||
|
return list.vblocked.v;
|
||||||
|
};
|
||||||
|
switch (result.type()) {
|
||||||
|
case mtpc_contacts_blockedSlice: {
|
||||||
|
receivedUsers(handleContactsBlocked(result.c_contacts_blockedSlice()));
|
||||||
|
} break;
|
||||||
|
case mtpc_contacts_blocked: {
|
||||||
|
_allLoaded = true;
|
||||||
|
receivedUsers(handleContactsBlocked(result.c_contacts_blocked()));
|
||||||
|
} break;
|
||||||
|
default: Unexpected("Bad type() in MTPcontacts_GetBlocked() result.");
|
||||||
|
}
|
||||||
|
}).fail([this](const RPCError &error) {
|
||||||
|
_loadRequestId = 0;
|
||||||
|
}).send();
|
||||||
|
}
|
||||||
|
|
||||||
|
void BlockedBoxController::rowClicked(not_null<PeerListRow*> row) {
|
||||||
|
InvokeQueued(App::main(), [peerId = row->peer()->id] {
|
||||||
|
Ui::showPeerHistory(peerId, ShowAtUnreadMsgId);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
void BlockedBoxController::rowActionClicked(not_null<PeerListRow*> row) {
|
||||||
|
auto user = row->peer()->asUser();
|
||||||
|
Expects(user != nullptr);
|
||||||
|
|
||||||
|
Auth().api().unblockUser(user);
|
||||||
|
}
|
||||||
|
|
||||||
|
void BlockedBoxController::receivedUsers(const QVector<MTPContactBlocked> &result) {
|
||||||
|
if (result.empty()) {
|
||||||
|
_allLoaded = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
for_const (auto &item, result) {
|
||||||
|
++_offset;
|
||||||
|
if (item.type() != mtpc_contactBlocked) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
auto &contactBlocked = item.c_contactBlocked();
|
||||||
|
auto userId = contactBlocked.vuser_id.v;
|
||||||
|
if (auto user = App::userLoaded(userId)) {
|
||||||
|
appendRow(user);
|
||||||
|
user->setBlockStatus(UserData::BlockStatus::Blocked);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
delegate()->peerListRefreshRows();
|
||||||
|
}
|
||||||
|
|
||||||
|
void BlockedBoxController::handleBlockedEvent(UserData *user) {
|
||||||
|
if (user->isBlocked()) {
|
||||||
|
if (prependRow(user)) {
|
||||||
|
delegate()->peerListRefreshRows();
|
||||||
|
delegate()->peerListScrollToTop();
|
||||||
|
}
|
||||||
|
} else if (auto row = delegate()->peerListFindRow(user->id)) {
|
||||||
|
delegate()->peerListRemoveRow(row);
|
||||||
|
delegate()->peerListRefreshRows();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void BlockedBoxController::BlockNewUser() {
|
||||||
|
auto controller = std::make_unique<BlockUserBoxController>();
|
||||||
|
auto initBox = [controller = controller.get()](not_null<PeerListBox*> box) {
|
||||||
|
controller->setBlockUserCallback([box](not_null<UserData*> user) {
|
||||||
|
Auth().api().blockUser(user);
|
||||||
|
box->closeBox();
|
||||||
|
});
|
||||||
|
box->addButton(langFactory(lng_cancel), [box] { box->closeBox(); });
|
||||||
|
};
|
||||||
|
Ui::show(
|
||||||
|
Box<PeerListBox>(std::move(controller), std::move(initBox)),
|
||||||
|
LayerOption::KeepOther);
|
||||||
|
}
|
||||||
|
|
||||||
|
bool BlockedBoxController::appendRow(UserData *user) {
|
||||||
|
if (delegate()->peerListFindRow(user->id)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
delegate()->peerListAppendRow(createRow(user));
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool BlockedBoxController::prependRow(UserData *user) {
|
||||||
|
if (delegate()->peerListFindRow(user->id)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
delegate()->peerListPrependRow(createRow(user));
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
std::unique_ptr<PeerListRow> BlockedBoxController::createRow(UserData *user) const {
|
||||||
|
auto row = std::make_unique<PeerListRowWithLink>(user);
|
||||||
|
row->setActionLink(lang(lng_blocked_list_unblock));
|
||||||
|
auto status = [user]() -> QString {
|
||||||
|
if (user->botInfo) {
|
||||||
|
return lang(lng_status_bot);
|
||||||
|
} else if (user->phone().isEmpty()) {
|
||||||
|
return lang(lng_blocked_list_unknown_phone);
|
||||||
|
}
|
||||||
|
return App::formatPhone(user->phone());
|
||||||
|
};
|
||||||
|
row->setCustomStatus(status());
|
||||||
|
return std::move(row);
|
||||||
|
}
|
||||||
|
|
||||||
|
ApiWrap::Privacy::Key LastSeenPrivacyController::key() {
|
||||||
|
return Key::LastSeen;
|
||||||
|
}
|
||||||
|
|
||||||
|
MTPInputPrivacyKey LastSeenPrivacyController::apiKey() {
|
||||||
|
return MTP_inputPrivacyKeyStatusTimestamp();
|
||||||
|
}
|
||||||
|
|
||||||
|
QString LastSeenPrivacyController::title() {
|
||||||
|
return lang(lng_edit_privacy_lastseen_title);
|
||||||
|
}
|
||||||
|
|
||||||
|
QString LastSeenPrivacyController::description() {
|
||||||
|
return lang(lng_edit_privacy_lastseen_description);
|
||||||
|
}
|
||||||
|
|
||||||
|
QString LastSeenPrivacyController::warning() {
|
||||||
|
return lang(lng_edit_privacy_lastseen_warning);
|
||||||
|
}
|
||||||
|
|
||||||
|
QString LastSeenPrivacyController::exceptionLinkText(Exception exception, int count) {
|
||||||
|
switch (exception) {
|
||||||
|
case Exception::Always: return (count > 0) ? lng_edit_privacy_lastseen_always(lt_count, count) : lang(lng_edit_privacy_lastseen_always_empty);
|
||||||
|
case Exception::Never: return (count > 0) ? lng_edit_privacy_lastseen_never(lt_count, count) : lang(lng_edit_privacy_lastseen_never_empty);
|
||||||
|
}
|
||||||
|
Unexpected("Invalid exception value.");
|
||||||
|
}
|
||||||
|
|
||||||
|
QString LastSeenPrivacyController::exceptionBoxTitle(Exception exception) {
|
||||||
|
switch (exception) {
|
||||||
|
case Exception::Always: return lang(lng_edit_privacy_lastseen_always_title);
|
||||||
|
case Exception::Never: return lang(lng_edit_privacy_lastseen_never_title);
|
||||||
|
}
|
||||||
|
Unexpected("Invalid exception value.");
|
||||||
|
}
|
||||||
|
|
||||||
|
QString LastSeenPrivacyController::exceptionsDescription() {
|
||||||
|
return lang(lng_edit_privacy_lastseen_exceptions);
|
||||||
|
}
|
||||||
|
|
||||||
|
void LastSeenPrivacyController::confirmSave(bool someAreDisallowed, FnMut<void()> saveCallback) {
|
||||||
|
if (someAreDisallowed && !Auth().settings().lastSeenWarningSeen()) {
|
||||||
|
auto weakBox = std::make_shared<QPointer<ConfirmBox>>();
|
||||||
|
auto callback = [weakBox, saveCallback = std::move(saveCallback)]() mutable {
|
||||||
|
if (auto box = *weakBox) {
|
||||||
|
box->closeBox();
|
||||||
|
}
|
||||||
|
saveCallback();
|
||||||
|
Auth().settings().setLastSeenWarningSeen(true);
|
||||||
|
Local::writeUserSettings();
|
||||||
|
};
|
||||||
|
auto box = Box<ConfirmBox>(lang(lng_edit_privacy_lastseen_warning), lang(lng_continue), lang(lng_cancel), std::move(callback));
|
||||||
|
*weakBox = Ui::show(std::move(box), LayerOption::KeepOther);
|
||||||
|
} else {
|
||||||
|
saveCallback();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
ApiWrap::Privacy::Key GroupsInvitePrivacyController::key() {
|
||||||
|
return Key::Invites;
|
||||||
|
}
|
||||||
|
|
||||||
|
MTPInputPrivacyKey GroupsInvitePrivacyController::apiKey() {
|
||||||
|
return MTP_inputPrivacyKeyChatInvite();
|
||||||
|
}
|
||||||
|
|
||||||
|
QString GroupsInvitePrivacyController::title() {
|
||||||
|
return lang(lng_edit_privacy_groups_title);
|
||||||
|
}
|
||||||
|
|
||||||
|
bool GroupsInvitePrivacyController::hasOption(Option option) {
|
||||||
|
return (option != Option::Nobody);
|
||||||
|
}
|
||||||
|
|
||||||
|
QString GroupsInvitePrivacyController::description() {
|
||||||
|
return lang(lng_edit_privacy_groups_description);
|
||||||
|
}
|
||||||
|
|
||||||
|
QString GroupsInvitePrivacyController::exceptionLinkText(Exception exception, int count) {
|
||||||
|
switch (exception) {
|
||||||
|
case Exception::Always: return (count > 0) ? lng_edit_privacy_groups_always(lt_count, count) : lang(lng_edit_privacy_groups_always_empty);
|
||||||
|
case Exception::Never: return (count > 0) ? lng_edit_privacy_groups_never(lt_count, count) : lang(lng_edit_privacy_groups_never_empty);
|
||||||
|
}
|
||||||
|
Unexpected("Invalid exception value.");
|
||||||
|
}
|
||||||
|
|
||||||
|
QString GroupsInvitePrivacyController::exceptionBoxTitle(Exception exception) {
|
||||||
|
switch (exception) {
|
||||||
|
case Exception::Always: return lang(lng_edit_privacy_groups_always_title);
|
||||||
|
case Exception::Never: return lang(lng_edit_privacy_groups_never_title);
|
||||||
|
}
|
||||||
|
Unexpected("Invalid exception value.");
|
||||||
|
}
|
||||||
|
|
||||||
|
QString GroupsInvitePrivacyController::exceptionsDescription() {
|
||||||
|
return lang(lng_edit_privacy_groups_exceptions);
|
||||||
|
}
|
||||||
|
|
||||||
|
ApiWrap::Privacy::Key CallsPrivacyController::key() {
|
||||||
|
return Key::Calls;
|
||||||
|
}
|
||||||
|
|
||||||
|
MTPInputPrivacyKey CallsPrivacyController::apiKey() {
|
||||||
|
return MTP_inputPrivacyKeyPhoneCall();
|
||||||
|
}
|
||||||
|
|
||||||
|
QString CallsPrivacyController::title() {
|
||||||
|
return lang(lng_edit_privacy_calls_title);
|
||||||
|
}
|
||||||
|
|
||||||
|
QString CallsPrivacyController::description() {
|
||||||
|
return lang(lng_edit_privacy_calls_description);
|
||||||
|
}
|
||||||
|
|
||||||
|
QString CallsPrivacyController::exceptionLinkText(Exception exception, int count) {
|
||||||
|
switch (exception) {
|
||||||
|
case Exception::Always: return (count > 0) ? lng_edit_privacy_calls_always(lt_count, count) : lang(lng_edit_privacy_calls_always_empty);
|
||||||
|
case Exception::Never: return (count > 0) ? lng_edit_privacy_calls_never(lt_count, count) : lang(lng_edit_privacy_calls_never_empty);
|
||||||
|
}
|
||||||
|
Unexpected("Invalid exception value.");
|
||||||
|
}
|
||||||
|
|
||||||
|
QString CallsPrivacyController::exceptionBoxTitle(Exception exception) {
|
||||||
|
switch (exception) {
|
||||||
|
case Exception::Always: return lang(lng_edit_privacy_calls_always_title);
|
||||||
|
case Exception::Never: return lang(lng_edit_privacy_calls_never_title);
|
||||||
|
}
|
||||||
|
Unexpected("Invalid exception value.");
|
||||||
|
}
|
||||||
|
|
||||||
|
QString CallsPrivacyController::exceptionsDescription() {
|
||||||
|
return lang(lng_edit_privacy_calls_exceptions);
|
||||||
|
}
|
||||||
|
|
||||||
|
} // namespace Settings
|
|
@ -0,0 +1,91 @@
|
||||||
|
/*
|
||||||
|
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
|
||||||
|
|
||||||
|
#include "boxes/peer_list_box.h"
|
||||||
|
#include "boxes/edit_privacy_box.h"
|
||||||
|
#include "mtproto/sender.h"
|
||||||
|
|
||||||
|
namespace Settings {
|
||||||
|
|
||||||
|
class BlockedBoxController : public PeerListController, private base::Subscriber, private MTP::Sender {
|
||||||
|
public:
|
||||||
|
void prepare() override;
|
||||||
|
void rowClicked(not_null<PeerListRow*> row) override;
|
||||||
|
void rowActionClicked(not_null<PeerListRow*> row) override;
|
||||||
|
void loadMoreRows() override;
|
||||||
|
|
||||||
|
static void BlockNewUser();
|
||||||
|
|
||||||
|
private:
|
||||||
|
void receivedUsers(const QVector<MTPContactBlocked> &result);
|
||||||
|
void handleBlockedEvent(UserData *user);
|
||||||
|
|
||||||
|
bool appendRow(UserData *user);
|
||||||
|
bool prependRow(UserData *user);
|
||||||
|
std::unique_ptr<PeerListRow> createRow(UserData *user) const;
|
||||||
|
|
||||||
|
int _offset = 0;
|
||||||
|
mtpRequestId _loadRequestId = 0;
|
||||||
|
bool _allLoaded = false;
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
class LastSeenPrivacyController : public EditPrivacyBox::Controller, private base::Subscriber {
|
||||||
|
public:
|
||||||
|
using Option = EditPrivacyBox::Option;
|
||||||
|
using Exception = EditPrivacyBox::Exception;
|
||||||
|
|
||||||
|
Key key() override;
|
||||||
|
MTPInputPrivacyKey apiKey() override;
|
||||||
|
|
||||||
|
QString title() override;
|
||||||
|
QString description() override;
|
||||||
|
QString warning() override;
|
||||||
|
QString exceptionLinkText(Exception exception, int count) override;
|
||||||
|
QString exceptionBoxTitle(Exception exception) override;
|
||||||
|
QString exceptionsDescription() override;
|
||||||
|
|
||||||
|
void confirmSave(bool someAreDisallowed, FnMut<void()> saveCallback) override;
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
class GroupsInvitePrivacyController : public EditPrivacyBox::Controller, private base::Subscriber {
|
||||||
|
public:
|
||||||
|
using Option = EditPrivacyBox::Option;
|
||||||
|
using Exception = EditPrivacyBox::Exception;
|
||||||
|
|
||||||
|
Key key() override;
|
||||||
|
MTPInputPrivacyKey apiKey() override;
|
||||||
|
|
||||||
|
QString title() override;
|
||||||
|
bool hasOption(Option option) override;
|
||||||
|
QString description() override;
|
||||||
|
QString exceptionLinkText(Exception exception, int count) override;
|
||||||
|
QString exceptionBoxTitle(Exception exception) override;
|
||||||
|
QString exceptionsDescription() override;
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
class CallsPrivacyController : public EditPrivacyBox::Controller, private base::Subscriber {
|
||||||
|
public:
|
||||||
|
using Option = EditPrivacyBox::Option;
|
||||||
|
using Exception = EditPrivacyBox::Exception;
|
||||||
|
|
||||||
|
Key key() override;
|
||||||
|
MTPInputPrivacyKey apiKey() override;
|
||||||
|
|
||||||
|
QString title() override;
|
||||||
|
QString description() override;
|
||||||
|
QString exceptionLinkText(Exception exception, int count) override;
|
||||||
|
QString exceptionBoxTitle(Exception exception) override;
|
||||||
|
QString exceptionsDescription() override;
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
} // namespace Settings
|
|
@ -8,7 +8,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||||
#include "settings/settings_privacy_security.h"
|
#include "settings/settings_privacy_security.h"
|
||||||
|
|
||||||
#include "settings/settings_common.h"
|
#include "settings/settings_common.h"
|
||||||
#include "old_settings/settings_privacy_controllers.h"
|
#include "settings/settings_privacy_controllers.h"
|
||||||
#include "boxes/peer_list_box.h"
|
#include "boxes/peer_list_box.h"
|
||||||
#include "boxes/edit_privacy_box.h"
|
#include "boxes/edit_privacy_box.h"
|
||||||
#include "boxes/passcode_box.h"
|
#include "boxes/passcode_box.h"
|
||||||
|
@ -57,11 +57,11 @@ void SetupPrivacy(not_null<Ui::VerticalLayout*> container) {
|
||||||
box->closeBox();
|
box->closeBox();
|
||||||
});
|
});
|
||||||
box->addLeftButton(langFactory(lng_blocked_list_add), [] {
|
box->addLeftButton(langFactory(lng_blocked_list_add), [] {
|
||||||
OldSettings::BlockedBoxController::BlockNewUser();
|
BlockedBoxController::BlockNewUser();
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
Ui::show(Box<PeerListBox>(
|
Ui::show(Box<PeerListBox>(
|
||||||
std::make_unique<OldSettings::BlockedBoxController>(),
|
std::make_unique<BlockedBoxController>(),
|
||||||
initBox));
|
initBox));
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -94,7 +94,6 @@ void SetupPrivacy(not_null<Ui::VerticalLayout*> container) {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
using namespace OldSettings;
|
|
||||||
const auto add = [&](LangKey label, Privacy::Key key, auto controller) {
|
const auto add = [&](LangKey label, Privacy::Key key, auto controller) {
|
||||||
AddButtonWithLabel(
|
AddButtonWithLabel(
|
||||||
container,
|
container,
|
||||||
|
|
|
@ -14,7 +14,6 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||||
#include "storage/localstorage.h"
|
#include "storage/localstorage.h"
|
||||||
#include "boxes/confirm_box.h"
|
#include "boxes/confirm_box.h"
|
||||||
#include "styles/style_window.h"
|
#include "styles/style_window.h"
|
||||||
#include "styles/style_old_settings.h"
|
|
||||||
#include "styles/style_dialogs.h"
|
#include "styles/style_dialogs.h"
|
||||||
#include "styles/style_boxes.h"
|
#include "styles/style_boxes.h"
|
||||||
#include "ui/widgets/scroll_area.h"
|
#include "ui/widgets/scroll_area.h"
|
||||||
|
@ -391,10 +390,10 @@ void Editor::Inner::selectSkipPage(int delta, int direction) {
|
||||||
void Editor::Inner::paintEvent(QPaintEvent *e) {
|
void Editor::Inner::paintEvent(QPaintEvent *e) {
|
||||||
Painter p(this);
|
Painter p(this);
|
||||||
|
|
||||||
p.setFont(st::settingsFixedBarFont);
|
p.setFont(st::boxTitleFont);
|
||||||
p.setPen(st::windowFg);
|
p.setPen(st::windowFg);
|
||||||
if (!_newRows->isHidden()) {
|
if (!_newRows->isHidden()) {
|
||||||
p.drawTextLeft(st::themeEditorMargin.left(), _existingRows->y() + _existingRows->height() + st::settingsFixedBarTextPosition.y(), width(), lang(lng_theme_editor_new_keys));
|
p.drawTextLeft(st::themeEditorMargin.left(), _existingRows->y() + _existingRows->height() + st::boxLayerTitlePosition.y(), width(), lang(lng_theme_editor_new_keys));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -404,7 +403,7 @@ int Editor::Inner::resizeGetHeight(int newWidth) {
|
||||||
_newRows->resizeToWidth(rowsWidth);
|
_newRows->resizeToWidth(rowsWidth);
|
||||||
|
|
||||||
_existingRows->moveToLeft(0, 0);
|
_existingRows->moveToLeft(0, 0);
|
||||||
_newRows->moveToLeft(0, _existingRows->height() + st::settingsFixedBarHeight);
|
_newRows->moveToLeft(0, _existingRows->height() + st::boxLayerTitleHeight);
|
||||||
|
|
||||||
auto lowest = (_newRows->isHidden() ? _existingRows : _newRows).data();
|
auto lowest = (_newRows->isHidden() ? _existingRows : _newRows).data();
|
||||||
|
|
||||||
|
@ -573,7 +572,7 @@ void ThemeExportBox::prepare() {
|
||||||
addButton(langFactory(lng_theme_editor_export), [this] { exportTheme(); });
|
addButton(langFactory(lng_theme_editor_export), [this] { exportTheme(); });
|
||||||
addButton(langFactory(lng_cancel), [this] { closeBox(); });
|
addButton(langFactory(lng_cancel), [this] { closeBox(); });
|
||||||
|
|
||||||
auto height = st::settingsSmallSkip + st::settingsBackgroundSize + st::settingsSmallSkip + _tileBackground->height();
|
auto height = st::themesSmallSkip + st::themesBackgroundSize + st::themesSmallSkip + _tileBackground->height();
|
||||||
|
|
||||||
setDimensions(st::boxWideWidth, height);
|
setDimensions(st::boxWideWidth, height);
|
||||||
|
|
||||||
|
@ -585,23 +584,23 @@ void ThemeExportBox::paintEvent(QPaintEvent *e) {
|
||||||
|
|
||||||
Painter p(this);
|
Painter p(this);
|
||||||
|
|
||||||
auto linkLeft = st::boxPadding.left() + st::settingsBackgroundSize + st::settingsSmallSkip;
|
auto linkLeft = st::boxPadding.left() + st::themesBackgroundSize + st::themesSmallSkip;
|
||||||
|
|
||||||
p.setPen(st::boxTextFg);
|
p.setPen(st::boxTextFg);
|
||||||
p.setFont(st::boxTextFont);
|
p.setFont(st::boxTextFont);
|
||||||
p.drawTextLeft(linkLeft, st::settingsSmallSkip, width(), _imageText);
|
p.drawTextLeft(linkLeft, st::themesSmallSkip, width(), _imageText);
|
||||||
|
|
||||||
p.drawPixmapLeft(st::boxPadding.left(), st::settingsSmallSkip, width(), _thumbnail);
|
p.drawPixmapLeft(st::boxPadding.left(), st::themesSmallSkip, width(), _thumbnail);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ThemeExportBox::resizeEvent(QResizeEvent *e) {
|
void ThemeExportBox::resizeEvent(QResizeEvent *e) {
|
||||||
auto linkLeft = st::boxPadding.left() + st::settingsBackgroundSize + st::settingsSmallSkip;
|
auto linkLeft = st::boxPadding.left() + st::themesBackgroundSize + st::themesSmallSkip;
|
||||||
_chooseFromFile->moveToLeft(linkLeft, st::settingsSmallSkip + st::boxTextFont->height + st::settingsSmallSkip);
|
_chooseFromFile->moveToLeft(linkLeft, st::themesSmallSkip + st::boxTextFont->height + st::themesSmallSkip);
|
||||||
_tileBackground->moveToLeft(st::boxPadding.left(), st::settingsSmallSkip + st::settingsBackgroundSize + 2 * st::settingsSmallSkip);
|
_tileBackground->moveToLeft(st::boxPadding.left(), st::themesSmallSkip + st::themesBackgroundSize + 2 * st::themesSmallSkip);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ThemeExportBox::updateThumbnail() {
|
void ThemeExportBox::updateThumbnail() {
|
||||||
int32 size = st::settingsBackgroundSize * cIntRetinaFactor();
|
int32 size = st::themesBackgroundSize * cIntRetinaFactor();
|
||||||
QImage back(size, size, QImage::Format_ARGB32_Premultiplied);
|
QImage back(size, size, QImage::Format_ARGB32_Premultiplied);
|
||||||
back.setDevicePixelRatio(cRetinaFactor());
|
back.setDevicePixelRatio(cRetinaFactor());
|
||||||
{
|
{
|
||||||
|
@ -612,7 +611,7 @@ void ThemeExportBox::updateThumbnail() {
|
||||||
int sx = (pix.width() > pix.height()) ? ((pix.width() - pix.height()) / 2) : 0;
|
int sx = (pix.width() > pix.height()) ? ((pix.width() - pix.height()) / 2) : 0;
|
||||||
int sy = (pix.height() > pix.width()) ? ((pix.height() - pix.width()) / 2) : 0;
|
int sy = (pix.height() > pix.width()) ? ((pix.height() - pix.width()) / 2) : 0;
|
||||||
int s = (pix.width() > pix.height()) ? pix.height() : pix.width();
|
int s = (pix.width() > pix.height()) ? pix.height() : pix.width();
|
||||||
p.drawImage(QRect(0, 0, st::settingsBackgroundSize, st::settingsBackgroundSize), pix, QRect(sx, sy, s, s));
|
p.drawImage(QRect(0, 0, st::themesBackgroundSize, st::themesBackgroundSize), pix, QRect(sx, sy, s, s));
|
||||||
}
|
}
|
||||||
Images::prepareRound(back, ImageRoundRadius::Small);
|
Images::prepareRound(back, ImageRoundRadius::Small);
|
||||||
_thumbnail = App::pixmapFromImageInPlace(std::move(back));
|
_thumbnail = App::pixmapFromImageInPlace(std::move(back));
|
||||||
|
@ -690,7 +689,7 @@ void ThemeExportBox::exportTheme() {
|
||||||
}
|
}
|
||||||
|
|
||||||
Editor::Editor(QWidget*, const QString &path)
|
Editor::Editor(QWidget*, const QString &path)
|
||||||
: _scroll(this, st::settingsScroll)
|
: _scroll(this, st::themesScroll)
|
||||||
, _close(this, st::contactsMultiSelect.fieldCancel)
|
, _close(this, st::contactsMultiSelect.fieldCancel)
|
||||||
, _select(this, st::contactsMultiSelect, langFactory(lng_country_ph))
|
, _select(this, st::contactsMultiSelect, langFactory(lng_country_ph))
|
||||||
, _leftShadow(this)
|
, _leftShadow(this)
|
||||||
|
@ -779,7 +778,7 @@ void Editor::paintEvent(QPaintEvent *e) {
|
||||||
|
|
||||||
p.fillRect(e->rect(), st::dialogsBg);
|
p.fillRect(e->rect(), st::dialogsBg);
|
||||||
|
|
||||||
p.setFont(st::settingsFixedBarFont);
|
p.setFont(st::boxTitleFont);
|
||||||
p.setPen(st::windowFg);
|
p.setPen(st::windowFg);
|
||||||
p.drawTextLeft(st::themeEditorMargin.left(), st::themeEditorMargin.top(), width(), lang(lng_theme_editor_title));
|
p.drawTextLeft(st::themeEditorMargin.left(), st::themeEditorMargin.top(), width(), lang(lng_theme_editor_title));
|
||||||
}
|
}
|
||||||
|
|
|
@ -36,7 +36,6 @@
|
||||||
'<(src_loc)/overview/overview.style',
|
'<(src_loc)/overview/overview.style',
|
||||||
'<(src_loc)/passport/passport.style',
|
'<(src_loc)/passport/passport.style',
|
||||||
'<(src_loc)/profile/profile.style',
|
'<(src_loc)/profile/profile.style',
|
||||||
'<(src_loc)/old_settings/old_settings.style',
|
|
||||||
'<(src_loc)/settings/settings.style',
|
'<(src_loc)/settings/settings.style',
|
||||||
'<(src_loc)/chat_helpers/chat_helpers.style',
|
'<(src_loc)/chat_helpers/chat_helpers.style',
|
||||||
'<(src_loc)/ui/widgets/widgets.style',
|
'<(src_loc)/ui/widgets/widgets.style',
|
||||||
|
|
|
@ -534,36 +534,6 @@
|
||||||
<(src_loc)/profile/profile_channel_controllers.h
|
<(src_loc)/profile/profile_channel_controllers.h
|
||||||
<(src_loc)/profile/profile_cover_drop_area.cpp
|
<(src_loc)/profile/profile_cover_drop_area.cpp
|
||||||
<(src_loc)/profile/profile_cover_drop_area.h
|
<(src_loc)/profile/profile_cover_drop_area.h
|
||||||
<(src_loc)/old_settings/settings_advanced_widget.cpp
|
|
||||||
<(src_loc)/old_settings/settings_advanced_widget.h
|
|
||||||
<(src_loc)/old_settings/settings_background_widget.cpp
|
|
||||||
<(src_loc)/old_settings/settings_background_widget.h
|
|
||||||
<(src_loc)/old_settings/settings_block_widget.cpp
|
|
||||||
<(src_loc)/old_settings/settings_block_widget.h
|
|
||||||
<(src_loc)/old_settings/settings_chat_settings_widget.cpp
|
|
||||||
<(src_loc)/old_settings/settings_chat_settings_widget.h
|
|
||||||
<(src_loc)/old_settings/settings_cover.cpp
|
|
||||||
<(src_loc)/old_settings/settings_cover.h
|
|
||||||
<(src_loc)/old_settings/settings_fixed_bar.cpp
|
|
||||||
<(src_loc)/old_settings/settings_fixed_bar.h
|
|
||||||
<(src_loc)/old_settings/settings_general_widget.cpp
|
|
||||||
<(src_loc)/old_settings/settings_general_widget.h
|
|
||||||
<(src_loc)/old_settings/settings_info_widget.cpp
|
|
||||||
<(src_loc)/old_settings/settings_info_widget.h
|
|
||||||
<(src_loc)/old_settings/settings_inner_widget.cpp
|
|
||||||
<(src_loc)/old_settings/settings_inner_widget.h
|
|
||||||
<(src_loc)/old_settings/settings_layer.cpp
|
|
||||||
<(src_loc)/old_settings/settings_layer.h
|
|
||||||
<(src_loc)/old_settings/settings_notifications_widget.cpp
|
|
||||||
<(src_loc)/old_settings/settings_notifications_widget.h
|
|
||||||
<(src_loc)/old_settings/settings_privacy_controllers.cpp
|
|
||||||
<(src_loc)/old_settings/settings_privacy_controllers.h
|
|
||||||
<(src_loc)/old_settings/settings_privacy_widget.cpp
|
|
||||||
<(src_loc)/old_settings/settings_privacy_widget.h
|
|
||||||
<(src_loc)/old_settings/settings_scale_widget.cpp
|
|
||||||
<(src_loc)/old_settings/settings_scale_widget.h
|
|
||||||
<(src_loc)/old_settings/settings_widget.cpp
|
|
||||||
<(src_loc)/old_settings/settings_widget.h
|
|
||||||
<(src_loc)/settings/settings_chat.cpp
|
<(src_loc)/settings/settings_chat.cpp
|
||||||
<(src_loc)/settings/settings_chat.h
|
<(src_loc)/settings/settings_chat.h
|
||||||
<(src_loc)/settings/settings_codes.cpp
|
<(src_loc)/settings/settings_codes.cpp
|
||||||
|
@ -580,6 +550,8 @@
|
||||||
<(src_loc)/settings/settings_main.h
|
<(src_loc)/settings/settings_main.h
|
||||||
<(src_loc)/settings/settings_notifications.cpp
|
<(src_loc)/settings/settings_notifications.cpp
|
||||||
<(src_loc)/settings/settings_notifications.h
|
<(src_loc)/settings/settings_notifications.h
|
||||||
|
<(src_loc)/settings/settings_privacy_controllers.cpp
|
||||||
|
<(src_loc)/settings/settings_privacy_controllers.h
|
||||||
<(src_loc)/settings/settings_privacy_security.cpp
|
<(src_loc)/settings/settings_privacy_security.cpp
|
||||||
<(src_loc)/settings/settings_privacy_security.h
|
<(src_loc)/settings/settings_privacy_security.h
|
||||||
<(src_loc)/storage/file_download.cpp
|
<(src_loc)/storage/file_download.cpp
|
||||||
|
|
Loading…
Reference in New Issue