2019-01-05 14:08:02 +03:00
|
|
|
/*
|
|
|
|
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
|
|
|
|
|
2023-11-15 00:54:32 +03:00
|
|
|
#include "settings/settings_common_session.h"
|
2020-08-21 14:50:13 +04:00
|
|
|
#include "ui/effects/animations.h"
|
2019-01-05 14:08:02 +03:00
|
|
|
#include "base/timer.h"
|
|
|
|
|
2020-11-29 21:26:49 +03:00
|
|
|
namespace style {
|
|
|
|
struct Checkbox;
|
|
|
|
struct Radio;
|
|
|
|
} // namespace style
|
|
|
|
|
2019-01-05 14:08:02 +03:00
|
|
|
namespace Calls {
|
2019-07-24 16:00:30 +02:00
|
|
|
class Call;
|
2019-01-05 14:08:02 +03:00
|
|
|
} // namespace Calls
|
|
|
|
|
|
|
|
namespace Ui {
|
2019-07-24 16:00:30 +02:00
|
|
|
class LevelMeter;
|
2021-02-01 17:51:01 +04:00
|
|
|
class GenericBox;
|
2022-03-14 00:52:33 +03:00
|
|
|
class Show;
|
2019-07-24 16:00:30 +02:00
|
|
|
} // namespace Ui
|
2019-01-05 14:08:02 +03:00
|
|
|
|
2020-08-21 14:50:13 +04:00
|
|
|
namespace Webrtc {
|
2019-07-24 16:00:30 +02:00
|
|
|
class AudioInputTester;
|
2022-03-14 00:52:33 +03:00
|
|
|
class VideoTrack;
|
2020-08-21 14:50:13 +04:00
|
|
|
} // namespace Webrtc
|
2019-01-05 14:08:02 +03:00
|
|
|
|
|
|
|
namespace Settings {
|
|
|
|
|
2022-04-01 15:53:23 +04:00
|
|
|
class Calls : public Section<Calls> {
|
2019-01-05 14:08:02 +03:00
|
|
|
public:
|
2019-07-24 16:00:30 +02:00
|
|
|
Calls(QWidget *parent, not_null<Window::SessionController*> controller);
|
|
|
|
~Calls();
|
|
|
|
|
2022-04-13 12:05:10 +04:00
|
|
|
[[nodiscard]] rpl::producer<QString> title() override;
|
2022-04-01 15:53:23 +04:00
|
|
|
|
2019-07-24 16:00:30 +02:00
|
|
|
void sectionSaveChanges(FnMut<void()> done) override;
|
2019-01-05 14:08:02 +03:00
|
|
|
|
2022-03-14 00:52:33 +03:00
|
|
|
static Webrtc::VideoTrack *AddCameraSubsection(
|
|
|
|
std::shared_ptr<Ui::Show> show,
|
|
|
|
not_null<Ui::VerticalLayout*> content,
|
|
|
|
bool saveToSettings);
|
|
|
|
|
2019-01-05 14:08:02 +03:00
|
|
|
private:
|
2020-06-09 20:57:05 +04:00
|
|
|
void setupContent();
|
2019-01-05 14:08:02 +03:00
|
|
|
void requestPermissionAndStartTestingMicrophone();
|
2024-01-24 12:42:37 +04:00
|
|
|
|
|
|
|
void initPlaybackButton(
|
|
|
|
not_null<Ui::VerticalLayout*> container,
|
|
|
|
rpl::producer<QString> text,
|
|
|
|
rpl::producer<QString> resolvedId,
|
|
|
|
Fn<void(QString)> set);
|
|
|
|
void initCaptureButton(
|
|
|
|
not_null<Ui::VerticalLayout*> container,
|
|
|
|
rpl::producer<QString> text,
|
|
|
|
rpl::producer<QString> resolvedId,
|
|
|
|
Fn<void(QString)> set);
|
2019-01-05 14:08:02 +03:00
|
|
|
|
2020-06-09 20:57:05 +04:00
|
|
|
const not_null<Window::SessionController*> _controller;
|
2020-08-18 18:00:33 +04:00
|
|
|
rpl::event_stream<QString> _cameraNameStream;
|
2024-01-24 12:42:37 +04:00
|
|
|
rpl::variable<bool> _testingMicrophone;
|
2019-07-24 16:00:30 +02:00
|
|
|
|
2019-01-05 14:08:02 +03:00
|
|
|
};
|
|
|
|
|
2020-11-28 19:18:51 +03:00
|
|
|
inline constexpr auto kMicTestUpdateInterval = crl::time(100);
|
|
|
|
inline constexpr auto kMicTestAnimationDuration = crl::time(200);
|
|
|
|
|
2024-01-22 20:40:55 +04:00
|
|
|
[[nodiscard]] rpl::producer<QString> PlaybackDeviceNameValue(
|
|
|
|
rpl::producer<QString> id);
|
|
|
|
[[nodiscard]] rpl::producer<QString> CaptureDeviceNameValue(
|
|
|
|
rpl::producer<QString> id);
|
2024-01-24 12:42:37 +04:00
|
|
|
[[nodiscard]] rpl::producer<QString> CameraDeviceNameValue(
|
|
|
|
rpl::producer<QString> id);
|
2024-01-22 20:40:55 +04:00
|
|
|
[[nodiscard]] object_ptr<Ui::GenericBox> ChoosePlaybackDeviceBox(
|
|
|
|
rpl::producer<QString> currentId,
|
|
|
|
Fn<void(QString id)> chosen,
|
2020-11-29 21:26:49 +03:00
|
|
|
const style::Checkbox *st = nullptr,
|
|
|
|
const style::Radio *radioSt = nullptr);
|
2024-01-22 20:40:55 +04:00
|
|
|
[[nodiscard]] object_ptr<Ui::GenericBox> ChooseCaptureDeviceBox(
|
|
|
|
rpl::producer<QString> currentId,
|
|
|
|
Fn<void(QString id)> chosen,
|
2020-11-29 21:26:49 +03:00
|
|
|
const style::Checkbox *st = nullptr,
|
|
|
|
const style::Radio *radioSt = nullptr);
|
2024-01-24 12:42:37 +04:00
|
|
|
[[nodiscard]] object_ptr<Ui::GenericBox> ChooseCameraDeviceBox(
|
|
|
|
rpl::producer<QString> currentId,
|
|
|
|
Fn<void(QString id)> chosen,
|
|
|
|
const style::Checkbox *st = nullptr,
|
|
|
|
const style::Radio *radioSt = nullptr);
|
2020-11-28 19:18:51 +03:00
|
|
|
|
2019-01-05 14:08:02 +03:00
|
|
|
} // namespace Settings
|
|
|
|
|