tdesktop/Telegram/SourceFiles/settings/settings_calls.h

86 lines
2.3 KiB
C
Raw Normal View History

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"
#include "ui/effects/animations.h"
2019-01-05 11:08:02 +00:00
#include "base/timer.h"
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;
class GenericBox;
class Show;
2019-07-24 14:00:30 +00:00
} // namespace Ui
2019-01-05 11:08:02 +00:00
namespace Webrtc {
2019-07-24 14:00:30 +00:00
class AudioInputTester;
class VideoTrack;
} // namespace Webrtc
2019-01-05 11:08:02 +00:00
namespace Settings {
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();
[[nodiscard]] rpl::producer<QString> title() override;
2019-07-24 14:00:30 +00:00
void sectionSaveChanges(FnMut<void()> done) override;
2019-01-05 11:08:02 +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:
void setupContent();
2019-01-05 11:08:02 +00:00
void requestPermissionAndStartTestingMicrophone();
void startTestingMicrophone();
const not_null<Window::SessionController*> _controller;
rpl::event_stream<QString> _cameraNameStream;
2019-01-05 11:08:02 +00:00
rpl::event_stream<QString> _outputNameStream;
rpl::event_stream<QString> _inputNameStream;
std::unique_ptr<Webrtc::AudioInputTester> _micTester;
2019-01-05 11:08:02 +00:00
Ui::LevelMeter *_micTestLevel = nullptr;
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();
[[nodiscard]] object_ptr<Ui::GenericBox> ChooseAudioOutputBox(
Fn<void(QString id, QString name)> chosen,
const style::Checkbox *st = nullptr,
const style::Radio *radioSt = nullptr);
[[nodiscard]] object_ptr<Ui::GenericBox> ChooseAudioInputBox(
Fn<void(QString id, QString name)> chosen,
const style::Checkbox *st = nullptr,
const style::Radio *radioSt = nullptr);
//[[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