a draft of player view, debug

This commit is contained in:
Blue 2018-10-29 00:32:44 +03:00 committed by blue
parent 9abb5ee116
commit cacbc5d891
13 changed files with 183 additions and 33 deletions

View file

@ -7,7 +7,8 @@ M::Player::Player(const W::Address& address, QObject* parent):
playPauseBtn(new M::Button(address + W::Address{u"play"})),
_queueView(new M::List(address + W::Address{u"queueView"})),
_queue(),
current(0)
current(0),
counter(0)
{
W::Handler* get = W::Handler::create(address + W::Address({u"get"}), this, &M::Player::_h_get);
W::Handler* hqueue = W::Handler::create(address + W::Address({u"queue"}), this, &M::Player::_h_queue);
@ -52,7 +53,6 @@ void M::Player::h_subscribe(const W::Event& ev)
h_get(ev);
}
void M::Player::h_get(const W::Event& ev)
{
W::Vector* ctrls = new W::Vector();
@ -61,8 +61,8 @@ void M::Player::h_get(const W::Event& ev)
for (; citr != cend; ++citr) {
W::Vocabulary* cvc = new W::Vocabulary();
cvc->insert(u"type", new W::Uint64(cend->first));
cvc->insert(u"address", cend->second);
cvc->insert(u"type", new W::Uint64(citr->first));
cvc->insert(u"address", citr->second);
ctrls->push(cvc);
}
@ -73,8 +73,8 @@ void M::Player::h_get(const W::Event& ev)
for (; vitr != vend; ++vitr) {
W::Vocabulary* vvc = new W::Vocabulary();
vvc->insert(u"type", new W::Uint64(vend->first));
vvc->insert(u"address", vend->second);
vvc->insert(u"type", new W::Uint64(vitr->first));
vvc->insert(u"address", vitr->second);
vws->push(vvc);
}
@ -97,7 +97,7 @@ void M::Player::h_queue(const W::Event& ev)
const W::Vocabulary& data = static_cast<const W::Vocabulary&>(ev.getData());
const W::Uint64& id = static_cast<const W::Uint64&>(data.at(u"id"));
ProxySong* song = new ProxySong(id, address + W::Address{u"currentPlayback"});
ProxySong* song = new ProxySong(id, address + W::Address{W::String(W::Uint64(counter++).toString())});
addModel(song);
if (current == 0) {
current = song;

View file

@ -41,7 +41,7 @@ namespace M {
handler(queue);
private:
typedef std::map<ItemType, const W::Address&> ItemMap;
typedef std::map<ItemType, W::Address> ItemMap;
typedef std::deque<ProxySong*> Queue;
ItemMap controls;
@ -50,6 +50,7 @@ namespace M {
M::List* _queueView;
Queue _queue;
ProxySong* current;
uint64_t counter;
private slots:
void onPlayPauseBtn();