19 #ifndef MPRIS_MEDIA_PLAYER2_H_ 20 #define MPRIS_MEDIA_PLAYER2_H_ 22 #include <core/dbus/macros.h> 23 #include <core/dbus/object.h> 24 #include <core/dbus/property.h> 25 #include <core/dbus/interfaces/properties.h> 26 #include <core/dbus/types/variant.h> 38 static const std::string&
name()
40 static const std::string s{
"org.mpris.MediaPlayer2"};
64 DBUS_CPP_READABLE_PROPERTY_DEF(CanQuit,
MediaPlayer2,
bool)
68 DBUS_CPP_WRITABLE_PROPERTY_DEF(Fullscreen,
MediaPlayer2,
bool)
74 DBUS_CPP_READABLE_PROPERTY_DEF(CanSetFullscreen,
MediaPlayer2,
bool)
79 DBUS_CPP_READABLE_PROPERTY_DEF(CanRaise,
MediaPlayer2,
bool)
83 DBUS_CPP_READABLE_PROPERTY_DEF(HasTrackList,
MediaPlayer2,
bool)
86 DBUS_CPP_READABLE_PROPERTY_DEF(Identity,
MediaPlayer2, std::string)
91 DBUS_CPP_READABLE_PROPERTY_DEF(DesktopEntry,
MediaPlayer2, std::string)
94 DBUS_CPP_READABLE_PROPERTY_DEF(SupportedUriSchemes,
MediaPlayer2, std::vector<std::string>)
97 DBUS_CPP_READABLE_PROPERTY_DEF(SupportedMimeTypes,
MediaPlayer2, std::vector<std::string>)
112 Properties::CanQuit::ValueType can_quit{
false};
113 Properties::Fullscreen::ValueType fullscreen{
false};
114 Properties::CanSetFullscreen::ValueType can_set_fullscreen{
false};
115 Properties::CanRaise::ValueType can_raise{
false};
116 Properties::HasTrackList::ValueType has_track_list{
false};
117 Properties::Identity::ValueType identity{};
118 Properties::DesktopEntry::ValueType desktop_entry{};
119 Properties::SupportedUriSchemes::ValueType supported_uri_schemes{};
120 Properties::SupportedMimeTypes::ValueType supported_mime_types{};
126 : configuration(configuration),
129 configuration.
object->get_property<Properties::CanQuit>(),
130 configuration.
object->get_property<Properties::Fullscreen>(),
131 configuration.
object->get_property<Properties::CanSetFullscreen>(),
132 configuration.
object->get_property<Properties::CanRaise>(),
133 configuration.
object->get_property<Properties::HasTrackList>(),
134 configuration.
object->get_property<Properties::Identity>(),
135 configuration.
object->get_property<Properties::DesktopEntry>(),
136 configuration.
object->get_property<Properties::SupportedUriSchemes>(),
137 configuration.
object->get_property<Properties::SupportedMimeTypes>()
141 configuration.object->get_signal<core::dbus::interfaces::Properties::Signals::PropertiesChanged>()
145 properties.can_quit->set(configuration.defaults.can_quit);
146 properties.fullscreen->set(configuration.defaults.fullscreen);
147 properties.can_set_fullscreen->set(configuration.defaults.can_set_fullscreen);
148 properties.can_raise->set(configuration.defaults.can_raise);
149 properties.has_track_list->set(configuration.defaults.has_track_list);
150 properties.desktop_entry->set(configuration.defaults.desktop_entry);
151 properties.identity->set(configuration.defaults.identity);
152 properties.supported_mime_types->set(configuration.defaults.supported_mime_types);
157 std::map<std::string, core::dbus::types::Variant> dict;
158 dict[Properties::CanQuit::name()]
159 = core::dbus::types::Variant::encode(properties.can_quit->get());
160 dict[Properties::Fullscreen::name()]
161 = core::dbus::types::Variant::encode(properties.fullscreen->get());
162 dict[Properties::CanSetFullscreen::name()]
163 = core::dbus::types::Variant::encode(properties.can_set_fullscreen->get());
164 dict[Properties::CanRaise::name()]
165 = core::dbus::types::Variant::encode(properties.can_raise->get());
166 dict[Properties::HasTrackList::name()]
167 = core::dbus::types::Variant::encode(properties.has_track_list->get());
168 dict[Properties::CanSetFullscreen::name()]
169 = core::dbus::types::Variant::encode(properties.can_set_fullscreen->get());
170 dict[Properties::DesktopEntry::name()]
171 = core::dbus::types::Variant::encode(properties.desktop_entry->get());
172 dict[Properties::Identity::name()]
173 = core::dbus::types::Variant::encode(properties.identity->get());
174 dict[Properties::SupportedMimeTypes::name()]
175 = core::dbus::types::Variant::encode(properties.supported_mime_types->get());
186 std::shared_ptr<core::dbus::Property<Properties::CanQuit>>
can_quit;
187 std::shared_ptr<core::dbus::Property<Properties::Fullscreen>>
fullscreen;
189 std::shared_ptr<core::dbus::Property<Properties::CanRaise>>
can_raise;
191 std::shared_ptr<core::dbus::Property<Properties::Identity>>
identity;
192 std::shared_ptr<core::dbus::Property<Properties::DesktopEntry>>
desktop_entry;
201 core::dbus::interfaces::Properties::Signals::PropertiesChanged,
202 core::dbus::interfaces::Properties::Signals::PropertiesChanged::ArgumentType
209 #endif // MPRIS_MEDIA_PLAYER2_H_