/*
 * Copyright 2010  Jonas Emanuel Müller <zanoi@zanoi.net>
 *
 * This program is free software; you can redistribute it and/or
 * modify it under the terms of the GNU General Public License as
 * published by the Free Software Foundation; either version 2 of 
 * the License, or (at your option) any later version.

 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.

 * You should have received a copy of the GNU General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */

#include "dummyloader.h"
#include "loader.h"

#include <QString>
#include <QList>
#include <QModelIndex>
#include <QObject>

namespace Videocatcher {

DummyLoader::DummyLoader(const QString &url)
{
    Q_UNUSED(url);
}

DummyLoader::~DummyLoader()
{
}

void DummyLoader::load()
{
    Channel* channel = new Channel;
    QList<Episode> channelEpisodes;
  
        channel->setUrl("http://test.foobar");
        channel->setTitle("Title of dummy channel");
        channel->setAuthor("Mr Dummy");
        channel->setWebsiteUrl("http://test.foobar");

        for(int i=0; i<10; i++) {
            Episode episode;

            episode.title = QString("Dummy episode %1").arg(i);
            episode.description = "This is a dummy description"; 
            episode.videoUrl = QString("~/Videos/testdownload/testvideo%1.ogg").arg(i);
            episode.videoSize = 1000000;
            
            episode.datePublished = 1234567890;
            
            channelEpisodes << episode;
        }
      channel->setEpisodes(channelEpisodes);
      qDebug() << "dummy loader now emitting signal";
      emit loadingComplete(channel, Loader_Success, "http://test.foobar");
      delete channel;
      QObject::deleteLater();
}

} //namespace Videocatcher
