Exemplo n.º 1
0
void TagReaderClient::ReadFileBlocking(const QString& filename, Song* song) {
  Q_ASSERT(QThread::currentThread() != thread());

  TagReaderReply* reply = ReadFile(filename);
  if (reply->WaitForFinished()) {
    song->InitFromProtobuf(reply->message().read_file_response().metadata());
  }
  reply->deleteLater();
}
Exemplo n.º 2
0
void TagReaderClient::DeleteAsyncReply() {
  TagReaderReply *reply = dynamic_cast<TagReaderReply*>(QObject::sender());
  if (reply) {
    qLog(Debug) << " - waiting for " << reply->id();
    reply->WaitForFinished();
    qLog(Debug) << " - done waiting for " << reply->id();
    reply->deleteLater();
  } else {
    qLog(Warning) << "sender(TagReaderReply*) is null";
  }
}
Exemplo n.º 3
0
bool TagReaderClient::IsMediaFileBlocking(const QString& filename) {
  Q_ASSERT(QThread::currentThread() != thread());

  bool ret = false;

  TagReaderReply* reply = IsMediaFile(filename);
  if (reply->WaitForFinished()) {
    ret = reply->message().is_media_file_response().success();
  }
  reply->deleteLater();

  return ret;
}
Exemplo n.º 4
0
bool TagReaderClient::UpdateSongRatingBlocking(const Song& metadata) {
  Q_ASSERT(QThread::currentThread() != thread());

  bool ret = false;

  TagReaderReply* reply = UpdateSongRating(metadata);
  if (reply->WaitForFinished()) {
    ret = reply->message().save_song_rating_to_file_response().success();
  }
  reply->deleteLater();

  return ret;
}
bool TagReaderClient::SaveFileBlocking(const QString& filename, const Song& metadata) {
    Q_ASSERT(QThread::currentThread() != thread());

    bool ret = false;

    TagReaderReply* reply = SaveFile(filename, metadata);
    if (reply->WaitForFinished()) {
        ret = reply->message().save_file_response().success();
    }
    reply->deleteLater();

    return ret;
}
Exemplo n.º 6
0
QImage TagReaderClient::LoadEmbeddedArtBlocking(const QString& filename) {
  Q_ASSERT(QThread::currentThread() != thread());

  QImage ret;

  TagReaderReply* reply = LoadEmbeddedArt(filename);
  if (reply->WaitForFinished()) {
    const std::string& data_str =
        reply->message().load_embedded_art_response().data();
    ret.loadFromData(QByteArray(data_str.data(), data_str.size()));
  }
  reply->deleteLater();

  return ret;
}