This forum has been archived. All content is frozen. Please use KDE Discuss instead.

[Solved] QtDBus: amarok->GetMetadata

Tags: None
(comma "," separated)
User avatar
StAn666
Registered Member
Posts
15
Karma
0
OS
Hi!

I am trying to call the "GetMetadata" dbus method from within my Qt Application in order to get info from an running amarok2 instance. if I do a

Code: Select all
qDebug()   ret;
QString interface("org.freedesktop.MediaPlayer");
QString method("GetMetadata");
QDBusMessage msg = getPlayerCall(interface,method);
QDBusMessage retval = call(msg);
qDebug() ();


but how can I turn retval.arguments to a proper QVariantMap?

Last edited by StAn666 on Sat Aug 15, 2009 5:30 pm, edited 2 times in total.


BOFH Excuse #450:
Terrorists crashed an airplane into the server room, have to remove /bin/laden. (rm -rf /bin/laden)
User avatar
StAn666
Registered Member
Posts
15
Karma
0
OS

Re: QtDBus: amarok->GetMetadata

Sun Jul 26, 2009 8:37 pm
after some hours spent with google It seems that I finally found a solution. I let you know if it works.


BOFH Excuse #450:
Terrorists crashed an airplane into the server room, have to remove /bin/laden. (rm -rf /bin/laden)
User avatar
StAn666
Registered Member
Posts
15
Karma
0
OS

Re: QtDBus: amarok->GetMetadata

Sun Jul 26, 2009 8:46 pm
here it is:
Code: Select all
QMap AmarokPlayer::getMetadata()
{
   QMap  ret;
   QString interface("org.freedesktop.MediaPlayer");
   QString method("GetMetadata");
   QDBusMessage msg = getPlayerCall(interface,method);
   QDBusReply > argumentList = call(msg);
   if (argumentList.isValid()) {
      QMap map = argumentList.value();
      QMap::iterator i = map.begin();
      while (i != map.end()) {
         ret[i.key()] = i.value().toString();
          ++i;
       }
   }
   return ret;
}


BOFH Excuse #450:
Terrorists crashed an airplane into the server room, have to remove /bin/laden. (rm -rf /bin/laden)


Bookmarks



Who is online

Registered users: Bing [Bot], gfielding, Google [Bot], markhm, Sogou [Bot], Yahoo [Bot]