mirror of https://github.com/procxx/kepka.git
Move calls settings to Settings > Advanced.
Also add calls settings button to the calls list box.
This commit is contained in:
parent
c4d919d46b
commit
8711830f66
|
@ -378,11 +378,14 @@ void AbstractBox::updateButtonsPositions() {
|
||||||
if (_leftButton) {
|
if (_leftButton) {
|
||||||
_leftButton->moveToLeft(right, top);
|
_leftButton->moveToLeft(right, top);
|
||||||
}
|
}
|
||||||
for_const (auto &button, _buttons) {
|
for (const auto &button : _buttons) {
|
||||||
button->moveToRight(right, top);
|
button->moveToRight(right, top);
|
||||||
right += button->width() + padding.left();
|
right += button->width() + padding.left();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (_topButton) {
|
||||||
|
_topButton->moveToRight(0, 0);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
QPointer<QWidget> AbstractBox::outerContainer() {
|
QPointer<QWidget> AbstractBox::outerContainer() {
|
||||||
|
@ -403,6 +406,7 @@ void AbstractBox::clearButtons() {
|
||||||
button.destroy();
|
button.destroy();
|
||||||
}
|
}
|
||||||
_leftButton.destroy();
|
_leftButton.destroy();
|
||||||
|
_topButton = nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
QPointer<Ui::RoundButton> AbstractBox::addButton(Fn<QString()> textFactory, Fn<void()> clickCallback, const style::RoundButton &st) {
|
QPointer<Ui::RoundButton> AbstractBox::addButton(Fn<QString()> textFactory, Fn<void()> clickCallback, const style::RoundButton &st) {
|
||||||
|
@ -423,6 +427,15 @@ QPointer<Ui::RoundButton> AbstractBox::addLeftButton(Fn<QString()> textFactory,
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
QPointer<Ui::IconButton> AbstractBox::addTopButton(const style::IconButton &st, Fn<void()> clickCallback) {
|
||||||
|
_topButton = base::make_unique_q<Ui::IconButton>(this, st);
|
||||||
|
auto result = QPointer<Ui::IconButton>(_topButton.get());
|
||||||
|
result->setClickedCallback(std::move(clickCallback));
|
||||||
|
result->show();
|
||||||
|
updateButtonsPositions();
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
void AbstractBox::setDimensions(int newWidth, int maxHeight) {
|
void AbstractBox::setDimensions(int newWidth, int maxHeight) {
|
||||||
_maxContentHeight = maxHeight;
|
_maxContentHeight = maxHeight;
|
||||||
|
|
||||||
|
|
|
@ -8,10 +8,12 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "window/layer_widget.h"
|
#include "window/layer_widget.h"
|
||||||
|
#include "base/unique_qptr.h"
|
||||||
#include "ui/rp_widget.h"
|
#include "ui/rp_widget.h"
|
||||||
|
|
||||||
namespace style {
|
namespace style {
|
||||||
struct RoundButton;
|
struct RoundButton;
|
||||||
|
struct IconButton;
|
||||||
struct ScrollArea;
|
struct ScrollArea;
|
||||||
} // namespace style
|
} // namespace style
|
||||||
|
|
||||||
|
@ -35,6 +37,7 @@ public:
|
||||||
virtual void clearButtons() = 0;
|
virtual void clearButtons() = 0;
|
||||||
virtual QPointer<Ui::RoundButton> addButton(Fn<QString()> textFactory, Fn<void()> clickCallback, const style::RoundButton &st) = 0;
|
virtual QPointer<Ui::RoundButton> addButton(Fn<QString()> textFactory, Fn<void()> clickCallback, const style::RoundButton &st) = 0;
|
||||||
virtual QPointer<Ui::RoundButton> addLeftButton(Fn<QString()> textFactory, Fn<void()> clickCallback, const style::RoundButton &st) = 0;
|
virtual QPointer<Ui::RoundButton> addLeftButton(Fn<QString()> textFactory, Fn<void()> clickCallback, const style::RoundButton &st) = 0;
|
||||||
|
virtual QPointer<Ui::IconButton> addTopButton(const style::IconButton &st, Fn<void()> clickCallback) = 0;
|
||||||
virtual void updateButtonsPositions() = 0;
|
virtual void updateButtonsPositions() = 0;
|
||||||
|
|
||||||
virtual void showBox(
|
virtual void showBox(
|
||||||
|
@ -102,6 +105,9 @@ public:
|
||||||
}
|
}
|
||||||
QPointer<Ui::RoundButton> addButton(Fn<QString()> textFactory, Fn<void()> clickCallback);
|
QPointer<Ui::RoundButton> addButton(Fn<QString()> textFactory, Fn<void()> clickCallback);
|
||||||
QPointer<Ui::RoundButton> addLeftButton(Fn<QString()> textFactory, Fn<void()> clickCallback);
|
QPointer<Ui::RoundButton> addLeftButton(Fn<QString()> textFactory, Fn<void()> clickCallback);
|
||||||
|
QPointer<Ui::IconButton> addTopButton(const style::IconButton &st, Fn<void()> clickCallback) {
|
||||||
|
return getDelegate()->addTopButton(st, std::move(clickCallback));
|
||||||
|
}
|
||||||
QPointer<Ui::RoundButton> addButton(Fn<QString()> textFactory, Fn<void()> clickCallback, const style::RoundButton &st) {
|
QPointer<Ui::RoundButton> addButton(Fn<QString()> textFactory, Fn<void()> clickCallback, const style::RoundButton &st) {
|
||||||
return getDelegate()->addButton(std::move(textFactory), std::move(clickCallback), st);
|
return getDelegate()->addButton(std::move(textFactory), std::move(clickCallback), st);
|
||||||
}
|
}
|
||||||
|
@ -251,6 +257,7 @@ public:
|
||||||
void clearButtons() override;
|
void clearButtons() override;
|
||||||
QPointer<Ui::RoundButton> addButton(Fn<QString()> textFactory, Fn<void()> clickCallback, const style::RoundButton &st) override;
|
QPointer<Ui::RoundButton> addButton(Fn<QString()> textFactory, Fn<void()> clickCallback, const style::RoundButton &st) override;
|
||||||
QPointer<Ui::RoundButton> addLeftButton(Fn<QString()> textFactory, Fn<void()> clickCallback, const style::RoundButton &st) override;
|
QPointer<Ui::RoundButton> addLeftButton(Fn<QString()> textFactory, Fn<void()> clickCallback, const style::RoundButton &st) override;
|
||||||
|
QPointer<Ui::IconButton> addTopButton(const style::IconButton &st, Fn<void()> clickCallback) override;
|
||||||
void updateButtonsPositions() override;
|
void updateButtonsPositions() override;
|
||||||
QPointer<QWidget> outerContainer() override;
|
QPointer<QWidget> outerContainer() override;
|
||||||
|
|
||||||
|
@ -319,6 +326,7 @@ private:
|
||||||
|
|
||||||
std::vector<object_ptr<Ui::RoundButton>> _buttons;
|
std::vector<object_ptr<Ui::RoundButton>> _buttons;
|
||||||
object_ptr<Ui::RoundButton> _leftButton = { nullptr };
|
object_ptr<Ui::RoundButton> _leftButton = { nullptr };
|
||||||
|
base::unique_qptr<Ui::IconButton> _topButton = { nullptr };
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -896,3 +896,16 @@ createPollWarning: FlatLabel(defaultFlatLabel) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
createPollWarningPosition: point(16px, 6px);
|
createPollWarningPosition: point(16px, 6px);
|
||||||
|
|
||||||
|
callSettingsButton: IconButton {
|
||||||
|
width: 50px;
|
||||||
|
height: boxLayerTitleHeight;
|
||||||
|
icon: icon {{ "menu_settings", boxTitleCloseFg }};
|
||||||
|
iconOver: icon {{ "menu_settings", boxTitleCloseFgOver }};
|
||||||
|
iconPosition: point(8px, -1px);
|
||||||
|
rippleAreaSize: 44px;
|
||||||
|
rippleAreaPosition: point(0px, 6px);
|
||||||
|
ripple: RippleAnimation(defaultRippleAnimation) {
|
||||||
|
color: windowBgOver;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
@ -60,7 +60,6 @@ settingsIconFaq: icon {{ "settings_faq", menuIconFg }};
|
||||||
settingsIconStickers: icon {{ "settings_stickers", menuIconFg }};
|
settingsIconStickers: icon {{ "settings_stickers", menuIconFg }};
|
||||||
settingsIconEmoji: icon {{ "settings_emoji", menuIconFg }};
|
settingsIconEmoji: icon {{ "settings_emoji", menuIconFg }};
|
||||||
settingsIconThemes: icon {{ "settings_themes", menuIconFg }};
|
settingsIconThemes: icon {{ "settings_themes", menuIconFg }};
|
||||||
settingsIconCalls: icon {{ "settings_phone_number", menuIconFg }};
|
|
||||||
|
|
||||||
settingsSetPhotoSkip: 7px;
|
settingsSetPhotoSkip: 7px;
|
||||||
|
|
||||||
|
|
|
@ -436,11 +436,32 @@ void SetupPerformance(not_null<Ui::VerticalLayout*> container) {
|
||||||
}, container->lifetime());
|
}, container->lifetime());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void SetupSystemIntegration(
|
||||||
|
not_null<Ui::VerticalLayout*> container,
|
||||||
|
Fn<void(Type)> showOther) {
|
||||||
|
AddDivider(container);
|
||||||
|
AddSkip(container);
|
||||||
|
AddSubsectionTitle(container, lng_settings_system_integration);
|
||||||
|
AddButton(
|
||||||
|
container,
|
||||||
|
lng_settings_section_call_settings,
|
||||||
|
st::settingsButton
|
||||||
|
)->addClickHandler([=] {
|
||||||
|
showOther(Type::Calls);
|
||||||
|
});
|
||||||
|
SetupTray(container);
|
||||||
|
AddSkip(container);
|
||||||
|
}
|
||||||
|
|
||||||
Advanced::Advanced(QWidget *parent, UserData *self)
|
Advanced::Advanced(QWidget *parent, UserData *self)
|
||||||
: Section(parent) {
|
: Section(parent) {
|
||||||
setupContent();
|
setupContent();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
rpl::producer<Type> Advanced::sectionShowOther() {
|
||||||
|
return _showOther.events();
|
||||||
|
}
|
||||||
|
|
||||||
void Advanced::setupContent() {
|
void Advanced::setupContent() {
|
||||||
const auto content = Ui::CreateChild<Ui::VerticalLayout>(this);
|
const auto content = Ui::CreateChild<Ui::VerticalLayout>(this);
|
||||||
|
|
||||||
|
@ -473,18 +494,16 @@ void Advanced::setupContent() {
|
||||||
}
|
}
|
||||||
SetupDataStorage(content);
|
SetupDataStorage(content);
|
||||||
SetupAutoDownload(content);
|
SetupAutoDownload(content);
|
||||||
if (HasTray()) {
|
SetupSystemIntegration(content, [=](Type type) {
|
||||||
addDivider();
|
_showOther.fire_copy(type);
|
||||||
AddSkip(content);
|
});
|
||||||
AddSubsectionTitle(content, lng_settings_system_integration);
|
|
||||||
SetupTray(content);
|
AddDivider(content);
|
||||||
AddSkip(content);
|
|
||||||
}
|
|
||||||
addDivider();
|
|
||||||
AddSkip(content);
|
AddSkip(content);
|
||||||
AddSubsectionTitle(content, lng_settings_performance);
|
AddSubsectionTitle(content, lng_settings_performance);
|
||||||
SetupPerformance(content);
|
SetupPerformance(content);
|
||||||
AddSkip(content);
|
AddSkip(content);
|
||||||
|
|
||||||
if (cAutoUpdate()) {
|
if (cAutoUpdate()) {
|
||||||
addUpdate();
|
addUpdate();
|
||||||
}
|
}
|
||||||
|
|
|
@ -23,9 +23,13 @@ class Advanced : public Section {
|
||||||
public:
|
public:
|
||||||
explicit Advanced(QWidget *parent, UserData *self = nullptr);
|
explicit Advanced(QWidget *parent, UserData *self = nullptr);
|
||||||
|
|
||||||
|
rpl::producer<Type> sectionShowOther() override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void setupContent();
|
void setupContent();
|
||||||
|
|
||||||
|
rpl::event_stream<Type> _showOther;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace Settings
|
} // namespace Settings
|
||||||
|
|
|
@ -87,10 +87,6 @@ void SetupSections(
|
||||||
lng_settings_section_chat_settings,
|
lng_settings_section_chat_settings,
|
||||||
Type::Chat,
|
Type::Chat,
|
||||||
&st::settingsIconChat);
|
&st::settingsIconChat);
|
||||||
addSection(
|
|
||||||
lng_settings_section_call_settings,
|
|
||||||
Type::Calls,
|
|
||||||
&st::settingsIconCalls);
|
|
||||||
addSection(
|
addSection(
|
||||||
lng_settings_advanced,
|
lng_settings_advanced,
|
||||||
Type::Advanced,
|
Type::Advanced,
|
||||||
|
|
|
@ -8,6 +8,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||||
#include "window/window_main_menu.h"
|
#include "window/window_main_menu.h"
|
||||||
|
|
||||||
#include "window/themes/window_theme.h"
|
#include "window/themes/window_theme.h"
|
||||||
|
#include "window/window_controller.h"
|
||||||
#include "ui/widgets/buttons.h"
|
#include "ui/widgets/buttons.h"
|
||||||
#include "ui/widgets/labels.h"
|
#include "ui/widgets/labels.h"
|
||||||
#include "ui/widgets/menu.h"
|
#include "ui/widgets/menu.h"
|
||||||
|
@ -16,6 +17,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||||
#include "mainwindow.h"
|
#include "mainwindow.h"
|
||||||
#include "storage/localstorage.h"
|
#include "storage/localstorage.h"
|
||||||
#include "support/support_templates.h"
|
#include "support/support_templates.h"
|
||||||
|
#include "settings/settings_common.h"
|
||||||
#include "boxes/about_box.h"
|
#include "boxes/about_box.h"
|
||||||
#include "boxes/peer_list_controllers.h"
|
#include "boxes/peer_list_controllers.h"
|
||||||
#include "calls/calls_box_controller.h"
|
#include "calls/calls_box_controller.h"
|
||||||
|
@ -27,6 +29,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||||
#include "styles/style_window.h"
|
#include "styles/style_window.h"
|
||||||
#include "styles/style_dialogs.h"
|
#include "styles/style_dialogs.h"
|
||||||
#include "styles/style_settings.h"
|
#include "styles/style_settings.h"
|
||||||
|
#include "styles/style_boxes.h"
|
||||||
|
|
||||||
namespace Window {
|
namespace Window {
|
||||||
namespace {
|
namespace {
|
||||||
|
@ -193,7 +196,14 @@ void MainMenu::refreshMenu() {
|
||||||
if (Global::PhoneCallsEnabled()) {
|
if (Global::PhoneCallsEnabled()) {
|
||||||
_menu->addAction(lang(lng_menu_calls), [] {
|
_menu->addAction(lang(lng_menu_calls), [] {
|
||||||
Ui::show(Box<PeerListBox>(std::make_unique<Calls::BoxController>(), [](not_null<PeerListBox*> box) {
|
Ui::show(Box<PeerListBox>(std::make_unique<Calls::BoxController>(), [](not_null<PeerListBox*> box) {
|
||||||
box->addButton(langFactory(lng_close), [box] { box->closeBox(); });
|
box->addButton(langFactory(lng_close), [=] {
|
||||||
|
box->closeBox();
|
||||||
|
});
|
||||||
|
box->addTopButton(st::callSettingsButton, [=] {
|
||||||
|
App::wnd()->controller()->showSettings(
|
||||||
|
Settings::Type::Calls,
|
||||||
|
Window::SectionShow(anim::type::instant));
|
||||||
|
});
|
||||||
}));
|
}));
|
||||||
}, &st::mainMenuCalls, &st::mainMenuCallsOver);
|
}, &st::mainMenuCalls, &st::mainMenuCallsOver);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue