19 #ifndef MPRIS_PLAYLISTS_H_ 20 #define MPRIS_PLAYLISTS_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/struct.h> 27 #include <core/dbus/types/variant.h> 41 return lhs.value != rhs.value;
54 static const std::string&
name()
56 static const std::string s{
"org.mpris.MediaPlayer2.Playlists"};
return s;
63 static constexpr
const char* alphabetical{
"Alphabetical"};
65 static constexpr
const char* creation_date{
"CreationDate"};
67 static constexpr
const char* modified_date{
"ModifiedDate"};
69 static constexpr
const char* last_play_date{
"LastPlayDate"};
71 static constexpr
const char* user_defined{
"UserDefined"};
75 typedef core::dbus::types::Struct
81 core::dbus::types::ObjectPath,
90 typedef core::dbus::types::Struct
109 DBUS_CPP_METHOD_DEF(ActivatePlaylist,
Playlists)
125 DBUS_CPP_METHOD_DEF(GetPlaylists,
Playlists)
142 DBUS_CPP_READABLE_PROPERTY_DEF(PlaylistCount,
Playlists, std::uint32_t)
161 Properties::PlaylistCount::ValueType playlist_count{0};
162 Properties::Orderings::ValueType orderings{{Orderings::alphabetical}};
163 Properties::ActivePlaylist::ValueType active_playlist
168 core::dbus::types::ObjectPath{
"/"},
177 : configuration(configuration),
180 configuration.
object->get_property<Properties::PlaylistCount>(),
181 configuration.
object->get_property<Properties::Orderings>()
185 configuration.object->get_signal<Signals::PlaylistsChanged>()
188 properties.playlist_count->set(configuration.defaults.playlist_count);
189 properties.orderings->set(configuration.defaults.orderings);
194 std::map<std::string, core::dbus::types::Variant> dict;
195 dict[Properties::PlaylistCount::name()] = core::dbus::types::Variant::encode(properties.playlist_count->get());
196 dict[Properties::Orderings::name()] = core::dbus::types::Variant::encode(properties.orderings->get());
206 std::shared_ptr<core::dbus::Property<Properties::Orderings>>
orderings;
211 core::dbus::Signal<Signals::PlaylistsChanged, Signals::PlaylistsChanged::ArgumentType>::Ptr
playlist_changed;
216 #endif // MPRIS_PLAYLISTS_H_ core::dbus::types::Struct< std::tuple< bool, Playlist > > MaybePlaylist
core::dbus::Signal< Signals::PlaylistsChanged, Signals::PlaylistsChanged::ArgumentType >::Ptr playlist_changed
std::shared_ptr< core::dbus::Property< Properties::PlaylistCount > > playlist_count
std::shared_ptr< core::dbus::Property< Properties::Orderings > > orderings
bool operator!=(const Struct< T > &lhs, const Struct< T > &rhs)
std::map< std::string, core::dbus::types::Variant > get_all_properties()
core::dbus::types::Struct< std::tuple< core::dbus::types::ObjectPath, std::string, std::string > > Playlist
Skeleton(const Configuration &configuration)
core::dbus::Object::Ptr object
Configuration configuration
static const std::string & name()