static void proxy_added(GDBusProxy *proxy, void *user_data) { const char *interface; interface = g_dbus_proxy_get_interface(proxy); if (!strcmp(interface, BLUEZ_MEDIA_PLAYER_INTERFACE)) player_added(proxy); else if (!strcmp(interface, BLUEZ_MEDIA_FOLDER_INTERFACE)) folder_added(proxy); else if (!strcmp(interface, BLUEZ_MEDIA_ITEM_INTERFACE)) item_added(proxy); }
void Client::addPlayer(const QString &player_info){ QStringList texts = player_info.split(":"); QString name = texts.at(0); QString base64 = texts.at(1); QByteArray data = QByteArray::fromBase64(base64.toAscii()); QString screen_name = QString::fromUtf8(data); QString avatar = texts.at(2); ClientPlayer *player = new ClientPlayer(this); player->setObjectName(name); player->setScreenName(screen_name); player->setProperty("avatar", avatar); alive_count ++; emit player_added(player); }
void Client::addPlayer(const QJsonValue &player_info){ QJsonArray texts = player_info.toArray(); QString name = texts.at(0).toString(); QString screen_name = texts.at(1).toString(); QString avatar = texts.at(2).toString(); ClientPlayer *player = new ClientPlayer(this); player->setObjectName(name); player->setScreenName(screen_name); player->setProperty("avatar", avatar); players << player; alive_count++; emit player_added(player); }