mirror of
https://github.com/vale981/tdesktop
synced 2025-03-06 02:01:40 -05:00
Move some settings to the main menu (support).
This commit is contained in:
parent
3f1f070d3f
commit
81a9554caa
8 changed files with 30 additions and 35 deletions
BIN
Telegram/Resources/icons/menu_fix_order.png
Normal file
BIN
Telegram/Resources/icons/menu_fix_order.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 728 B |
BIN
Telegram/Resources/icons/menu_fix_order@2x.png
Normal file
BIN
Telegram/Resources/icons/menu_fix_order@2x.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.4 KiB |
BIN
Telegram/Resources/icons/menu_reload.png
Normal file
BIN
Telegram/Resources/icons/menu_reload.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 661 B |
BIN
Telegram/Resources/icons/menu_reload@2x.png
Normal file
BIN
Telegram/Resources/icons/menu_reload@2x.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.2 KiB |
|
@ -946,38 +946,6 @@ void SetupSupport(not_null<Ui::VerticalLayout*> container) {
|
|||
});
|
||||
|
||||
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);
|
||||
|
||||
const auto subscription = Ui::AttachAsChild(inner, rpl::lifetime());
|
||||
AddButton(
|
||||
inner,
|
||||
rpl::single(qsl("Reload templates")),
|
||||
st::settingsButton
|
||||
)->addClickHandler([=] {
|
||||
*subscription = Auth().supportTemplates()->errors(
|
||||
) | rpl::start_with_next([=](QStringList errors) {
|
||||
Ui::Toast::Show(errors.isEmpty()
|
||||
? "Templates reloaded!"
|
||||
: ("Errors:\n\n" + errors.join("\n\n")));
|
||||
});
|
||||
Auth().supportTemplates()->reload();
|
||||
});
|
||||
AddSkip(inner);
|
||||
}
|
||||
|
||||
Chat::Chat(QWidget *parent, not_null<UserData*> self)
|
||||
|
|
|
@ -93,8 +93,9 @@ void Inner::showRows(std::vector<Question> &&rows) {
|
|||
prepareRow(added);
|
||||
}
|
||||
resizeToWidth(width());
|
||||
update();
|
||||
_selected = _pressed = -1;
|
||||
moveSelection(1);
|
||||
update();
|
||||
}
|
||||
|
||||
std::pair<int, int> Inner::moveSelection(int delta) {
|
||||
|
|
|
@ -135,6 +135,10 @@ mainMenuSettings: icon {{ "menu_settings", menuIconFg }};
|
|||
mainMenuSettingsOver: icon {{ "menu_settings", menuIconFgOver }};
|
||||
mainMenuNightMode: icon {{ "menu_night_mode", menuIconFg }};
|
||||
mainMenuNightModeOver: icon {{ "menu_night_mode", menuIconFgOver }};
|
||||
mainMenuReload: icon {{ "menu_reload", menuIconFg }};
|
||||
mainMenuReloadOver: icon {{ "menu_reload", menuIconFgOver }};
|
||||
mainMenuFixOrder: icon {{ "menu_fix_order", menuIconFg }};
|
||||
mainMenuFixOrderOver: icon {{ "menu_fix_order", menuIconFgOver }};
|
||||
mainMenuFooterLeft: 30px;
|
||||
mainMenuTelegramLabel: FlatLabel(defaultFlatLabel) {
|
||||
align: align(left);
|
||||
|
|
|
@ -13,10 +13,12 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
|||
#include "ui/widgets/buttons.h"
|
||||
#include "ui/widgets/labels.h"
|
||||
#include "ui/widgets/menu.h"
|
||||
#include "ui/toast/toast.h"
|
||||
#include "ui/special_buttons.h"
|
||||
#include "ui/empty_userpic.h"
|
||||
#include "mainwindow.h"
|
||||
#include "storage/localstorage.h"
|
||||
#include "support/support_templates.h"
|
||||
#include "boxes/about_box.h"
|
||||
#include "boxes/peer_list_controllers.h"
|
||||
#include "calls/calls_box_controller.h"
|
||||
|
@ -117,13 +119,33 @@ void MainMenu::refreshMenu() {
|
|||
_menu->addAction(lang(lng_profile_add_contact), [] {
|
||||
App::wnd()->onShowAddContact();
|
||||
}, &st::mainMenuContacts, &st::mainMenuContactsOver);
|
||||
|
||||
const auto fix = std::make_shared<QPointer<QAction>>();
|
||||
*fix = _menu->addAction(qsl("Fix chats order"), [=] {
|
||||
(*fix)->setChecked(!(*fix)->isChecked());
|
||||
Auth().settings().setSupportFixChatsOrder((*fix)->isChecked());
|
||||
Local::writeUserSettings();
|
||||
}, &st::mainMenuFixOrder, &st::mainMenuFixOrderOver);
|
||||
(*fix)->setCheckable(true);
|
||||
(*fix)->setChecked(Auth().settings().supportFixChatsOrder());
|
||||
|
||||
const auto subscription = Ui::AttachAsChild(_menu, rpl::lifetime());
|
||||
_menu->addAction(qsl("Reload templates"), [=] {
|
||||
*subscription = Auth().supportTemplates()->errors(
|
||||
) | rpl::start_with_next([=](QStringList errors) {
|
||||
Ui::Toast::Show(errors.isEmpty()
|
||||
? "Templates reloaded!"
|
||||
: ("Errors:\n\n" + errors.join("\n\n")));
|
||||
});
|
||||
Auth().supportTemplates()->reload();
|
||||
}, &st::mainMenuReload, &st::mainMenuReloadOver);
|
||||
}
|
||||
_menu->addAction(lang(lng_menu_settings), [] {
|
||||
App::wnd()->showSettings();
|
||||
}, &st::mainMenuSettings, &st::mainMenuSettingsOver);
|
||||
|
||||
_nightThemeAction = std::make_shared<QPointer<QAction>>(nullptr);
|
||||
auto action = _menu->addAction(lang(lng_menu_night_mode), [this] {
|
||||
_nightThemeAction = std::make_shared<QPointer<QAction>>();
|
||||
auto action = _menu->addAction(lang(lng_menu_night_mode), [=] {
|
||||
if (auto action = *_nightThemeAction) {
|
||||
action->setChecked(!action->isChecked());
|
||||
_nightThemeSwitch.callOnce(st::mainMenu.itemToggle.duration);
|
||||
|
|
Loading…
Add table
Reference in a new issue