Coverage Report

Created: 2022-07-04 16:17

src/client/ui.rs
Line
Count
Source (jump to first uncovered line)
1
use super::Client;
2
use crate::{
3
    requests::ui::{
4
        OpenSourceProjector, OpenSourceProjectorInternal, OpenVideoMixProjector,
5
        OpenVideoMixProjectorInternal, Request,
6
    },
7
    responses::ui as responses,
8
    Result,
9
};
10
11
/// API functions related to the user interface.
12
pub struct Ui<'a> {
13
    pub(super) client: &'a Client,
14
}
15
16
impl<'a> Ui<'a> {
17
    /// Gets whether studio is enabled.
18
19
    pub async fn studio_mode_enabled(&self) -> Result<bool> {
<obws::client::ui::Ui>::studio_mode_enabled
Line
Count
Source
18
19
    pub async fn studio_mode_enabled(&self) -> Result<bool> {
Unexecuted instantiation: <obws::client::ui::Ui>::studio_mode_enabled
19
19
        self.client
20
38
            .send_message::<_, responses::StudioModeEnabled>(Request::GetStudioModeEnabled)
21
38
            .await
22
19
            .map(|sme| sme.enabled)
<obws::client::ui::Ui>::studio_mode_enabled::{closure#0}::{closure#0}
Line
Count
Source
22
19
            .map(|sme| sme.enabled)
Unexecuted instantiation: <obws::client::ui::Ui>::studio_mode_enabled::{closure#0}::{closure#0}
Unexecuted instantiation: <obws::client::ui::Ui>::studio_mode_enabled::{closure#0}::{closure#0}
23
19
    }
<obws::client::ui::Ui>::studio_mode_enabled::{closure#0}
Line
Count
Source
19
19
        self.client
20
38
            .send_message::<_, responses::StudioModeEnabled>(Request::GetStudioModeEnabled)
21
38
            .await
22
19
            .map(|sme| sme.enabled)
23
19
    }
Unexecuted instantiation: <obws::client::ui::Ui>::studio_mode_enabled::{closure#0}
Unexecuted instantiation: <obws::client::ui::Ui>::studio_mode_enabled::{closure#0}
24
25
    /// Enables or disables studio mode.
26
    ///
27
    /// - `enabled`: Enable or disable the studio mode.
28
6
    pub async fn set_studio_mode_enabled(&self, enabled: bool) -> Result<()> {
<obws::client::ui::Ui>::set_studio_mode_enabled
Line
Count
Source
28
6
    pub async fn set_studio_mode_enabled(&self, enabled: bool) -> Result<()> {
Unexecuted instantiation: <obws::client::ui::Ui>::set_studio_mode_enabled
29
6
        self.client
30
12
            .send_message(Request::SetStudioModeEnabled { enabled })
31
12
            .await
32
6
    }
<obws::client::ui::Ui>::set_studio_mode_enabled::{closure#0}
Line
Count
Source
29
6
        self.client
30
12
            .send_message(Request::SetStudioModeEnabled { enabled })
31
12
            .await
32
6
    }
Unexecuted instantiation: <obws::client::ui::Ui>::set_studio_mode_enabled::{closure#0}
Unexecuted instantiation: <obws::client::ui::Ui>::set_studio_mode_enabled::{closure#0}
33
34
    /// Opens the properties dialog of an input.
35
0
    pub async fn open_properties_dialog(&self, input: &str) -> Result<()> {
Unexecuted instantiation: <obws::client::ui::Ui>::open_properties_dialog
Unexecuted instantiation: <obws::client::ui::Ui>::open_properties_dialog
36
0
        self.client
37
0
            .send_message(Request::OpenInputPropertiesDialog { input })
38
0
            .await
39
0
    }
Unexecuted instantiation: <obws::client::ui::Ui>::open_properties_dialog::{closure#0}
Unexecuted instantiation: <obws::client::ui::Ui>::open_properties_dialog::{closure#0}
40
41
    /// Opens the filters dialog of an input.
42
0
    pub async fn open_filters_dialog(&self, input: &str) -> Result<()> {
Unexecuted instantiation: <obws::client::ui::Ui>::open_filters_dialog
Unexecuted instantiation: <obws::client::ui::Ui>::open_filters_dialog
43
0
        self.client
44
0
            .send_message(Request::OpenInputFiltersDialog { input })
45
0
            .await
46
0
    }
Unexecuted instantiation: <obws::client::ui::Ui>::open_filters_dialog::{closure#0}
Unexecuted instantiation: <obws::client::ui::Ui>::open_filters_dialog::{closure#0}
47
48
    /// Opens the interact dialog of an input.
49
0
    pub async fn open_interact_dialog(&self, input: &str) -> Result<()> {
Unexecuted instantiation: <obws::client::ui::Ui>::open_interact_dialog
Unexecuted instantiation: <obws::client::ui::Ui>::open_interact_dialog
50
0
        self.client
51
0
            .send_message(Request::OpenInputInteractDialog { input })
52
0
            .await
53
0
    }
Unexecuted instantiation: <obws::client::ui::Ui>::open_interact_dialog::{closure#0}
Unexecuted instantiation: <obws::client::ui::Ui>::open_interact_dialog::{closure#0}
54
55
    /// Gets a list of connected monitors and information about them.
56
1
    pub async fn list_monitors(&self) -> Result<Vec<responses::Monitor>> {
<obws::client::ui::Ui>::list_monitors
Line
Count
Source
56
1
    pub async fn list_monitors(&self) -> Result<Vec<responses::Monitor>> {
Unexecuted instantiation: <obws::client::ui::Ui>::list_monitors
57
1
        self.client
58
2
            .send_message::<_, responses::MonitorList>(Request::GetMonitorList)
59
2
            .await
60
1
            .map(|ml| ml.monitors)
<obws::client::ui::Ui>::list_monitors::{closure#0}::{closure#0}
Line
Count
Source
60
1
            .map(|ml| ml.monitors)
Unexecuted instantiation: <obws::client::ui::Ui>::list_monitors::{closure#0}::{closure#0}
Unexecuted instantiation: <obws::client::ui::Ui>::list_monitors::{closure#0}::{closure#0}
61
1
    }
<obws::client::ui::Ui>::list_monitors::{closure#0}
Line
Count
Source
57
1
        self.client
58
2
            .send_message::<_, responses::MonitorList>(Request::GetMonitorList)
59
2
            .await
60
1
            .map(|ml| ml.monitors)
61
1
    }
Unexecuted instantiation: <obws::client::ui::Ui>::list_monitors::{closure#0}
Unexecuted instantiation: <obws::client::ui::Ui>::list_monitors::{closure#0}
62
63
    /// Open a projector for a specific output video mix.
64
1
    pub async fn open_video_mix_projector(&self, open: OpenVideoMixProjector) -> Result<()> {
<obws::client::ui::Ui>::open_video_mix_projector
Line
Count
Source
64
1
    pub async fn open_video_mix_projector(&self, open: OpenVideoMixProjector) -> Result<()> {
Unexecuted instantiation: <obws::client::ui::Ui>::open_video_mix_projector
65
1
        self.client
66
1
            .send_message(Request::OpenVideoMixProjector(
67
1
                OpenVideoMixProjectorInternal {
68
1
                    r#type: open.r#type,
69
1
                    location: open.location.map(Into::into),
70
1
                },
71
2
            ))
72
2
            .await
73
1
    }
<obws::client::ui::Ui>::open_video_mix_projector::{closure#0}
Line
Count
Source
65
1
        self.client
66
1
            .send_message(Request::OpenVideoMixProjector(
67
1
                OpenVideoMixProjectorInternal {
68
1
                    r#type: open.r#type,
69
1
                    location: open.location.map(Into::into),
70
1
                },
71
2
            ))
72
2
            .await
73
1
    }
Unexecuted instantiation: <obws::client::ui::Ui>::open_video_mix_projector::{closure#0}
Unexecuted instantiation: <obws::client::ui::Ui>::open_video_mix_projector::{closure#0}
74
75
    /// Opens a projector for a source.
76
1
    pub async fn open_source_projector(&self, open: OpenSourceProjector<'a>) -> Result<()> {
<obws::client::ui::Ui>::open_source_projector
Line
Count
Source
76
1
    pub async fn open_source_projector(&self, open: OpenSourceProjector<'a>) -> Result<()> {
Unexecuted instantiation: <obws::client::ui::Ui>::open_source_projector
77
1
        self.client
78
1
            .send_message(Request::OpenSourceProjector(OpenSourceProjectorInternal {
79
1
                source: open.source,
80
1
                location: open.location.map(Into::into),
81
2
            }))
82
2
            .await
83
1
    }
<obws::client::ui::Ui>::open_source_projector::{closure#0}
Line
Count
Source
77
1
        self.client
78
1
            .send_message(Request::OpenSourceProjector(OpenSourceProjectorInternal {
79
1
                source: open.source,
80
1
                location: open.location.map(Into::into),
81
2
            }))
82
2
            .await
83
1
    }
Unexecuted instantiation: <obws::client::ui::Ui>::open_source_projector::{closure#0}
Unexecuted instantiation: <obws::client::ui::Ui>::open_source_projector::{closure#0}
84
}