59 lines
1.1 KiB
C++
59 lines
1.1 KiB
C++
// This file is part of Desktop App Toolkit,
|
|
// a set of libraries for developing nice desktop applications.
|
|
//
|
|
// For license and copyright information please follow this link:
|
|
// https://github.com/desktop-app/legal/blob/master/LEGAL
|
|
//
|
|
#pragma once
|
|
|
|
#include "ui/widgets/call_button.h"
|
|
|
|
namespace Ui {
|
|
|
|
enum class CallMuteButtonType {
|
|
Connecting,
|
|
Active,
|
|
Muted,
|
|
ForceMuted,
|
|
};
|
|
|
|
struct CallMuteButtonState {
|
|
QString text;
|
|
CallMuteButtonType type = CallMuteButtonType::Connecting;
|
|
};
|
|
|
|
class CallMuteButton final {
|
|
public:
|
|
explicit CallMuteButton(
|
|
not_null<QWidget*> parent,
|
|
CallMuteButtonState initial = CallMuteButtonState());
|
|
|
|
void setState(const CallMuteButtonState &state);
|
|
void setLevel(float level);
|
|
[[nodiscard]] rpl::producer<Qt::MouseButton> clicks() const;
|
|
|
|
[[nodiscard]] QSize innerSize() const;
|
|
void moveInner(QPoint position);
|
|
|
|
void setVisible(bool visible);
|
|
void show() {
|
|
setVisible(true);
|
|
}
|
|
void hide() {
|
|
setVisible(false);
|
|
}
|
|
void raise();
|
|
void lower();
|
|
|
|
[[nodiscard]] rpl::lifetime &lifetime();
|
|
|
|
private:
|
|
CallMuteButtonState _state;
|
|
float _level = 0.;
|
|
|
|
CallButton _content;
|
|
CallButton _connecting;
|
|
|
|
};
|
|
|
|
} // namespace Ui
|