2019-01-05 11:08:02 +00: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
|
|
|
|
|
|
|
|
#include "settings/settings_common.h"
|
2020-08-21 10:50:13 +00:00
|
|
|
#include "ui/effects/animations.h"
|
2019-01-05 11:08:02 +00:00
|
|
|
#include "base/timer.h"
|
|
|
|
|
2020-11-29 18:26:49 +00:00
|
|
|
namespace style {
|
|
|
|
struct Checkbox;
|
|
|
|
struct Radio;
|
|
|
|
} // namespace style
|
|
|
|
|
2019-01-05 11:08:02 +00:00
|
|
|
namespace Calls {
|
2019-07-24 14:00:30 +00:00
|
|
|
class Call;
|
2019-01-05 11:08:02 +00:00
|
|
|
} // namespace Calls
|
|
|
|
|
|
|
|
namespace Ui {
|
2019-07-24 14:00:30 +00:00
|
|
|
class LevelMeter;
|
2021-02-01 13:51:01 +00:00
|
|
|
class GenericBox;
|
2022-03-13 21:52:33 +00:00
|
|
|
class Show;
|
2019-07-24 14:00:30 +00:00
|
|
|
} // namespace Ui
|
2019-01-05 11:08:02 +00:00
|
|
|
|
2020-08-21 10:50:13 +00:00
|
|
|
namespace Webrtc {
|
2019-07-24 14:00:30 +00:00
|
|
|
class AudioInputTester;
|
2022-03-13 21:52:33 +00:00
|
|
|
class VideoTrack;
|
2020-08-21 10:50:13 +00:00
|
|
|
} // namespace Webrtc
|
2019-01-05 11:08:02 +00:00
|
|
|
|
|
|
|
namespace Settings {
|
|
|
|
|
2022-04-01 11:53:23 +00:00
|
|
|
class Calls : public Section<Calls> {
|
2019-01-05 11:08:02 +00:00
|
|
|
public:
|
2019-07-24 14:00:30 +00:00
|
|
|
Calls(QWidget *parent, not_null<Window::SessionController*> controller);
|
|
|
|
~Calls();
|
|
|
|
|
2022-04-13 08:05:10 +00:00
|
|
|
[[nodiscard]] rpl::producer<QString> title() override;
|
2022-04-01 11:53:23 +00:00
|
|
|
|
2019-07-24 14:00:30 +00:00
|
|
|
void sectionSaveChanges(FnMut<void()> done) override;
|
2019-01-05 11:08:02 +00:00
|
|
|
|
2022-03-13 21:52:33 +00:00
|
|
|
static Webrtc::VideoTrack *AddCameraSubsection(
|
|
|
|
std::shared_ptr<Ui::Show> show,
|
|
|
|
not_null<Ui::VerticalLayout*> content,
|
|
|
|
bool saveToSettings);
|
|
|
|
|
2019-01-05 11:08:02 +00:00
|
|
|
private:
|
2020-06-09 16:57:05 +00:00
|
|
|
void setupContent();
|
2019-01-05 11:08:02 +00:00
|
|
|
void requestPermissionAndStartTestingMicrophone();
|
|
|
|
void startTestingMicrophone();
|
|
|
|
|
2020-06-09 16:57:05 +00:00
|
|
|
const not_null<Window::SessionController*> _controller;
|
2020-08-18 14:00:33 +00:00
|
|
|
rpl::event_stream<QString> _cameraNameStream;
|
2019-01-05 11:08:02 +00:00
|
|
|
rpl::event_stream<QString> _outputNameStream;
|
|
|
|
rpl::event_stream<QString> _inputNameStream;
|
2020-08-21 10:50:13 +00:00
|
|
|
std::unique_ptr<Webrtc::AudioInputTester> _micTester;
|
2019-01-05 11:08:02 +00:00
|
|
|
Ui::LevelMeter *_micTestLevel = nullptr;
|
2020-08-21 10:50:13 +00:00
|
|
|
float _micLevel = 0.;
|
|
|
|
Ui::Animations::Simple _micLevelAnimation;
|
2019-01-05 11:08:02 +00:00
|
|
|
base::Timer _levelUpdateTimer;
|
2019-07-24 14:00:30 +00:00
|
|
|
|
2019-01-05 11:08:02 +00:00
|
|
|
};
|
|
|
|
|
2020-11-28 16:18:51 +00:00
|
|
|
inline constexpr auto kMicTestUpdateInterval = crl::time(100);
|
|
|
|
inline constexpr auto kMicTestAnimationDuration = crl::time(200);
|
|
|
|
|
|
|
|
[[nodiscard]] QString CurrentAudioOutputName();
|
|
|
|
[[nodiscard]] QString CurrentAudioInputName();
|
2021-02-01 13:51:01 +00:00
|
|
|
[[nodiscard]] object_ptr<Ui::GenericBox> ChooseAudioOutputBox(
|
2020-11-29 18:26:49 +00:00
|
|
|
Fn<void(QString id, QString name)> chosen,
|
|
|
|
const style::Checkbox *st = nullptr,
|
|
|
|
const style::Radio *radioSt = nullptr);
|
2021-02-01 13:51:01 +00:00
|
|
|
[[nodiscard]] object_ptr<Ui::GenericBox> ChooseAudioInputBox(
|
2020-11-29 18:26:49 +00:00
|
|
|
Fn<void(QString id, QString name)> chosen,
|
|
|
|
const style::Checkbox *st = nullptr,
|
|
|
|
const style::Radio *radioSt = nullptr);
|
2021-02-01 13:51:01 +00:00
|
|
|
//[[nodiscard]] object_ptr<Ui::GenericBox> ChooseAudioBackendBox(
|
|
|
|
// const style::Checkbox *st = nullptr,
|
|
|
|
// const style::Radio *radioSt = nullptr);
|
2020-11-28 16:18:51 +00:00
|
|
|
|
2019-01-05 11:08:02 +00:00
|
|
|
} // namespace Settings
|
|
|
|
|