Ejemplo n.º 1
0
void PodcatcherUI::onRefreshEpisodes(int channelId)
{
    PodcastChannel *channel = m_pManager.podcastChannel(channelId);
    qDebug() << "Refreshing channel: " << channelId << channel->title();
    if (channel == 0) {
        qWarning() << "Got NULL episode!";
        return;
    }
    m_pManager.refreshPodcastChannelEpisodes(channel, true);
}
Ejemplo n.º 2
0
int Controller::indexOfChannelInList(const std::string& feedURL, std::vector<PodcastChannel*>& channels)
{
  for (int i = 0; i < channels.size(); i++)
  {
    PodcastChannel* channel = channels[i];
    if (channel->getFeedURL() == feedURL)
    {
      return i;
    }
  }

  return -1;
}
Ejemplo n.º 3
0
int Controller::scanChannel(int channelIndex)
{
  std::vector<PodcastChannel*> channels = storage->getChannels();
  PodcastChannel* originalChannel = channels[channelIndex];

  PodcastChannel* newChannel = createChannelFromFeed(originalChannel->getFeedURL(), originalChannel->getDirectory());

  // Get the number of podcasts to download.
  int podcastCount = 0;
  std::string latestPublishDate = originalChannel->getPodcast(0)->getPublishedDate();
  for (int index = 0; index < newChannel->getPodcastCount(); index++)
  {
    PodcastDetails* podcast = newChannel->getPodcast(index);
    if (latestPublishDate == podcast->getPublishedDate())
    {
      break;
    }

    podcastCount++;
  }

  storage->updateChannel(*originalChannel, *newChannel);

  return podcastCount;
}
Ejemplo n.º 4
0
bool PodcastChannel::operator<(const PodcastChannel &other) const
{
    if (m_title < other.title() ) {
        return true;
    } else  {
        return false;
    }

}
Ejemplo n.º 5
0
void PodcatcherUI::onShowChannel(QString channelId)
{
    qDebug() << "Opening channel" << channelId;

    PodcastChannel *channel = m_pManager.podcastChannel(channelId.toInt());
    if (channel == 0) {
        qWarning() << "Got NULL channel pointer!";
        return;
    }
    if (channel->description().length() > 270) {
        QString oldDesc = channel->description();
        oldDesc.truncate(270);
        QString newDesc = QString("%1%2").arg(oldDesc).arg("...");

        channel->setDescription(newDesc);
    }

   view->rootContext()->setContextProperty("channel", channel);

   PodcastEpisodesModel *episodesModel = modelFactory->episodesModel(channel->channelDbId());   // FIXME: Do not expose DB id.
   view->rootContext()->setContextProperty("episodesModel", episodesModel);
}