2012-03-04 21:47:58 +01:00
|
|
|
/* This file is part of Clementine.
|
|
|
|
Copyright 2012, David Sansome <me@davidsansome.com>
|
2014-02-07 16:34:20 +01:00
|
|
|
|
2012-03-04 21:47:58 +01:00
|
|
|
Clementine 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 3 of the License, or
|
|
|
|
(at your option) any later version.
|
2014-02-07 16:34:20 +01:00
|
|
|
|
2012-03-04 21:47:58 +01:00
|
|
|
Clementine 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.
|
2014-02-07 16:34:20 +01:00
|
|
|
|
2012-03-04 21:47:58 +01:00
|
|
|
You should have received a copy of the GNU General Public License
|
|
|
|
along with Clementine. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
*/
|
|
|
|
|
2014-02-07 20:34:34 +01:00
|
|
|
#ifndef PODCASTS_PODCASTEPISODE_H_
|
|
|
|
#define PODCASTS_PODCASTEPISODE_H_
|
2012-03-04 21:47:58 +01:00
|
|
|
|
2012-03-11 00:39:09 +01:00
|
|
|
#include "core/song.h"
|
|
|
|
|
2012-03-04 21:47:58 +01:00
|
|
|
#include <QSharedDataPointer>
|
|
|
|
#include <QSqlQuery>
|
|
|
|
#include <QUrl>
|
|
|
|
#include <QVariantMap>
|
|
|
|
|
2012-03-11 00:39:09 +01:00
|
|
|
class Podcast;
|
|
|
|
|
2012-03-04 21:47:58 +01:00
|
|
|
class PodcastEpisode {
|
2014-02-07 16:34:20 +01:00
|
|
|
public:
|
2012-03-04 21:47:58 +01:00
|
|
|
PodcastEpisode();
|
|
|
|
PodcastEpisode(const PodcastEpisode& other);
|
|
|
|
~PodcastEpisode();
|
|
|
|
|
|
|
|
static const QStringList kColumns;
|
|
|
|
static const QString kColumnSpec;
|
2012-03-06 19:37:46 +01:00
|
|
|
static const QString kJoinSpec;
|
2012-03-04 21:47:58 +01:00
|
|
|
static const QString kBindSpec;
|
|
|
|
static const QString kUpdateSpec;
|
|
|
|
|
|
|
|
void InitFromQuery(const QSqlQuery& query);
|
|
|
|
void BindToQuery(QSqlQuery* query) const;
|
|
|
|
|
2012-03-11 00:39:09 +01:00
|
|
|
Song ToSong(const Podcast& podcast) const;
|
|
|
|
|
2012-03-11 13:27:48 +01:00
|
|
|
bool is_valid() const { return database_id() != -1; }
|
|
|
|
|
2012-03-04 21:47:58 +01:00
|
|
|
int database_id() const;
|
|
|
|
int podcast_database_id() const;
|
|
|
|
const QString& title() const;
|
|
|
|
const QString& description() const;
|
|
|
|
const QString& author() const;
|
|
|
|
const QDateTime& publication_date() const;
|
|
|
|
int duration_secs() const;
|
|
|
|
const QUrl& url() const;
|
|
|
|
bool listened() const;
|
2012-03-12 20:35:47 +01:00
|
|
|
const QDateTime& listened_date() const;
|
2012-03-04 21:47:58 +01:00
|
|
|
bool downloaded() const;
|
|
|
|
const QUrl& local_url() const;
|
|
|
|
const QVariantMap& extra() const;
|
|
|
|
QVariant extra(const QString& key) const;
|
|
|
|
|
|
|
|
void set_database_id(int v);
|
|
|
|
void set_podcast_database_id(int v);
|
|
|
|
void set_title(const QString& v);
|
|
|
|
void set_description(const QString& v);
|
|
|
|
void set_author(const QString& v);
|
|
|
|
void set_publication_date(const QDateTime& v);
|
|
|
|
void set_duration_secs(int v);
|
|
|
|
void set_url(const QUrl& v);
|
|
|
|
void set_listened(bool v);
|
2012-03-12 20:35:47 +01:00
|
|
|
void set_listened_date(const QDateTime& v);
|
2012-03-04 21:47:58 +01:00
|
|
|
void set_downloaded(bool v);
|
|
|
|
void set_local_url(const QUrl& v);
|
|
|
|
void set_extra(const QVariantMap& v);
|
|
|
|
void set_extra(const QString& key, const QVariant& value);
|
|
|
|
|
2014-02-07 16:34:20 +01:00
|
|
|
PodcastEpisode& operator=(const PodcastEpisode& other);
|
2012-03-04 21:47:58 +01:00
|
|
|
|
2014-02-07 16:34:20 +01:00
|
|
|
private:
|
2012-03-04 21:47:58 +01:00
|
|
|
struct Private;
|
|
|
|
QSharedDataPointer<Private> d;
|
|
|
|
};
|
|
|
|
Q_DECLARE_METATYPE(PodcastEpisode)
|
|
|
|
|
|
|
|
typedef QList<PodcastEpisode> PodcastEpisodeList;
|
|
|
|
Q_DECLARE_METATYPE(QList<PodcastEpisode>)
|
|
|
|
|
2014-02-07 20:34:34 +01:00
|
|
|
#endif // PODCASTS_PODCASTEPISODE_H_
|