Compare commits

...

41 Commits
0.9 ... master

Author SHA1 Message Date
Herwig Birke 464f546cfe migrate 3 years ago
birkeh 824238b995 update routine 7 years ago
birkeh 217fac56e4 added resolution to series and movies 7 years ago
Herwig Birke 44fda299d2 added resolution field 7 years ago
Herwig Birke 8915a0a216 added resolution field for series 7 years ago
birkeh 445ec6e3ba bug fixing 7 years ago
birkeh b0f5698610 added local path information to series 7 years ago
birkeh 6defbf5e83 Preferences Dialog 7 years ago
birkeh 5d55ee6dc4 sorting enabled 7 years ago
birkeh 7c79287e17 changed dialog titles 7 years ago
Herwig Birke 1790ec58e6 . 7 years ago
birkeh a1d8412143 minor changes 7 years ago
birkeh a9cce71939 project renamed 7 years ago
birkeh 8b17ebe2b5 some details added 7 years ago
birkeh b8c816af8d splash screen 7 years ago
Herwig Birke 775e183721 added AudioDB 7 years ago
Herwig Birke a568a7d985 Movie & Serie Discover 7 years ago
Herwig Birke b057e1d73a switched from QTreeWidget to QTreeView 7 years ago
Herwig Birke 8f63d174f3 added Doxygen 7 years ago
birkeh 1fb97e1891 added serie discover 7 years ago
birkeh ae35df6499 added movie discover 7 years ago
birkeh 0d610927ae added preview to movie search 7 years ago
birkeh 29feba342c Movie and Serie Discover 7 years ago
Herwig Birke f7d4f14b28 implemented export dialog 7 years ago
birkeh 1a5d4ad0ba removed cUpdateThread 7 years ago
birkeh ddcb197a6b added search function 8 years ago
birkeh 8c484e4739 added possibility to open all download links at once 8 years ago
birkeh 9bac9843b6 add application icon 8 years ago
Herwig Birke 395005b9fb added filter functionality, changed display procedure for movies 8 years ago
birkeh 940a51080e Merge branch 'master' of https://github.com/birkeh/qtMovies 8 years ago
birkeh 65abda249c . 8 years ago
Herwig Birke cfc76f257f . 8 years ago
birkeh 86ef83024b . 8 years ago
birkeh 0cb0e3516c . 8 years ago
Herwig Birke a28d2587f5 . 8 years ago
Herwig Birke 7ab6d2eb2a . 8 years ago
Herwig Birke 1b76553f2a . 8 years ago
birkeh 4caa5f7eb7 . 8 years ago
Herwig Birke e010208520 . 8 years ago
birkeh dbb113e0da . 8 years ago
birkeh b9116dc732 . 8 years ago

2511
Doxyfile

File diff suppressed because it is too large Load Diff

@ -0,0 +1,378 @@
#include "cartist.h"
cArtist::cArtist() :
m_iArtistID(0),
m_szArtist(QString("")),
m_szArtistStripped(QString("")),
m_szArtistAlernate(QString("")),
m_szLabel(QString("")),
m_iLabelID(0),
m_iFormedYear(0),
m_iBornYear(0),
m_iDiedYear(0),
m_szDisbanded(QString("")),
m_szStyle(QString("")),
m_szGenre(QString("")),
m_szMood(QString("")),
m_szWebsite(QString("")),
m_szFacebook(QString("")),
m_szTwitter(QString("")),
m_szBiography(QString("")),
m_szGender(QString("")),
m_iMembers(0),
m_szCountry(QString("")),
m_szCountryCode(QString("")),
m_szArtistThumb(QString("")),
m_szArtistLogo(QString("")),
m_szArtistClearart(QString("")),
m_szArtistWideThumb(QString("")),
m_szArtistFanart(QString("")),
m_szArtistFanart2(QString("")),
m_szArtistFanart3(QString("")),
m_szArtistBanner(QString("")),
m_szMusicBrainzID(QString("")),
m_szLastFMChart(QString(""))
{
}
void cArtist::setArtistID(const qint32& iArtistID)
{
m_iArtistID = iArtistID;
}
qint32 cArtist::artistID()
{
return(m_iArtistID);
}
void cArtist::setArtist(const QString& szArtist)
{
m_szArtist = szArtist;
}
QString cArtist::artist()
{
return(m_szArtist);
}
void cArtist::setArtistStripped(const QString& szArtistStripped)
{
m_szArtistStripped = szArtistStripped;
}
QString cArtist::artistStripped()
{
return(m_szArtistStripped);
}
void cArtist::setArtistAlernate(const QString& szArtistAlernate)
{
m_szArtistAlernate = szArtistAlernate;
}
QString cArtist::artistAlernate()
{
return(m_szArtistAlernate);
}
void cArtist::setLabel(const QString& szLabel)
{
m_szLabel = szLabel;
}
QString cArtist::label()
{
return(m_szLabel);
}
void cArtist::setLabelID(const qint32& iLabelID)
{
m_iLabelID = iLabelID;
}
qint32 cArtist::labelID()
{
return(m_iLabelID);
}
void cArtist::setFormedYear(const qint32& iFormedYear)
{
m_iFormedYear = iFormedYear;
}
qint32 cArtist::formedYear()
{
return(m_iFormedYear);
}
void cArtist::setBornYear(const qint32& iBornYear)
{
m_iBornYear = iBornYear;
}
qint32 cArtist::bornYear()
{
return(m_iBornYear);
}
void cArtist::setDiedYear(const qint32& iDiedYear)
{
m_iDiedYear = iDiedYear;
}
qint32 cArtist::diedYear()
{
return(m_iDiedYear);
}
void cArtist::setDisbanded(const QString& szDisbanded)
{
m_szDisbanded = szDisbanded;
}
QString cArtist::disbanded()
{
return(m_szDisbanded);
}
void cArtist::setStyle(const QString& szStyle)
{
m_szStyle = szStyle;
}
QString cArtist::style()
{
return(m_szStyle);
}
void cArtist::setGenre(const QString& szGenre)
{
m_szGenre = szGenre;
}
QString cArtist::genre()
{
return(m_szGenre);
}
void cArtist::setMood(const QString& szMood)
{
m_szMood = szMood;
}
QString cArtist::mood()
{
return(m_szMood);
}
void cArtist::setWebsite(const QString& szWebsite)
{
m_szWebsite = szWebsite;
}
QString cArtist::website()
{
return(m_szWebsite);
}
void cArtist::setFacebook(const QString& szFacebook)
{
m_szFacebook = szFacebook;
}
QString cArtist::facebook()
{
return(m_szFacebook);
}
void cArtist::setTwitter(const QString& szTwitter)
{
m_szTwitter = szTwitter;
}
QString cArtist::twitter()
{
return(m_szTwitter);
}
void cArtist::setBiography(const QString& szBiography)
{
m_szBiography = szBiography;
}
QString cArtist::biography()
{
return(m_szBiography);
}
void cArtist::setGender(const QString& szGender)
{
m_szGender = szGender;
}
QString cArtist::gender()
{
return(m_szGender);
}
void cArtist::setMembers(const qint32& iMembers)
{
m_iMembers = iMembers;
}
qint32 cArtist::members()
{
return(m_iMembers);
}
void cArtist::setCountry(const QString& szCountry)
{
m_szCountry = szCountry;
}
QString cArtist::country()
{
return(m_szCountry);
}
void cArtist::setCountryCode(const QString& szCountryCode)
{
m_szCountryCode = szCountryCode;
}
QString cArtist::countryCode()
{
return(m_szCountryCode);
}
void cArtist::setArtistThumb(const QString& szArtistThumb)
{
m_szArtistThumb = szArtistThumb;
}
QString cArtist::artistThumb()
{
return(m_szArtistThumb);
}
void cArtist::setArtistLogo(const QString& szArtistLogo)
{
m_szArtistLogo = szArtistLogo;
}
QString cArtist::artistLogo()
{
return(m_szArtistLogo);
}
void cArtist::setArtistClearart(const QString& szArtistClearart)
{
m_szArtistClearart = szArtistClearart;
}
QString cArtist::artistClearart()
{
return(m_szArtistClearart);
}
void cArtist::setArtistWideThumb(const QString& szArtistWideThumb)
{
m_szArtistWideThumb = szArtistWideThumb;
}
QString cArtist::artistWideThumb()
{
return(m_szArtistWideThumb);
}
void cArtist::setArtistFanart(const QString& szArtistFanart)
{
m_szArtistFanart = szArtistFanart;
}
QString cArtist::artistFanart()
{
return(m_szArtistFanart);
}
void cArtist::setArtistFanart2(const QString& szArtistFanart2)
{
m_szArtistFanart2 = szArtistFanart2;
}
QString cArtist::artistFanart2()
{
return(m_szArtistFanart2);
}
void cArtist::setArtistFanart3(const QString& szArtistFanart3)
{
m_szArtistFanart3 = szArtistFanart3;
}
QString cArtist::artistFanart3()
{
return(m_szArtistFanart3);
}
void cArtist::setArtistBanner(const QString& szArtistBanner)
{
m_szArtistBanner = szArtistBanner;
}
QString cArtist::artistBanner()
{
return(m_szArtistBanner);
}
void cArtist::setMusicBrainzID(const QString& szMusicBrainzID)
{
m_szMusicBrainzID = szMusicBrainzID;
}
QString cArtist::musicBrainzID()
{
return(m_szMusicBrainzID);
}
void cArtist::setLastFMChart(const QString& szLastFMChart)
{
m_szLastFMChart = szLastFMChart;
}
QString cArtist::lastFMChart()
{
return(m_szLastFMChart);
}
cArtist* cArtistList::add(const qint32& iID)
{
cArtist* lpNew = find(iID);
if(!lpNew)
lpNew = new cArtist;
lpNew->setArtistID(iID);
append(lpNew);
return(lpNew);
}
cArtist* cArtistList::add(cArtist* lpArtist)
{
for(int z = 0;z < count();z++)
{
if(at(z) == lpArtist)
return(0);
}
append(lpArtist);
return(lpArtist);
}
cArtist* cArtistList::find(const qint32& iID)
{
for(int z = 0;z < count();z++)
{
if(at(z)->artistID() == iID)
return(at(z));
}
return(0);
}

@ -0,0 +1,124 @@
#ifndef CARTIST_H
#define CARTIST_H
#include <QMetaType>
#include <QDate>
#include <QSqlDatabase>
#include <QStringList>
#include <QMap>
class cArtist
{
public:
cArtist();
void setArtistID(const qint32& iArtistID);
qint32 artistID();
void setArtist(const QString& szArtist);
QString artist();
void setArtistStripped(const QString& szArtistStripped);
QString artistStripped();
void setArtistAlernate(const QString& szArtistAlernate);
QString artistAlernate();
void setLabel(const QString& szLabel);
QString label();
void setLabelID(const qint32& iLabelID);
qint32 labelID();
void setFormedYear(const qint32& iFormedYear);
qint32 formedYear();
void setBornYear(const qint32& iBornYear);
qint32 bornYear();
void setDiedYear(const qint32& iDiedYear);
qint32 diedYear();
void setDisbanded(const QString& szDisbanded);
QString disbanded();
void setStyle(const QString& szStyle);
QString style();
void setGenre(const QString& szGenre);
QString genre();
void setMood(const QString& szMood);
QString mood();
void setWebsite(const QString& szWebsite);
QString website();
void setFacebook(const QString& szFacebook);
QString facebook();
void setTwitter(const QString& szTwitter);
QString twitter();
void setBiography(const QString& szBiography);
QString biography();
void setGender(const QString& szGender);
QString gender();
void setMembers(const qint32& iMembers);
qint32 members();
void setCountry(const QString& szCountry);
QString country();
void setCountryCode(const QString& szCountryCode);
QString countryCode();
void setArtistThumb(const QString& szArtistThumb);
QString artistThumb();
void setArtistLogo(const QString& szArtistLogo);
QString artistLogo();
void setArtistClearart(const QString& szArtistClearart);
QString artistClearart();
void setArtistWideThumb(const QString& szArtistWideThumb);
QString artistWideThumb();
void setArtistFanart(const QString& szArtistFanart);
QString artistFanart();
void setArtistFanart2(const QString& szArtistFanart2);
QString artistFanart2();
void setArtistFanart3(const QString& szArtistFanart3);
QString artistFanart3();
void setArtistBanner(const QString& szArtistBanner);
QString artistBanner();
void setMusicBrainzID(const QString& szMusicBrainzID);
QString musicBrainzID();
void setLastFMChart(const QString& szLastFMChart);
QString lastFMChart();
private:
qint32 m_iArtistID;
QString m_szArtist;
QString m_szArtistStripped;
QString m_szArtistAlernate;
QString m_szLabel;
qint32 m_iLabelID;
qint32 m_iFormedYear;
qint32 m_iBornYear;
qint32 m_iDiedYear;
QString m_szDisbanded;
QString m_szStyle;
QString m_szGenre;
QString m_szMood;
QString m_szWebsite;
QString m_szFacebook;
QString m_szTwitter;
QString m_szBiography;
QString m_szGender;
qint32 m_iMembers;
QString m_szCountry;
QString m_szCountryCode;
QString m_szArtistThumb;
QString m_szArtistLogo;
QString m_szArtistClearart;
QString m_szArtistWideThumb;
QString m_szArtistFanart;
QString m_szArtistFanart2;
QString m_szArtistFanart3;
QString m_szArtistBanner;
QString m_szMusicBrainzID;
QString m_szLastFMChart;
};
Q_DECLARE_METATYPE(cArtist*)
class cArtistList : public QList<cArtist*>
{
public:
cArtist* add(const qint32& iArtistID);
cArtist* add(cArtist* lpArtist);
cArtist* find(const qint32& iArtistID);
};
#endif // CARTIST_H

@ -0,0 +1,29 @@
/* */
#include "ccheckboxitemdelegate.h"
#include <QPainter>
#include <QTextDocument>
#include <QAbstractTextDocumentLayout>
#include <QFont>
void cCheckBoxItemDelegate::paint(QPainter* painter, const QStyleOptionViewItem & option, const QModelIndex &index) const
{
QStyleOptionViewItem options = option;
initStyleOption(&options, index);
if(index.data(Qt::CheckStateRole) == Qt::Checked)
options.font.setBold(true);
QStyledItemDelegate::paint(painter, options, index);
}
QSize cCheckBoxItemDelegate::sizeHint ( const QStyleOptionViewItem & option, const QModelIndex & index ) const
{
QStyleOptionViewItem options = option;
initStyleOption(&options, index);
//if(index.data(Qt::CheckStateRole) == Qt::Checked)
options.font.setBold(true);
return(QStyledItemDelegate::sizeHint(options, index));
}

@ -0,0 +1,37 @@
#ifndef CCHECKBOXITEMDELEGATE_H
#define CCHECKBOXITEMDELEGATE_H
#include <QStyledItemDelegate>
/*!
\brief
\class cCheckBoxItemDelegate ccheckboxitemdelegate.h "ccheckboxitemdelegate.h"
*/
class cCheckBoxItemDelegate : public QStyledItemDelegate
{
public:
protected:
/*!
\brief
\fn paint
\param painter
\param option
\param index
*/
void paint(QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index) const;
/*!
\brief
\fn sizeHint
\param option
\param index
\return QSize
*/
QSize sizeHint(const QStyleOptionViewItem &option, const QModelIndex &index) const;
};
#endif // CCHECKBOXITEMDELEGATE_H

@ -0,0 +1,160 @@
#include "cdiscover.h"
#include "ui_cdiscover.h"
#include "ccheckboxitemdelegate.h"
#include "cthemoviedbv3.h"
#include <QStandardItem>
#include <QMap>
#include <QList>
#include <QDebug>
cDiscover::cDiscover(const cSerieList serieList, QWidget *parent) :
QDialog(parent),
ui(new Ui::cDiscover),
m_serieList(serieList)
{
ui->setupUi(this);
m_lpGenresModel = new QStandardItemModel(0, 1);
QStringList headerLabels = QStringList() << tr("Name");
m_lpGenresModel->setHorizontalHeaderLabels(headerLabels);
ui->m_lpGenres->setModel(m_lpGenresModel);
ui->m_lpGenres->setItemDelegate(new cCheckBoxItemDelegate());
ui->m_lpGenres->setWrapping(true);
m_lpSeriesModel = new QStandardItemModel(0, 1);
ui->m_lpSeries->setModel(m_lpSeriesModel);
headerLabels = QStringList() << tr("Title") << tr("Year") << tr("Voting");
m_lpSeriesModel->setHorizontalHeaderLabels(headerLabels);
connect(ui->m_lpVoting, &QxtSpanSlider::spanChanged, this, &cDiscover::spanChanged);
ui->m_lpVoting->setRange(0, 100);
ui->m_lpVoting->setLowerValue(0);
ui->m_lpVoting->setUpperValue(100);
cTheMovieDBV3 movieDB3;
QMap<qint32, QString> genres;
genres = movieDB3.genresSerie("de-DE");
QMapIterator<qint32, QString> iterator(genres);
while(iterator.hasNext())
{
iterator.next();
QStandardItem* lpItem = new QStandardItem(iterator.value());
lpItem->setData(iterator.key());
lpItem->setCheckable(true);
m_lpGenresModel->appendRow(lpItem);
}
}
cDiscover::~cDiscover()
{
delete ui;
delete m_lpGenresModel;
}
void cDiscover::spanChanged(int lower, int upper)
{
ui->m_lpVotingFrom->setText(QString::number((qreal)lower/10));
ui->m_lpVotingTo->setText(QString::number((qreal)upper/10));
}
void cDiscover::on_m_lpDiscover_clicked()
{
QString szText = ui->m_lpText->text();
qint32 iYear = ui->m_lpYear->value();
qreal voteMin = (qreal)ui->m_lpVoting->lowerValue()/10;
qreal voteMax = (qreal)ui->m_lpVoting->upperValue()/10;
QList<qint32> genres;
if(!ui->m_lpYearEnable->isChecked())
iYear = -1;
for(int x = 0;x < m_lpGenresModel->rowCount();x++)
{
QStandardItem* lpItem = m_lpGenresModel->item(x);
if(lpItem->checkState() == Qt::Checked)
genres.append(lpItem->data().toInt());
}
setCursor(Qt::WaitCursor);
cTheMovieDBV3 movieDB3;
QList<cSerie*> serieList = movieDB3.discoverSerie(m_serieList, szText, iYear, genres, voteMin, voteMax, "de-DE");
m_lpSeriesModel->clear();
QStringList headerLabels = QStringList() << tr("Title") << tr("Year") << tr("Voting");
m_lpSeriesModel->setHorizontalHeaderLabels(headerLabels);
for(int x = 0; x < serieList.count();x++)
{
cSerie* lpSerie = serieList[x];
if(m_serieList.find(lpSerie->seriesID()))
continue;
QList<QStandardItem*> items;
items.append(new QStandardItem(lpSerie->seriesName()));
items.append(new QStandardItem(QString::number(lpSerie->firstAired().year())));
items.append(new QStandardItem(QString::number(lpSerie->voteAverage())));
items[0]->setData(QVariant::fromValue(lpSerie));
items[1]->setData(QVariant::fromValue(lpSerie));
items[2]->setData(QVariant::fromValue(lpSerie));
items[0]->setCheckable(true);
m_lpSeriesModel->appendRow(items);
}
for(int x = 0;x < headerLabels.count();x++)
ui->m_lpSeries->resizeColumnToContents(x);
setCursor(Qt::ArrowCursor);
}
void cDiscover::on_m_lpYearEnable_clicked(bool checked)
{
ui->m_lpYear->setEnabled(checked);
}
void cDiscover::on_m_lpSeries_clicked(const QModelIndex &index)
{
setCursor(Qt::WaitCursor);
QStandardItem* lpItem = m_lpSeriesModel->itemFromIndex(index);
cSerie* lpSerie = lpItem->data().value<cSerie*>();
if(lpSerie->cast().isEmpty())
{
cTheMovieDBV3 theMovieDB;
theMovieDB.loadCastSerie(lpSerie);
}
ui->m_lpSerieDetails->setSerie(lpSerie);
setCursor(Qt::ArrowCursor);
}
QList<qint32> cDiscover::id()
{
QList<qint32> idList;
for(int x = 0;x < m_lpSeriesModel->rowCount();x++)
{
if(m_lpSeriesModel->item(x, 0)->checkState() == Qt::Checked)
{
cSerie* lpSerie = m_lpSeriesModel->item(x, 0)->data().value<cSerie*>();
idList.append(lpSerie->seriesID());
}
}
return(idList);
}

@ -0,0 +1,85 @@
#ifndef CDISCOVER_H
#define CDISCOVER_H
#include <QDialog>
#include <QStandardItemModel>
#include "cserie.h"
namespace Ui {
class cDiscover;
}
/*!
\brief
\class cDiscover cdiscover.h "cdiscover.h"
*/
class cDiscover : public QDialog
{
Q_OBJECT
public:
/*!
\brief
\fn cDiscover
\param serieList
\param parent
*/
explicit cDiscover(const cSerieList serieList, QWidget *parent = 0);
/*!
\brief
\fn ~cDiscover
*/
~cDiscover();
/*!
\brief
\fn id
\return QList<qint32>
*/
QList<qint32> id();
private slots:
/*!
\brief
\fn spanChanged
\param lower
\param upper
*/
void spanChanged(int lower, int upper);
/*!
\brief
\fn on_m_lpDiscover_clicked
*/
void on_m_lpDiscover_clicked();
/*!
\brief
\fn on_m_lpYearEnable_clicked
\param checked
*/
void on_m_lpYearEnable_clicked(bool checked);
/*!
\brief
\fn on_m_lpSeries_clicked
\param index
*/
void on_m_lpSeries_clicked(const QModelIndex &index);
private:
Ui::cDiscover* ui; /*!< TODO: describe */
QStandardItemModel* m_lpGenresModel; /*!< TODO: describe */
QStandardItemModel* m_lpSeriesModel; /*!< TODO: describe */
cSerieList m_serieList; /*!< TODO: describe */
};
#endif // CDISCOVER_H

@ -0,0 +1,233 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>cDiscover</class>
<widget class="QDialog" name="cDiscover">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>900</width>
<height>500</height>
</rect>
</property>
<property name="windowTitle">
<string>Discover Series</string>
</property>
<layout class="QGridLayout" name="gridLayout_3">
<item row="0" column="0">
<layout class="QVBoxLayout" name="verticalLayout_3" stretch="1,10">
<item>
<layout class="QVBoxLayout" name="verticalLayout_2">
<item>
<layout class="QHBoxLayout" name="horizontalLayout_2">
<item>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<layout class="QHBoxLayout" name="horizontalLayout_3">
<item>
<widget class="QLabel" name="label_3">
<property name="text">
<string>Text:</string>
</property>
</widget>
</item>
<item>
<widget class="QLineEdit" name="m_lpText"/>
</item>
</layout>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<widget class="QCheckBox" name="m_lpYearEnable">
<property name="text">
<string>Erscheinungsjahr:</string>
</property>
</widget>
</item>
<item>
<widget class="QSpinBox" name="m_lpYear">
<property name="enabled">
<bool>false</bool>
</property>
<property name="minimum">
<number>1800</number>
</property>
<property name="maximum">
<number>2100</number>
</property>
</widget>
</item>
</layout>
</item>
<item>
<layout class="QGridLayout" name="gridLayout_2" columnstretch="0,1,1">
<item row="0" column="0">
<widget class="QLabel" name="label_2">
<property name="text">
<string>Voting:</string>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QLabel" name="m_lpVotingFrom">
<property name="text">
<string>TextLabel</string>
</property>
</widget>
</item>
<item row="1" column="2">
<widget class="QLabel" name="m_lpVotingTo">
<property name="text">
<string>TextLabel</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
</widget>
</item>
<item row="0" column="1" colspan="2">
<widget class="QxtSpanSlider" name="m_lpVoting">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</item>
<item>
<widget class="QGroupBox" name="groupBox">
<property name="title">
<string>Genre</string>
</property>
<layout class="QGridLayout" name="gridLayout">
<item row="0" column="0">
<widget class="QListView" name="m_lpGenres">
<property name="editTriggers">
<set>QAbstractItemView::NoEditTriggers</set>
</property>
<property name="alternatingRowColors">
<bool>true</bool>
</property>
<property name="flow">
<enum>QListView::TopToBottom</enum>
</property>
</widget>
</item>
</layout>
</widget>
</item>
</layout>
</item>
<item>
<widget class="QPushButton" name="m_lpDiscover">
<property name="text">
<string>Discover</string>
</property>
</widget>
</item>
</layout>
</item>
<item>
<widget class="QSplitter" name="splitter">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<widget class="QTreeView" name="m_lpSeries">
<property name="editTriggers">
<set>QAbstractItemView::NoEditTriggers</set>
</property>
<property name="alternatingRowColors">
<bool>true</bool>
</property>
<property name="sortingEnabled">
<bool>true</bool>
</property>
</widget>
<widget class="QScrollArea" name="m_lpMovieDetailsScroller">
<property name="widgetResizable">
<bool>true</bool>
</property>
<widget class="QWidget" name="scrollAreaWidgetContents">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>90</width>
<height>304</height>
</rect>
</property>
<layout class="QGridLayout" name="gridLayout_4">
<item row="0" column="0">
<widget class="cSerieDetails" name="m_lpSerieDetails" native="true"/>
</item>
</layout>
</widget>
</widget>
</widget>
</item>
</layout>
</item>
<item row="1" column="0">
<widget class="QDialogButtonBox" name="buttonBox">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="standardButtons">
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
</property>
</widget>
</item>
</layout>
</widget>
<customwidgets>
<customwidget>
<class>QxtSpanSlider</class>
<extends>QSlider</extends>
<header>qxtspanslider.h</header>
</customwidget>
<customwidget>
<class>cSerieDetails</class>
<extends>QWidget</extends>
<header>cseriedetails.h</header>
<container>1</container>
</customwidget>
</customwidgets>
<resources/>
<connections>
<connection>
<sender>buttonBox</sender>
<signal>accepted()</signal>
<receiver>cDiscover</receiver>
<slot>accept()</slot>
<hints>
<hint type="sourcelabel">
<x>248</x>
<y>254</y>
</hint>
<hint type="destinationlabel">
<x>157</x>
<y>274</y>
</hint>
</hints>
</connection>
<connection>
<sender>buttonBox</sender>
<signal>rejected()</signal>
<receiver>cDiscover</receiver>
<slot>reject()</slot>
<hints>
<hint type="sourcelabel">
<x>316</x>
<y>260</y>
</hint>
<hint type="destinationlabel">
<x>286</x>
<y>274</y>
</hint>
</hints>
</connection>
</connections>
</ui>

@ -2,6 +2,8 @@
#include "ui_cedit.h"
#include "cmovieimage.h"
#include "cfanartimage.h"
#include "cseasondetails.h"
#include "cmessageanimatedialog.h"
@ -17,6 +19,8 @@
#include <QLabel>
#include <QButtonGroup>
#include <QSqlQuery>
#include <QDebug>
#include <QTime>
@ -25,27 +29,49 @@ cEdit::cEdit(QWidget *parent) :
QDialog(parent),
ui(new Ui::cEdit),
m_bLoaded(false),
m_lpButton1(0),
m_lpButton2(0),
m_lpButton3(0),
m_lpInit(0),
m_lpProgress(0),
m_lpDone(0),
m_lpGroupBox(0),
m_lpGridLayout(0),
m_lpGrid(0),
m_lpLabel(0),
m_lpLabel1(0),
m_lpSpacer(0),
m_lpGroup(0),
m_lpAllInit(0),
m_lpAllProgress(0),
m_lpAllDone(0),
m_lpVerticalSpacer(0),
m_lpSerie(0)
m_lpButton1(nullptr),
m_lpButton2(nullptr),
m_lpButton3(nullptr),
m_lpInit(nullptr),
m_lpProgress(nullptr),
m_lpDone(nullptr),
m_lpGroupBox(nullptr),
m_lpGridLayout(nullptr),
m_lpGrid(nullptr),
m_lpLabel(nullptr),
m_lpLabel1(nullptr),
m_lpSpacer(nullptr),
m_lpGroup(nullptr),
m_lpAllInit(nullptr),
m_lpAllProgress(nullptr),
m_lpAllDone(nullptr),
m_lpVerticalSpacer(nullptr),
m_lpDetailsActorsModel(nullptr),
m_lpDetailsGenreModel(nullptr),
m_lpSerie(nullptr)
{
ui->setupUi(this);
QSqlQuery query;
query.prepare("SELECT resolution FROM resolution ORDER BY sort;");
if(query.exec())
{
while(query.next())
ui->m_lpResolution->addItem(query.value("resolution").toString());
}
QPalette palette = ui->m_lpDownloadLinkLabel->palette();
QColor col = palette.color(QPalette::Window);
QString color = QString("background-color: rgb(%1,%2,%3,%4);").arg(col.red()).arg(col.green()).arg(col.blue()).arg(95);
ui->m_lpScrollArea->setStyleSheet(color);
m_lpDetailsActorsModel = new QStandardItemModel(0, 0);
ui->m_lpDetailsActors->setModel(m_lpDetailsActorsModel);
m_lpDetailsGenreModel = new QStandardItemModel(0, 0);
ui->m_lpDetailsGenre->setModel(m_lpDetailsGenreModel);
connect(ui->m_lpAllInit, SIGNAL(clicked()), this, SLOT(lpAllInit_clicked()));
connect(ui->m_lpAllProgress, SIGNAL(clicked()), this, SLOT(lpAllProgress_clicked()));
connect(ui->m_lpAllDone, SIGNAL(clicked()), this, SLOT(lpAllDone_clicked()));
@ -69,14 +95,17 @@ cEdit::~cEdit()
cEpisode* lpEpisode = episodeList.at(y);
if(lpEpisode)
{
lpEpisode->setButton1(0);
lpEpisode->setButton2(0);
lpEpisode->setButton3(0);
lpEpisode->setButton1(nullptr);
lpEpisode->setButton2(nullptr);
lpEpisode->setButton3(nullptr);
}
}
}
}
delete m_lpDetailsActorsModel;
delete m_lpDetailsGenreModel;
delete ui;
}
@ -86,11 +115,23 @@ void cEdit::setSerie(cSerie* lpSerie)
if(!lpSerie)
return;
ui->m_lpName->setText(lpSerie->seriesName());
ui->m_lpFirstAired->setDate(lpSerie->firstAired());
ui->m_lpCliffhanger->setChecked(lpSerie->cliffhanger());
ui->m_lpDownloadLink->setText(lpSerie->download());
ui->m_lpLocalPath->setText(lpSerie->localPath());
ui->m_lpResolution->setCurrentText(lpSerie->resolution());
QString szBanner = lpSerie->fanartBanner();
{
if(!szBanner.isEmpty())
{
cFanartImage banner;
QPixmap pixmap = banner.getImage(szBanner);
if(!pixmap.isNull())
ui->m_lpBanner->setPixmap(pixmap);
}
}
int x;
QList<cSeason*> seasonList = lpSerie->seasonList();
@ -132,6 +173,7 @@ void cEdit::setSerie(cSerie* lpSerie)
m_lpGroup = new QButtonGroup(this);
lpEpisode->setGroup(m_lpGroup);
m_lpLabel = new QLabel(QString("%1").arg(lpEpisode->episodeNumber()), m_lpGroupBox);
lpEpisode->setLabel(m_lpLabel);
if(bFirst)
@ -190,6 +232,11 @@ void cEdit::setSerie(cSerie* lpSerie)
m_lpVerticalSpacer = new QSpacerItem(20, 40, QSizePolicy::Minimum, QSizePolicy::Expanding);
ui->m_lpGridLayoutScroll->addItem(m_lpVerticalSpacer, x+1, 0, 1, 1);
cMovieImage image;
//QPixmap backdrop = image.getImage(m_lpSerie->backdropPath());
QPixmap poster = image.getImage(m_lpSerie->posterPath());
ui->m_lpProgressTab->setPixmap(poster);
}
void cEdit::lpAllInit_clicked()
@ -209,19 +256,19 @@ void cEdit::lpAllDone_clicked()
void cEdit::allInit_clicked()
{
QPushButton* lpButton = (QPushButton*)sender();
QPushButton* lpButton = static_cast<QPushButton*>(sender());
m_lpSerie->seasonInit(lpButton);
}
void cEdit::allProgress_clicked()
{
QPushButton* lpButton = (QPushButton*)sender();
QPushButton* lpButton = static_cast<QPushButton*>(sender());
m_lpSerie->seasonProgress(lpButton);
}
void cEdit::allDone_clicked()
{
QPushButton* lpButton = (QPushButton*)sender();
QPushButton* lpButton = static_cast<QPushButton*>(sender());
m_lpSerie->seasonDone(lpButton);
}
@ -230,6 +277,16 @@ QString cEdit::download()
return(ui->m_lpDownloadLink->text());
}
QString cEdit::localPath()
{
return(ui->m_lpLocalPath->text());
}
QString cEdit::resolution()
{
return(ui->m_lpResolution->currentText());
}
void cEdit::on_m_lpTabWidget_tabBarClicked(int index)
{
if(index == 1)
@ -242,35 +299,28 @@ void cEdit::on_m_lpTabWidget_tabBarClicked(int index)
lpDialog->show();
cMovieImage image;
QPixmap backdrop = image.getImage(m_lpSerie->backdropPath());
//QPalette palette;
//palette.setBrush(this->backgroundRole(), QBrush(backdrop.toImage()));
//this->setPalette(palette);
// ui->m_lpDetailsBackdrop->setPixmap(backdrop);
QPixmap poster = image.getImage(m_lpSerie->posterPath());
ui->m_lpDetailsImage->setPixmap(poster.scaledToHeight(200));
ui->m_lpDetailsOverview->setText(m_lpSerie->overview());
ui->m_lpDetailsSeasonTab->clear();
QTreeWidgetItem* lpItem;
for(int x = 0;x < m_lpSerie->cast().count();x++)
{
QStringList tmp = m_lpSerie->cast().at(x).split(",");
lpItem = new QTreeWidgetItem(ui->m_lpDetailsActors);
lpItem->setText(0, tmp.at(0));
QList<QStandardItem*> items;
QStringList tmp = m_lpSerie->cast().at(x).split(",");
items.append(new QStandardItem(tmp.at(0)));
if(tmp.count() > 1)
lpItem->setText(1, tmp.at(1));
items.append(new QStandardItem(tmp.at(1)));
ui->m_lpDetailsActors->addTopLevelItem(lpItem);
m_lpDetailsActorsModel->appendRow(items);
}
ui->m_lpDetailsActors->resizeColumnToContents(0);
ui->m_lpDetailsActors->resizeColumnToContents(1);
for(int x = 0;x < m_lpSerie->genre().count();x++)
{
lpItem = new QTreeWidgetItem(ui->m_lpDetailsGenre);
lpItem->setText(0, m_lpSerie->genre().at(x));
ui->m_lpDetailsGenre->addTopLevelItem(lpItem);
}
m_lpDetailsGenreModel->appendRow(new QStandardItem(m_lpSerie->genre().at(x)));
for(int x = 0;x < m_lpSerie->seasonList().count();x++)
{
cSeason* lpSeason = m_lpSerie->seasonList().at(x);

@ -5,61 +5,154 @@
#include "cserie.h"
#include <QDialog>
#include <QStandardItemModel>
namespace Ui {
class cEdit;
}
/*!
\brief
\class cEdit cedit.h "cedit.h"
*/
class cEdit : public QDialog
{
Q_OBJECT
public:
/*!
\brief
\fn cEdit
\param parent
*/
explicit cEdit(QWidget *parent = 0);
/*!
\brief
\fn ~cEdit
*/
~cEdit();
/*!
\brief
\fn setSerie
\param lpSerie
*/
void setSerie(cSerie* lpSerie);
/*!
\brief
\fn download
\return QString
*/
QString download();
/*!
\brief
\fn localPath
\return QString
*/
QString localPath();
/*!
\brief
\fn resolution
\return QString
*/
QString resolution();
private slots:
/*!
\brief
\fn lpAllInit_clicked
*/
void lpAllInit_clicked();
/*!
\brief
\fn lpAllProgress_clicked
*/
void lpAllProgress_clicked();
/*!
\brief
\fn lpAllDone_clicked
*/
void lpAllDone_clicked();
/*!
\brief
\fn allInit_clicked
*/
void allInit_clicked();
/*!
\brief
\fn allProgress_clicked
*/
void allProgress_clicked();
/*!
\brief
\fn allDone_clicked
*/
void allDone_clicked();
/*!
\brief
\fn on_m_lpTabWidget_tabBarClicked
\param index
*/
void on_m_lpTabWidget_tabBarClicked(int index);
/*!
\brief
\fn on_m_lpCliffhanger_clicked
*/
void on_m_lpCliffhanger_clicked();
/*!
\brief
\fn on_m_lpFirstAired_dateChanged
\param date
*/
void on_m_lpFirstAired_dateChanged(const QDate &date);
private:
Ui::cEdit* ui;
bool m_bLoaded;
QRadioButton* m_lpButton1;
QRadioButton* m_lpButton2;
QRadioButton* m_lpButton3;
QPushButton* m_lpInit;
QPushButton* m_lpProgress;
QPushButton* m_lpDone;
QGroupBox* m_lpGroupBox;
QGridLayout* m_lpGridLayout;
QGridLayout* m_lpGrid;
QLabel* m_lpLabel;
QLabel* m_lpLabel1;
QSpacerItem* m_lpSpacer;
QButtonGroup* m_lpGroup;
QPushButton* m_lpAllInit;
QPushButton* m_lpAllProgress;
QPushButton* m_lpAllDone;
QSpacerItem* m_lpVerticalSpacer;
cSerie* m_lpSerie;
Ui::cEdit* ui; /*!< TODO: describe */
bool m_bLoaded; /*!< TODO: describe */
QRadioButton* m_lpButton1; /*!< TODO: describe */
QRadioButton* m_lpButton2; /*!< TODO: describe */
QRadioButton* m_lpButton3; /*!< TODO: describe */
QPushButton* m_lpInit; /*!< TODO: describe */
QPushButton* m_lpProgress; /*!< TODO: describe */
QPushButton* m_lpDone; /*!< TODO: describe */
QGroupBox* m_lpGroupBox; /*!< TODO: describe */
QGridLayout* m_lpGridLayout; /*!< TODO: describe */
QGridLayout* m_lpGrid; /*!< TODO: describe */
QLabel* m_lpLabel; /*!< TODO: describe */
QLabel* m_lpLabel1; /*!< TODO: describe */
QSpacerItem* m_lpSpacer; /*!< TODO: describe */
QButtonGroup* m_lpGroup; /*!< TODO: describe */
QPushButton* m_lpAllInit; /*!< TODO: describe */
QPushButton* m_lpAllProgress; /*!< TODO: describe */
QPushButton* m_lpAllDone; /*!< TODO: describe */
QSpacerItem* m_lpVerticalSpacer; /*!< TODO: describe */
QStandardItemModel* m_lpDetailsActorsModel;
QStandardItemModel* m_lpDetailsGenreModel;
cSerie* m_lpSerie; /*!< TODO: describe */
};
#endif // CEDIT_H

@ -6,12 +6,12 @@
<rect>
<x>0</x>
<y>0</y>
<width>804</width>
<height>732</height>
<width>702</width>
<height>458</height>
</rect>
</property>
<property name="windowTitle">
<string>Edit</string>
<string>Edit Serie</string>
</property>
<layout class="QGridLayout" name="gridLayout_2">
<item row="0" column="0">
@ -19,15 +19,22 @@
<item>
<widget class="QTabWidget" name="m_lpTabWidget">
<property name="currentIndex">
<number>1</number>
<number>0</number>
</property>
<widget class="QWidget" name="tab">
<widget class="cPixmapWidget" name="m_lpProgressTab">
<attribute name="title">
<string>Progress</string>
</attribute>
<layout class="QGridLayout" name="gridLayout">
<item row="0" column="0">
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<widget class="QLabel" name="m_lpBanner">
<property name="text">
<string/>
</property>
</widget>
</item>
<item>
<layout class="QVBoxLayout" name="m_lpVerticalLayout">
<item>
@ -59,9 +66,9 @@
</layout>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_2">
<layout class="QHBoxLayout" name="horizontalLayout_2" stretch="0,4,0,2,0,0">
<item>
<widget class="QLabel" name="label">
<widget class="QLabel" name="m_lpDownloadLinkLabel">
<property name="text">
<string>Download Link:</string>
</property>
@ -70,6 +77,26 @@
<item>
<widget class="QLineEdit" name="m_lpDownloadLink"/>
</item>
<item>
<widget class="QLabel" name="label">
<property name="text">
<string>Local Path:</string>
</property>
</widget>
</item>
<item>
<widget class="QLineEdit" name="m_lpLocalPath"/>
</item>
<item>
<widget class="QLabel" name="label_5">
<property name="text">
<string>Resolution:</string>
</property>
</widget>
</item>
<item>
<widget class="QComboBox" name="m_lpResolution"/>
</item>
</layout>
</item>
<item>
@ -107,10 +134,13 @@
<rect>
<x>0</x>
<y>0</y>
<width>754</width>
<height>546</height>
<width>652</width>
<height>253</height>
</rect>
</property>
<property name="autoFillBackground">
<bool>true</bool>
</property>
<layout class="QGridLayout" name="m_lpGridLayoutScroll"/>
</widget>
</widget>
@ -121,134 +151,127 @@
</item>
</layout>
</widget>
<widget class="QWidget" name="tab_2">
<widget class="QWidget" name="m_lpDetailsTab">
<attribute name="title">
<string>Details</string>
</attribute>
<layout class="QGridLayout" name="gridLayout_3">
<layout class="QGridLayout" name="gridLayout_4">
<item row="0" column="0">
<layout class="QVBoxLayout" name="verticalLayout_3" stretch="0,1,1">
<item>
<widget class="QLabel" name="m_lpDetailsBackdrop">
<property name="minimumSize">
<layout class="QGridLayout" name="gridLayout_3">
<item row="0" column="6">
<layout class="QHBoxLayout" name="horizontalLayout_4">
<item>
<widget class="cVerticalLabel" name="label_2">
<property name="text">
<string>Actors</string>
</property>
</widget>
</item>
<item>
<widget class="QTreeView" name="m_lpDetailsActors">
<property name="editTriggers">
<set>QAbstractItemView::NoEditTriggers</set>
</property>
<property name="alternatingRowColors">
<bool>true</bool>
</property>
<attribute name="headerVisible">
<bool>false</bool>
</attribute>
</widget>
</item>
</layout>
</item>
<item row="0" column="5" rowspan="2">
<widget class="QTextEdit" name="m_lpDetailsOverview">
<property name="maximumSize">
<size>
<width>758</width>
<height>140</height>
<width>16777215</width>
<height>16777215</height>
</size>
</property>
<property name="frameShape">
<enum>QFrame::Box</enum>
</property>
<property name="text">
<string/>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
</widget>
</item>
<item>
<widget class="QScrollArea" name="scrollArea">
<property name="widgetResizable">
<property name="readOnly">
<bool>true</bool>
</property>
<widget class="QWidget" name="scrollAreaWidgetContents">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>756</width>
<height>241</height>
</rect>
</property>
<layout class="QGridLayout" name="gridLayout_4">
<item row="0" column="0">
<layout class="QHBoxLayout" name="horizontalLayout_5">
<item>
<widget class="QTextEdit" name="m_lpDetailsOverview">
<property name="readOnly">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<layout class="QVBoxLayout" name="verticalLayout_4" stretch="2,1">
<item>
<layout class="QHBoxLayout" name="horizontalLayout_4">
<item>
<widget class="cVerticalLabel" name="label_2">
<property name="text">
<string>Actors</string>
</property>
</widget>
</item>
<item>
<widget class="QTreeWidget" name="m_lpDetailsActors">
<property name="columnCount">
<number>2</number>
</property>
<attribute name="headerVisible">
<bool>false</bool>
</attribute>
<column>
<property name="text">
<string notr="true">1</string>
</property>
</column>
<column>
<property name="text">
<string notr="true">2</string>
</property>
</column>
</widget>
</item>
</layout>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_3">
<item>
<widget class="cVerticalLabel" name="label_3">
<property name="text">
<string>Genre</string>
</property>
</widget>
</item>
<item>
<widget class="QTreeWidget" name="m_lpDetailsGenre">
<attribute name="headerVisible">
<bool>false</bool>
</attribute>
<column>
<property name="text">
<string notr="true">1</string>
</property>
</column>
</widget>
</item>
</layout>
</item>
</layout>
</item>
</layout>
</item>
</layout>
</widget>
</widget>
</item>
<item>
<widget class="QTabWidget" name="m_lpDetailsSeasonTab">
<property name="currentIndex">
<number>0</number>
</property>
<widget class="QWidget" name="tab_3">
<attribute name="title">
<string>Tab 1</string>
</attribute>
</widget>
</widget>
<item row="1" column="6">
<layout class="QHBoxLayout" name="horizontalLayout_3">
<item>
<widget class="cVerticalLabel" name="label_3">
<property name="text">
<string>Genre</string>
</property>
</widget>
</item>
<item>
<widget class="QTreeView" name="m_lpDetailsGenre">
<property name="editTriggers">
<set>QAbstractItemView::NoEditTriggers</set>
</property>
<property name="alternatingRowColors">
<bool>true</bool>
</property>
<attribute name="headerVisible">
<bool>false</bool>
</attribute>
<attribute name="headerDefaultSectionSize">
<number>35</number>
</attribute>
</widget>
</item>
</layout>
</item>
<item row="0" column="0" rowspan="2">
<layout class="QVBoxLayout" name="verticalLayout_3">
<item>
<widget class="QLabel" name="m_lpDetailsImage">
<property name="minimumSize">
<size>
<width>0</width>
<height>0</height>
</size>
</property>
<property name="frameShape">
<enum>QFrame::Box</enum>
</property>
<property name="text">
<string/>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
</widget>
</item>
<item>
<spacer name="verticalSpacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>40</height>
</size>
</property>
</spacer>
</item>
</layout>
</item>
</layout>
</item>
<item row="1" column="0">
<widget class="QTabWidget" name="m_lpDetailsSeasonTab">
<property name="currentIndex">
<number>0</number>
</property>
<widget class="QWidget" name="tab_3">
<attribute name="title">
<string>Tab 1</string>
</attribute>
</widget>
</widget>
</item>
</layout>
</widget>
</widget>
@ -273,6 +296,12 @@
<extends>QLabel</extends>
<header>cverticallabel.h</header>
</customwidget>
<customwidget>
<class>cPixmapWidget</class>
<extends>QWidget</extends>
<header>cpixmapwidget.h</header>
<container>1</container>
</customwidget>
</customwidgets>
<resources/>
<connections>

@ -2,7 +2,7 @@
#include "common.h"
#define DELETE(x) { if(x) delete x;x = 0;}
#define DELETE(x) { if(x) delete x;x = nullptr;}
cEpisode::cEpisode() :
m_iID(-1),
@ -54,12 +54,12 @@ QString cEpisode::name()
return(m_szName);
}
void cEpisode::setEpisodeNumber(const qint16& iEpisodeNumber)
void cEpisode::setEpisodeNumber(const qint32& iEpisodeNumber)
{
m_iEpisodeNumber = iEpisodeNumber;
}
qint16 cEpisode::episodeNumber()
qint32 cEpisode::episodeNumber()
{
return(m_iEpisodeNumber);
}
@ -114,12 +114,12 @@ QString cEpisode::productionCode()
return(m_szProductionCode);
}
void cEpisode::setSeasonNumber(const qint16& iSeasonNumber)
void cEpisode::setSeasonNumber(const qint32& iSeasonNumber)
{
m_iSeasonNumber = iSeasonNumber;
}
qint16 cEpisode::seasonNumber()
qint32 cEpisode::seasonNumber()
{
return(m_iSeasonNumber);
}
@ -164,12 +164,12 @@ qreal cEpisode::voteAverage()
return(m_dVoteAverage);
}
void cEpisode::setVoteCount(const qint16& iVoteCount)
void cEpisode::setVoteCount(const qint32& iVoteCount)
{
m_iVoteCount = iVoteCount;
}
qint16 cEpisode::voteCount()
qint32 cEpisode::voteCount()
{
return(m_iVoteCount);
}
@ -238,22 +238,22 @@ QString cEpisode::fileName()
return(m_szFileName);
}
void cEpisode::setThumbHeight(const qint16& iThumbHeight)
void cEpisode::setThumbHeight(const qint32& iThumbHeight)
{
m_iThumbHeight = iThumbHeight;
}
qint16 cEpisode::thumbHeight()
qint32 cEpisode::thumbHeight()
{
return(m_iThumbHeight);
}
void cEpisode::setThumbWidth(const qint16& iThumbWidth)
void cEpisode::setThumbWidth(const qint32& iThumbWidth)
{
m_iThumbWidth = iThumbWidth;
}
qint16 cEpisode::thumbWidth()
qint32 cEpisode::thumbWidth()
{
return(m_iThumbWidth);
}

@ -11,9 +11,19 @@
#include <QRadioButton>
/*!
\brief
\class cEpisode cepisode.h "cepisode.h"
*/
class cEpisode
{
public:
/*!
\brief
\enum State
*/
enum State
{
StateUnknown = 0,
@ -23,98 +33,384 @@ public:
};
cEpisode();
/*!
\brief
\fn ~cEpisode
*/
~cEpisode();
/*!
\brief
\fn setID
\param iID
*/
void setID(const qint32& iID);
/*!
\brief
\fn id
\return qint32
*/
qint32 id();
/*!
\brief
\fn setName
\param szName
*/
void setName(const QString& szName);
/*!
\brief
\fn name
\return QString
*/
QString name();
void setEpisodeNumber(const qint16& iEpisodeNumber);
qint16 episodeNumber();
/*!
\brief
\fn setEpisodeNumber
\param iEpisodeNumber
*/
void setEpisodeNumber(const qint32& iEpisodeNumber);
/*!
\brief
\fn episodeNumber
\return qint32
*/
qint32 episodeNumber();
/*!
\brief
\fn setAirDate
\param szAirDate
*/
void setAirDate(const QString& szAirDate);
/*!
\brief
\fn setAirDate
\param airDate
*/
void setAirDate(const QDate& airDate);
/*!
\brief
\fn airDate
\return QDate
*/
QDate airDate();
/*!
\brief
\fn setGuestStars
\param szGuestStars
*/
void setGuestStars(const QString& szGuestStars);
/*!
\brief
\fn setGuestStars
\param szGuestStars
*/
void setGuestStars(const QStringList& szGuestStars);
/*!
\brief
\fn guestStars
\return QStringList
*/
QStringList guestStars();
/*!
\brief
\fn setOverview
\param szOverview
*/
void setOverview(const QString& szOverview);
/*!
\brief
\fn overview
\return QString
*/
QString overview();
/*!
\brief
\fn setProductionCode
\param szProductionCode
*/
void setProductionCode(const QString& szProductionCode);
/*!
\brief
\fn productionCode
\return QString
*/
QString productionCode();
void setSeasonNumber(const qint16& iSeasonNumber);
qint16 seasonNumber();
/*!
\brief
\fn setSeasonNumber
\param iSeasonNumber
*/
void setSeasonNumber(const qint32& iSeasonNumber);
/*!
\brief
\fn seasonNumber
\return qint32
*/
qint32 seasonNumber();
/*!
\brief
\fn setSeasonID
\param iSeasonID
*/
void setSeasonID(const qint32& iSeasonID);
/*!
\brief
\fn seasonID
\return qint32
*/
qint32 seasonID();
/*!
\brief
\fn setSeriesID
\param iSeriesID
*/
void setSeriesID(const qint32& iSeriesID);
/*!
\brief
\fn seriesID
\return qint32
*/
qint32 seriesID();
/*!
\brief
\fn setStillPath
\param szStillPath
*/
void setStillPath(const QString& szStillPath);
/*!
\brief
\fn stillPath
\return QString
*/
QString stillPath();
/*!
\brief
\fn setVoteAverage
\param dVoteAverage
*/
void setVoteAverage(const qreal& dVoteAverage);
/*!
\brief
\fn voteAverage
\return qreal
*/
qreal voteAverage();
void setVoteCount(const qint16& iVoteCount);
qint16 voteCount();
/*!
\brief
\fn setVoteCount
\param iVoteCount
*/
void setVoteCount(const qint32& iVoteCount);
/*!
\brief
\fn voteCount
\return qint32
*/
qint32 voteCount();
/*!
\brief
\fn setCrew
\param szCrew
*/
void setCrew(const QString& szCrew);
/*!
\brief
\fn setCrew
\param szCrew
*/
void setCrew(const QStringList& szCrew);
/*!
\brief
\fn crew
\return QStringList
*/
QStringList crew();
/*!
\brief
\fn setState
\param state
*/
void setState(const State& state);
/*!
\brief
\fn state
\return State
*/
State state();
/*!
\brief
\fn setFileName
\param szFileName
*/
void setFileName(const QString& szFileName);
/*!
\brief
\fn fileName
\return QString
*/
QString fileName();
void setThumbHeight(const qint16& iThumbHeight);
qint16 thumbHeight();
/*!
\brief
void setThumbWidth(const qint16& iThumbWidth);
qint16 thumbWidth();
\fn setThumbHeight
\param iThumbHeight
*/
void setThumbHeight(const qint32& iThumbHeight);
/*!
\brief
\fn thumbHeight
\return qint32
*/
qint32 thumbHeight();
/*!
\brief
\fn setThumbWidth
\param iThumbWidth
*/
void setThumbWidth(const qint32& iThumbWidth);
/*!
\brief
\fn thumbWidth
\return qint32
*/
qint32 thumbWidth();
/*!
\brief
\fn isValid
\return bool
*/
bool isValid();
/*!
\brief
\fn setGroup
\param lpGroup
*/
void setGroup(QButtonGroup* lpGroup);
/*!
\brief
\fn setLabel
\param lpLabel
*/
void setLabel(QLabel* lpLabel);
/*!
\brief
\fn setButton1
\param lpButton1
*/
void setButton1(QRadioButton* lpButton1);
/*!
\brief
\fn setButton2
\param lpButton2
*/
void setButton2(QRadioButton* lpButton2);
/*!
\brief
\fn setButton3
\param lpButton3
*/
void setButton3(QRadioButton* lpButton3);
/*!
\brief
\fn updateState
*/
void updateState();
/*!
\brief
\fn deleteResources
*/
void deleteResources();
private:
qint32 m_iID;
QString m_szName;
qint16 m_iEpisodeNumber;
QDate m_airDate;
QStringList m_szGuestStars;
QString m_szOverview;
QString m_szProductionCode;
qint16 m_iSeasonNumber;
qint32 m_iSeasonID;
qint32 m_iSeriesID;
QString m_szStillPath;
qreal m_dVoteAverage;
qint16 m_iVoteCount;
QStringList m_szCrew;
State m_state;
QButtonGroup* m_lpGroup;
QLabel* m_lpLabel;
QRadioButton* m_lpButton1;
QRadioButton* m_lpButton2;
QRadioButton* m_lpButton3;
qint32 m_iID; /*!< TODO: describe */
QString m_szName; /*!< TODO: describe */
qint32 m_iEpisodeNumber; /*!< TODO: describe */
QDate m_airDate; /*!< TODO: describe */
QStringList m_szGuestStars; /*!< TODO: describe */
QString m_szOverview; /*!< TODO: describe */
QString m_szProductionCode; /*!< TODO: describe */
qint32 m_iSeasonNumber; /*!< TODO: describe */
qint32 m_iSeasonID; /*!< TODO: describe */
qint32 m_iSeriesID; /*!< TODO: describe */
QString m_szStillPath; /*!< TODO: describe */
qreal m_dVoteAverage; /*!< TODO: describe */
qint32 m_iVoteCount; /*!< TODO: describe */
QStringList m_szCrew; /*!< TODO: describe */
State m_state; /*!< TODO: describe */
QButtonGroup* m_lpGroup; /*!< TODO: describe */
QLabel* m_lpLabel; /*!< TODO: describe */
QRadioButton* m_lpButton1; /*!< TODO: describe */
QRadioButton* m_lpButton2; /*!< TODO: describe */
QRadioButton* m_lpButton3; /*!< TODO: describe */
};
Q_DECLARE_METATYPE(cEpisode*)
Q_DECLARE_METATYPE(cEpisode::State)
#endif // CEPISODE_H

@ -5,19 +5,25 @@
#include "cmessageanimatedialog.h"
#include <QDebug>
#include <QTreeWidgetItem>
cEpisodeDetails::cEpisodeDetails(QWidget *parent) :
QWidget(parent),
ui(new Ui::cEpisodeDetails),
m_lpDetailsActorsModel(0),
m_lpEpisode(0),
m_bLoaded(false)
{
ui->setupUi(this);
m_lpDetailsActorsModel = new QStandardItemModel(0, 0);
ui->m_lpDetailsActors->setModel(m_lpDetailsActorsModel);
}
cEpisodeDetails::~cEpisodeDetails()
{
delete m_lpDetailsActorsModel;
delete ui;
}
@ -26,6 +32,20 @@ void cEpisodeDetails::setEpisode(cEpisode* lpEpisode)
m_lpEpisode = lpEpisode;
ui->m_lpEpisodeTitle->setText(lpEpisode->name());
ui->m_lpOverview->setText(lpEpisode->overview());
for(int x = 0;x < lpEpisode->guestStars().count();x++)
{
QStringList tmp = lpEpisode->guestStars().at(x).split(",");
QList<QStandardItem*> items;
items << new QStandardItem(tmp.at(0));
if(tmp.count() > 1)
items << new QStandardItem(tmp.at(1));
m_lpDetailsActorsModel->appendRow(items);
}
ui->m_lpDetailsActors->resizeColumnToContents(0);
ui->m_lpDetailsActors->resizeColumnToContents(1);
}
void cEpisodeDetails::loadImages()
@ -42,7 +62,7 @@ void cEpisodeDetails::loadImages()
lpDialog->show();
cMovieImage image;
QPixmap pixmap = image.getImage(m_lpEpisode->stillPath()).scaledToHeight(200);
QPixmap pixmap = image.getImage(m_lpEpisode->stillPath()).scaledToHeight(100);
ui->m_lpEpisodeThumb->setPixmap(pixmap);
delete lpDialog;

@ -2,6 +2,7 @@
#define CEPISODEDETAILS_H
#include <QWidget>
#include <QStandardItemModel>
#include "cepisode.h"
@ -10,20 +11,48 @@ namespace Ui {
class cEpisodeDetails;
}
/*!
\brief
\class cEpisodeDetails cepisodedetails.h "cepisodedetails.h"
*/
class cEpisodeDetails : public QWidget
{
Q_OBJECT
public:
/*!
\brief
\fn cEpisodeDetails
\param parent
*/
explicit cEpisodeDetails(QWidget *parent = 0);
/*!
\brief
\fn ~cEpisodeDetails
*/
~cEpisodeDetails();
/*!
\brief
\fn setEpisode
\param lpEpisode
*/
void setEpisode(cEpisode* lpEpisode);
/*!
\brief
\fn loadImages
*/
void loadImages();
private:
Ui::cEpisodeDetails* ui;
cEpisode* m_lpEpisode;
bool m_bLoaded;
Ui::cEpisodeDetails* ui; /*!< TODO: describe */
QStandardItemModel* m_lpDetailsActorsModel;
cEpisode* m_lpEpisode; /*!< TODO: describe */
bool m_bLoaded; /*!< TODO: describe */
};
#endif // CEPISODEDETAILS_H

@ -6,8 +6,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>400</width>
<height>300</height>
<width>759</width>
<height>502</height>
</rect>
</property>
<property name="windowTitle">
@ -15,29 +15,60 @@
</property>
<layout class="QGridLayout" name="gridLayout">
<item row="0" column="0">
<layout class="QHBoxLayout" name="horizontalLayout">
<layout class="QVBoxLayout" name="verticalLayout_2">
<item>
<widget class="QLabel" name="m_lpEpisodeThumb">
<property name="text">
<string/>
<widget class="QLineEdit" name="m_lpEpisodeTitle">
<property name="font">
<font>
<pointsize>12</pointsize>
<weight>75</weight>
<bold>true</bold>
</font>
</property>
<property name="readOnly">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<layout class="QVBoxLayout" name="verticalLayout">
<layout class="QHBoxLayout" name="horizontalLayout_2">
<item>
<widget class="QLineEdit" name="m_lpEpisodeTitle">
<property name="font">
<font>
<pointsize>12</pointsize>
<weight>75</weight>
<bold>true</bold>
</font>
</property>
<property name="readOnly">
<bool>true</bool>
</property>
</widget>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<widget class="QLabel" name="m_lpEpisodeThumb">
<property name="text">
<string/>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
</widget>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<widget class="cVerticalLabel" name="label_2">
<property name="text">
<string>Guest Stars</string>
</property>
</widget>
</item>
<item>
<widget class="QTreeView" name="m_lpDetailsActors">
<property name="editTriggers">
<set>QAbstractItemView::NoEditTriggers</set>
</property>
<property name="alternatingRowColors">
<bool>true</bool>
</property>
<attribute name="headerVisible">
<bool>false</bool>
</attribute>
</widget>
</item>
</layout>
</item>
</layout>
</item>
<item>
<widget class="QScrollArea" name="m_lpScrollArea">
@ -49,8 +80,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>365</width>
<height>245</height>
<width>363</width>
<height>447</height>
</rect>
</property>
<layout class="QGridLayout" name="gridLayout_2">
@ -71,6 +102,13 @@
</item>
</layout>
</widget>
<customwidgets>
<customwidget>
<class>cVerticalLabel</class>
<extends>QLabel</extends>
<header>cverticallabel.h</header>
</customwidget>
</customwidgets>
<resources/>
<connections/>
</ui>

@ -0,0 +1,58 @@
#include "cexportdialog.h"
#include "ui_cexportdialog.h"
#include <QSettings>
#include <QDir>
#include <QFileDialog>
cExportDialog::cExportDialog(QWidget *parent) :
QDialog(parent),
ui(new Ui::cExportDialog)
{
ui->setupUi(this);
QSettings settings;
QString szExportSerie = settings.value("exportSeriePath", QString("%1%2series.xml").arg(QDir::homePath()).arg(QDir::separator())).toString();
QString szExportMovie = settings.value("exportMoviePath", QString("%1%2movies.xml").arg(QDir::homePath()).arg(QDir::separator())).toString();
bool bExportSerie = settings.value("exportSerie", QDir::homePath()).toBool();
bool bExportMovie = settings.value("exportMovie", QDir::homePath()).toBool();
ui->m_lpExportSeries->setChecked(bExportSerie);
ui->m_lpExportMovies->setChecked(bExportMovie);
ui->m_lpSeriesPath->setText(szExportSerie);
ui->m_lpMoviesPath->setText(szExportMovie);
}
cExportDialog::~cExportDialog()
{
delete ui;
}
void cExportDialog::on_m_lpSeriesPathSelect_clicked()
{
QString szFile = QFileDialog::getSaveFileName(this, tr("export Serie"), ui->m_lpSeriesPath->text(), tr("XML Files (*.xml)"));
if(szFile.isEmpty())
return;
ui->m_lpSeriesPath->setText(szFile);
}
void cExportDialog::on_m_lpMoviesPathSelect_clicked()
{
QString szFile = QFileDialog::getSaveFileName(this, tr("export Serie"), ui->m_lpMoviesPath->text(), tr("XML Files (*.xml)"));
if(szFile.isEmpty())
return;
ui->m_lpMoviesPath->setText(szFile);
}
void cExportDialog::values(bool& bSeries, QString& szSeriesPath, bool& bMovies, QString& szMoviesPath)
{
bSeries = ui->m_lpExportSeries->checkState() == Qt::Checked;
szSeriesPath = ui->m_lpSeriesPath->text();
bMovies = ui->m_lpExportMovies->checkState() == Qt::Checked;
szMoviesPath = ui->m_lpMoviesPath->text();
}

@ -0,0 +1,64 @@
#ifndef CEXPORTDIALOG_H
#define CEXPORTDIALOG_H
#include <QDialog>
namespace Ui {
class cExportDialog;
}
/*!
\brief
\class cExportDialog cexportdialog.h "cexportdialog.h"
*/
class cExportDialog : public QDialog
{
Q_OBJECT
public:
/*!
\brief
\fn cExportDialog
\param parent
*/
explicit cExportDialog(QWidget *parent = 0);
/*!
\brief
\fn ~cExportDialog
*/
~cExportDialog();
/*!
\brief
\fn values
\param bSeries
\param szSeriesPath
\param bMovies
\param szMoviesPath
*/
void values(bool& bSeries, QString& szSeriesPath, bool& bMovies, QString& szMoviesPath);
private slots:
/*!
\brief
\fn on_m_lpSeriesPathSelect_clicked
*/
void on_m_lpSeriesPathSelect_clicked();
/*!
\brief
\fn on_m_lpMoviesPathSelect_clicked
*/
void on_m_lpMoviesPathSelect_clicked();
private:
Ui::cExportDialog *ui; /*!< TODO: describe */
};
#endif // CEXPORTDIALOG_H

@ -0,0 +1,98 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>cExportDialog</class>
<widget class="QDialog" name="cExportDialog">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>400</width>
<height>99</height>
</rect>
</property>
<property name="windowTitle">
<string>Export</string>
</property>
<layout class="QGridLayout" name="gridLayout">
<item row="0" column="0">
<widget class="QCheckBox" name="m_lpExportSeries">
<property name="text">
<string>Series</string>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QLineEdit" name="m_lpSeriesPath"/>
</item>
<item row="0" column="2">
<widget class="QPushButton" name="m_lpSeriesPathSelect">
<property name="text">
<string>...</string>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QCheckBox" name="m_lpExportMovies">
<property name="text">
<string>Movies</string>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QLineEdit" name="m_lpMoviesPath"/>
</item>
<item row="1" column="2">
<widget class="QPushButton" name="m_lpMoviesPathSelect">
<property name="text">
<string>...</string>
</property>
</widget>
</item>
<item row="2" column="0" colspan="3">
<widget class="QDialogButtonBox" name="buttonBox">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="standardButtons">
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
</property>
</widget>
</item>
</layout>
</widget>
<resources/>
<connections>
<connection>
<sender>buttonBox</sender>
<signal>accepted()</signal>
<receiver>cExportDialog</receiver>
<slot>accept()</slot>
<hints>
<hint type="sourcelabel">
<x>248</x>
<y>254</y>
</hint>
<hint type="destinationlabel">
<x>157</x>
<y>274</y>
</hint>
</hints>
</connection>
<connection>
<sender>buttonBox</sender>
<signal>rejected()</signal>
<receiver>cExportDialog</receiver>
<slot>reject()</slot>
<hints>
<hint type="sourcelabel">
<x>316</x>
<y>260</y>
</hint>
<hint type="destinationlabel">
<x>286</x>
<y>274</y>
</hint>
</hints>
</connection>
</connections>
</ui>

@ -0,0 +1,150 @@
#include "cfanart.h"
cFanart::cFanart(Type type) :
m_type(type),
m_iID(-1),
m_szURL(""),
m_szLanguage(""),
m_iLikes(0),
m_iSeason(-1),
m_szDisc(""),
m_szDiscType(""),
m_bActive(false)
{
}
void cFanart::setType(const Type& type)
{
m_type = type;
}
cFanart::Type cFanart::type()
{
return(m_type);
}
void cFanart::setID(const qint32& iID)
{
m_iID = iID;
}
qint32 cFanart::id()
{
return(m_iID);
}
void cFanart::setURL(const QString& szURL)
{
m_szURL = szURL;
}
QString cFanart::url()
{
return(m_szURL);
}
void cFanart::setLanguage(const QString& szLanguage)
{
m_szLanguage = szLanguage;
}
QString cFanart::language()
{
return(m_szLanguage);
}
void cFanart::setLikes(const qint32& iLikes)
{
m_iLikes = iLikes;
}
qint32 cFanart::likes()
{
return(m_iLikes);
}
void cFanart::setSeason(const qint32& iSeason)
{
m_iSeason = iSeason;
}
qint32 cFanart::season()
{
return(m_iSeason);
}
void cFanart::setDisc(const QString& szDisc)
{
m_szDisc = szDisc;
}
QString cFanart::disc()
{
return(m_szDisc);
}
void cFanart::setDiscType(const QString& szDiscType)
{
m_szDiscType = szDiscType;
}
QString cFanart::discType()
{
return(m_szDiscType);
}
void cFanart::setActive(const bool& bActive)
{
m_bActive = bActive;
}
bool cFanart::active()
{
return(m_bActive);
}
cFanart* cFanartList::add(const cFanart::Type& type)
{
cFanart* lpNew = new cFanart(type);
append(lpNew);
return(lpNew);
}
cFanart* cFanartList::search(const cFanart::Type& type, const QString& szLanguage)
{
for(int x = 0;x < count();x++)
{
if(szLanguage.length())
{
if(at(x)->type() == type && !at(x)->language().compare(szLanguage, Qt::CaseInsensitive))
return(at(x));
}
else
{
if(at(x)->type() == type)
return(at(x));
}
}
return(0);
}
cFanart* cFanartList::search(const cFanart::Type& type, const bool bActive, const QString& szLanguage)
{
for(int x = 0;x < count();x++)
{
if(szLanguage.length())
{
if(at(x)->type() == type &&
!at(x)->language().compare(szLanguage, Qt::CaseInsensitive) &&
at(x)->active() == bActive)
return(at(x));
}
else
{
if(at(x)->type() == type && at(x)->active() == bActive)
return(at(x));
}
}
return(0);
}

@ -0,0 +1,237 @@
#ifndef CFANART_H
#define CFANART_H
#include <QString>
#include <QMetaType>
#include <QList>
/*!
\brief
\class cFanart cfanart.h "cfanart.h"
*/
class cFanart
{
public:
/*!
\brief
\enum Type
*/
enum Type
{
TypeUnknown = 0,
TypeHDTVLogo = 1,
TypeClearLogo = 2,
TypeTVPoster = 3,
TypeClearArt = 4,
TypeHDClearArt = 5,
TypeShowBackground = 6,
TypeSeasonPoster = 7,
TypeTVThumb = 8,
TypeSeasonBanner = 9,
TypeCharacterArt = 10,
TypeSeasonThumb = 11,
TypeTVBanner = 12,
TypeHDMovieLogo = 13,
TypeMovieDisc = 14,
TypeMovieLogo = 15,
TypeMoviePoster = 16,
TypeHDMovieClearArt = 17,
TypeMovieArt = 18,
TypeMovieBackground = 19,
TypeMovieBanner = 20,
TypeMovieThumb = 21,
};
cFanart(Type type = TypeUnknown);
/*!
\brief
\fn setType
\param type
*/
void setType(const Type& type);
/*!
\brief
\fn type
\return Type
*/
Type type();
/*!
\brief
\fn setID
\param iID
*/
void setID(const qint32& iID);
/*!
\brief
\fn id
\return qint32
*/
qint32 id();
/*!
\brief
\fn setURL
\param szURL
*/
void setURL(const QString& szURL);
/*!
\brief
\fn url
\return QString
*/
QString url();
/*!
\brief
\fn setLanguage
\param szLanguage
*/
void setLanguage(const QString& szLanguage);
/*!
\brief
\fn language
\return QString
*/
QString language();
/*!
\brief
\fn setLikes
\param iLikes
*/
void setLikes(const qint32& iLikes);
/*!
\brief
\fn likes
\return qint32
*/
qint32 likes();
/*!
\brief
\fn setSeason
\param iSeason
*/
void setSeason(const qint32& iSeason);
/*!
\brief
\fn season
\return qint32
*/
qint32 season();
/*!
\brief
\fn setDisc
\param szDisc
*/
void setDisc(const QString& szDisc);
/*!
\brief
\fn disc
\return QString
*/
QString disc();
/*!
\brief
\fn setDiscType
\param szDiscType
*/
void setDiscType(const QString& szDiscType);
/*!
\brief
\fn discType
\return QString
*/
QString discType();
/*!
\brief
\fn setActive
\param bActive
*/
void setActive(const bool& bActive);
/*!
\brief
\fn active
\return bool
*/
bool active();
private:
Type m_type; /*!< TODO: describe */
qint32 m_iID; /*!< TODO: describe */
QString m_szURL; /*!< TODO: describe */
QString m_szLanguage; /*!< TODO: describe */
qint32 m_iLikes; /*!< TODO: describe */
qint32 m_iSeason; /*!< TODO: describe */
QString m_szDisc; /*!< TODO: describe */
QString m_szDiscType; /*!< TODO: describe */
bool m_bActive; /*!< TODO: describe */
};
Q_DECLARE_METATYPE(cFanart*)
Q_DECLARE_METATYPE(cFanart::Type)
/*!
\brief
\class cFanartList cfanart.h "cfanart.h"
*/
class cFanartList : public QList<cFanart*>
{
public:
/*!
\brief
\fn add
\param type
\return cFanart
*/
cFanart* add(const cFanart::Type& type);
/*!
\brief
\fn search
\param type
\param szLanguage
\return cFanart
*/
cFanart* search(const cFanart::Type& type, const QString& szLanguage = "");
/*!
\brief
\fn search
\param type
\param bActive
\param szLanguage
\return cFanart
*/
cFanart* search(const cFanart::Type& type, const bool bActive, const QString& szLanguage = "");
};
#endif // CFANART_H

@ -1,6 +1,6 @@
#include "common.h"
#include "cimage.h"
#include "cfanartimage.h"
#include <QDir>
#include <QFile>
@ -11,15 +11,16 @@
#include <QUrl>
cImage::cImage()
cFanartImage::cFanartImage()
{
}
QPixmap cImage::getImage(const QString& szFileName)
QPixmap cFanartImage::getImage(const QString& szFileName)
{
QPixmap pixmap;
QString szPath = rootPath() + QDir::separator() + szFileName;
QString szPath = rootPath() + QDir::separator() + szFileName.mid(25);
szPath.replace("/", QDir::separator());
if(szFileName.isEmpty())
pixmap.load(rootPath() + QDir::separator() + QDir::separator() + "empty.jpg");
@ -32,13 +33,13 @@ QPixmap cImage::getImage(const QString& szFileName)
return(pixmap);
}
QPixmap cImage::downloadFile(const QString& szFileName)
QPixmap cFanartImage::downloadFile(const QString& szFileName)
{
QPixmap pixmap;
QString szPath = rootPath() + QDir::separator() + szFileName;
// QString szURL = "http://thetvdb.com/banners/" + szFileName;
QString szURL = "https://www.thetvdb.com/banners/" + szFileName;
QString szPath = rootPath() + QDir::separator() + szFileName.mid(25);
szPath.replace("/", QDir::separator());
QString szURL = szFileName;
QNetworkAccessManager networkManager;
QUrl url(szURL);

@ -0,0 +1,36 @@
#ifndef CFANARTIMAGE_H
#define CFANARTIMAGE_H
#include <QPixmap>
/*!
\brief
\class cFanartImage cfanartimage.h "cfanartimage.h"
*/
class cFanartImage
{
public:
cFanartImage();
/*!
\brief
\fn getImage
\param szFileName
\return QPixmap
*/
QPixmap getImage(const QString& szFileName);
private:
/*!
\brief
\fn downloadFile
\param szFileName
\return QPixmap
*/
QPixmap downloadFile(const QString& szFileName);
};
#endif // CFANARTIMAGE_H

@ -0,0 +1,163 @@
#include "cfanarttv.h"
#include <QNetworkAccessManager>
#include <QNetworkRequest>
#include <QNetworkReply>
#include <QEventLoop>
#include <QByteArray>
#include <QJsonDocument>
#include <QJsonObject>
#include <QJsonArray>
cFanartTV::cFanartTV() :
m_szAPIKey("5c31661038de56f110b5f2fc4d49a7d1")
{
}
void cFanartTV::processArray(const QJsonArray& array, cFanartList& fanartList, cFanart::Type type)
{
cFanart* lpFanart;
for(int x = 0;x < array.count();x++)
{
QJsonObject obj = array.at(x).toObject();
lpFanart = fanartList.add(type);
switch(type)
{
case cFanart::TypeHDTVLogo:
case cFanart::TypeClearLogo:
case cFanart::TypeTVPoster:
case cFanart::TypeClearArt:
case cFanart::TypeHDClearArt:
case cFanart::TypeTVThumb:
case cFanart::TypeCharacterArt:
case cFanart::TypeTVBanner:
lpFanart->setID(obj["id"].toString().toInt());
lpFanart->setLanguage(obj["lang"].toString());
lpFanart->setLikes(obj["likes"].toString().toInt());
lpFanart->setURL(obj["url"].toString());
break;
case cFanart::TypeShowBackground:
case cFanart::TypeSeasonPoster:
case cFanart::TypeSeasonBanner:
case cFanart::TypeSeasonThumb:
lpFanart->setID(obj["id"].toString().toInt());
lpFanart->setLanguage(obj["lang"].toString());
lpFanart->setLikes(obj["likes"].toString().toInt());
lpFanart->setURL(obj["url"].toString());
if(!obj["season"].toString().compare("all"))
lpFanart->setSeason(-1);
else
lpFanart->setSeason(obj["season"].toString().toInt());
break;
case cFanart::TypeHDMovieLogo:
case cFanart::TypeMovieLogo:
case cFanart::TypeMoviePoster:
case cFanart::TypeHDMovieClearArt:
case cFanart::TypeMovieArt:
case cFanart::TypeMovieBackground:
case cFanart::TypeMovieBanner:
case cFanart::TypeMovieThumb:
lpFanart->setID(obj["id"].toString().toInt());
lpFanart->setLanguage(obj["lang"].toString());
lpFanart->setLikes(obj["likes"].toString().toInt());
lpFanart->setURL(obj["url"].toString());
break;
case cFanart::TypeMovieDisc:
lpFanart->setID(obj["id"].toString().toInt());
lpFanart->setLanguage(obj["lang"].toString());
lpFanart->setLikes(obj["likes"].toString().toInt());
lpFanart->setURL(obj["url"].toString());
lpFanart->setDisc(obj["disc"].toString());
lpFanart->setDiscType(obj["disc_type"].toString());
break;
default:
break;
}
}
}
cFanartList cFanartTV::loadFanartSerie(const qint32 &iID)
{
cFanartList fanartList;
QNetworkAccessManager networkManager;
QNetworkRequest request(QUrl(QString("http://webservice.fanart.tv/v3/tv/%1?api_key=%2").arg(iID).arg(m_szAPIKey)));
request.setRawHeader("Content-Type", "application/json");
QNetworkReply* reply = networkManager.get(request);
QEventLoop loop;
QObject::connect(reply, SIGNAL(finished()), &loop, SLOT(quit()));
loop.exec();
if (reply->error() == QNetworkReply::NoError)
{
QString strReply = (QString)reply->readAll();
QJsonDocument jsonResponse = QJsonDocument::fromJson(strReply.toUtf8());
QJsonObject jsonObj = jsonResponse.object();
delete reply;
processArray(jsonObj["hdtvlogo"].toArray(), fanartList, cFanart::TypeHDTVLogo);
processArray(jsonObj["clearlogo"].toArray(), fanartList, cFanart::TypeClearLogo);
processArray(jsonObj["tvposter"].toArray(), fanartList, cFanart::TypeTVPoster);
processArray(jsonObj["clearart"].toArray(), fanartList, cFanart::TypeClearArt);
processArray(jsonObj["hdclearart"].toArray(), fanartList, cFanart::TypeHDClearArt);
processArray(jsonObj["showbackground"].toArray(), fanartList, cFanart::TypeShowBackground);
processArray(jsonObj["seasonposter"].toArray(), fanartList, cFanart::TypeSeasonPoster);
processArray(jsonObj["tvthumb"].toArray(), fanartList, cFanart::TypeTVThumb);
processArray(jsonObj["seasonbanner"].toArray(), fanartList, cFanart::TypeSeasonBanner);
processArray(jsonObj["characterart"].toArray(), fanartList, cFanart::TypeCharacterArt);
processArray(jsonObj["seasonthumb"].toArray(), fanartList, cFanart::TypeSeasonThumb);
processArray(jsonObj["tvbanner"].toArray(), fanartList, cFanart::TypeTVBanner);
}
else
{
qDebug() << reply->errorString();
delete reply;
}
return(fanartList);
}
cFanartList cFanartTV::loadFanartMovie(const QString &szIMDBID)
{
cFanartList fanartList;
QNetworkAccessManager networkManager;
QNetworkRequest request(QUrl(QString("http://webservice.fanart.tv/v3/movies/%1?api_key=%2").arg(szIMDBID).arg(m_szAPIKey)));
request.setRawHeader("Content-Type", "application/json");
QNetworkReply* reply = networkManager.get(request);
QEventLoop loop;
QObject::connect(reply, SIGNAL(finished()), &loop, SLOT(quit()));
loop.exec();
if (reply->error() == QNetworkReply::NoError)
{
QString strReply = (QString)reply->readAll();
QJsonDocument jsonResponse = QJsonDocument::fromJson(strReply.toUtf8());
QJsonObject jsonObj = jsonResponse.object();
delete reply;
processArray(jsonObj["hdmovielogo"].toArray(), fanartList, cFanart::TypeHDMovieLogo);
processArray(jsonObj["movielogo"].toArray(), fanartList, cFanart::TypeMovieLogo);
processArray(jsonObj["movieposter"].toArray(), fanartList, cFanart::TypeMoviePoster);
processArray(jsonObj["hdmovieclearart"].toArray(), fanartList, cFanart::TypeHDMovieClearArt);
processArray(jsonObj["movieart"].toArray(), fanartList, cFanart::TypeMovieArt);
processArray(jsonObj["moviebackground"].toArray(), fanartList, cFanart::TypeMovieBackground);
processArray(jsonObj["moviebanner"].toArray(), fanartList, cFanart::TypeMovieBanner);
processArray(jsonObj["moviethumb"].toArray(), fanartList, cFanart::TypeMovieThumb);
}
else
{
qDebug() << reply->errorString();
delete reply;
}
return(fanartList);
}

@ -0,0 +1,50 @@
#ifndef CFANARTTV_H
#define CFANARTTV_H
#include "cfanart.h"
#include <QString>
/*!
\brief
\class cFanartTV cfanarttv.h "cfanarttv.h"
*/
class cFanartTV
{
public:
cFanartTV();
/*!
\brief
\fn loadFanartSerie
\param iID
\return cFanartList
*/
cFanartList loadFanartSerie(const qint32 &iID);
/*!
\brief
\fn loadFanartMovie
\param szIMDBID
\return cFanartList
*/
cFanartList loadFanartMovie(const QString& szIMDBID);
private:
QString m_szAPIKey; /*!< TODO: describe */
/*!
\brief
\fn processArray
\param array
\param fanartList
\param type
*/
void processArray(const QJsonArray& array, cFanartList& fanartList, cFanart::Type type);
};
#endif // CFANARTTV_H

@ -1,17 +0,0 @@
#ifndef CIMAGE_H
#define CIMAGE_H
#include <QPixmap>
class cImage
{
public:
cImage();
QPixmap getImage(const QString& szFileName);
private:
QPixmap downloadFile(const QString& szFileName);
};
#endif // CIMAGE_H

File diff suppressed because it is too large Load Diff

@ -5,7 +5,7 @@
#include "cserie.h"
#include "cmovie.h"
#include "cupdatethread.h"
//#include "cupdatethread.h"
#include "cpicturesthread.h"
#include <QMainWindow>
@ -28,101 +28,614 @@ namespace Ui {
class cMainWindow;
}
/*!
\brief
\class cMainWindow cmainwindow.h "cmainwindow.h"
*/
class cMainWindow : public QMainWindow
{
Q_OBJECT
public:
explicit cMainWindow(QWidget *parent = 0);
/*!
\brief
\fn cMainWindow
\param parent
*/
explicit cMainWindow(QWidget *parent = nullptr);
/*!
\brief
\fn ~cMainWindow
*/
~cMainWindow();
/*!
\brief
\fn initDone
*/
void initDone();
private slots:
/*!
\brief
\fn on_m_lpSeriesList1_customContextMenuRequested
\param pos
*/
void on_m_lpSeriesList1_customContextMenuRequested(const QPoint &pos);
/*!
\brief
\fn on_m_lpSeriesList1_doubleClicked
\param index
*/
void on_m_lpSeriesList1_doubleClicked(const QModelIndex &index);
/*!
\brief
\fn on_m_lpSeriesList1_pressed
\param index
*/
void on_m_lpSeriesList1_pressed(const QModelIndex &index);
/*!
\brief
\fn on_m_lpSeriesList2_customContextMenuRequested
\param pos
*/
void on_m_lpSeriesList2_customContextMenuRequested(const QPoint &pos);
/*!
\brief
\fn on_m_lpSeriesList2_doubleClicked
\param index
*/
void on_m_lpSeriesList2_doubleClicked(const QModelIndex &index);
/*!
\brief
\fn on_m_lpSeriesList2_pressed
\param index
*/
void on_m_lpSeriesList2_pressed(const QModelIndex &index);
/*!
\brief
\fn on_m_lpMoviesList_customContextMenuRequested
\param pos
*/
void on_m_lpMoviesList_customContextMenuRequested(const QPoint &pos);
/*!
\brief
\fn on_m_lpMoviesList_doubleClicked
\param index
*/
void on_m_lpMoviesList_doubleClicked(const QModelIndex &index);
/*!
\brief
\fn onActionAdd
*/
void onActionAdd();
/*!
\brief
\fn onActionUpdateAll
*/
void onActionUpdateAll();
/*!
\brief
\fn onActionUpdateUnfinished
*/
void onActionUpdateUnfinished();
/*!
\brief
\fn onActionUpdate
*/
void onActionUpdate();
/*!
\brief
\fn onActionDelete
*/
void onActionDelete();
/*!
\brief
\fn onActionEdit
*/
void onActionEdit();
/*!
\brief
\fn onActionGotoDownload
*/
void onActionGotoDownload();
/*!
\brief
\fn onActionCopyDownload
*/
void onActionCopyDownload();
void onActionLoadPictures();
/*!
\brief
\fn onActionGotoIMDB
*/
void onActionGotoIMDB();
/*!
\brief
\fn onActionLoadPictures
*/
void onActionLoadPictures();
/*!
\brief
\fn onActionFind
*/
void onActionFind();
/*!
\brief
\fn onActionFindAgain
*/
void onActionFindAgain();
/*!
\brief
\fn onActionDiscover
*/
void onActionDiscover();
/*!
\brief
\fn onActionGotoAllDownload
*/
void onActionGotoAllDownload();
/*!
\brief
\fn onActionGotoAllDownloadOpen
*/
void onActionGotoAllDownloadOpen();
/*!
\brief
\fn onActionMovieAdd
*/
void onActionMovieAdd();
/*!
\brief
\fn onActionMovieUpdateAll
*/
void onActionMovieUpdateAll();
/*!
\brief
\fn onActionMovieUpdate
*/
void onActionMovieUpdate();
/*!
\brief
\fn onActionMovieDelete
*/
void onActionMovieDelete();
/*!
\brief
\fn onActionMovieEdit
*/
void onActionMovieEdit();
/*!
\brief
\fn onActionMovieGotoIMDB
*/
void onActionMovieGotoIMDB();
void onActionMovieLoadPictures();
/*!
\brief
\fn onActionMovieLoadPictures
*/
void onActionMovieLoadPictures();
/*!
\brief
\fn onActionMovieFind
*/
void onActionMovieFind();
/*!
\brief
\fn onActionMovieFindAgain
*/
void onActionMovieFindAgain();
/*!
\brief
\fn onActionMovieDiscover
*/
void onActionMovieDiscover();
/*!
\brief
\fn onActionExport
*/
void onActionExport();
/*!
\brief
\fn onActionPreferences
*/
void onActionPreferences();
/*!
\brief
\fn onActionAddGlobal
*/
void onActionAddGlobal();
/*!
\brief
\fn onActionFindGlobal
*/
void onActionFindGlobal();
/*!
\brief
\fn onActionFindAgainGlobal
*/
void onActionFindAgainGlobal();
/*!
\brief
\fn updateMessage
\param szMessage
\param iProgress
*/
void updateMessage(const QString& szMessage, const qint32 &iProgress);
/*!
\brief
\fn updateAppendMessage
\param szMessage
*/
void updateAppendMessage(const QString& szMessage);
/*!
\brief
\fn updateDone
*/
void updateDone();
/*!
\brief
\fn picturesMessage
\param szMessage
\param iProgress
*/
void picturesMessage(const QString& szMessage, const qint32 &iProgress);
/*!
\brief
\fn picturesAppendMessage
\param szMessage
*/
void picturesAppendMessage(const QString& szMessage);
/*!
\brief
\fn picturesDone
*/
void picturesDone();
/*!
\brief
\fn selectionChanged1
\param selected
\param deselected
*/
void selectionChanged1(const QItemSelection &selected, const QItemSelection &deselected);
/*!
\brief
\fn selectionChanged2
\param selected
\param deselected
*/
void selectionChanged2(const QItemSelection &selected, const QItemSelection &deselected);
/*!
\brief
\fn scrollbarValueChanged1
\param value
*/
void scrollbarValueChanged1(int value);
/*!
\brief
\fn scrollbarValueChanged2
\param value
*/
void scrollbarValueChanged2(int value);
/*!
\brief
\fn on_m_lpSeriesFilterInitialized_clicked
*/
void on_m_lpSeriesFilterInitialized_clicked();
/*!
\brief
\fn on_m_lpSeriesFilterProgress_clicked
*/
void on_m_lpSeriesFilterProgress_clicked();
/*!
\brief
\fn on_m_lpSeriesFilterDone_clicked
*/
void on_m_lpSeriesFilterDone_clicked();
/*!
\brief
\fn on_m_lpSeriesFilterWithLink_clicked
*/
void on_m_lpSeriesFilterWithLink_clicked();
/*!
\brief
\fn on_m_lpSeriesFilterCliffhanger_clicked
*/
void on_m_lpSeriesFilterCliffhanger_clicked();
/*!
\brief
\fn on_m_lpSeriesFilterNotFinished_clicked
*/
void on_m_lpSeriesFilterNotFinished_clicked();
/*!
\brief
\fn on_m_lpMoviesFilterInitialized_clicked
*/
void on_m_lpMoviesFilterInitialized_clicked();
/*!
\brief
\fn on_m_lpMoviesFilterProgress_clicked
*/
void on_m_lpMoviesFilterProgress_clicked();
/*!
\brief
\fn on_m_lpMoviesFilterDone_clicked
*/
void on_m_lpMoviesFilterDone_clicked();
/*!
\brief
\fn on_m_lpSeriesFilter_clicked
*/
void on_m_lpSeriesFilter_clicked();
/*!
\brief
\fn on_m_lpMoviesFilter_clicked
*/
void on_m_lpMoviesFilter_clicked();
/*!
\brief
\fn onActionExit
*/
void onActionExit();
private:
Ui::cMainWindow* ui;
cSerieList m_serieList;
cMovieList m_movieList;
QSqlDatabase m_db;
Ui::cMainWindow* ui; /*!< TODO: describe */
cSerieList m_serieList; /*!< TODO: describe */
cMovieList m_movieList; /*!< TODO: describe */
QSqlDatabase m_db; /*!< TODO: describe */
QString m_szOldSelected;
QString m_szOldSelected; /*!< TODO: describe */
cMessageDialog* m_lpMessageDialog;
cUpdateThread* m_lpUpdateThread;
cPicturesThread* m_lpPicturesThread;
cMessageDialog* m_lpMessageDialog; /*!< TODO: describe */
cPicturesThread* m_lpPicturesThread; /*!< TODO: describe */
QTime m_timer;
QStandardItemModel* m_lpSeriesListModel; /*!< TODO: describe */
QStandardItemModel* m_lpMoviesListModel; /*!< TODO: describe */
QStandardItemModel* m_lpSeriesListModel;
QStandardItemModel* m_lpMoviesListModel;
bool m_bProcessing; /*!< TODO: describe */
bool m_bProcessing;
QShortcut* m_lpShortcutAdd; /*!< TODO: describe */
QShortcut* m_lpShortcutFind; /*!< TODO: describe */
QShortcut* m_lpShortcutFindAgain; /*!< TODO: describe */
QShortcut* m_lpShortcut;
QString m_szFind; /*!< TODO: describe */
QString m_szFindMovie; /*!< TODO: describe */
QMenu* m_lpFileMenu; /*!< TODO: describe */
QAction* m_lpFileExportAction; /*!< TODO: describe */
QAction* m_lpFilePreferencesAction; /*!< TODO: describe */
QAction* m_lpFileExitAction; /*!< TODO: describe */
/*!
\brief
\fn initDB
*/
void initDB();
/*!
\brief
\fn loadDB
*/
void loadDB();
void convertSeries();
/*!
\brief
\fn loadSeriesDB
*/
void loadSeriesDB();
/*!
\brief
\fn loadMoviesDB
*/
void loadMoviesDB();
/*!
\brief
\fn displaySeries
*/
void displaySeries();
/*!
\brief
\fn displayMovies
*/
void displayMovies();
/*!
\brief
\fn runEdit
\param lpSerie
\param szDownload
\return bool
*/
bool runEdit(cSerie *lpSerie, QString& szDownload);
/*!
\brief
\fn runMovieEdit
\param lpMovie
\return bool
*/
bool runMovieEdit(cMovie *lpMovie);
/*!
\brief
\fn showSeriesContextMenu
\param lpTreeView
\param pos
*/
void showSeriesContextMenu(QTreeView* lpTreeView, const QPoint &pos);
/*!
\brief
\fn doUpdate
\param serieList
*/
void doUpdate(cSerieList& serieList);
/*!
\brief
\fn showMoviesContextMenu
\param lpTreeView
\param pos
*/
void showMoviesContextMenu(QTreeView* lpTreeView, const QPoint &pos);
/*!
\brief
\fn setSeriesStyle
\param lpItems
*/
void setSeriesStyle(QList<QStandardItem *> lpItems);
/*!
\brief
\fn setMovieStyle
\param lpItem
*/
void setMovieStyle(QStandardItem* lpItem);
/*!
\brief
\fn applySeriesFilter
*/
void applySeriesFilter();
/*!
\brief
\fn applyMoviesFilter
*/
void applyMoviesFilter();
/*!
\brief
\fn applyMoviesFilter
\param i
\param lpMovie
\return bool
*/
bool applyMoviesFilter(qint32 i, cMovie* lpMovie);
/*!
\brief
\fn applyMoviesFilter
\param lpParent
*/
void applyMoviesFilter(QStandardItem* lpParent);
/*!
\brief
\fn checkState
\param state
\param bDesiredState
\return bool
*/
bool checkState(const Qt::CheckState &state, bool bDesiredState);
/*!
\brief
\fn find
*/
void find();
/*!
\brief
\fn findMovie
*/
void findMovie();
protected:
/*!
\brief
\fn closeEvent
\param event
*/
void closeEvent(QCloseEvent *event);
};

@ -11,22 +11,111 @@
</rect>
</property>
<property name="windowTitle">
<string>qtSeries</string>
<string>qtMultimediaDB</string>
</property>
<widget class="QWidget" name="centralWidget">
<layout class="QGridLayout" name="gridLayout_2">
<item row="0" column="0">
<item row="0" column="1">
<widget class="QTabWidget" name="m_lpMainTab">
<property name="currentIndex">
<number>1</number>
<number>0</number>
</property>
<widget class="QWidget" name="m_lpTVShowsTab">
<attribute name="title">
<string>TV Shows</string>
</attribute>
<layout class="QGridLayout" name="gridLayout">
<layout class="QGridLayout" name="gridLayout_5">
<item row="0" column="0">
<layout class="QVBoxLayout" name="verticalLayout" stretch="1,0">
<layout class="QVBoxLayout" name="verticalLayout" stretch="0,1,0">
<item>
<widget class="QGroupBox" name="m_lpSeriesFilter">
<property name="title">
<string>Filter</string>
</property>
<property name="checkable">
<bool>true</bool>
</property>
<layout class="QGridLayout" name="gridLayout_4">
<item row="0" column="0">
<layout class="QGridLayout" name="gridLayout">
<item row="0" column="0">
<widget class="QCheckBox" name="m_lpSeriesFilterInitialized">
<property name="text">
<string>initialized</string>
</property>
<property name="tristate">
<bool>true</bool>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QCheckBox" name="m_lpSeriesFilterCliffhanger">
<property name="text">
<string>cliffhanger</string>
</property>
<property name="tristate">
<bool>true</bool>
</property>
</widget>
</item>
<item row="0" column="2">
<widget class="QCheckBox" name="m_lpSeriesFilterDone">
<property name="text">
<string>done</string>
</property>
<property name="tristate">
<bool>true</bool>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QCheckBox" name="m_lpSeriesFilterProgress">
<property name="text">
<string>in progress</string>
</property>
<property name="tristate">
<bool>true</bool>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QCheckBox" name="m_lpSeriesFilterWithLink">
<property name="text">
<string>download link</string>
</property>
<property name="tristate">
<bool>true</bool>
</property>
</widget>
</item>
<item row="1" column="2">
<widget class="QCheckBox" name="m_lpSeriesFilterNotFinished">
<property name="text">
<string>not finished</string>
</property>
<property name="tristate">
<bool>true</bool>
</property>
</widget>
</item>
</layout>
</item>
<item row="0" column="1">
<spacer name="horizontalSpacer_3">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</widget>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_3">
<item>
@ -167,60 +256,123 @@
<attribute name="title">
<string>Movies</string>
</attribute>
<layout class="QGridLayout" name="gridLayout_3">
<layout class="QGridLayout" name="gridLayout_7">
<item row="0" column="0">
<widget class="QTreeView" name="m_lpMoviesList">
<property name="contextMenuPolicy">
<enum>Qt::CustomContextMenu</enum>
</property>
<property name="editTriggers">
<set>QAbstractItemView::NoEditTriggers</set>
</property>
<property name="alternatingRowColors">
<bool>true</bool>
</property>
<property name="selectionMode">
<enum>QAbstractItemView::ExtendedSelection</enum>
</property>
<property name="rootIsDecorated">
<bool>true</bool>
</property>
<property name="allColumnsShowFocus">
<bool>true</bool>
</property>
<attribute name="headerVisible">
<bool>false</bool>
</attribute>
</widget>
</item>
<item row="1" column="0">
<layout class="QHBoxLayout" name="horizontalLayout">
<layout class="QVBoxLayout" name="verticalLayout_2" stretch="0,1,0">
<item>
<widget class="QLabel" name="label">
<property name="text">
<string>Movies:</string>
<widget class="QGroupBox" name="m_lpMoviesFilter">
<property name="title">
<string>Filter</string>
</property>
<property name="checkable">
<bool>true</bool>
</property>
<layout class="QGridLayout" name="gridLayout_6">
<item row="0" column="0">
<layout class="QGridLayout" name="gridLayout_3">
<item row="0" column="1">
<widget class="QCheckBox" name="m_lpMoviesFilterProgress">
<property name="text">
<string>in progress</string>
</property>
<property name="tristate">
<bool>true</bool>
</property>
</widget>
</item>
<item row="0" column="0">
<widget class="QCheckBox" name="m_lpMoviesFilterInitialized">
<property name="text">
<string>Initialized</string>
</property>
<property name="tristate">
<bool>true</bool>
</property>
</widget>
</item>
<item row="0" column="2">
<widget class="QCheckBox" name="m_lpMoviesFilterDone">
<property name="text">
<string>done</string>
</property>
<property name="tristate">
<bool>true</bool>
</property>
</widget>
</item>
</layout>
</item>
<item row="0" column="1">
<spacer name="horizontalSpacer_4">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</widget>
</item>
<item>
<widget class="QLabel" name="m_lpMoviesCount">
<property name="text">
<string>0</string>
<widget class="QTreeView" name="m_lpMoviesList">
<property name="contextMenuPolicy">
<enum>Qt::CustomContextMenu</enum>
</property>
<property name="editTriggers">
<set>QAbstractItemView::NoEditTriggers</set>
</property>
<property name="alternatingRowColors">
<bool>true</bool>
</property>
<property name="selectionMode">
<enum>QAbstractItemView::ExtendedSelection</enum>
</property>
<property name="rootIsDecorated">
<bool>true</bool>
</property>
<property name="allColumnsShowFocus">
<bool>true</bool>
</property>
<attribute name="headerVisible">
<bool>false</bool>
</attribute>
</widget>
</item>
<item>
<spacer name="horizontalSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<widget class="QLabel" name="label">
<property name="text">
<string>Movies:</string>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="m_lpMoviesCount">
<property name="text">
<string>0</string>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</item>
</layout>
</item>
@ -230,7 +382,7 @@
</item>
</layout>
</widget>
<widget class="QMenuBar" name="menuBar">
<widget class="QMenuBar" name="m_lpMenuBar">
<property name="geometry">
<rect>
<x>0</x>
@ -249,6 +401,30 @@
</attribute>
</widget>
<widget class="QStatusBar" name="statusBar"/>
<action name="m_lpFind">
<property name="text">
<string>&amp;find...</string>
</property>
<property name="shortcut">
<string>Ctrl+F</string>
</property>
</action>
<action name="action_Export">
<property name="text">
<string>&amp;Export...</string>
</property>
<property name="shortcut">
<string>Ctrl+E</string>
</property>
</action>
<action name="actionE_xit">
<property name="text">
<string>E&amp;xit</string>
</property>
<property name="shortcut">
<string>Ctrl+X</string>
</property>
</action>
</widget>
<layoutdefault spacing="6" margin="11"/>
<resources/>

@ -27,6 +27,11 @@ namespace Ui {
class cMessageAnimateDialog;
}
/*!
\brief
\class cMessageAnimateDialog cmessageanimatedialog.h "cmessageanimatedialog.h"
*/
class cMessageAnimateDialog : public QDialog
{
Q_OBJECT

@ -14,7 +14,7 @@
</rect>
</property>
<property name="windowTitle">
<string>Dialog</string>
<string>Message</string>
</property>
<layout class="QGridLayout" name="gridLayout">
<item row="0" column="0">

@ -7,22 +7,69 @@ namespace Ui {
class cMessageDialog;
}
/*!
\brief
\class cMessageDialog cmessagedialog.h "cmessagedialog.h"
*/
class cMessageDialog : public QDialog
{
Q_OBJECT
public:
/*!
\brief
\fn cMessageDialog
\param parent
*/
explicit cMessageDialog(QWidget *parent = 0);
/*!
\brief
\fn ~cMessageDialog
*/
~cMessageDialog();
/*!
\brief
\fn setMessage
\param szMessage
*/
void setMessage(const QString& szMessage);
/*!
\brief
\fn addMessage
\param szMessage
*/
void addMessage(const QString& szMessage);
/*!
\brief
\fn setProgress
\param iMin
\param iMax
*/
void setProgress(qint32 iMin, qint32 iMax);
/*!
\brief
\fn setProgress
\param iValue
*/
void setProgress(qint32 iValue);
/*!
\brief
\fn cancelButton
\return QPushButton
*/
QPushButton* cancelButton();
private:
Ui::cMessageDialog *ui;
Ui::cMessageDialog *ui; /*!< TODO: describe */
};
#endif // CMESSAGEDIALOG_H

@ -11,7 +11,7 @@
</rect>
</property>
<property name="windowTitle">
<string>Dialog</string>
<string>Message</string>
</property>
<layout class="QGridLayout" name="gridLayout">
<item row="0" column="0">

@ -1,4 +1,5 @@
#include "cmovie.h"
#include "cfanarttv.h"
#include "common.h"
#include <QStringList>
@ -22,7 +23,9 @@ cMovie::cMovie() :
m_bVideo(false),
m_dVoteAverage(0.0),
m_iVoteCount(0),
m_iState(StateInit)
m_iState(StateInit),
m_szLocalPath(""),
m_szResolution("")
{
}
@ -326,13 +329,51 @@ cMovie::State cMovie::state()
return(m_iState);
}
void cMovie::setLocalPath(const QString& szLocalPath)
{
m_szLocalPath = szLocalPath;
}
QString cMovie::localPath()
{
return(m_szLocalPath);
}
void cMovie::setResolution(const QString& szResolution)
{
m_szResolution = szResolution;
}
QString cMovie::resolution()
{
return(m_szResolution);
}
void cMovie::loadFanart()
{
cFanartTV fanartTV;
m_fanartList = fanartTV.loadFanartMovie(imdbID());
}
cFanartList cMovie::fanartList()
{
return(m_fanartList);
}
void cMovie::setFanartList(const cFanartList& fanartList)
{
m_fanartList = fanartList;
}
bool cMovie::save(QSqlDatabase &db)
{
QSqlQuery query;
QSqlQuery queryMovie;
QSqlQuery queryFanart;
queryMovie.prepare("INSERT INTO movie (movieID,movieTitle,originalTitle,backdropPath,posterPath,overview,releaseDate,genre,imdbid,originalLanguage,popularity,productionCompanies,productionCountries,voteAverage,voteCount,adult,belongsToCollection,budget,homepage,revenue,runtime,spokenLanguages,status,tagline,video,cast,crew,state)"
" VALUES (:movieID,:movieTitle,:originalTitle,:backdropPath,:posterPath,:overview,:releaseDate,:genre,:imdbid,:originalLanguage,:popularity,:productionCompanies,:productionCountries,:voteAverage,:voteCount,:adult,:belongsToCollection,:budget,:homepage,:revenue,:runtime,:spokenLanguages,:status,:tagline,:video,:cast,:crew,:state);");
queryMovie.prepare("INSERT INTO movie (movieID,movieTitle,originalTitle,backdropPath,posterPath,overview,releaseDate,genre,imdbid,originalLanguage,popularity,productionCompanies,productionCountries,voteAverage,voteCount,adult,belongsToCollection,budget,homepage,revenue,runtime,spokenLanguages,status,tagline,video,cast,crew,state,localPath,resolution)"
" VALUES (:movieID,:movieTitle,:originalTitle,:backdropPath,:posterPath,:overview,:releaseDate,:genre,:imdbid,:originalLanguage,:popularity,:productionCompanies,:productionCountries,:voteAverage,:voteCount,:adult,:belongsToCollection,:budget,:homepage,:revenue,:runtime,:spokenLanguages,:status,:tagline,:video,:cast,:crew,:state,:localPath,:resolution);");
queryFanart.prepare("INSERT INTO fanart (id,type,url,language,likes,discType,disc,active,movieID) VALUES (:id,:type,:url,:language,:likes,:discType,:disc,:active,:movieID);");
db.transaction();
query.exec(QString("SELECT movieID FROM movie WHERE movieID=%1;").arg(movieID()));
@ -366,9 +407,29 @@ bool cMovie::save(QSqlDatabase &db)
queryMovie.bindValue(":cast", cast().join("|"));
queryMovie.bindValue(":crew", crew().join("|"));
queryMovie.bindValue(":state", state());
queryMovie.bindValue(":localPath", localPath());
queryMovie.bindValue(":resolution", resolution());
if(queryMovie.exec())
{
for(int x = 0;x < m_fanartList.count();x++)
{
cFanart* lpFanart = m_fanartList.at(x);
queryFanart.bindValue(":id", lpFanart->id());
queryFanart.bindValue(":type", lpFanart->type());
queryFanart.bindValue(":url", lpFanart->url());
queryFanart.bindValue(":language", lpFanart->language());
queryFanart.bindValue(":likes", lpFanart->likes());
queryFanart.bindValue(":discType", lpFanart->discType());
queryFanart.bindValue(":disc", lpFanart->disc());
queryFanart.bindValue(":active", lpFanart->active());
queryFanart.bindValue(":movieID", movieID());
if(queryFanart.exec())
{
}
else
qDebug() << queryFanart.lastError().text();
}
}
else
qDebug() << queryMovie.lastError().text();
@ -383,6 +444,14 @@ bool cMovie::del(QSqlDatabase& db)
QSqlQuery query;
db.transaction();
if(m_fanartList.count())
{
query.prepare("DELETE FROM fanart WHERE movieID=:movieID;");
query.bindValue(":movieID", movieID());
query.exec();
}
query.prepare("DELETE FROM movie WHERE movieID=:movieID;");
query.bindValue(":movieID", movieID());
query.exec();
@ -394,12 +463,9 @@ bool cMovie::del(QSqlDatabase& db)
cMovie* cMovieList::add(const qint32& iID)
{
for(int z = 0;z < count();z++)
{
if(at(z)->movieID() == iID)
return(at(z));
}
cMovie* lpNew = new cMovie;
cMovie* lpNew = find(iID);
if(!lpNew)
lpNew = new cMovie;
lpNew->setMovieID(iID);
append(lpNew);
return(lpNew);
@ -410,8 +476,18 @@ cMovie* cMovieList::add(cMovie* lpMovie)
for(int z = 0;z < count();z++)
{
if(at(z) == lpMovie)
return(0);
return(nullptr);
}
append(lpMovie);
return(lpMovie);
}
cMovie* cMovieList::find(const qint32& iID)
{
for(int z = 0;z < count();z++)
{
if(at(z)->movieID() == iID)
return(at(z));
}
return(nullptr);
}

@ -2,6 +2,8 @@
#define CMOVIE_H
#include "cfanart.h"
#include <QMetaType>
#include <QDate>
#include <QSqlDatabase>
@ -9,9 +11,19 @@
#include <QMap>
/*!
\brief
\class cMovie cmovie.h "cmovie.h"
*/
class cMovie
{
public:
/*!
\brief
\enum State
*/
enum State
{
StateUnknown = 0,
@ -22,135 +34,591 @@ public:
cMovie();
/*!
\brief
\fn setMovieTitle
\param szTitle
*/
void setMovieTitle(const QString& szTitle);
/*!
\brief
\fn movieTitle
\return QString
*/
QString movieTitle();
/*!
\brief
\fn setMovieID
\param iID
*/
void setMovieID(const qint32 iID);
/*!
\brief
\fn movieID
\return qint32
*/
qint32 movieID();
/*!
\brief
\fn setOriginalTitle
\param szOriginalTitle
*/
void setOriginalTitle(const QString& szOriginalTitle);
/*!
\brief
\fn originalTitle
\return QString
*/
QString originalTitle();
/*!
\brief
\fn setReleaseDate
\param szDate
*/
void setReleaseDate(const QString& szDate);
/*!
\brief
\fn releaseDate
\return QDate
*/
QDate releaseDate();
/*!
\brief
\fn setAdult
\param bAdult
*/
void setAdult(const bool bAdult);
/*!
\brief
\fn adult
\return bool
*/
bool adult();
/*!
\brief
\fn setBackdropPath
\param szBackdropPath
*/
void setBackdropPath(const QString& szBackdropPath);
/*!
\brief
\fn backdropPath
\return QString
*/
QString backdropPath();
/*!
\brief
\fn setBelongsToCollection
\param szBelongsToCollection
*/
void setBelongsToCollection(const QString& szBelongsToCollection);
/*!
\brief
\fn belongsToCollection
\return QString
*/
QString belongsToCollection();
/*!
\brief
\fn setBudget
\param dBudget
*/
void setBudget(const qreal dBudget);
/*!
\brief
\fn budget
\return qreal
*/
qreal budget();
/*!
\brief
\fn setGenres
\param szGenres
*/
void setGenres(const QString& szGenres);
/*!
\brief
\fn setGenres
\param szGenres
*/
void setGenres(const QStringList& szGenres);
/*!
\brief
\fn genres
\return QStringList
*/
QStringList genres();
/*!
\brief
\fn setHomepage
\param szHomepage
*/
void setHomepage(const QString& szHomepage);
/*!
\brief
\fn homepage
\return QString
*/
QString homepage();
/*!
\brief
\fn setIMDBID
\param szIMDBID
*/
void setIMDBID(const QString& szIMDBID);
/*!
\brief
\fn imdbID
\return QString
*/
QString imdbID();
/*!
\brief
\fn setOriginalLanguage
\param szOriginalLanguage
*/
void setOriginalLanguage(const QString& szOriginalLanguage);
/*!
\brief
\fn originalLanguage
\return QString
*/
QString originalLanguage();
/*!
\brief
\fn setOverview
\param szOverview
*/
void setOverview(const QString& szOverview);
/*!
\brief
\fn overview
\return QString
*/
QString overview();
/*!
\brief
\fn setPopularity
\param dPopularity
*/
void setPopularity(const qreal dPopularity);
/*!
\brief
\fn popularity
\return qreal
*/
qreal popularity();
/*!
\brief
\fn setPosterPath
\param szPosterPath
*/
void setPosterPath(const QString& szPosterPath);
/*!
\brief
\fn posterPath
\return QString
*/
QString posterPath();
/*!
\brief
\fn setProductionCompanies
\param szProductionCompanies
*/
void setProductionCompanies(const QString& szProductionCompanies);
/*!
\brief
\fn setProductionCompanies
\param szProductionCompanies
*/
void setProductionCompanies(const QStringList& szProductionCompanies);
/*!
\brief
\fn productionCompanies
\return QStringList
*/
QStringList productionCompanies();
/*!
\brief
\fn setProductionCountries
\param szProductionCountries
*/
void setProductionCountries(const QString& szProductionCountries);
/*!
\brief
\fn setProductionCountries
\param szProductionCountries
*/
void setProductionCountries(const QStringList& szProductionCountries);
/*!
\brief
\fn productionCountries
\return QStringList
*/
QStringList productionCountries();
/*!
\brief
\fn setRevenue
\param dRevenue
*/
void setRevenue(const qreal dRevenue);
/*!
\brief
\fn revenue
\return qreal
*/
qreal revenue();
/*!
\brief
\fn setRuntime
\param iRuntime
*/
void setRuntime(const qint32 iRuntime);
/*!
\brief
\fn runtime
\return qint32
*/
qint32 runtime();
/*!
\brief
\fn setSpokenLanguages
\param szSpokenLanguages
*/
void setSpokenLanguages(const QString& szSpokenLanguages);
/*!
\brief
\fn setSpokenLanguages
\param szSpokenLanguages
*/
void setSpokenLanguages(const QStringList& szSpokenLanguages);
/*!
\brief
\fn spokenLanguages
\return QStringList
*/
QStringList spokenLanguages();
/*!
\brief
\fn setStatus
\param szStatus
*/
void setStatus(const QString& szStatus);
/*!
\brief
\fn status
\return QString
*/
QString status();
/*!
\brief
\fn setTagline
\param szTagline
*/
void setTagline(const QString& szTagline);
/*!
\brief
\fn tagline
\return QString
*/
QString tagline();
/*!
\brief
\fn setVideo
\param bVideo
*/
void setVideo(const bool bVideo);
/*!
\brief
\fn video
\return bool
*/
bool video();
/*!
\brief
\fn setVoteAverage
\param dVoteAverage
*/
void setVoteAverage(const qreal dVoteAverage);
/*!
\brief
\fn voteAverage
\return qreal
*/
qreal voteAverage();
/*!
\brief
\fn setVoteCount
\param iVoteCount
*/
void setVoteCount(const qint32 iVoteCount);
/*!
\brief
\fn voteCount
\return qint32
*/
qint32 voteCount();
/*!
\brief
\fn setCast
\param szCast
*/
void setCast(const QStringList& szCast);
/*!
\brief
\fn cast
\return QStringList
*/
QStringList cast();
/*!
\brief
\fn setCrew
\param szCrew
*/
void setCrew(const QStringList& szCrew);
/*!
\brief
\fn crew
\return QStringList
*/
QStringList crew();
/*!
\brief
\fn setState
\param state
*/
void setState(const State state);
/*!
\brief
\fn state
\return State
*/
State state();
/*!
\brief
\fn setLocalPath
\param szLocalPath
*/
void setLocalPath(const QString& szLocalPath);
/*!
\brief
\fn localPath
\return QString
*/
QString localPath();
/*!
\brief
\fn setResolution
\param szResolution
*/
void setResolution(const QString& szResolution);
/*!
\brief
\fn resolution
\return QString
*/
QString resolution();
/*!
\brief
\fn save
\param db
\return bool
*/
bool save(QSqlDatabase& db);
/*!
\brief
\fn del
\param db
\return bool
*/
bool del(QSqlDatabase& db);
/*!
\brief
\fn loadFanart
*/
void loadFanart();
/*!
\brief
\fn setFanartList
\param fanartList
*/
void setFanartList(const cFanartList& fanartList);
/*!
\brief
\fn fanartList
\return cFanartList
*/
cFanartList fanartList();
private:
QString m_szMovieTitle;
qint32 m_iID;
QString m_szOriginalTitle;
QDate m_releaseDate;
bool m_bAdult;
QString m_szBackdropPath;
QString m_szBelongsToCollection;
qreal m_dBudget;
QStringList m_szGenres;
QString m_szHomepage;
QString m_szIMDBID;
QString m_szOriginalLanguage;
QString m_szOverview;
qreal m_dPopularity;
QString m_szPosterPath;
QStringList m_szProductionCompanies;
QStringList m_szProductionCountries;
qreal m_dRevenue;
qint32 m_iRuntime;
QStringList m_szSpokenLanguages;
QString m_szStatus;
QString m_szTagline;
bool m_bVideo;
qreal m_dVoteAverage;
qint32 m_iVoteCount;
QStringList m_szCast;
QStringList m_szCrew;
State m_iState;
QString m_szMovieTitle; /*!< TODO: describe */
qint32 m_iID; /*!< TODO: describe */
QString m_szOriginalTitle; /*!< TODO: describe */
QDate m_releaseDate; /*!< TODO: describe */
bool m_bAdult; /*!< TODO: describe */
QString m_szBackdropPath; /*!< TODO: describe */
QString m_szBelongsToCollection; /*!< TODO: describe */
qreal m_dBudget; /*!< TODO: describe */
QStringList m_szGenres; /*!< TODO: describe */
QString m_szHomepage; /*!< TODO: describe */
QString m_szIMDBID; /*!< TODO: describe */
QString m_szOriginalLanguage; /*!< TODO: describe */
QString m_szOverview; /*!< TODO: describe */
qreal m_dPopularity; /*!< TODO: describe */
QString m_szPosterPath; /*!< TODO: describe */
QStringList m_szProductionCompanies; /*!< TODO: describe */
QStringList m_szProductionCountries; /*!< TODO: describe */
qreal m_dRevenue; /*!< TODO: describe */
qint32 m_iRuntime; /*!< TODO: describe */
QStringList m_szSpokenLanguages; /*!< TODO: describe */
QString m_szStatus; /*!< TODO: describe */
QString m_szTagline; /*!< TODO: describe */
bool m_bVideo; /*!< TODO: describe */
qreal m_dVoteAverage; /*!< TODO: describe */
qint32 m_iVoteCount; /*!< TODO: describe */
QStringList m_szCast; /*!< TODO: describe */
QStringList m_szCrew; /*!< TODO: describe */
State m_iState; /*!< TODO: describe */
QString m_szLocalPath; /*!< TODO: describe */
QString m_szResolution; /*!< TODO: describe */
cFanartList m_fanartList; /*!< TODO: describe */
};
Q_DECLARE_METATYPE(cMovie*)
Q_DECLARE_METATYPE(cMovie::State)
/*!
\brief
\class cMovieList cmovie.h "cmovie.h"
*/
class cMovieList : public QList<cMovie*>
{
public:
/*!
\brief
\fn add
\param iID
\return cMovie
*/
cMovie* add(const qint32& iID);
/*!
\brief
\fn add
\param lpMovie
\return cMovie
*/
cMovie* add(cMovie* lpMovie);
/*!
\brief
\fn find
\param iID
\return cMovie
*/
cMovie* find(const qint32& iID);
};
#endif // CMOVIE_H

@ -0,0 +1,63 @@
#include "cmoviedetails.h"
#include "ui_cmoviedetails.h"
#include "cmovieimage.h"
cMovieDetails::cMovieDetails(QWidget *parent) :
QWidget(parent),
ui(new Ui::cMovieDetails),
m_lpActorsModel(0),
m_lpGenreModel(0)
{
ui->setupUi(this);
m_lpActorsModel = new QStandardItemModel(0, 0);
ui->m_lpDetailsActors->setModel(m_lpActorsModel);
m_lpGenreModel = new QStandardItemModel(0, 9);
ui->m_lpDetailsGenre->setModel(m_lpGenreModel);
}
cMovieDetails::~cMovieDetails()
{
delete m_lpActorsModel;
delete m_lpGenreModel;
delete ui;
}
void cMovieDetails::setMovie(cMovie* lpMovie)
{
ui->m_lpName->setText(lpMovie->movieTitle());
ui->m_lpFirstAired->setDate(lpMovie->releaseDate());
ui->m_lpVoting->setText(QString::number(lpMovie->voteAverage()));
ui->m_lpDetailsBanner->clear();
if(!lpMovie->backdropPath().isEmpty())
{
cMovieImage image;
QPixmap banner = image.getImage(lpMovie->backdropPath());
ui->m_lpDetailsBanner->setPixmap(banner);
}
ui->m_lpDetailsOverview->setText(lpMovie->overview());
m_lpActorsModel->clear();
for(int x = 0;x < lpMovie->cast().count();x++)
{
QList<QStandardItem*> items;
QStringList str = lpMovie->cast().at(x).split(",");
items.append(new QStandardItem(str.at(0)));
items.append(new QStandardItem(str.at(1)));
m_lpActorsModel->appendRow(items);
}
ui->m_lpDetailsActors->resizeColumnToContents(0);
m_lpGenreModel->clear();
for(int x = 0;x < lpMovie->genres().count();x++)
m_lpGenreModel->appendRow(new QStandardItem(lpMovie->genres().at(x)));
ui->m_lpDetailsGenre->resizeColumnToContents(0);
}

@ -0,0 +1,52 @@
#ifndef CMOVIEDETAILS_H
#define CMOVIEDETAILS_H
#include "cmovie.h"
#include <QWidget>
#include <QStandardItemModel>
namespace Ui {
class cMovieDetails;
}
/*!
\brief
\class cMovieDetails cmoviedetails.h "cmoviedetails.h"
*/
class cMovieDetails : public QWidget
{
Q_OBJECT
public:
/*!
\brief
\fn cMovieDetails
\param parent
*/
explicit cMovieDetails(QWidget *parent = 0);
/*!
\brief
\fn ~cMovieDetails
*/
~cMovieDetails();
/*!
\brief
\fn setMovie
\param lpMovie
*/
void setMovie(cMovie* lpMovie);
private:
Ui::cMovieDetails* ui; /*!< TODO: describe */
QStandardItemModel* m_lpActorsModel;
QStandardItemModel* m_lpGenreModel;
};
#endif // CMOVIEDETAILS_H

@ -0,0 +1,206 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>cMovieDetails</class>
<widget class="QWidget" name="cMovieDetails">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>781</width>
<height>596</height>
</rect>
</property>
<property name="windowTitle">
<string>Form</string>
</property>
<layout class="QGridLayout" name="gridLayout">
<item row="0" column="0">
<layout class="QHBoxLayout" name="horizontalLayout_6">
<item>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<layout class="QHBoxLayout" name="horizontalLayout_2">
<item>
<widget class="QLineEdit" name="m_lpName">
<property name="readOnly">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="label_4">
<property name="text">
<string>Year:</string>
</property>
</widget>
</item>
<item>
<widget class="QDateEdit" name="m_lpFirstAired">
<property name="readOnly">
<bool>true</bool>
</property>
</widget>
</item>
</layout>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<widget class="QLabel" name="label">
<property name="text">
<string>Voting:</string>
</property>
</widget>
</item>
<item>
<widget class="QLineEdit" name="m_lpVoting">
<property name="readOnly">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</item>
<item>
<spacer name="verticalSpacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>40</height>
</size>
</property>
</spacer>
</item>
</layout>
</item>
<item>
<widget class="QLabel" name="m_lpDetailsBanner">
<property name="minimumSize">
<size>
<width>310</width>
<height>200</height>
</size>
</property>
<property name="frameShape">
<enum>QFrame::Box</enum>
</property>
<property name="text">
<string/>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
</widget>
</item>
</layout>
</item>
<item row="1" column="0">
<widget class="QScrollArea" name="scrollArea">
<property name="widgetResizable">
<bool>true</bool>
</property>
<widget class="QWidget" name="scrollAreaWidgetContents">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>761</width>
<height>310</height>
</rect>
</property>
<layout class="QGridLayout" name="gridLayout_4">
<item row="0" column="0">
<layout class="QHBoxLayout" name="horizontalLayout_5">
<item>
<widget class="QTextEdit" name="m_lpDetailsOverview">
<property name="readOnly">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<layout class="QVBoxLayout" name="verticalLayout_4" stretch="2,1">
<item>
<layout class="QHBoxLayout" name="horizontalLayout_4">
<item>
<widget class="cVerticalLabel" name="label_2">
<property name="text">
<string>Actors</string>
</property>
</widget>
</item>
<item>
<widget class="QTreeView" name="m_lpDetailsActors">
<property name="editTriggers">
<set>QAbstractItemView::NoEditTriggers</set>
</property>
<property name="alternatingRowColors">
<bool>true</bool>
</property>
<attribute name="headerVisible">
<bool>false</bool>
</attribute>
</widget>
</item>
</layout>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_3">
<item>
<widget class="cVerticalLabel" name="label_3">
<property name="text">
<string>Genre</string>
</property>
</widget>
</item>
<item>
<widget class="QTreeView" name="m_lpDetailsGenre">
<property name="editTriggers">
<set>QAbstractItemView::NoEditTriggers</set>
</property>
<property name="alternatingRowColors">
<bool>true</bool>
</property>
<attribute name="headerVisible">
<bool>false</bool>
</attribute>
</widget>
</item>
</layout>
</item>
</layout>
</item>
</layout>
</item>
</layout>
</widget>
</widget>
</item>
</layout>
</widget>
<customwidgets>
<customwidget>
<class>cVerticalLabel</class>
<extends>QLabel</extends>
<header>cverticallabel.h</header>
</customwidget>
</customwidgets>
<resources/>
<connections/>
</ui>

@ -0,0 +1,159 @@
#include "cmoviediscover.h"
#include "ui_cmoviediscover.h"
#include "ccheckboxitemdelegate.h"
#include "cthemoviedbv3.h"
#include <QStandardItem>
#include <QMap>
#include <QList>
#include <QDebug>
cMovieDiscover::cMovieDiscover(const cMovieList movieList, QWidget *parent) :
QDialog(parent),
ui(new Ui::cMovieDiscover),
m_movieList(movieList)
{
ui->setupUi(this);
m_lpGenresModel = new QStandardItemModel(0, 1);
QStringList headerLabels = QStringList() << tr("Name");
m_lpGenresModel->setHorizontalHeaderLabels(headerLabels);
ui->m_lpGenres->setModel(m_lpGenresModel);
ui->m_lpGenres->setItemDelegate(new cCheckBoxItemDelegate());
ui->m_lpGenres->setWrapping(true);
m_lpMoviesModel = new QStandardItemModel(0, 1);
ui->m_lpMovies->setModel(m_lpMoviesModel);
headerLabels = QStringList() << tr("Title") << tr("Year") << tr("Voting");
m_lpMoviesModel->setHorizontalHeaderLabels(headerLabels);
connect(ui->m_lpVoting, &QxtSpanSlider::spanChanged, this, &cMovieDiscover::spanChanged);
ui->m_lpVoting->setRange(0, 100);
ui->m_lpVoting->setLowerValue(0);
ui->m_lpVoting->setUpperValue(100);
cTheMovieDBV3 movieDB3;
QMap<qint32, QString> genres;
genres = movieDB3.genresMovie("de-DE");
QMapIterator<qint32, QString> iterator(genres);
while(iterator.hasNext())
{
iterator.next();
QStandardItem* lpItem = new QStandardItem(iterator.value());
lpItem->setData(iterator.key());
lpItem->setCheckable(true);
m_lpGenresModel->appendRow(lpItem);
}
}
cMovieDiscover::~cMovieDiscover()
{
delete ui;
delete m_lpGenresModel;
}
void cMovieDiscover::spanChanged(int lower, int upper)
{
ui->m_lpVotingFrom->setText(QString::number((qreal)lower/10));
ui->m_lpVotingTo->setText(QString::number((qreal)upper/10));
}
void cMovieDiscover::on_m_lpDiscover_clicked()
{
QString szText = ui->m_lpText->text();
bool bAdult = ui->m_lpIncludeAdult->isChecked();
qint32 iYear = ui->m_lpYear->value();
qreal voteMin = (qreal)ui->m_lpVoting->lowerValue()/10;
qreal voteMax = (qreal)ui->m_lpVoting->upperValue()/10;
QList<qint32> genres;
if(!ui->m_lpYearEnable->isChecked())
iYear = -1;
for(int x = 0;x < m_lpGenresModel->rowCount();x++)
{
QStandardItem* lpItem = m_lpGenresModel->item(x);
if(lpItem->checkState() == Qt::Checked)
genres.append(lpItem->data().toInt());
}
setCursor(Qt::WaitCursor);
cTheMovieDBV3 movieDB3;
QList<cMovie*> movieList = movieDB3.discoverMovie(m_movieList, szText, bAdult, iYear, genres, voteMin, voteMax, "de-DE");
m_lpMoviesModel->clear();
QStringList headerLabels = QStringList() << tr("Title") << tr("Year") << tr("Voting");
m_lpMoviesModel->setHorizontalHeaderLabels(headerLabels);
for(int x = 0; x < movieList.count();x++)
{
cMovie* lpMovie = movieList[x];
QList<QStandardItem*> items;
items.append(new QStandardItem(lpMovie->movieTitle()));
items.append(new QStandardItem(QString::number(lpMovie->releaseDate().year())));
items.append(new QStandardItem(QString::number(lpMovie->voteAverage())));
items[0]->setData(QVariant::fromValue(lpMovie));
items[1]->setData(QVariant::fromValue(lpMovie));
items[2]->setData(QVariant::fromValue(lpMovie));
items[0]->setCheckable(true);
m_lpMoviesModel->appendRow(items);
}
for(int x = 0;x < headerLabels.count();x++)
ui->m_lpMovies->resizeColumnToContents(x);
setCursor(Qt::ArrowCursor);
}
void cMovieDiscover::on_m_lpYearEnable_clicked(bool checked)
{
ui->m_lpYear->setEnabled(checked);
}
void cMovieDiscover::on_m_lpMovies_clicked(const QModelIndex &index)
{
setCursor(Qt::WaitCursor);
QStandardItem* lpItem = m_lpMoviesModel->itemFromIndex(index);
cMovie* lpMovie = lpItem->data().value<cMovie*>();
if(lpMovie->cast().isEmpty())
{
cTheMovieDBV3 theMovieDB;
theMovieDB.loadCastMovie(lpMovie);
}
ui->m_lpMovieDetails->setMovie(lpMovie);
setCursor(Qt::ArrowCursor);
}
QList<qint32> cMovieDiscover::id()
{
QList<qint32> idList;
for(int x = 0;x < m_lpMoviesModel->rowCount();x++)
{
if(m_lpMoviesModel->item(x, 0)->checkState() == Qt::Checked)
{
cMovie* lpMovie = m_lpMoviesModel->item(x, 0)->data().value<cMovie*>();
idList.append(lpMovie->movieID());
}
}
return(idList);
}

@ -0,0 +1,85 @@
#ifndef CMOVIEDISCOVER_H
#define CMOVIEDISCOVER_H
#include "cmovie.h"
#include <QDialog>
#include <QStandardItemModel>
namespace Ui {
class cMovieDiscover;
}
/*!
\brief
\class cMovieDiscover cmoviediscover.h "cmoviediscover.h"
*/
class cMovieDiscover : public QDialog
{
Q_OBJECT
public:
/*!
\brief
\fn cMovieDiscover
\param movieList
\param parent
*/
explicit cMovieDiscover(const cMovieList movieList, QWidget *parent = nullptr);
/*!
\brief
\fn ~cMovieDiscover
*/
~cMovieDiscover();
/*!
\brief
\fn id
\return QList<qint32>
*/
QList<qint32> id();
private slots:
/*!
\brief
\fn spanChanged
\param lower
\param upper
*/
void spanChanged(int lower, int upper);
/*!
\brief
\fn on_m_lpDiscover_clicked
*/
void on_m_lpDiscover_clicked();
/*!
\brief
\fn on_m_lpYearEnable_clicked
\param checked
*/
void on_m_lpYearEnable_clicked(bool checked);
/*!
\brief
\fn on_m_lpMovies_clicked
\param index
*/
void on_m_lpMovies_clicked(const QModelIndex &index);
private:
Ui::cMovieDiscover* ui; /*!< TODO: describe */
QStandardItemModel* m_lpGenresModel; /*!< TODO: describe */
QStandardItemModel* m_lpMoviesModel; /*!< TODO: describe */
cMovieList m_movieList; /*!< TODO: describe */
};
#endif // CMOVIEDISCOVER_H

@ -0,0 +1,241 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>cMovieDiscover</class>
<widget class="QDialog" name="cMovieDiscover">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>900</width>
<height>500</height>
</rect>
</property>
<property name="windowTitle">
<string>Discover Movie</string>
</property>
<layout class="QGridLayout" name="gridLayout_3">
<item row="0" column="0">
<layout class="QVBoxLayout" name="verticalLayout_3" stretch="1,10">
<item>
<layout class="QVBoxLayout" name="verticalLayout_2">
<item>
<layout class="QHBoxLayout" name="horizontalLayout_2">
<item>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<layout class="QHBoxLayout" name="horizontalLayout_3">
<item>
<widget class="QLabel" name="label_3">
<property name="text">
<string>Text:</string>
</property>
</widget>
</item>
<item>
<widget class="QLineEdit" name="m_lpText"/>
</item>
</layout>
</item>
<item>
<widget class="QCheckBox" name="m_lpIncludeAdult">
<property name="text">
<string>inklusive Erotik</string>
</property>
</widget>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<widget class="QCheckBox" name="m_lpYearEnable">
<property name="text">
<string>Erscheinungsjahr:</string>
</property>
</widget>
</item>
<item>
<widget class="QSpinBox" name="m_lpYear">
<property name="enabled">
<bool>false</bool>
</property>
<property name="minimum">
<number>1800</number>
</property>
<property name="maximum">
<number>2100</number>
</property>
</widget>
</item>
</layout>
</item>
<item>
<layout class="QGridLayout" name="gridLayout_2" columnstretch="0,1,1">
<item row="0" column="0">
<widget class="QLabel" name="label_2">
<property name="text">
<string>Voting:</string>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QLabel" name="m_lpVotingFrom">
<property name="text">
<string>TextLabel</string>
</property>
</widget>
</item>
<item row="1" column="2">
<widget class="QLabel" name="m_lpVotingTo">
<property name="text">
<string>TextLabel</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
</widget>
</item>
<item row="0" column="1" colspan="2">
<widget class="QxtSpanSlider" name="m_lpVoting">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</item>
<item>
<widget class="QGroupBox" name="groupBox">
<property name="title">
<string>Genre</string>
</property>
<layout class="QGridLayout" name="gridLayout">
<item row="0" column="0">
<widget class="QListView" name="m_lpGenres">
<property name="editTriggers">
<set>QAbstractItemView::NoEditTriggers</set>
</property>
<property name="alternatingRowColors">
<bool>true</bool>
</property>
<property name="flow">
<enum>QListView::TopToBottom</enum>
</property>
</widget>
</item>
</layout>
</widget>
</item>
</layout>
</item>
<item>
<widget class="QPushButton" name="m_lpDiscover">
<property name="text">
<string>Discover</string>
</property>
</widget>
</item>
</layout>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_4" stretch="1,2">
<item>
<widget class="QTreeView" name="m_lpMovies">
<property name="editTriggers">
<set>QAbstractItemView::NoEditTriggers</set>
</property>
<property name="alternatingRowColors">
<bool>true</bool>
</property>
<property name="sortingEnabled">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<widget class="QScrollArea" name="m_lpMovieDetailsScroller">
<property name="widgetResizable">
<bool>true</bool>
</property>
<widget class="QWidget" name="scrollAreaWidgetContents">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>579</width>
<height>284</height>
</rect>
</property>
<layout class="QGridLayout" name="gridLayout_4">
<item row="0" column="0">
<widget class="cMovieDetails" name="m_lpMovieDetails" native="true"/>
</item>
</layout>
</widget>
</widget>
</item>
</layout>
</item>
</layout>
</item>
<item row="1" column="0">
<widget class="QDialogButtonBox" name="buttonBox">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="standardButtons">
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
</property>
</widget>
</item>
</layout>
</widget>
<customwidgets>
<customwidget>
<class>QxtSpanSlider</class>
<extends>QSlider</extends>
<header>qxtspanslider.h</header>
</customwidget>
<customwidget>
<class>cMovieDetails</class>
<extends>QWidget</extends>
<header>cmoviedetails.h</header>
<container>1</container>
</customwidget>
</customwidgets>
<resources/>
<connections>
<connection>
<sender>buttonBox</sender>
<signal>accepted()</signal>
<receiver>cMovieDiscover</receiver>
<slot>accept()</slot>
<hints>
<hint type="sourcelabel">
<x>248</x>
<y>254</y>
</hint>
<hint type="destinationlabel">
<x>157</x>
<y>274</y>
</hint>
</hints>
</connection>
<connection>
<sender>buttonBox</sender>
<signal>rejected()</signal>
<receiver>cMovieDiscover</receiver>
<slot>reject()</slot>
<hints>
<hint type="sourcelabel">
<x>316</x>
<y>260</y>
</hint>
<hint type="destinationlabel">
<x>286</x>
<y>274</y>
</hint>
</hints>
</connection>
</connections>
</ui>

@ -3,17 +3,39 @@
#include "ui_cmovieedit.h"
#include <QSqlQuery>
cMovieEdit::cMovieEdit(QWidget *parent) :
QDialog(parent),
ui(new Ui::cMovieEdit),
m_lpMovie(0)
m_lpMovie(nullptr),
m_lpActorsModel(nullptr),
m_lpGenreModel(nullptr)
{
ui->setupUi(this);
QSqlQuery query;
query.prepare("SELECT resolution FROM resolution ORDER BY sort;");
if(query.exec())
{
while(query.next())
ui->m_lpResolution->addItem(query.value("resolution").toString());
}
m_lpActorsModel = new QStandardItemModel(0, 0);
ui->m_lpDetailsActors->setModel(m_lpActorsModel);
m_lpGenreModel = new QStandardItemModel(0, 0);
ui->m_lpDetailsGenre->setModel(m_lpGenreModel);
}
cMovieEdit::~cMovieEdit()
{
delete m_lpActorsModel;
delete m_lpGenreModel;
delete ui;
}
@ -26,6 +48,8 @@ void cMovieEdit::setMovie(cMovie *lpMovie)
ui->m_lpName->setText(lpMovie->movieTitle());
ui->m_lpFirstAired->setDate(lpMovie->releaseDate());
ui->m_lpLocalPath->setText(lpMovie->localPath());
ui->m_lpResolution->setCurrentText(lpMovie->resolution());
switch(lpMovie->state())
{
@ -38,6 +62,8 @@ void cMovieEdit::setMovie(cMovie *lpMovie)
case cMovie::StateDone:
ui->m_lpDone->setChecked(true);
break;
default:
break;
}
if(!m_lpMovie->backdropPath().isEmpty())
@ -49,36 +75,31 @@ void cMovieEdit::setMovie(cMovie *lpMovie)
ui->m_lpDetailsOverview->setText(m_lpMovie->overview());
QTreeWidgetItem* lpItem;
for(int x = 0;x < m_lpMovie->cast().count();x++)
{
QStringList str = m_lpMovie->cast().at(x).split(",");
lpItem = new QTreeWidgetItem(ui->m_lpDetailsActors);
lpItem->setText(0, str.at(0));
lpItem->setText(1, str.at(1));
ui->m_lpDetailsActors->addTopLevelItem(lpItem);
QList<QStandardItem*> items;
QStringList str = m_lpMovie->cast().at(x).split(",");
items.append(new QStandardItem(str.at(0)));
items.append(new QStandardItem(str.at(1)));
m_lpActorsModel->appendRow(items);
}
ui->m_lpDetailsActors->resizeColumnToContents(0);
for(int x = 0;x < m_lpMovie->genres().count();x++)
{
lpItem = new QTreeWidgetItem(ui->m_lpDetailsGenre);
lpItem->setText(0, m_lpMovie->genres().at(x));
ui->m_lpDetailsGenre->addTopLevelItem(lpItem);
}
ui->m_lpDetailsGenre->resizeColumnToContents(0);
}
m_lpGenreModel->appendRow(new QStandardItem(m_lpMovie->genres().at(x)));
void cMovieEdit::on_m_lpInit_clicked()
{
m_lpMovie->setState(cMovie::StateInit);
ui->m_lpDetailsGenre->resizeColumnToContents(0);
}
void cMovieEdit::on_m_lpProgress_clicked()
void cMovieEdit::on_buttonBox_accepted()
{
m_lpMovie->setState(cMovie::StateProgress);
}
m_lpMovie->setLocalPath(ui->m_lpLocalPath->text());
m_lpMovie->setResolution(ui->m_lpResolution->currentText());
void cMovieEdit::on_m_lpDone_clicked()
{
m_lpMovie->setState(cMovie::StateDone);
if(ui->m_lpInit->isChecked())
m_lpMovie->setState(cMovie::StateInit);
else if(ui->m_lpProgress->isChecked())
m_lpMovie->setState(cMovie::StateProgress);
else
m_lpMovie->setState(cMovie::StateDone);
}

@ -5,31 +5,57 @@
#include "cmovie.h"
#include <QDialog>
#include <QStandardItemModel>
namespace Ui {
class cMovieEdit;
}
/*!
\brief
\class cMovieEdit cmovieedit.h "cmovieedit.h"
*/
class cMovieEdit : public QDialog
{
Q_OBJECT
public:
explicit cMovieEdit(QWidget *parent = 0);
/*!
\brief
\fn cMovieEdit
\param parent
*/
explicit cMovieEdit(QWidget *parent = nullptr);
/*!
\brief
\fn ~cMovieEdit
*/
~cMovieEdit();
/*!
\brief
\fn setMovie
\param lpMovie
*/
void setMovie(cMovie* lpMovie);
private slots:
void on_m_lpInit_clicked();
/*!
\brief
void on_m_lpProgress_clicked();
void on_m_lpDone_clicked();
\fn on_buttonBox_accepted
*/
void on_buttonBox_accepted();
private:
Ui::cMovieEdit *ui;
cMovie* m_lpMovie;
Ui::cMovieEdit* ui; /*!< TODO: describe */
cMovie* m_lpMovie; /*!< TODO: describe */
QStandardItemModel* m_lpActorsModel; /*!< TODO: describe */
QStandardItemModel* m_lpGenreModel; /*!< TODO: describe */
};
#endif // CMOVIEEDIT_H

@ -11,7 +11,7 @@
</rect>
</property>
<property name="windowTitle">
<string>Dialog</string>
<string>Edit Movie</string>
</property>
<layout class="QGridLayout" name="gridLayout">
<item row="0" column="0">
@ -43,6 +43,30 @@
</item>
</layout>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_7">
<item>
<widget class="QLabel" name="label">
<property name="text">
<string>Local Path:</string>
</property>
</widget>
</item>
<item>
<widget class="QLineEdit" name="m_lpLocalPath"/>
</item>
<item>
<widget class="QLabel" name="label_5">
<property name="text">
<string>Resolution:</string>
</property>
</widget>
</item>
<item>
<widget class="QComboBox" name="m_lpResolution"/>
</item>
</layout>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
@ -140,23 +164,16 @@
</widget>
</item>
<item>
<widget class="QTreeWidget" name="m_lpDetailsActors">
<property name="columnCount">
<number>2</number>
<widget class="QTreeView" name="m_lpDetailsActors">
<property name="editTriggers">
<set>QAbstractItemView::NoEditTriggers</set>
</property>
<property name="alternatingRowColors">
<bool>true</bool>
</property>
<attribute name="headerVisible">
<bool>false</bool>
</attribute>
<column>
<property name="text">
<string notr="true">1</string>
</property>
</column>
<column>
<property name="text">
<string notr="true">2</string>
</property>
</column>
</widget>
</item>
</layout>
@ -171,23 +188,16 @@
</widget>
</item>
<item>
<widget class="QTreeWidget" name="m_lpDetailsGenre">
<property name="columnCount">
<number>2</number>
<widget class="QTreeView" name="m_lpDetailsGenre">
<property name="editTriggers">
<set>QAbstractItemView::NoEditTriggers</set>
</property>
<property name="alternatingRowColors">
<bool>true</bool>
</property>
<attribute name="headerVisible">
<bool>false</bool>
</attribute>
<column>
<property name="text">
<string notr="true">1</string>
</property>
</column>
<column>
<property name="text">
<string notr="true">2</string>
</property>
</column>
</widget>
</item>
</layout>

@ -5,12 +5,31 @@
#include <QPixmap>
/*!
\brief
\class cMovieImage cmovieimage.h "cmovieimage.h"
*/
class cMovieImage
{
public:
cMovieImage();
/*!
\brief
\fn getImage
\param szFileName
\return QPixmap
*/
QPixmap getImage(const QString& szFileName);
private:
/*!
\brief
\fn downloadFile
\param szFileName
\return QPixmap
*/
QPixmap downloadFile(const QString& szFileName);
};

@ -9,10 +9,11 @@
#include <QList>
cMovieSearch::cMovieSearch(QWidget *parent) :
cMovieSearch::cMovieSearch(const cMovieList& movieList, QWidget *parent) :
QDialog(parent),
ui(new Ui::cMovieSearch)
ui(new Ui::cMovieSearch),
m_lpResultsModel(nullptr),
m_movieList(movieList)
{
ui->setupUi(this);
ui->m_lpSearchButton->setEnabled(false);
@ -21,6 +22,9 @@ cMovieSearch::cMovieSearch(QWidget *parent) :
ui->m_lpButtonBox->button(QDialogButtonBox::Ok)->setEnabled(false);
ui->m_lpSearch->setFocus();
ui->m_lpSearchButton->setDefault(true);
m_lpResultsModel = new QStandardItemModel(0, 0);
ui->m_lpResults->setModel(m_lpResultsModel);
}
cMovieSearch::~cMovieSearch()
@ -28,7 +32,7 @@ cMovieSearch::~cMovieSearch()
delete ui;
}
void cMovieSearch::on_m_lpSearch_textChanged(const QString &arg1)
void cMovieSearch::on_m_lpSearch_textChanged(const QString &/*arg1*/)
{
if(ui->m_lpSearch->text().isEmpty())
ui->m_lpSearchButton->setEnabled(false);
@ -38,6 +42,8 @@ void cMovieSearch::on_m_lpSearch_textChanged(const QString &arg1)
void cMovieSearch::on_m_lpSearchButton_clicked()
{
setCursor(Qt::WaitCursor);
cMessageAnimateDialog* lpDialog = new cMessageAnimateDialog(this);
lpDialog->setTitle("Search");
lpDialog->setMessage("Searching");
@ -45,7 +51,7 @@ void cMovieSearch::on_m_lpSearchButton_clicked()
cTheMovieDBV3 theMovieDBV3;
QString szSearchText = ui->m_lpSearch->text();
qint16 iYear = -1;
qint32 iYear = -1;
if(szSearchText.contains("(") && szSearchText.contains(")"))
{
@ -59,37 +65,58 @@ void cMovieSearch::on_m_lpSearchButton_clicked()
}
}
QList<cMovie*> movieList = theMovieDBV3.searchMovie(szSearchText, iYear, "de-DE");
QList<cMovie*> movieList = theMovieDBV3.searchMovie(m_movieList, szSearchText, iYear, "de-DE");
ui->m_lpResults->clear();
m_lpResultsModel->clear();
QStringList headerLabels = QStringList() << tr("Title") << tr("Year");
m_lpResultsModel->setHorizontalHeaderLabels(headerLabels);
for(int z = 0;z < movieList.count();z++)
{
cMovie* lpMovie = movieList.at(z);
QTreeWidgetItem* lpNew = new QTreeWidgetItem(ui->m_lpResults);
lpNew->setText(0, lpMovie->movieTitle());
lpNew->setText(2, QString("%1").arg(lpMovie->releaseDate().year()));
lpNew->setData(0, Qt::UserRole, QVariant::fromValue(lpMovie->movieID()));
ui->m_lpResults->addTopLevelItem(lpNew);
QList<QStandardItem*> items;
items.append(new QStandardItem(lpMovie->movieTitle()));
items.append(new QStandardItem(QString::number(lpMovie->releaseDate().year())));
items[0]->setData(QVariant::fromValue(lpMovie));
items[1]->setData(QVariant::fromValue(lpMovie));
items[0]->setCheckable(true);
m_lpResultsModel->appendRow(items);
}
ui->m_lpResults->resizeColumnToContents(0);
ui->m_lpResults->resizeColumnToContents(1);
ui->m_lpResults->sortItems(0, Qt::AscendingOrder);
for(int x = 0;x < headerLabels.count();x++)
ui->m_lpResults->resizeColumnToContents(x);
m_lpResultsModel->sort(0, Qt::AscendingOrder);
delete lpDialog;
setCursor(Qt::ArrowCursor);
}
qint32 cMovieSearch::id()
QList<qint32> cMovieSearch::id()
{
if(!ui->m_lpResults->selectedItems().count())
QList<qint32> idList;
for(int x = 0;x < m_lpResultsModel->rowCount();x++)
{
if(m_lpResultsModel->item(x, 0)->checkState() == Qt::Checked)
{
cMovie* lpMovie = m_lpResultsModel->item(x, 0)->data().value<cMovie*>();
idList.append(lpMovie->movieID());
}
}
if(idList.isEmpty())
{
qint32 iID = ui->m_lpSearch->text().toInt();
if(iID)
return(iID);
return(-1);
idList.append(iID);
return(idList);
}
return(ui->m_lpResults->selectedItems().at(0)->data(0, Qt::UserRole).toInt());
return(idList);
}
QString cMovieSearch::placeholderName()
@ -102,22 +129,35 @@ bool cMovieSearch::placeholder()
return(ui->m_lpTabWidget->currentIndex() == 1);
}
qint16 cMovieSearch::year()
qint32 cMovieSearch::year()
{
return(ui->m_lpYear->value());
}
void cMovieSearch::on_m_lpResults_clicked(const QModelIndex &index)
void cMovieSearch::on_m_lpResults_clicked(const QModelIndex& index)
{
setCursor(Qt::WaitCursor);
cMovie* lpMovie = m_lpResultsModel->itemFromIndex(index)->data().value<cMovie*>();
if(lpMovie->cast().isEmpty())
{
cTheMovieDBV3 theMovieDB;
theMovieDB.loadCastMovie(lpMovie);
}
ui->m_lpMovieDetails->setMovie(lpMovie);
setButtonBox();
setCursor(Qt::ArrowCursor);
}
void cMovieSearch::on_m_lpPlaceholderName_textChanged(const QString &arg1)
void cMovieSearch::on_m_lpPlaceholderName_textChanged(const QString &/*arg1*/)
{
setButtonBox();
}
void cMovieSearch::on_m_lpYear_valueChanged(int arg1)
void cMovieSearch::on_m_lpYear_valueChanged(int /*arg1*/)
{
setButtonBox();
}
@ -126,11 +166,15 @@ void cMovieSearch::setButtonBox()
{
if(ui->m_lpTabWidget->currentIndex() == 0)
{
if(ui->m_lpResults->selectedItems().count())
ui->m_lpButtonBox->button(QDialogButtonBox::Ok)->setEnabled(true);
else
ui->m_lpButtonBox->button(QDialogButtonBox::Ok)->setEnabled(false);
return;
ui->m_lpButtonBox->button(QDialogButtonBox::Ok)->setEnabled(false);
for(int x = 0;x < m_lpResultsModel->rowCount();x++)
{
if(m_lpResultsModel->item(x, 0)->checkState() == Qt::Checked)
{
ui->m_lpButtonBox->button(QDialogButtonBox::Ok)->setEnabled(true);
return;
}
}
}
if(ui->m_lpPlaceholderName->text().isEmpty())
@ -148,8 +192,8 @@ void cMovieSearch::setButtonBox()
ui->m_lpButtonBox->button(QDialogButtonBox::Ok)->setEnabled(true);
}
void cMovieSearch::on_m_lpResults_doubleClicked(const QModelIndex &index)
{
if(index.isValid())
accept();
}
//void cMovieSearch::on_m_lpResults_doubleClicked(const QModelIndex &index)
//{
// if(index.isValid())
// accept();
//}

@ -2,39 +2,118 @@
#define CMOVIESEARCH_H
#include <QDialog>
#include <QList>
#include <QStandardItemModel>
#include "cmovie.h"
namespace Ui {
class cMovieSearch;
}
/*!
\brief
\class cMovieSearch cmoviesearch.h "cmoviesearch.h"
*/
class cMovieSearch : public QDialog
{
Q_OBJECT
public:
explicit cMovieSearch(QWidget *parent = 0);
/*!
\brief
\fn cMovieSearch
\param parent
*/
explicit cMovieSearch(const cMovieList& movieList, QWidget *parent = nullptr);
/*!
\brief
\fn ~cMovieSearch
*/
~cMovieSearch();
qint32 id();
QString placeholderName();
/*!
\brief
\fn id
\return QList<qint32>
*/
QList<qint32> id();
/*!
\brief
\fn placeholderName
\return QString
*/
QString placeholderName();
/*!
\brief
\fn placeholder
\return bool
*/
bool placeholder();
qint16 year();
/*!
\brief
\fn year
\return qint32
*/
qint32 year();
private slots:
/*!
\brief
\fn on_m_lpSearchButton_clicked
*/
void on_m_lpSearchButton_clicked();
/*!
\brief
\fn on_m_lpSearch_textChanged
\param arg1
*/
void on_m_lpSearch_textChanged(const QString &arg1);
/*!
\brief
\fn on_m_lpPlaceholderName_textChanged
\param arg1
*/
void on_m_lpPlaceholderName_textChanged(const QString &arg1);
/*!
\brief
\fn on_m_lpYear_valueChanged
\param arg1
*/
void on_m_lpYear_valueChanged(int arg1);
void on_m_lpResults_clicked(const QModelIndex &index);
/*!
\brief
void on_m_lpResults_doubleClicked(const QModelIndex &index);
\fn on_m_lpResults_clicked
\param index
*/
void on_m_lpResults_clicked(const QModelIndex &index);
private:
Ui::cMovieSearch *ui;
Ui::cMovieSearch* ui; /*!< TODO: describe */
QStandardItemModel* m_lpResultsModel;
cMovieList m_movieList; /*!< TODO: describe */
/*!
\brief
\fn setButtonBox
*/
void setButtonBox();
};

@ -6,12 +6,12 @@
<rect>
<x>0</x>
<y>0</y>
<width>334</width>
<height>460</height>
<width>900</width>
<height>500</height>
</rect>
</property>
<property name="windowTitle">
<string>Dialog</string>
<string>Search Movies</string>
</property>
<layout class="QGridLayout" name="gridLayout_3">
<item row="1" column="0">
@ -35,50 +35,62 @@
</attribute>
<layout class="QGridLayout" name="gridLayout">
<item row="0" column="0">
<layout class="QVBoxLayout" name="verticalLayout_2">
<layout class="QVBoxLayout" name="verticalLayout" stretch="1,10">
<item>
<layout class="QVBoxLayout" name="verticalLayout">
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<widget class="QLineEdit" name="m_lpSearch"/>
</item>
<item>
<widget class="QPushButton" name="m_lpSearchButton">
<property name="text">
<string>Search</string>
</property>
</widget>
</item>
</layout>
<widget class="QLineEdit" name="m_lpSearch"/>
</item>
<item>
<widget class="QTreeWidget" name="m_lpResults">
<property name="columnCount">
<number>3</number>
<widget class="QPushButton" name="m_lpSearchButton">
<property name="text">
<string>Search</string>
</property>
<attribute name="headerVisible">
<bool>false</bool>
</attribute>
<column>
<property name="text">
<string notr="true">1</string>
</property>
</column>
<column>
<property name="text">
<string notr="true">2</string>
</property>
</column>
<column>
<property name="text">
<string notr="true">3</string>
</property>
</column>
</widget>
</item>
</layout>
</item>
<item>
<widget class="QSplitter" name="m_lpSplitter">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<widget class="QTreeView" name="m_lpResults">
<property name="editTriggers">
<set>QAbstractItemView::NoEditTriggers</set>
</property>
<property name="alternatingRowColors">
<bool>true</bool>
</property>
<property name="selectionMode">
<enum>QAbstractItemView::SingleSelection</enum>
</property>
<property name="sortingEnabled">
<bool>true</bool>
</property>
</widget>
<widget class="QScrollArea" name="m_lpMovieDetailsScroller">
<property name="widgetResizable">
<bool>true</bool>
</property>
<widget class="QWidget" name="scrollAreaWidgetContents">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>87</width>
<height>363</height>
</rect>
</property>
<layout class="QGridLayout" name="gridLayout_5">
<item row="0" column="0">
<widget class="cMovieDetails" name="m_lpMovieDetails" native="true"/>
</item>
</layout>
</widget>
</widget>
</widget>
</item>
</layout>
</item>
</layout>
@ -142,6 +154,14 @@
</item>
</layout>
</widget>
<customwidgets>
<customwidget>
<class>cMovieDetails</class>
<extends>QWidget</extends>
<header>cmoviedetails.h</header>
<container>1</container>
</customwidget>
</customwidgets>
<tabstops>
<tabstop>m_lpSearch</tabstop>
<tabstop>m_lpSearchButton</tabstop>

@ -55,6 +55,8 @@ void cMovieViewItemDelegate::paint(QPainter* painter, const QStyleOptionViewItem
case cMovie::StateDone:
statusDone++;
break;
default:
break;
}
}
x++;

@ -5,11 +5,32 @@
#include <QStyledItemDelegate>
/*!
\brief
\class cMovieViewItemDelegate cmovieviewitemdelegate.h "cmovieviewitemdelegate.h"
*/
class cMovieViewItemDelegate : public QStyledItemDelegate
{
public:
protected:
/*!
\brief
\fn paint
\param painter
\param option
\param index
*/
void paint(QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index) const;
/*!
\brief
\fn sizeHint
\param option
\param index
\return QSize
*/
QSize sizeHint(const QStyleOptionViewItem &option, const QModelIndex &index) const;
};

@ -5,7 +5,20 @@
#include <QString>
/*!
\brief
\fn rootPath
\return QString
*/
QString rootPath();
/*!
\brief
\fn cleanList
\param list
\return QStringList
*/
QStringList cleanList(const QStringList& list);

@ -22,7 +22,7 @@ void cPicturesThread::stop()
void cPicturesThread::run()
{
qint16 iCurrent = 0;
qint32 iCurrent = 0;
for(int z = 0;z < m_items.count();z++)
{

@ -10,27 +10,67 @@
#include <QList>
/*!
\brief
\class cPicturesThread cpicturesthread.h "cpicturesthread.h"
*/
class cPicturesThread : public QThread
{
Q_OBJECT
public:
/*!
\brief
\fn cPicturesThread
*/
explicit cPicturesThread();
/*!
\brief
\fn setData
\param lpMessageDialog
\param list
*/
void setData(cMessageDialog *lpMessageDialog, const QList<cSerie*>& list);
public slots:
/*!
\brief
\fn stop
*/
void stop();
signals:
/*!
\brief
\fn picturesMessage
\param szMessage
\param iProgress
*/
void picturesMessage(const QString& szMessage, const qint32 &iProgress);
/*!
\brief
\fn picturesAppendMessage
\param szMessage
*/
void picturesAppendMessage(const QString& szMessage);
private:
QMutex m_mutex;
bool m_bStop;
QList<cSerie*> m_items;
QWidget* m_lpParent;
QMutex m_mutex; /*!< TODO: describe */
bool m_bStop; /*!< TODO: describe */
QList<cSerie*> m_items; /*!< TODO: describe */
QWidget* m_lpParent; /*!< TODO: describe */
/*!
\brief
\fn run
*/
void run();
};

@ -0,0 +1,24 @@
#include "cpixmapwidget.h"
#include <QPainter>
cPixmapWidget::cPixmapWidget(QWidget *parent) : QWidget(parent)
{
}
void cPixmapWidget::setPixmap(const QPixmap& pixmap)
{
m_pixmap = pixmap;
}
void cPixmapWidget::paintEvent(QPaintEvent *event)
{
if(!m_pixmap.isNull())
{
QPainter painter(this);
painter.drawPixmap(0, 0, m_pixmap.scaled(width(), height(), Qt::KeepAspectRatioByExpanding, Qt::SmoothTransformation));
}
QWidget::paintEvent(event);
}

@ -0,0 +1,48 @@
#ifndef CPIXMAPWIDGET_H
#define CPIXMAPWIDGET_H
#include <QWidget>
#include <QPixmap>
/*!
\brief
\class cPixmapWidget cpixmapwidget.h "cpixmapwidget.h"
*/
class cPixmapWidget : public QWidget
{
Q_OBJECT
public:
/*!
\brief
\fn cPixmapWidget
\param parent
*/
explicit cPixmapWidget(QWidget *parent = nullptr);
/*!
\brief
\fn setPixmap
\param pixmap
*/
void setPixmap(const QPixmap& pixmap);
signals:
public slots:
protected:
QPixmap m_pixmap; /*!< TODO: describe */
/*!
\brief
\fn paintEvent
\param event
*/
void paintEvent(QPaintEvent *event);
};
#endif // CPIXMAPWIDGET_H

@ -0,0 +1,74 @@
#include "cpreferences.h"
#include "ui_cpreferences.h"
#include <QSettings>
#include <QDir>
#include <QFileDialog>
cPreferences::cPreferences(QWidget *parent) :
QDialog(parent),
ui(new Ui::cPreferences)
{
ui->setupUi(this);
QSettings settings;
ui->m_lpExportSeries->setChecked(settings.value("exportSerie", QDir::homePath()).toBool());
ui->m_lpExportMovies->setChecked(settings.value("exportMovie", QDir::homePath()).toBool());
ui->m_lpSeriesPath->setText(settings.value("exportSeriePath", QString("%1%2series.xml").arg(QDir::homePath()).arg(QDir::separator())).toString());
ui->m_lpMoviesPath->setText(settings.value("exportMoviePath", QString("%1%2movies.xml").arg(QDir::homePath()).arg(QDir::separator())).toString());
ui->m_lpDiscoverResultsSerie->setValue(settings.value("serieDiscover/results", 100).toInt());
ui->m_lpSearchResultsSerie->setValue(settings.value("serieSearch/results", 100).toInt());
ui->m_lpDiscoverResultsMovie->setValue(settings.value("movieDiscover/results", 100).toInt());
ui->m_lpSearchResultsMovie->setValue(settings.value("movieSearch/results", 100).toInt());
ui->m_lpDisplaySeason0->setChecked(settings.value("displaySeason0", true).toBool());
m_bDisplaySeason0 = settings.value("displaySeason0", true).toBool();
}
cPreferences::~cPreferences()
{
QSettings settings;
settings.setValue("exportSeriePath", ui->m_lpSeriesPath->text());
settings.setValue("exportMoviePath", ui->m_lpMoviesPath->text());
settings.setValue("exportSerie", ui->m_lpExportSeries->isChecked());
settings.setValue("exportMovie", ui->m_lpExportMovies->isChecked());
settings.setValue("serieDiscover/results", ui->m_lpDiscoverResultsSerie->value());
settings.setValue("serieSearch/results", ui->m_lpSearchResultsSerie->value());
settings.setValue("movieDiscover/results", ui->m_lpDiscoverResultsMovie->value());
settings.setValue("movieSearch/results", ui->m_lpSearchResultsMovie->value());
settings.setValue("displaySeason0", ui->m_lpDisplaySeason0->isChecked());
delete ui;
}
bool cPreferences::displaySeason0Changed()
{
return(m_bDisplaySeason0 != ui->m_lpDisplaySeason0->isChecked());
}
void cPreferences::on_m_lpSeriesPathSelect_clicked()
{
QString szFile = QFileDialog::getSaveFileName(this, tr("export Serie"), ui->m_lpSeriesPath->text(), tr("XML Files (*.xml)"));
if(szFile.isEmpty())
return;
ui->m_lpSeriesPath->setText(szFile);
}
void cPreferences::on_m_lpMoviesPathSelect_clicked()
{
QString szFile = QFileDialog::getSaveFileName(this, tr("export Serie"), ui->m_lpMoviesPath->text(), tr("XML Files (*.xml)"));
if(szFile.isEmpty())
return;
ui->m_lpMoviesPath->setText(szFile);
}

@ -0,0 +1,29 @@
#ifndef CPREFERENCES_H
#define CPREFERENCES_H
#include <QDialog>
namespace Ui {
class cPreferences;
}
class cPreferences : public QDialog
{
Q_OBJECT
public:
explicit cPreferences(QWidget *parent = nullptr);
~cPreferences();
bool displaySeason0Changed();
private slots:
void on_m_lpSeriesPathSelect_clicked();
void on_m_lpMoviesPathSelect_clicked();
private:
Ui::cPreferences* ui;
bool m_bDisplaySeason0;
};
#endif // CPREFERENCES_H

@ -0,0 +1,207 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>cPreferences</class>
<widget class="QDialog" name="cPreferences">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>494</width>
<height>317</height>
</rect>
</property>
<property name="windowTitle">
<string>Preferences</string>
</property>
<layout class="QGridLayout" name="gridLayout">
<item row="0" column="0">
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<widget class="QGroupBox" name="groupBox">
<property name="title">
<string>General</string>
</property>
</widget>
</item>
<item>
<widget class="QGroupBox" name="groupBox_2">
<property name="title">
<string>Series</string>
</property>
<layout class="QGridLayout" name="gridLayout_3">
<item row="0" column="0">
<layout class="QGridLayout" name="gridLayout_2">
<item row="0" column="1">
<widget class="QLineEdit" name="m_lpSeriesPath"/>
</item>
<item row="0" column="2">
<widget class="QPushButton" name="m_lpSeriesPathSelect">
<property name="text">
<string>...</string>
</property>
</widget>
</item>
<item row="2" column="0">
<widget class="QLabel" name="label">
<property name="text">
<string>number of discover results</string>
</property>
</widget>
</item>
<item row="0" column="0">
<widget class="QCheckBox" name="m_lpExportSeries">
<property name="text">
<string>enable export</string>
</property>
<property name="checked">
<bool>true</bool>
</property>
</widget>
</item>
<item row="2" column="1">
<widget class="QSpinBox" name="m_lpDiscoverResultsSerie">
<property name="maximum">
<number>9999</number>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QCheckBox" name="m_lpDisplaySeason0">
<property name="text">
<string>display season &quot;0&quot;</string>
</property>
<property name="checked">
<bool>true</bool>
</property>
</widget>
</item>
<item row="3" column="0">
<widget class="QLabel" name="label_3">
<property name="text">
<string>number of search results</string>
</property>
</widget>
</item>
<item row="3" column="1">
<widget class="QSpinBox" name="m_lpSearchResultsMovie">
<property name="maximum">
<number>9999</number>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</widget>
</item>
<item>
<widget class="QGroupBox" name="groupBox_3">
<property name="title">
<string>Movies</string>
</property>
<layout class="QGridLayout" name="gridLayout_5">
<item row="0" column="0">
<layout class="QGridLayout" name="gridLayout_4">
<item row="0" column="0">
<widget class="QCheckBox" name="m_lpExportMovies">
<property name="text">
<string>enable export</string>
</property>
<property name="checked">
<bool>true</bool>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QLabel" name="label_2">
<property name="text">
<string>number of discover results</string>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QSpinBox" name="m_lpDiscoverResultsMovie">
<property name="maximum">
<number>9999</number>
</property>
</widget>
</item>
<item row="0" column="2">
<widget class="QPushButton" name="m_lpMoviesPathSelect">
<property name="text">
<string>...</string>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QLineEdit" name="m_lpMoviesPath"/>
</item>
<item row="2" column="0">
<widget class="QLabel" name="label_4">
<property name="text">
<string>number of search results</string>
</property>
</widget>
</item>
<item row="2" column="1">
<widget class="QSpinBox" name="m_lpSearchResultsSerie">
<property name="maximum">
<number>9999</number>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</widget>
</item>
<item>
<widget class="QDialogButtonBox" name="buttonBox">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="standardButtons">
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</widget>
<resources/>
<connections>
<connection>
<sender>buttonBox</sender>
<signal>accepted()</signal>
<receiver>cPreferences</receiver>
<slot>accept()</slot>
<hints>
<hint type="sourcelabel">
<x>248</x>
<y>254</y>
</hint>
<hint type="destinationlabel">
<x>157</x>
<y>274</y>
</hint>
</hints>
</connection>
<connection>
<sender>buttonBox</sender>
<signal>rejected()</signal>
<receiver>cPreferences</receiver>
<slot>reject()</slot>
<hints>
<hint type="sourcelabel">
<x>316</x>
<y>260</y>
</hint>
<hint type="destinationlabel">
<x>286</x>
<y>274</y>
</hint>
</hints>
</connection>
</connections>
</ui>

@ -0,0 +1,23 @@
#include "cscrollarea.h"
#include <QPainter>
cScrollArea::cScrollArea(QWidget* parent) :
QScrollArea(parent)
{
}
void cScrollArea::setPixmap(const QPixmap& pixmap)
{
m_pixmap = pixmap;
}
void cScrollArea::paintEvent(QPaintEvent *event)
{
if(!m_pixmap.isNull())
{
QPainter painter(this);
painter.drawPixmap(0, 0, m_pixmap);
}
QScrollArea::paintEvent(event);
}

@ -0,0 +1,36 @@
#ifndef CSCROLLAREA_H
#define CSCROLLAREA_H
#include <QScrollArea>
#include <QPixmap>
/*!
\brief
\class cScrollArea cscrollarea.h "cscrollarea.h"
*/
class cScrollArea : public QScrollArea
{
public:
cScrollArea(QWidget* parent = 0);
/*!
\brief
\fn setPixmap
\param pixmap
*/
void setPixmap(const QPixmap& pixmap);
protected:
QPixmap m_pixmap; /*!< TODO: describe */
/*!
\brief
\fn paintEvent
\param event
*/
void paintEvent(QPaintEvent *event);
};
#endif // CSCROLLAREA_H

@ -9,9 +9,11 @@
#include <QList>
cSearch::cSearch(QWidget *parent) :
cSearch::cSearch(const cSerieList& serieList, QWidget *parent) :
QDialog(parent),
ui(new Ui::cSearch)
ui(new Ui::cSearch),
m_lpResultsModel(nullptr),
m_serieList(serieList)
{
ui->setupUi(this);
ui->m_lpSearchButton->setEnabled(false);
@ -20,10 +22,14 @@ cSearch::cSearch(QWidget *parent) :
ui->m_lpButtonBox->button(QDialogButtonBox::Ok)->setEnabled(false);
ui->m_lpSearch->setFocus();
ui->m_lpSearchButton->setDefault(true);
m_lpResultsModel = new QStandardItemModel(0, 0);
ui->m_lpResults->setModel(m_lpResultsModel);
}
cSearch::~cSearch()
{
delete m_lpResultsModel;
delete ui;
}
@ -37,6 +43,8 @@ void cSearch::on_m_lpSearch_textChanged(const QString& /*arg1*/)
void cSearch::on_m_lpSearchButton_clicked()
{
setCursor(Qt::WaitCursor);
cMessageAnimateDialog* lpDialog = new cMessageAnimateDialog(this);
lpDialog->setTitle("Search");
lpDialog->setMessage("Searching");
@ -44,37 +52,46 @@ void cSearch::on_m_lpSearchButton_clicked()
cTheMovieDBV3 theMovieDBV3;
QList<cSerie*> serieList3 = theMovieDBV3.searchSerie(ui->m_lpSearch->text(), -1, "de-DE");
QList<cSerie*> serieList3 = theMovieDBV3.searchSerie(m_serieList, ui->m_lpSearch->text(), -1, "de-DE");
ui->m_lpResults->clear();
m_lpResultsModel->clear();
for(int z = 0;z < serieList3.count();z++)
{
cSerie* lpSerie = serieList3.at(z);
QTreeWidgetItem* lpNew = new QTreeWidgetItem(ui->m_lpResults);
lpNew->setText(0, lpSerie->seriesName());
lpNew->setText(2, QString("%1").arg(lpSerie->firstAired().year()));
lpNew->setData(0, Qt::UserRole, QVariant::fromValue(lpSerie->seriesID()));
ui->m_lpResults->addTopLevelItem(lpNew);
QList<QStandardItem*> items;
items.append(new QStandardItem(lpSerie->seriesName()));
items.append(new QStandardItem(QString::number(lpSerie->firstAired().year())));
items[0]->setData(QVariant::fromValue(lpSerie));
items[1]->setData(QVariant::fromValue(lpSerie));
m_lpResultsModel->appendRow(items);
}
ui->m_lpResults->resizeColumnToContents(0);
ui->m_lpResults->resizeColumnToContents(1);
ui->m_lpResults->sortItems(0, Qt::AscendingOrder);
m_lpResultsModel->sort(0);
delete lpDialog;
setCursor(Qt::ArrowCursor);
}
qint32 cSearch::id()
{
if(!ui->m_lpResults->selectedItems().count())
if(!ui->m_lpResults->selectionModel()->selectedRows().count())
{
qint32 iID = ui->m_lpSearch->text().toInt();
if(iID)
return(iID);
return(-1);
}
return(ui->m_lpResults->selectedItems().at(0)->data(0, Qt::UserRole).toInt());
QStandardItem* lpItem = m_lpResultsModel->itemFromIndex(ui->m_lpResults->selectionModel()->selectedRows().at(0));
cSerie* lpSerie = lpItem->data().value<cSerie*>();
return(lpSerie->seriesID());
}
QString cSearch::placeholderName()
@ -87,14 +104,27 @@ bool cSearch::placeholder()
return(ui->m_lpTabWidget->currentIndex() == 1);
}
qint16 cSearch::year()
qint32 cSearch::year()
{
return(ui->m_lpYear->value());
}
void cSearch::on_m_lpResults_clicked(const QModelIndex &index)
void cSearch::on_m_lpResults_clicked(const QModelIndex& index)
{
setCursor(Qt::WaitCursor);
QStandardItem* lpItem = m_lpResultsModel->itemFromIndex(index);
cSerie* lpSerie = lpItem->data().value<cSerie*>();
if(lpSerie->cast().isEmpty())
{
cTheMovieDBV3 theMovieDB;
theMovieDB.loadCastSerie(lpSerie);
}
ui->m_lpSerieDetails->setSerie(lpSerie);
setButtonBox();
setCursor(Qt::ArrowCursor);
}
void cSearch::on_m_lpPlaceholderName_textChanged(const QString& /*arg1*/)
@ -111,7 +141,7 @@ void cSearch::setButtonBox()
{
if(ui->m_lpTabWidget->currentIndex() == 0)
{
if(ui->m_lpResults->selectedItems().count())
if(ui->m_lpResults->selectionModel()->selectedIndexes().count())
ui->m_lpButtonBox->button(QDialogButtonBox::Ok)->setEnabled(true);
else
ui->m_lpButtonBox->button(QDialogButtonBox::Ok)->setEnabled(false);

@ -1,39 +1,126 @@
#ifndef CSEARCH_H
#define CSEARCH_H
#include <QDialog>
#include <QStandardItemModel>
#include "cserie.h"
namespace Ui {
class cSearch;
}
/*!
\brief
\class cSearch csearch.h "csearch.h"
*/
class cSearch : public QDialog
{
Q_OBJECT
public:
explicit cSearch(QWidget *parent = 0);
/*!
\brief
\fn cSearch
\param parent
*/
explicit cSearch(const cSerieList& serieList, QWidget *parent = 0);
/*!
\brief
\fn ~cSearch
*/
~cSearch();
/*!
\brief
\fn id
\return qint32
*/
qint32 id();
/*!
\brief
\fn placeholderName
\return QString
*/
QString placeholderName();
/*!
\brief
\fn placeholder
\return bool
*/
bool placeholder();
qint16 year();
/*!
\brief
\fn year
\return qint32
*/
qint32 year();
private slots:
/*!
\brief
\fn on_m_lpSearchButton_clicked
*/
void on_m_lpSearchButton_clicked();
/*!
\brief
\fn on_m_lpSearch_textChanged
\param arg1
*/
void on_m_lpSearch_textChanged(const QString &arg1);
/*!
\brief
\fn on_m_lpResults_clicked
\param index
*/
void on_m_lpResults_clicked(const QModelIndex &index);
/*!
\brief
\fn on_m_lpPlaceholderName_textChanged
\param arg1
*/
void on_m_lpPlaceholderName_textChanged(const QString &arg1);
/*!
\brief
\fn on_m_lpYear_valueChanged
\param arg1
*/
void on_m_lpYear_valueChanged(int arg1);
/*!
\brief
\fn on_m_lpResults_doubleClicked
\param index
*/
void on_m_lpResults_doubleClicked(const QModelIndex &index);
private:
Ui::cSearch *ui;
Ui::cSearch* ui; /*!< TODO: describe */
QStandardItemModel* m_lpResultsModel;
cSerieList m_serieList; /*!< TODO: describe */
/*!
\brief
\fn setButtonBox
*/
void setButtonBox();
};

@ -6,12 +6,12 @@
<rect>
<x>0</x>
<y>0</y>
<width>334</width>
<height>460</height>
<width>900</width>
<height>500</height>
</rect>
</property>
<property name="windowTitle">
<string>Dialog</string>
<string>Search Series</string>
</property>
<layout class="QGridLayout" name="gridLayout_3">
<item row="1" column="0">
@ -35,50 +35,62 @@
</attribute>
<layout class="QGridLayout" name="gridLayout">
<item row="0" column="0">
<layout class="QVBoxLayout" name="verticalLayout_2">
<layout class="QVBoxLayout" name="verticalLayout" stretch="1,10">
<item>
<layout class="QVBoxLayout" name="verticalLayout">
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<widget class="QLineEdit" name="m_lpSearch"/>
</item>
<item>
<widget class="QPushButton" name="m_lpSearchButton">
<property name="text">
<string>Search</string>
</property>
</widget>
</item>
</layout>
<widget class="QLineEdit" name="m_lpSearch"/>
</item>
<item>
<widget class="QTreeWidget" name="m_lpResults">
<property name="columnCount">
<number>3</number>
<widget class="QPushButton" name="m_lpSearchButton">
<property name="text">
<string>Search</string>
</property>
<attribute name="headerVisible">
<bool>false</bool>
</attribute>
<column>
<property name="text">
<string notr="true">1</string>
</property>
</column>
<column>
<property name="text">
<string notr="true">2</string>
</property>
</column>
<column>
<property name="text">
<string notr="true">3</string>
</property>
</column>
</widget>
</item>
</layout>
</item>
<item>
<widget class="QSplitter" name="splitter">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<widget class="QTreeView" name="m_lpResults">
<property name="editTriggers">
<set>QAbstractItemView::NoEditTriggers</set>
</property>
<property name="alternatingRowColors">
<bool>true</bool>
</property>
<property name="sortingEnabled">
<bool>true</bool>
</property>
<attribute name="headerVisible">
<bool>false</bool>
</attribute>
</widget>
<widget class="QScrollArea" name="m_lpMovieDetailsScroller">
<property name="widgetResizable">
<bool>true</bool>
</property>
<widget class="QWidget" name="scrollAreaWidgetContents">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>87</width>
<height>363</height>
</rect>
</property>
<layout class="QGridLayout" name="gridLayout_5">
<item row="0" column="0">
<widget class="cSerieDetails" name="m_lpSerieDetails" native="true"/>
</item>
</layout>
</widget>
</widget>
</widget>
</item>
</layout>
</item>
</layout>
@ -142,6 +154,14 @@
</item>
</layout>
</widget>
<customwidgets>
<customwidget>
<class>cSerieDetails</class>
<extends>QWidget</extends>
<header>cseriedetails.h</header>
<container>1</container>
</customwidget>
</customwidgets>
<tabstops>
<tabstop>m_lpSearch</tabstop>
<tabstop>m_lpSearchButton</tabstop>

@ -1,6 +1,6 @@
#include "cseason.h"
#define DELETE(x) { if(x) delete x; x=0; }
#define DELETE(x) { if(x) delete x; x=nullptr; }
cSeason::cSeason() :
m_i_ID(-1),
@ -10,15 +10,15 @@ cSeason::cSeason() :
m_iID(-1),
m_szPosterPath(""),
m_iSeasonNumber(-1),
m_lpGroupBox(0),
m_lpGridLayout(0),
m_lpGrid(0),
m_lpLabel1(0),
m_lpAllInit(0),
m_lpAllProgress(0),
m_lpAllDone(0),
m_lpSpacer(0),
m_lpSerie(0)
m_lpGroupBox(nullptr),
m_lpGridLayout(nullptr),
m_lpGrid(nullptr),
m_lpLabel1(nullptr),
m_lpAllInit(nullptr),
m_lpAllProgress(nullptr),
m_lpAllDone(nullptr),
m_lpSpacer(nullptr),
m_lpSerie(nullptr)
{
}
@ -28,11 +28,12 @@ cSeason::~cSeason()
deleteResources();
}
void cSeason::set_ID(const qint16& _iID)
void cSeason::set_ID(const qint32& _iID)
{
m_i_ID = _iID;
}
qint16 cSeason::_id()
qint32 cSeason::_id()
{
return(m_i_ID);
}
@ -72,12 +73,12 @@ QString cSeason::overview()
return(m_szOverview);
}
void cSeason::setID(const qint16& iID)
void cSeason::setID(const qint32& iID)
{
m_iID = iID;
}
qint16 cSeason::id()
qint32 cSeason::id()
{
return(m_iID);
}
@ -92,12 +93,12 @@ QString cSeason::posterPath()
return(m_szPosterPath);
}
void cSeason::setSeasonNumber(const qint16& iSeasonNumber)
void cSeason::setSeasonNumber(const qint32& iSeasonNumber)
{
m_iSeasonNumber = iSeasonNumber;
}
qint16 cSeason::seasonNumber()
qint32 cSeason::seasonNumber()
{
return(m_iSeasonNumber);
}
@ -112,7 +113,7 @@ cSerie* cSeason::serie()
return(m_lpSerie);
}
cEpisode* cSeason::addEpisode(qint16 iNumber)
cEpisode* cSeason::addEpisode(qint32 iNumber)
{
cEpisode* lpNew = new cEpisode;
lpNew->setEpisodeNumber(iNumber);
@ -124,7 +125,7 @@ cEpisode* cSeason::addEpisode(qint16 iNumber)
cEpisode* cSeason::addEpisode(cEpisode* lpEpisode)
{
if(episodeList().contains(lpEpisode))
return(0);
return(nullptr);
m_episodeList.append(lpEpisode);
return(lpEpisode);
}
@ -134,19 +135,19 @@ QList<cEpisode*> cSeason::episodeList()
return(m_episodeList);
}
cEpisode* cSeason::findEpisode(qint16 iNumber)
cEpisode* cSeason::findEpisode(qint32 iNumber)
{
for(int x = 0;x < m_episodeList.count();x++)
{
if(m_episodeList.at(x)->episodeNumber() == iNumber)
return(m_episodeList.at(x));
}
return(0);
return(nullptr);
}
qint16 cSeason::episodeCount()
qint32 cSeason::episodeCount()
{
qint16 iTotal = -1;
qint32 iTotal = -1;
for(int z = 0;z < m_episodeList.count();z++)
{
cEpisode* lpEpisode = m_episodeList.at(z);
@ -179,6 +180,39 @@ void cSeason::setLabel1(QLabel* lpLabel1)
m_lpLabel1 = lpLabel1;
}
bool cSeason::hasInit()
{
for(int x = 0;x < m_episodeList.count();x++)
{
cEpisode* lpEpisode = m_episodeList.at(x);
if(lpEpisode->state() == cEpisode::StateInit)
return(true);
}
return(false);
}
bool cSeason::hasProgress()
{
for(int x = 0;x < m_episodeList.count();x++)
{
cEpisode* lpEpisode = m_episodeList.at(x);
if(lpEpisode->state() == cEpisode::StateProgress)
return(true);
}
return(false);
}
bool cSeason::hasDone()
{
for(int x = 0;x < m_episodeList.count();x++)
{
cEpisode* lpEpisode = m_episodeList.at(x);
if(lpEpisode->state() == cEpisode::StateDone)
return(true);
}
return(false);
}
void cSeason::setAllInit(QPushButton* lpAllInit)
{
m_lpAllInit = lpAllInit;

@ -16,81 +16,339 @@
class cSerie;
/*!
\brief
\class cSeason cseason.h "cseason.h"
*/
class cSeason
{
public:
cSeason();
/*!
\brief
\fn ~cSeason
*/
~cSeason();
void set_ID(const qint16& _iID);
qint16 _id();
/*!
\brief
\fn set_ID
\param _iID
*/
void set_ID(const qint32& _iID);
/*!
\brief
\fn _id
\return qint32
*/
qint32 _id();
/*!
\brief
\fn setAirDate
\param szAirDate
*/
void setAirDate(const QString& szAirDate);
/*!
\brief
\fn setAirDate
\param airDate
*/
void setAirDate(const QDate& airDate);
/*!
\brief
\fn airDate
\return QDate
*/
QDate airDate();
/*!
\brief
\fn setName
\param szName
*/
void setName(const QString& szName);
/*!
\brief
\fn name
\return QString
*/
QString name();
/*!
\brief
\fn setOverview
\param szOverview
*/
void setOverview(const QString& szOverview);
/*!
\brief
\fn overview
\return QString
*/
QString overview();
void setID(const qint16& iID);
qint16 id();
/*!
\brief
\fn setID
\param iID
*/
void setID(const qint32& iID);
/*!
\brief
\fn id
\return qint32
*/
qint32 id();
/*!
\brief
\fn setPosterPath
\param szPosterPath
*/
void setPosterPath(const QString& szPosterPath);
/*!
\brief
\fn posterPath
\return QString
*/
QString posterPath();
void setSeasonNumber(const qint16& iSeasonNumber);
qint16 seasonNumber();
/*!
\brief
\fn setSeasonNumber
\param iSeasonNumber
*/
void setSeasonNumber(const qint32& iSeasonNumber);
/*!
\brief
\fn seasonNumber
\return qint32
*/
qint32 seasonNumber();
/*!
\brief
\fn setSerie
\param lpSerie
*/
void setSerie(cSerie* lpSerie);
/*!
\brief
\fn serie
\return cSerie
*/
cSerie* serie();
cEpisode* addEpisode(qint16 iNumber);
/*!
\brief
\fn addEpisode
\param iNumber
\return cEpisode
*/
cEpisode* addEpisode(qint32 iNumber);
/*!
\brief
\fn addEpisode
\param lpEpisode
\return cEpisode
*/
cEpisode* addEpisode(cEpisode* lpEpisode);
/*!
\brief
\fn episodeList
\return QList<cEpisode *>
*/
QList<cEpisode*> episodeList();
cEpisode* findEpisode(qint16 iNumber);
/*!
\brief
qint16 episodeCount();
\fn findEpisode
\param iNumber
\return cEpisode
*/
cEpisode* findEpisode(qint32 iNumber);
/*!
\brief
\fn episodeCount
\return qint32
*/
qint32 episodeCount();
/*!
\brief
\fn setGroupBox
\param lpGroupBox
*/
void setGroupBox(QGroupBox* lpGroupBox);
/*!
\brief
\fn setGridLayout
\param lpGridLayout
*/
void setGridLayout(QGridLayout* lpGridLayout);
/*!
\brief
\fn setGrid
\param lpGrid
*/
void setGrid(QGridLayout* lpGrid);
/*!
\brief
\fn setLabel1
\param lpLabel1
*/
void setLabel1(QLabel* lpLabel1);
/*!
\brief
\fn setAllInit
\param lpAllInit
*/
void setAllInit(QPushButton* lpAllInit);
/*!
\brief
\fn setAllProgress
\param lpAllProgress
*/
void setAllProgress(QPushButton* lpAllProgress);
/*!
\brief
\fn setAllDone
\param lpAllDone
*/
void setAllDone(QPushButton* lpAllDone);
/*!
\brief
\fn setSpacer
\param lpSpacer
*/
void setSpacer(QSpacerItem* lpSpacer);
/*!
\brief
\fn updateState
*/
void updateState();
/*!
\brief
\fn deleteResources
*/
void deleteResources();
/*!
\brief
\fn hasInit
\return bool
*/
bool hasInit();
/*!
\brief
\fn hasProgress
\return bool
*/
bool hasProgress();
/*!
\brief
\fn hasDone
\return bool
*/
bool hasDone();
/*!
\brief
\fn allInit
*/
void allInit();
/*!
\brief
\fn allProgress
*/
void allProgress();
/*!
\brief
\fn allDone
*/
void allDone();
/*!
\brief
\fn allInitButton
\return QPushButton
*/
QPushButton* allInitButton();
/*!
\brief
\fn allProgressButton
\return QPushButton
*/
QPushButton* allProgressButton();
/*!
\brief
\fn allDoneButton
\return QPushButton
*/
QPushButton* allDoneButton();
private:
qint16 m_i_ID;
QDate m_airDate;
QString m_szName;
QString m_szOverview;
qint16 m_iID;
QString m_szPosterPath;
qint16 m_iSeasonNumber;
QList<cEpisode*> m_episodeList;
QGroupBox* m_lpGroupBox;
QGridLayout* m_lpGridLayout;
QGridLayout* m_lpGrid;
QLabel* m_lpLabel1;
QPushButton* m_lpAllInit;
QPushButton* m_lpAllProgress;
QPushButton* m_lpAllDone;
QSpacerItem* m_lpSpacer;
cSerie* m_lpSerie;
qint32 m_i_ID; /*!< TODO: describe */
QDate m_airDate; /*!< TODO: describe */
QString m_szName; /*!< TODO: describe */
QString m_szOverview; /*!< TODO: describe */
qint32 m_iID; /*!< TODO: describe */
QString m_szPosterPath; /*!< TODO: describe */
qint32 m_iSeasonNumber; /*!< TODO: describe */
QList<cEpisode*> m_episodeList; /*!< TODO: describe */
QGroupBox* m_lpGroupBox; /*!< TODO: describe */
QGridLayout* m_lpGridLayout; /*!< TODO: describe */
QGridLayout* m_lpGrid; /*!< TODO: describe */
QLabel* m_lpLabel1; /*!< TODO: describe */
QPushButton* m_lpAllInit; /*!< TODO: describe */
QPushButton* m_lpAllProgress; /*!< TODO: describe */
QPushButton* m_lpAllDone; /*!< TODO: describe */
QSpacerItem* m_lpSpacer; /*!< TODO: describe */
cSerie* m_lpSerie; /*!< TODO: describe */
};
Q_DECLARE_METATYPE(cSeason*)

@ -25,9 +25,9 @@
void cSeasonDelegate::paint(QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index) const
{
if(index.column() > 2)
if(index.column() > 3)
{
cSeason* lpSeason = 0;
cSeason* lpSeason = nullptr;
if(index.data(Qt::UserRole).canConvert<cSeason*>())
lpSeason = qvariant_cast<cSeason*>(index.data(Qt::UserRole));
@ -84,11 +84,11 @@ void cSeasonDelegate::paint(QPainter *painter, const QStyleOptionViewItem &optio
QSize cSeasonDelegate::sizeHint(const QStyleOptionViewItem &option, const QModelIndex &index) const
{
if(index.column() > 2)
if(index.column() > 3)
{
qint16 iTotal = -1;
qint16 z;
cSeason* lpSeason = 0;
qint32 iTotal = -1;
qint32 z;
cSeason* lpSeason = nullptr;
if(index.data(Qt::UserRole).canConvert<cSeason*>())
lpSeason = qvariant_cast<cSeason*>(index.data(Qt::UserRole));
@ -107,13 +107,10 @@ QSize cSeasonDelegate::sizeHint(const QStyleOptionViewItem &option, const QModel
}
if(iTotal > 0 && lpSeason->seasonNumber() != 0)
return(QSize((iTotal+1)*FIELD_STEP, HEIGHT));
//return(QSize((iTotal+1)*FIELD_STEP, FIELD_HEIGHT));
else
return(QSize(FIELD_STEP*40, HEIGHT));
//return(QSize(FIELD_STEP*40, FIELD_HEIGHT));
}
return(QSize(FIELD_STEP, HEIGHT));
//return(QSize(FIELD_STEP, FIELD_HEIGHT));
}
return QSize(QStyledItemDelegate::sizeHint(option, index).width(), HEIGHT);
}

@ -5,18 +5,36 @@
#include <QStyledItemDelegate>
/*!
\brief
\class cSeasonDelegate cseasondelegate.h "cseasondelegate.h"
*/
class cSeasonDelegate : public QStyledItemDelegate
{
Q_OBJECT
public:
cSeasonDelegate(QWidget *parent = 0) : QStyledItemDelegate(parent) {}
cSeasonDelegate(QWidget *parent = nullptr) : QStyledItemDelegate(parent) {}
/*!
\brief
\fn paint
\param painter
\param option
\param index
*/
void paint(QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index) const Q_DECL_OVERRIDE;
/*!
\brief
\fn sizeHint
\param option
\param index
\return QSize
*/
QSize sizeHint(const QStyleOptionViewItem &option, const QModelIndex &index) const Q_DECL_OVERRIDE;
//QWidget* createEditor(QWidget *parent, const QStyleOptionViewItem &option, const QModelIndex &index) const Q_DECL_OVERRIDE;
//void setEditorData(QWidget *editor, const QModelIndex &index) const Q_DECL_OVERRIDE;
//void setModelData(QWidget *editor, QAbstractItemModel *model, const QModelIndex &index) const Q_DECL_OVERRIDE;
};
#endif // CSEASONDELEGATE_H

@ -6,6 +6,8 @@
#include "cmessageanimatedialog.h"
#include "cmovieimage.h"
#include <QDebug>
@ -23,6 +25,13 @@ cSeasonDetails::~cSeasonDetails()
void cSeasonDetails::setSeason(cSeason* lpSeason)
{
ui->m_lpSeasonName->setText(lpSeason->name());
ui->m_lpSeasonOverview->setText(lpSeason->overview());
cMovieImage image;
QPixmap poster = image.getImage(lpSeason->posterPath());
ui->m_lpSeasonPoster->setPixmap(poster.scaledToHeight(200));
for(int x = 0;x < lpSeason->episodeList().count();x++)
{
cEpisode* lpEpisode = lpSeason->episodeList().at(x);

@ -11,21 +11,49 @@ namespace Ui {
class cSeasonDetails;
}
/*!
\brief
\class cSeasonDetails cseasondetails.h "cseasondetails.h"
*/
class cSeasonDetails : public QWidget
{
Q_OBJECT
public:
/*!
\brief
\fn cSeasonDetails
\param parent
*/
explicit cSeasonDetails(QWidget *parent = 0);
/*!
\brief
\fn ~cSeasonDetails
*/
~cSeasonDetails();
/*!
\brief
\fn setSeason
\param lpSeason
*/
void setSeason(cSeason* lpSeason);
private slots:
/*!
\brief
\fn on_m_lpDetailsEpisodeTab_tabBarClicked
\param index
*/
void on_m_lpDetailsEpisodeTab_tabBarClicked(int index);
private:
Ui::cSeasonDetails* ui;
Ui::cSeasonDetails* ui; /*!< TODO: describe */
};
#endif // CSEASONDETAILS_H

@ -15,11 +15,50 @@
</property>
<layout class="QGridLayout" name="gridLayout">
<item row="0" column="0">
<widget class="QTabWidget" name="m_lpDetailsEpisodeTab">
<property name="currentIndex">
<number>-1</number>
</property>
</widget>
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<widget class="QLineEdit" name="m_lpSeasonName">
<property name="font">
<font>
<pointsize>12</pointsize>
<weight>75</weight>
<bold>true</bold>
</font>
</property>
<property name="readOnly">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<widget class="QTextEdit" name="m_lpSeasonOverview">
<property name="readOnly">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="m_lpSeasonPoster">
<property name="text">
<string/>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
</widget>
</item>
</layout>
</item>
<item>
<widget class="QTabWidget" name="m_lpDetailsEpisodeTab">
<property name="currentIndex">
<number>-1</number>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</widget>

@ -1,4 +1,5 @@
#include "cserie.h"
#include "cfanarttv.h"
#include "common.h"
#include <QStringList>
@ -25,8 +26,14 @@ cSerie::cSerie() :
m_iVoteCount(-1),
m_szOverview(""),
m_firstAired(QDate(1900, 1, 1)),
m_szIMDBID(""),
m_szFreebaseMID(""),
m_szFreebaseID(""),
m_iTVDBID(-1),
m_iTVRageID(-1),
m_szStatus(""),
m_szDownload(""),
m_szLocalPath(""),
m_bCliffhanger(false)
{
}
@ -140,22 +147,22 @@ QStringList cSerie::networks()
return(m_szNetworks);
}
void cSerie::setEpisodes(const qint16& iEpisodes)
void cSerie::setEpisodes(const qint32& iEpisodes)
{
m_iEpisodes = iEpisodes;
}
qint16 cSerie::episodes()
qint32 cSerie::episodes()
{
return(m_iEpisodes);
}
void cSerie::setSeasons(const qint16& iSeasons)
void cSerie::setSeasons(const qint32& iSeasons)
{
m_iSeasons = iSeasons;
}
qint16 cSerie::seasons()
qint32 cSerie::seasons()
{
return(m_iSeasons);
}
@ -239,12 +246,12 @@ qreal cSerie::voteAverage()
return(m_dVoteAverage);
}
void cSerie::setVoteCount(const qint16& iVoteCount)
void cSerie::setVoteCount(const qint32& iVoteCount)
{
m_iVoteCount = iVoteCount;
}
qint16 cSerie::voteCount()
qint32 cSerie::voteCount()
{
return(m_iVoteCount);
}
@ -311,6 +318,56 @@ QStringList cSerie::genre()
return(m_szGenre);
}
void cSerie::setIMDBID(const QString& szIMDBID)
{
m_szIMDBID = szIMDBID;
}
QString cSerie::IMDBID()
{
return(m_szIMDBID);
}
void cSerie::setFreebaseMID(const QString& szFreebaseMID)
{
m_szFreebaseMID = szFreebaseMID;
}
QString cSerie::freebaseMID()
{
return(m_szFreebaseMID);
}
void cSerie::setFreebaseID(const QString& szFreebaseID)
{
m_szFreebaseID = szFreebaseID;
}
QString cSerie::freebaseID()
{
return(m_szFreebaseID);
}
void cSerie::setTVDBID(const qint32& iTVDBID)
{
m_iTVDBID = iTVDBID;
}
qint32 cSerie::tvdbID()
{
return(m_iTVDBID);
}
void cSerie::setTVRageID(const qint32& iTVRageID)
{
m_iTVRageID = iTVRageID;
}
qint32 cSerie::tvrageID()
{
return(m_iTVRageID);
}
void cSerie::setStatus(const QString& szStatus)
{
m_szStatus = szStatus;
@ -331,6 +388,26 @@ QString cSerie::download()
return(m_szDownload);
}
void cSerie::setLocalPath(const QString& szLocalPath)
{
m_szLocalPath = szLocalPath;
}
QString cSerie::localPath()
{
return(m_szLocalPath);
}
void cSerie::setResolution(const QString& szResolution)
{
m_szResolution = szResolution;
}
QString cSerie::resolution()
{
return(m_szResolution);
}
void cSerie::setCliffhanger(const bool& bCliffhanger)
{
m_bCliffhanger = bCliffhanger;
@ -341,7 +418,7 @@ bool cSerie::cliffhanger()
return(m_bCliffhanger);
}
cSeason* cSerie::addSeason(const qint16& iSeason)
cSeason* cSerie::addSeason(const qint32& iSeason)
{
cSeason* lpNew = new cSeason;
lpNew->setSeasonNumber(iSeason);
@ -350,14 +427,14 @@ cSeason* cSerie::addSeason(const qint16& iSeason)
return(lpNew);
}
cSeason* cSerie::findSeason(const qint16& iSeason)
cSeason* cSerie::findSeason(const qint32& iSeason)
{
for(int z = 0;z < m_seasonList.count();z++)
{
if(m_seasonList.at(z)->seasonNumber() == iSeason)
return(m_seasonList.at(z));
}
return(0);
return(nullptr);
}
QList<cSeason*> cSerie::seasonList()
@ -365,9 +442,9 @@ QList<cSeason*> cSerie::seasonList()
return(m_seasonList);
}
qint16 cSerie::minSeason()
qint32 cSerie::minSeason()
{
qint16 iMin = 9999;
qint32 iMin = 9999;
for(int z = 0;z < m_seasonList.count();z++)
{
if(m_seasonList.at(z)->seasonNumber() < iMin)
@ -378,9 +455,9 @@ qint16 cSerie::minSeason()
return(iMin);
}
qint16 cSerie::maxSeason()
qint32 cSerie::maxSeason()
{
qint16 iMax = -1;
qint32 iMax = -1;
for(int z = 0;z < m_seasonList.count();z++)
{
if(m_seasonList.at(z)->seasonNumber() > iMax)
@ -401,7 +478,7 @@ cEpisode* cSerie::findEpisode(const qint32& id)
return(lpEpisode);
}
}
return(0);
return(nullptr);
}
bool cSerie::isValid()
@ -412,9 +489,9 @@ bool cSerie::isValid()
return(false);
}
qint16 cSerie::maxEpisode()
qint32 cSerie::maxEpisode()
{
qint16 iMax = -1;
qint32 iMax = -1;
for(int z = 0;z < m_seasonList.count();z++)
{
if(m_seasonList.at(z)->episodeCount() > iMax)
@ -423,18 +500,63 @@ qint16 cSerie::maxEpisode()
return(iMax);
}
bool cSerie::hasInit()
{
for(int x = 0;x < m_seasonList.count();x++)
{
cSeason* lpSeason = m_seasonList.at(x);
if(!lpSeason->seasonNumber())
continue;
if(lpSeason->hasInit())
return(true);
}
return(false);
}
bool cSerie::hasProgress()
{
for(int x = 0;x < m_seasonList.count();x++)
{
cSeason* lpSeason = m_seasonList.at(x);
if(!lpSeason->seasonNumber())
continue;
if(lpSeason->hasProgress())
return(true);
}
return(false);
}
bool cSerie::hasDone()
{
for(int x = 0;x < m_seasonList.count();x++)
{
cSeason* lpSeason = m_seasonList.at(x);
if(!lpSeason->seasonNumber())
continue;
if(lpSeason->hasDone())
return(true);
}
return(false);
}
bool cSerie::save(QSqlDatabase &db)
{
QSqlQuery query;
QSqlQuery querySerie;
QSqlQuery querySeason;
QSqlQuery queryEpisode;
QSqlQuery queryFanart;
querySerie.prepare("INSERT INTO serie (seriesID,seriesName,originalName,backdropPath,createdBy,homepage,lastAired,languages,networks,nrEpisodes,nrSeasons,originCountries,originalLanguage,popularity,posterPath,productionCompanies,type,voteAverage,voteCount,overview,firstAired,cast,crew,genre,status,download,cliffhanger)"
" VALUES (:seriesID,:seriesName,:originalName,:backdropPath,:createdBy,:homepage,:lastAired,:languages,:networks,:nrEpisodes,:nrSeasons,:originCountries,:originalLanguage,:popularity,:posterPath,:productionCompanies,:type,:voteAverage,:voteCount,:overview,:firstAired,:cast,:crew,:genre,:status,:download,:cliffhanger);");
querySerie.prepare("INSERT INTO serie (seriesID,seriesName,originalName,backdropPath,createdBy,homepage,lastAired,languages,networks,nrEpisodes,nrSeasons,originCountries,originalLanguage,popularity,posterPath,productionCompanies,type,voteAverage,voteCount,overview,firstAired,cast,crew,genre,imdbid,freebasemid,freebaseid,tvdbid,tvrageid,status,download,localPath,resolution,cliffhanger)"
" VALUES (:seriesID,:seriesName,:originalName,:backdropPath,:createdBy,:homepage,:lastAired,:languages,:networks,:nrEpisodes,:nrSeasons,:originCountries,:originalLanguage,:popularity,:posterPath,:productionCompanies,:type,:voteAverage,:voteCount,:overview,:firstAired,:cast,:crew,:genre,:imdbid,:freebasemid,:freebaseid,:tvdbid,:tvrageid,:status,:download,:localPath,:resolution,:cliffhanger);");
querySeason.prepare("INSERT INTO season (_id,airDate,name,overview,id,posterPath,seasonNumber,seriesID) VALUES (:_id,:airDate,:name,:overview,:id,:posterPath,:seasonNumber,:seriesID);");
queryEpisode.prepare("INSERT INTO episode (id,name,episodeNumber,airDate,guestStars,overview,productioncode,seasonNumber,seasonID,seriesID,stillPath,voteAverage,voteCount,crew,state)"
" VALUES (:id,:name,:episodeNumber,:airDate,:guestStars,:overview,:productioncode,:seasonNumber,:seasonID,:seriesID,:stillPath,:voteAverage,:voteCount,:crew,:state);");
queryFanart.prepare("INSERT INTO fanart (id,type,url,language,likes,season,active,seriesID) VALUES (:id,:type,:url,:language,:likes,:season,:active,:seriesID);");
db.transaction();
query.exec(QString("SELECT seriesID FROM serie WHERE seriesID=%1;").arg(seriesID()));
if(!query.next())
@ -465,8 +587,15 @@ bool cSerie::save(QSqlDatabase &db)
querySerie.bindValue(":cast", cast().join("|"));
querySerie.bindValue(":crew", crew().join("|"));
querySerie.bindValue(":genre", genre().join(","));
querySerie.bindValue(":imdbid", IMDBID());
querySerie.bindValue(":freebasemid", freebaseMID());
querySerie.bindValue(":freebaseid", freebaseID());
querySerie.bindValue(":tvdbid", tvdbID());
querySerie.bindValue("tvrageid", tvrageID());
querySerie.bindValue(":status", status());
querySerie.bindValue(":download", download());
querySerie.bindValue(":localPath", localPath());
querySerie.bindValue(":resolution", resolution());
querySerie.bindValue(":cliffhanger", cliffhanger());
if(querySerie.exec())
{
@ -491,31 +620,44 @@ bool cSerie::save(QSqlDatabase &db)
{
cEpisode* lpEpisode = episodeList.at(episode);
//query.bindValue(":episodeID", lpEpisode->id());
//query.exec();
//if(!query.next())
queryEpisode.bindValue(":id", lpEpisode->id());
queryEpisode.bindValue(":name", lpEpisode->name());
queryEpisode.bindValue(":episodeNumber", lpEpisode->episodeNumber());
queryEpisode.bindValue(":airDate", lpEpisode->airDate());
queryEpisode.bindValue(":guestStars", lpEpisode->guestStars().join("|"));
queryEpisode.bindValue(":overview", lpEpisode->overview());
queryEpisode.bindValue(":productioncode", lpEpisode->productionCode());
queryEpisode.bindValue(":seasonNumber", lpEpisode->seasonNumber());
queryEpisode.bindValue(":seasonID", lpEpisode->seasonID());
queryEpisode.bindValue(":seriesID", lpEpisode->seriesID());
queryEpisode.bindValue(":stillPath", lpEpisode->stillPath());
queryEpisode.bindValue(":voteAverage", lpEpisode->voteAverage());
queryEpisode.bindValue(":voteCount", lpEpisode->voteCount());
queryEpisode.bindValue(":crew", lpEpisode->crew().join("|"));
queryEpisode.bindValue(":state", lpEpisode->state());
if(queryEpisode.exec())
{
queryEpisode.bindValue(":id", lpEpisode->id());
queryEpisode.bindValue(":name", lpEpisode->name());
queryEpisode.bindValue(":episodeNumber", lpEpisode->episodeNumber());
queryEpisode.bindValue(":airDate", lpEpisode->airDate());
queryEpisode.bindValue(":guestStars", lpEpisode->guestStars().join("|"));
queryEpisode.bindValue(":overview", lpEpisode->overview());
queryEpisode.bindValue(":productioncode", lpEpisode->productionCode());
queryEpisode.bindValue(":seasonNumber", lpEpisode->seasonNumber());
queryEpisode.bindValue(":seasonID", lpEpisode->seasonID());
queryEpisode.bindValue(":seriesID", lpEpisode->seriesID());
queryEpisode.bindValue(":stillPath", lpEpisode->stillPath());
queryEpisode.bindValue(":voteAverage", lpEpisode->voteAverage());
queryEpisode.bindValue(":voteCount", lpEpisode->voteCount());
queryEpisode.bindValue(":crew", lpEpisode->crew().join("|"));
queryEpisode.bindValue(":state", lpEpisode->state());
if(queryEpisode.exec())
{
}
}
}
}
for(int x = 0;x < m_fanartList.count();x++)
{
cFanart* lpFanart = m_fanartList.at(x);
queryFanart.bindValue(":id", lpFanart->id());
queryFanart.bindValue(":type", lpFanart->type());
queryFanart.bindValue(":url", lpFanart->url());
queryFanart.bindValue(":language", lpFanart->language());
queryFanart.bindValue(":likes", lpFanart->likes());
queryFanart.bindValue(":season", lpFanart->season());
queryFanart.bindValue(":active", lpFanart->active());
queryFanart.bindValue(":seriesID", seriesID());
if(queryFanart.exec())
{
}
else
qDebug() << queryFanart.lastError().text();
}
}
else
qDebug() << querySerie.lastError().text();
@ -530,6 +672,14 @@ bool cSerie::del(QSqlDatabase& db)
QSqlQuery query;
db.transaction();
if(m_fanartList.count())
{
query.prepare("DELETE FROM fanart WHERE seriesID=:seriesID;");
query.bindValue(":seriesID", seriesID());
query.exec();
}
query.prepare("DELETE FROM episode WHERE seriesID=:seriesID;");
query.bindValue(":seriesID", seriesID());
query.exec();
@ -612,14 +762,38 @@ void cSerie::deleteResources()
m_seasonList.at(z)->deleteResources();
}
cSerie* cSerieList::add(const qint32& iID)
void cSerie::loadFanart()
{
for(int z = 0;z < count();z++)
cFanartTV fanartTV;
m_fanartList = fanartTV.loadFanartSerie(tvdbID());
}
cFanartList cSerie::fanartList()
{
return(m_fanartList);
}
void cSerie::setFanartList(const cFanartList& fanartList)
{
m_fanartList = fanartList;
}
QString cSerie::fanartBanner()
{
for(int x = 0;x < m_fanartList.count();x++)
{
if(at(z)->seriesID() == iID)
return(at(z));
cFanart* lpFanartTV = m_fanartList.at(x);
if(lpFanartTV->type() == cFanart::TypeTVBanner)
return(lpFanartTV->url());
}
cSerie* lpNew = new cSerie;
return("");
}
cSerie* cSerieList::add(const qint32& iID)
{
cSerie* lpNew = find(iID);
if(!lpNew)
lpNew = new cSerie;
lpNew->setSeriesID(iID);
append(lpNew);
return(lpNew);
@ -630,15 +804,25 @@ cSerie* cSerieList::add(cSerie* lpSerie)
for(int z = 0;z < count();z++)
{
if(at(z) == lpSerie)
return(0);
return(nullptr);
}
append(lpSerie);
return(lpSerie);
}
qint16 cSerieList::minSeason()
cSerie* cSerieList::find(const qint32& iID)
{
for(int x = 0;x < count();x++)
{
if(at(x)->seriesID() == iID)
return(at(x));
}
return(nullptr);
}
qint32 cSerieList::minSeason()
{
qint16 iMin = 9999;
qint32 iMin = 9999;
for(int z = 0;z < count();z++)
{
if(at(z)->minSeason() < iMin)
@ -650,9 +834,9 @@ qint16 cSerieList::minSeason()
return(iMin);
}
qint16 cSerieList::maxSeason()
qint32 cSerieList::maxSeason()
{
qint16 iMax = -1;
qint32 iMax = -1;
for(int z = 0;z < count();z++)
{
if(at(z)->maxSeason() > iMax)
@ -665,9 +849,9 @@ qint16 cSerieList::maxSeason()
return(iMax);
}
qint16 cSerieList::maxEpisode()
qint32 cSerieList::maxEpisode()
{
qint16 iMax = -1;
qint32 iMax = -1;
for(int z = 0;z < count();z++)
{
if(at(z)->maxEpisode() > iMax)

@ -3,176 +3,873 @@
#include "cseason.h"
#include "cfanart.h"
#include <QMetaType>
#include <QDate>
#include <QSqlDatabase>
/*!
\brief
\class cSerie cserie.h "cserie.h"
*/
class cSerie
{
public:
cSerie();
/*!
\brief
\fn setSeriesName
\param szSeriesName
*/
void setSeriesName(const QString& szSeriesName);
/*!
\brief
\fn seriesName
\return QString
*/
QString seriesName();
/*!
\brief
\fn setOriginalName
\param szOriginalName
*/
void setOriginalName(const QString& szOriginalName);
/*!
\brief
\fn originalName
\return QString
*/
QString originalName();
/*!
\brief
\fn setSeriesID
\param iSeriesID
*/
void setSeriesID(const qint32& iSeriesID);
/*!
\brief
\fn seriesID
\return qint32
*/
qint32 seriesID();
/*!
\brief
\fn setBackdropPath
\param szBackdropPath
*/
void setBackdropPath(const QString& szBackdropPath);
/*!
\brief
\fn backdropPath
\return QString
*/
QString backdropPath();
/*!
\brief
\fn setCreatedBy
\param szCreatedBy
*/
void setCreatedBy(const QStringList& szCreatedBy);
/*!
\brief
\fn setCreatedBy
\param szCreatedBy
*/
void setCreatedBy(const QString& szCreatedBy);
/*!
\brief
\fn createdBy
\return QStringList
*/
QStringList createdBy();
/*!
\brief
\fn setHomepage
\param szHomepage
*/
void setHomepage(const QString& szHomepage);
/*!
\brief
\fn homepage
\return QString
*/
QString homepage();
/*!
\brief
\fn setLastAired
\param szLAstAired
*/
void setLastAired(const QString& szLAstAired);
/*!
\brief
\fn setLastAired
\param lastAired
*/
void setLastAired(const QDate& lastAired);
/*!
\brief
\fn lastAired
\return QDate
*/
QDate lastAired();
/*!
\brief
\fn setLanguages
\param szLanguages
*/
void setLanguages(const QString& szLanguages);
/*!
\brief
\fn setLanguages
\param szLanguages
*/
void setLanguages(const QStringList& szLanguages);
/*!
\brief
\fn languages
\return QStringList
*/
QStringList languages();
/*!
\brief
\fn setNetworks
\param szNetworks
*/
void setNetworks(const QStringList& szNetworks);
void setNetworks(const QString& szNetworks);
QStringList networks();
/*!
\brief
void setEpisodes(const qint16& iEpisodes);
qint16 episodes();
\fn setNetworks
\param szNetworks
*/
void setNetworks(const QString& szNetworks);
/*!
\brief
void setSeasons(const qint16& iSeasons);
qint16 seasons();
\fn networks
\return QStringList
*/
QStringList networks();
/*!
\brief
\fn setEpisodes
\param iEpisodes
*/
void setEpisodes(const qint32& iEpisodes);
/*!
\brief
\fn episodes
\return qint32
*/
qint32 episodes();
/*!
\brief
\fn setSeasons
\param iSeasons
*/
void setSeasons(const qint32& iSeasons);
/*!
\brief
\fn seasons
\return qint32
*/
qint32 seasons();
/*!
\brief
\fn setOriginCountries
\param szOriginCountries
*/
void setOriginCountries(const QStringList& szOriginCountries);
/*!
\brief
\fn setOriginCountries
\param szOriginCountries
*/
void setOriginCountries(const QString& szOriginCountries);
/*!
\brief
\fn originCountries
\return QStringList
*/
QStringList originCountries();
/*!
\brief
\fn setOriginalLanguage
\param szOriginalLanguage
*/
void setOriginalLanguage(const QString& szOriginalLanguage);
/*!
\brief
\fn originalLanguage
\return QString
*/
QString originalLanguage();
/*!
\brief
\fn setPopularity
\param dPopularity
*/
void setPopularity(const qreal& dPopularity);
/*!
\brief
\fn popularity
\return qreal
*/
qreal popularity();
/*!
\brief
\fn setPosterPath
\param szPosterPath
*/
void setPosterPath(const QString& szPosterPath);
/*!
\brief
\fn posterPath
\return QString
*/
QString posterPath();
/*!
\brief
\fn setProductionCompanies
\param szProductionCompanies
*/
void setProductionCompanies(const QStringList& szProductionCompanies);
/*!
\brief
\fn setProductionCompanies
\param szProductionCompanies
*/
void setProductionCompanies(const QString& szProductionCompanies);
/*!
\brief
\fn productionCompanies
\return QStringList
*/
QStringList productionCompanies();
/*!
\brief
\fn setType
\param szType
*/
void setType(const QString& szType);
/*!
\brief
\fn type
\return QString
*/
QString type();
/*!
\brief
\fn setVoteAverage
\param dVoteAverage
*/
void setVoteAverage(const qreal& dVoteAverage);
/*!
\brief
\fn voteAverage
\return qreal
*/
qreal voteAverage();
void setVoteCount(const qint16& iVoteCount);
qint16 voteCount();
/*!
\brief
\fn setVoteCount
\param iVoteCount
*/
void setVoteCount(const qint32& iVoteCount);
/*!
\brief
\fn voteCount
\return qint32
*/
qint32 voteCount();
/*!
\brief
\fn setOverview
\param szOverview
*/
void setOverview(const QString& szOverview);
/*!
\brief
\fn overview
\return QString
*/
QString overview();
/*!
\brief
\fn setFirstAired
\param szFirstAired
*/
void setFirstAired(const QString& szFirstAired);
/*!
\brief
\fn setFirstAired
\param firstAired
*/
void setFirstAired(const QDate& firstAired);
/*!
\brief
\fn firstAired
\return QDate
*/
QDate firstAired();
/*!
\brief
\fn setCast
\param szCast
*/
void setCast(const QStringList& szCast);
/*!
\brief
\fn cast
\return QStringList
*/
QStringList cast();
/*!
\brief
\fn setCrew
\param szCrew
*/
void setCrew(const QStringList& szCrew);
/*!
\brief
\fn crew
\return QStringList
*/
QStringList crew();
/*!
\brief
\fn setGenre
\param szGenre
*/
void setGenre(const QString& szGenre);
/*!
\brief
\fn setGenre
\param szGenre
*/
void setGenre(const QStringList& szGenre);
/*!
\brief
\fn genre
\return QStringList
*/
QStringList genre();
/*!
\brief
\fn setIMDBID
\param szIMDBID
*/
void setIMDBID(const QString& szIMDBID);
/*!
\brief
\fn IMDBID
\return QString
*/
QString IMDBID();
/*!
\brief
\fn setFreebaseMID
\param szFreebaseMID
*/
void setFreebaseMID(const QString& szFreebaseMID);
/*!
\brief
\fn freebaseMID
\return QString
*/
QString freebaseMID();
/*!
\brief
\fn setFreebaseID
\param szFreebaseID
*/
void setFreebaseID(const QString& szFreebaseID);
/*!
\brief
\fn freebaseID
\return QString
*/
QString freebaseID();
/*!
\brief
\fn setTVDBID
\param iTVDBID
*/
void setTVDBID(const qint32& iTVDBID);
/*!
\brief
\fn tvdbID
\return qint32
*/
qint32 tvdbID();
/*!
\brief
\fn setTVRageID
\param iTVRageID
*/
void setTVRageID(const qint32& iTVRageID);
/*!
\brief
\fn tvrageID
\return qint32
*/
qint32 tvrageID();
/*!
\brief
\fn setStatus
\param szStatus
*/
void setStatus(const QString& szStatus);
/*!
\brief
\fn status
\return QString
*/
QString status();
/*!
\brief
\fn setDownload
\param szDownload
*/
void setDownload(const QString& szDownload);
/*!
\brief
\fn download
\return QString
*/
QString download();
/*!
\brief
\fn setLocalPath
\param szLocalPath
*/
void setLocalPath(const QString& szLocalPath);
/*!
\brief
\fn localPath
\return QString
*/
QString localPath();
/*!
\brief
\fn setResolution
\param szResolution
*/
void setResolution(const QString& szResolution);
/*!
\brief
\fn resolution
\return QString
*/
QString resolution();
/*!
\brief
\fn setCliffhanger
\param bCliffhanger
*/
void setCliffhanger(const bool& bCliffhanger);
bool cliffhanger();
/*!
\brief
cSeason* addSeason(const qint16& iSeason);
QList<cSeason*> seasonList();
\fn cliffhanger
\return bool
*/
bool cliffhanger();
cSeason* findSeason(const qint16& iSeason);
/*!
\brief
qint16 minSeason();
qint16 maxSeason();
\fn addSeason
\param iSeason
\return cSeason
*/
cSeason* addSeason(const qint32& iSeason);
/*!
\brief
qint16 maxEpisode();
\fn seasonList
\return QList<cSeason *>
*/
QList<cSeason*> seasonList();
/*!
\brief
\fn findSeason
\param iSeason
\return cSeason
*/
cSeason* findSeason(const qint32& iSeason);
/*!
\brief
\fn minSeason
\return qint32
*/
qint32 minSeason();
/*!
\brief
\fn maxSeason
\return qint32
*/
qint32 maxSeason();
/*!
\brief
\fn maxEpisode
\return qint32
*/
qint32 maxEpisode();
/*!
\brief
\fn findEpisode
\param id
\return cEpisode
*/
cEpisode* findEpisode(const qint32& id);
/*!
\brief
\fn isValid
\return bool
*/
bool isValid();
/*!
\brief
\fn hasInit
\return bool
*/
bool hasInit();
/*!
\brief
\fn hasProgress
\return bool
*/
bool hasProgress();
/*!
\brief
\fn hasDone
\return bool
*/
bool hasDone();
/*!
\brief
\fn save
\param db
\return bool
*/
bool save(QSqlDatabase& db);
/*!
\brief
\fn del
\param db
\return bool
*/
bool del(QSqlDatabase& db);
/*!
\brief
\fn allInit
*/
void allInit();
/*!
\brief
\fn allProgress
*/
void allProgress();
/*!
\brief
\fn allDone
*/
void allDone();
/*!
\brief
\fn seasonInit
\param lpButton
*/
void seasonInit(QPushButton* lpButton);
/*!
\brief
\fn seasonProgress
\param lpButton
*/
void seasonProgress(QPushButton* lpButton);
/*!
\brief
\fn seasonDone
\param lpButton
*/
void seasonDone(QPushButton* lpButton);
/*!
\brief
\fn updateState
*/
void updateState();
/*!
\brief
\fn deleteResources
*/
void deleteResources();
/*!
\brief
\fn loadFanart
*/
void loadFanart();
/*!
\brief
\fn setFanartList
\param fanartList
*/
void setFanartList(const cFanartList& fanartList);
/*!
\brief
\fn fanartList
\return cFanartList
*/
cFanartList fanartList();
/*!
\brief
\fn fanartBanner
\return QString
*/
QString fanartBanner();
private:
QString m_szSeriesName;
QString m_szOriginalName;
qint32 m_iSeriesID;
QString m_szBackdropPath;
QStringList m_szCreatedBy;
QString m_szHomepage;
QDate m_lastAired;
QStringList m_szLanguages;
QStringList m_szNetworks;
qint16 m_iEpisodes;
qint16 m_iSeasons;
QStringList m_szOriginCountries;
QString m_szOriginalLanguage;
qreal m_dPopularity;
QString m_szPosterPath;
QStringList m_szProductionCompanies;
QString m_szType;
qreal m_dVoteAverage;
qint16 m_iVoteCount;
QString m_szOverview;
QDate m_firstAired;
QStringList m_szCast;
QStringList m_szCrew;
QStringList m_szGenre;
QString m_szStatus;
QString m_szDownload;
bool m_bCliffhanger;
QList<cSeason*> m_seasonList;
QString m_szSeriesName; /*!< TODO: describe */
QString m_szOriginalName; /*!< TODO: describe */
qint32 m_iSeriesID; /*!< TODO: describe */
QString m_szBackdropPath; /*!< TODO: describe */
QStringList m_szCreatedBy; /*!< TODO: describe */
QString m_szHomepage; /*!< TODO: describe */
QDate m_lastAired; /*!< TODO: describe */
QStringList m_szLanguages; /*!< TODO: describe */
QStringList m_szNetworks; /*!< TODO: describe */
qint32 m_iEpisodes; /*!< TODO: describe */
qint32 m_iSeasons; /*!< TODO: describe */
QStringList m_szOriginCountries; /*!< TODO: describe */
QString m_szOriginalLanguage; /*!< TODO: describe */
qreal m_dPopularity; /*!< TODO: describe */
QString m_szPosterPath; /*!< TODO: describe */
QStringList m_szProductionCompanies; /*!< TODO: describe */
QString m_szType; /*!< TODO: describe */
qreal m_dVoteAverage; /*!< TODO: describe */
qint32 m_iVoteCount; /*!< TODO: describe */
QString m_szOverview; /*!< TODO: describe */
QDate m_firstAired; /*!< TODO: describe */
QStringList m_szCast; /*!< TODO: describe */
QStringList m_szCrew; /*!< TODO: describe */
QStringList m_szGenre; /*!< TODO: describe */
QString m_szIMDBID; /*!< TODO: describe */
QString m_szFreebaseMID; /*!< TODO: describe */
QString m_szFreebaseID; /*!< TODO: describe */
qint32 m_iTVDBID; /*!< TODO: describe */
qint32 m_iTVRageID; /*!< TODO: describe */
QString m_szStatus; /*!< TODO: describe */
QString m_szDownload; /*!< TODO: describe */
QString m_szLocalPath; /*!< TODO: describe */
QString m_szResolution; /*!< TODO: describe */
bool m_bCliffhanger; /*!< TODO: describe */
cFanartList m_fanartList; /*!< TODO: describe */
QList<cSeason*> m_seasonList; /*!< TODO: describe */
};
Q_DECLARE_METATYPE(cSerie*)
/*!
\brief
\class cSerieList cserie.h "cserie.h"
*/
class cSerieList : public QList<cSerie*>
{
public:
/*!
\brief
\fn add
\param iID
\return cSerie
*/
cSerie* add(const qint32& iID);
cSerie* add(cSerie* lpSerie);
/*!
\brief
qint16 minSeason();
qint16 maxSeason();
\fn add
\param lpSerie
\return cSerie
*/
cSerie* add(cSerie* lpSerie);
qint16 maxEpisode();
/*!
\brief
\fn find
\param iID
\return cSerie
*/
cSerie* find(const qint32& iID);
/*!
\brief
\fn minSeason
\return qint32
*/
qint32 minSeason();
/*!
\brief
\fn maxSeason
\return qint32
*/
qint32 maxSeason();
/*!
\brief
\fn maxEpisode
\return qint32
*/
qint32 maxEpisode();
};
#endif // CSERIE_H

@ -0,0 +1,63 @@
#include "cseriedetails.h"
#include "ui_cseriedetails.h"
#include "cmovieimage.h"
cSerieDetails::cSerieDetails(QWidget *parent) :
QWidget(parent),
ui(new Ui::cSerieDetails),
m_lpActorsModel(0),
m_lpGenreModel(0)
{
ui->setupUi(this);
m_lpActorsModel = new QStandardItemModel(0, 0);
ui->m_lpDetailsActors->setModel(m_lpActorsModel);
m_lpGenreModel = new QStandardItemModel(0, 0);
ui->m_lpDetailsGenre->setModel(m_lpGenreModel);
}
cSerieDetails::~cSerieDetails()
{
delete m_lpActorsModel;
delete m_lpGenreModel;
delete ui;
}
void cSerieDetails::setSerie(cSerie* lpSerie)
{
ui->m_lpName->setText(lpSerie->seriesName());
ui->m_lpFirstAired->setDate(lpSerie->firstAired());
ui->m_lpVoting->setText(QString::number(lpSerie->voteAverage()));
ui->m_lpDetailsBanner->clear();
if(!lpSerie->backdropPath().isEmpty())
{
cMovieImage image;
QPixmap banner = image.getImage(lpSerie->backdropPath());
ui->m_lpDetailsBanner->setPixmap(banner);
}
ui->m_lpDetailsOverview->setText(lpSerie->overview());
m_lpActorsModel->clear();
for(int x = 0;x < lpSerie->cast().count();x++)
{
QList<QStandardItem*> items;
QStringList str = lpSerie->cast().at(x).split(",");
items.append(new QStandardItem(str.at(0)));
items.append(new QStandardItem(str.at(1)));
m_lpActorsModel->appendRow(items);
}
ui->m_lpDetailsActors->resizeColumnToContents(0);
m_lpGenreModel->clear();
for(int x = 0;x < lpSerie->genre().count();x++)
m_lpGenreModel->appendRow(new QStandardItem(lpSerie->genre().at(x)));
ui->m_lpDetailsGenre->resizeColumnToContents(0);
}

@ -0,0 +1,52 @@
#ifndef CSERIEDETAILS_H
#define CSERIEDETAILS_H
#include "cserie.h"
#include <QWidget>
#include <QStandardItemModel>
namespace Ui {
class cSerieDetails;
}
/*!
\brief
\class cSerieDetails cseriedetails.h "cseriedetails.h"
*/
class cSerieDetails : public QWidget
{
Q_OBJECT
public:
/*!
\brief
\fn cSerieDetails
\param parent
*/
explicit cSerieDetails(QWidget *parent = 0);
/*!
\brief
\fn ~cSerieDetails
*/
~cSerieDetails();
/*!
\brief
\fn setSerie
\param lpSerie
*/
void setSerie(cSerie* lpSerie);
private:
Ui::cSerieDetails* ui; /*!< TODO: describe */
QStandardItemModel* m_lpActorsModel; /*!< TODO: describe */
QStandardItemModel* m_lpGenreModel; /*!< TODO: describe */
};
#endif // CSERIEDETAILS_H

@ -0,0 +1,206 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>cSerieDetails</class>
<widget class="QWidget" name="cSerieDetails">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>860</width>
<height>516</height>
</rect>
</property>
<property name="windowTitle">
<string>Form</string>
</property>
<layout class="QGridLayout" name="gridLayout">
<item row="0" column="0">
<layout class="QHBoxLayout" name="horizontalLayout_6">
<item>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<layout class="QHBoxLayout" name="horizontalLayout_2">
<item>
<widget class="QLineEdit" name="m_lpName">
<property name="readOnly">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="label_4">
<property name="text">
<string>Year:</string>
</property>
</widget>
</item>
<item>
<widget class="QDateEdit" name="m_lpFirstAired">
<property name="readOnly">
<bool>true</bool>
</property>
</widget>
</item>
</layout>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<widget class="QLabel" name="label">
<property name="text">
<string>Voting:</string>
</property>
</widget>
</item>
<item>
<widget class="QLineEdit" name="m_lpVoting">
<property name="readOnly">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</item>
<item>
<spacer name="verticalSpacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>40</height>
</size>
</property>
</spacer>
</item>
</layout>
</item>
<item>
<widget class="QLabel" name="m_lpDetailsBanner">
<property name="minimumSize">
<size>
<width>310</width>
<height>200</height>
</size>
</property>
<property name="frameShape">
<enum>QFrame::Box</enum>
</property>
<property name="text">
<string/>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
</widget>
</item>
</layout>
</item>
<item row="1" column="0">
<widget class="QScrollArea" name="scrollArea">
<property name="widgetResizable">
<bool>true</bool>
</property>
<widget class="QWidget" name="scrollAreaWidgetContents">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>840</width>
<height>288</height>
</rect>
</property>
<layout class="QGridLayout" name="gridLayout_4">
<item row="0" column="0">
<layout class="QHBoxLayout" name="horizontalLayout_5">
<item>
<widget class="QTextEdit" name="m_lpDetailsOverview">
<property name="readOnly">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<layout class="QVBoxLayout" name="verticalLayout_4" stretch="2,1">
<item>
<layout class="QHBoxLayout" name="horizontalLayout_4">
<item>
<widget class="cVerticalLabel" name="label_2">
<property name="text">
<string>Actors</string>
</property>
</widget>
</item>
<item>
<widget class="QTreeView" name="m_lpDetailsActors">
<property name="editTriggers">
<set>QAbstractItemView::NoEditTriggers</set>
</property>
<property name="alternatingRowColors">
<bool>true</bool>
</property>
<attribute name="headerVisible">
<bool>false</bool>
</attribute>
</widget>
</item>
</layout>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_3">
<item>
<widget class="cVerticalLabel" name="label_3">
<property name="text">
<string>Genre</string>
</property>
</widget>
</item>
<item>
<widget class="QTreeView" name="m_lpDetailsGenre">
<property name="editTriggers">
<set>QAbstractItemView::NoEditTriggers</set>
</property>
<property name="alternatingRowColors">
<bool>true</bool>
</property>
<attribute name="headerVisible">
<bool>false</bool>
</attribute>
</widget>
</item>
</layout>
</item>
</layout>
</item>
</layout>
</item>
</layout>
</widget>
</widget>
</item>
</layout>
</widget>
<customwidgets>
<customwidget>
<class>cVerticalLabel</class>
<extends>QLabel</extends>
<header>cverticallabel.h</header>
</customwidget>
</customwidgets>
<resources/>
<connections/>
</ui>

@ -0,0 +1,35 @@
#include "csplashscreen.h"
#include "common.h"
cSplashScreen::cSplashScreen(const QPixmap& pixmap, QFont& font) :
QSplashScreen(pixmap)
{
setFont(font);
m_textDocument.setDefaultFont(font);
}
void cSplashScreen::drawContents(QPainter *painter)
{
painter->translate(m_rect.topLeft());
m_textDocument.setHtml(m_szMessage);
m_textDocument.drawContents(painter);
}
void cSplashScreen::showStatusMessage(const QString& message)
{
m_szMessage = message;
showMessage(m_szMessage);
}
void cSplashScreen::addStatusMessage(const QString& message)
{
m_szMessage.append(message);
showMessage(m_szMessage);
}
void cSplashScreen::setMessageRect(QRect rect)
{
m_rect = rect;
m_textDocument.setTextWidth(rect.width());
}

@ -0,0 +1,26 @@
#ifndef CSPLASHSCREEN_H
#define CSPLASHSCREEN_H
#include <QSplashScreen>
#include <QPainter>
#include <QTextDocument>
class cSplashScreen : public QSplashScreen
{
public:
cSplashScreen(const QPixmap& pixmap, QFont &font);
virtual void drawContents(QPainter *painter);
void showStatusMessage(const QString &message);
void addStatusMessage(const QString &message);
void setMessageRect(QRect rect);
private:
QTextDocument m_textDocument;
QString m_szMessage;
QRect m_rect;
};
#endif // CSPLASHSCREEN_H

@ -0,0 +1,96 @@
#include "ctheaudiodbv1.h"
#include <QNetworkAccessManager>
#include <QNetworkRequest>
#include <QNetworkReply>
#include <QEventLoop>
#include <QByteArray>
#include <QJsonDocument>
#include <QJsonObject>
#include <QJsonArray>
#include <QApplication>
cTheAudioDBV1::cTheAudioDBV1()
{
m_szToken = "1";
}
cTheAudioDBV1::~cTheAudioDBV1()
{
}
QList<cArtist*> cTheAudioDBV1::searchArtist(const QString& szArtist)
{
QList<cArtist*> artistList;
QNetworkAccessManager networkManager;
// QString szRequest = QString("theaudiodb.com/api/v1/json/%1/search.php?s=%2").arg(m_szToken).arg(szArtist);
QNetworkRequest request(QUrl(QString("https://www.theaudiodb.com/api/v1/json/%1/search.php?s=%2").arg(m_szToken).arg(szArtist)));
QNetworkReply* reply = networkManager.get(request);
QEventLoop loop;
QObject::connect(reply, SIGNAL(finished()), &loop, SLOT(quit()));
loop.exec();
if (reply->error() == QNetworkReply::NoError)
{
QString strReply = (QString)reply->readAll();
QJsonDocument jsonResponse = QJsonDocument::fromJson(strReply.toUtf8());
QJsonObject jsonObj = jsonResponse.object();
QJsonArray jsonArray = jsonObj["artists"].toArray();
for(int z = 0;z < jsonArray.count();z++)
{
QJsonObject artist = jsonArray[z].toObject();
cArtist* lpArtist = new cArtist;
lpArtist->setArtistID(artist["idArtist"].toInt());
lpArtist->setArtist(artist["strArtist"].toString());
lpArtist->setArtistStripped(artist["strArtistStripped"].toString());
lpArtist->setArtistAlernate(artist["strArtistAlternate"].toString());
lpArtist->setLabel(artist["strLabel"].toString());
lpArtist->setLabelID(artist["idLabel"].toInt());
lpArtist->setFormedYear(artist["intFormedYear"].toInt());
lpArtist->setBornYear(artist["intBornYear"].toInt());
lpArtist->setDiedYear(artist["intDiedYear"].toInt());
lpArtist->setDisbanded(artist["strDisbanded"].toString());
lpArtist->setStyle(artist["strStyle"].toString());
lpArtist->setGenre(artist["strGenre"].toString());
lpArtist->setMood(artist["strMood"].toString());
lpArtist->setWebsite(artist["strWebsite"].toString());
lpArtist->setFacebook(artist["strFacebook"].toString());
lpArtist->setTwitter(artist["strTwitter"].toString());
lpArtist->setBiography(artist["strBiographyDE"].toString());
if(lpArtist->biography().isEmpty())
lpArtist->setBiography(artist["strBiographyEN"].toString());
lpArtist->setGender(artist["strGender"].toString());
lpArtist->setMembers(artist["intMembers"].toInt());
lpArtist->setCountry(artist["strCountry"].toString());
lpArtist->setCountryCode(artist["strCountryCode"].toString());
lpArtist->setArtistThumb(artist["strArtistThumb"].toString());
lpArtist->setArtistLogo(artist["strArtistLogo"].toString());
lpArtist->setArtistClearart(artist["strArtistClearart"].toString());
lpArtist->setArtistWideThumb(artist["strArtistWideThumb"].toString());
lpArtist->setArtistFanart(artist["strArtistFanart"].toString());
lpArtist->setArtistFanart2(artist["strArtistFanart2"].toString());
lpArtist->setArtistFanart3(artist["strArtistFanart3"].toString());
lpArtist->setArtistBanner(artist["strArtistBanner"].toString());
lpArtist->setMusicBrainzID(artist["strMusicBrainzID"].toString());
lpArtist->setLastFMChart(artist["strLastFMChart"].toString());
artistList.append(lpArtist);
}
delete reply;
}
else
{
qDebug() << reply->errorString();
delete reply;
}
return(artistList);
}

@ -0,0 +1,24 @@
#ifndef CTHEAUDIODBV1_H
#define CTHEAUDIODBV1_H
#include "cartist.h"
#include <QString>
#include <QList>
#include <QStringList>
#include <QMap>
class cTheAudioDBV1
{
public:
cTheAudioDBV1();
~cTheAudioDBV1();
QList<cArtist*> searchArtist(const QString& szArtist);
private:
QString m_szToken;
};
#endif // CTHEAUDIODBV1_H

@ -10,7 +10,9 @@
#include <QJsonObject>
#include <QJsonArray>
using std::pair;
#include <QApplication>
#include <QSettings>
cTheMovieDBV3::cTheMovieDBV3()
@ -18,12 +20,21 @@ cTheMovieDBV3::cTheMovieDBV3()
m_szToken = "a33271b9e54cdcb9a80680eaf5522f1b";
}
QList<cMovie*> cTheMovieDBV3::searchMovie(const QString& szMovie, const qint16& year, const QString& szLanguage)
cTheMovieDBV3::~cTheMovieDBV3()
{
}
QList<cMovie*> cTheMovieDBV3::searchMovie(cMovieList& movieListOri, const QString& szMovie, const qint32& year, const QString& szLanguage)
{
if(m_genres.isEmpty())
m_genres = genresMovie("de-DE");
QList<cMovie*> movieList;
QNetworkAccessManager networkManager;
QString szRequest = QString("https://api.themoviedb.org/3/search/movie?api_key=%1").arg(m_szToken);
qint16 page = 1;
qint32 page = 1;
QSettings settings;
qint32 iResults = settings.value("movieSearch/results", 100).toInt();
if(!szLanguage.contains("all"))
szRequest.append(QString("&language=%1").arg(szLanguage));
@ -47,7 +58,7 @@ QList<cMovie*> cTheMovieDBV3::searchMovie(const QString& szMovie, const qint16&
if (reply->error() == QNetworkReply::NoError)
{
QString strReply = (QString)reply->readAll();
QString strReply = QString(reply->readAll());
QJsonDocument jsonResponse = QJsonDocument::fromJson(strReply.toUtf8());
QJsonObject jsonObj = jsonResponse.object();
QJsonArray jsonArray = jsonObj["results"].toArray();
@ -55,18 +66,44 @@ QList<cMovie*> cTheMovieDBV3::searchMovie(const QString& szMovie, const qint16&
for(int z = 0;z < jsonArray.count();z++)
{
QJsonObject movie = jsonArray[z].toObject();
if(movieListOri.find(movie["id"].toInt()))
continue;
cMovie* lpMovie = new cMovie;
lpMovie->setMovieTitle(movie["title"].toString());
lpMovie->setMovieID(movie["id"].toInt());
lpMovie->setOriginalTitle(movie["original_title"].toString());
lpMovie->setReleaseDate(movie["release_date"].toString());
lpMovie->setVoteCount(movie["vote_count"].toInt());
lpMovie->setVideo(movie["video"].toBool());
lpMovie->setVoteAverage(movie["vote_average"].toDouble());
lpMovie->setPopularity(movie["popularity"].toDouble());
lpMovie->setPosterPath(movie["poster_path"].toString());
lpMovie->setOriginalLanguage(movie["original_language"].toString());
QJsonArray genresArray = movie["genre_ids"].toArray();
QList<qint32> genresIDs;
for(int y = 0;y < genresArray.count();y++)
genresIDs.append(genresArray[y].toInt());
if(genresIDs.count())
lpMovie->setGenres(genresFromID(genresIDs));
lpMovie->setBackdropPath(movie["backdrop_path"].toString());
lpMovie->setAdult(movie["adult"].toBool());
lpMovie->setOverview(movie["overview"].toString());
lpMovie->setReleaseDate(movie["release_date"].toString());
movieList.append(lpMovie);
if(movieList.count() >= iResults)
break;
}
if(jsonObj["total_pages"].toInt() == page)
break;
page++;
if(page > 20)
if(movieList.count() >= iResults)
break;
delete reply;
@ -80,12 +117,14 @@ QList<cMovie*> cTheMovieDBV3::searchMovie(const QString& szMovie, const qint16&
return(movieList);
}
QList<cSerie*> cTheMovieDBV3::searchSerie(const QString& szSerie, const qint16& year, const QString& szLanguage)
QList<cSerie*> cTheMovieDBV3::searchSerie(cSerieList& serieListOri, const QString& szSerie, const qint32& year, const QString& szLanguage)
{
QList<cSerie*> serieList;
QNetworkAccessManager networkManager;
QString szRequest = QString("https://api.themoviedb.org/3/search/tv?api_key=%1").arg(m_szToken);
qint16 page = 1;
qint32 page = 1;
QSettings settings;
qint32 iResults = settings.value("serieSearch/results", 100).toInt();
if(!szLanguage.contains("all"))
szRequest.append(QString("&language=%1").arg(szLanguage));
@ -113,22 +152,77 @@ QList<cSerie*> cTheMovieDBV3::searchSerie(const QString& szSerie, const qint16&
QJsonDocument jsonResponse = QJsonDocument::fromJson(strReply.toUtf8());
QJsonObject jsonObj = jsonResponse.object();
QJsonArray jsonArray = jsonObj["results"].toArray();
QJsonArray tmpArray;
QStringList tmpList;
for(int z = 0;z < jsonArray.count();z++)
{
QJsonObject serie = jsonArray[z].toObject();
if(serieListOri.find(serie["id"].toInt()))
continue;
cSerie* lpSerie = new cSerie;
lpSerie->setSeriesName(serie["name"].toString());
lpSerie->setSeriesID(serie["id"].toInt());
lpSerie->setOriginalName(serie["original_name"].toString());
lpSerie->setBackdropPath(serie["backdrop_path"].toString());
tmpArray = serie["created_by"].toArray();
for(int x = 0;x < tmpArray.count();x++)
tmpList.append(tmpArray.at(x).toObject()["name"].toString());
lpSerie->setCreatedBy(tmpList);
tmpList.clear();
lpSerie->setFirstAired(serie["first_air_date"].toString());
tmpArray = serie["genres"].toArray();
for(int x = 0;x < tmpArray.count();x++)
tmpList.append(tmpArray.at(x).toObject()["name"].toString());
lpSerie->setGenre(tmpList);
tmpList.clear();
lpSerie->setHomepage(serie["homepage"].toString());
lpSerie->setLastAired(serie["last_air_date"].toString());
tmpArray = serie["languages"].toArray();
for(int x = 0;x < tmpArray.count();x++)
tmpList.append(tmpArray.at(x).toString());
lpSerie->setLanguages(tmpList);
tmpList.clear();
lpSerie->setSeriesName(serie["name"].toString());
tmpArray = serie["networks"].toArray();
for(int x = 0;x < tmpArray.count();x++)
tmpList.append(tmpArray.at(x).toObject()["name"].toString());
lpSerie->setNetworks(tmpList);
tmpList.clear();
lpSerie->setEpisodes(serie["number_of_episodes"].toInt());
lpSerie->setSeasons(serie["number_of_seasons"].toInt());
tmpArray = serie["origin_country"].toArray();
for(int x = 0;x < tmpArray.count();x++)
tmpList.append(tmpArray.at(x).toString());
lpSerie->setOriginCountries(tmpList);
tmpList.clear();
lpSerie->setOriginalLanguage(serie["original_language"].toString());
lpSerie->setOriginalName(serie["original_name"].toString());
lpSerie->setOverview(serie["overview"].toString());
lpSerie->setPopularity(serie["popularity"].toDouble());
lpSerie->setPosterPath(serie["poster_path"].toString());
tmpArray = serie["production_companies"].toArray();
for(int x = 0;x < tmpArray.count();x++)
tmpList.append(tmpArray.at(x).toObject()["name"].toString());
lpSerie->setProductionCompanies(tmpList);
tmpList.clear();
lpSerie->setStatus(serie["status"].toString());
lpSerie->setType(serie["type"].toString());
lpSerie->setVoteAverage(serie["vote_average"].toDouble());
lpSerie->setVoteCount(serie["vote_count"].toInt());
serieList.append(lpSerie);
if(serieList.count() >= iResults)
break;
}
if(jsonObj["total_pages"].toInt() == page)
break;
page++;
if(page > 20)
if(serieList.count() >= iResults)
break;
delete reply;
@ -144,7 +238,7 @@ QList<cSerie*> cTheMovieDBV3::searchSerie(const QString& szSerie, const qint16&
cMovie* cTheMovieDBV3::loadMovie(const qint32 &iID, const QString &szLanguage)
{
cMovie* lpMovie = 0;
cMovie* lpMovie = nullptr;
QNetworkAccessManager networkManager;
QNetworkRequest request(QUrl(QString("https://api.themoviedb.org/3/movie/%1?api_key=%2&language=%3").arg(iID).arg(m_szToken).arg(szLanguage)));
@ -163,7 +257,7 @@ cMovie* cTheMovieDBV3::loadMovie(const qint32 &iID, const QString &szLanguage)
if (reply->error() == QNetworkReply::NoError)
{
QString strReply = (QString)reply->readAll();
QString strReply = QString(reply->readAll());
QJsonDocument jsonResponse = QJsonDocument::fromJson(strReply.toUtf8());
QJsonObject jsonObj = jsonResponse.object();
@ -248,7 +342,7 @@ cMovie* cTheMovieDBV3::loadMovie(const qint32 &iID, const QString &szLanguage)
if (reply->error() == QNetworkReply::NoError)
{
strReply = (QString)reply->readAll();
strReply = QString(reply->readAll());
jsonResponse = QJsonDocument::fromJson(strReply.toUtf8());
QJsonObject jsonCast = jsonResponse.object();
QJsonArray jsonArrayCast = jsonCast["cast"].toArray();
@ -301,7 +395,7 @@ cSerie* cTheMovieDBV3::loadSerie(const QString& szIMDBID)
if (reply->error() == QNetworkReply::NoError)
{
QString strReply = (QString)reply->readAll();
QString strReply = QString(reply->readAll());
QJsonDocument jsonResponse = QJsonDocument::fromJson(strReply.toUtf8());
QJsonObject jsonObj = jsonResponse.object();
@ -318,14 +412,14 @@ cSerie* cTheMovieDBV3::loadSerie(const QString& szIMDBID)
}
else
qDebug() << reply->errorString();
return(0);
return(nullptr);
}
cSerie* cTheMovieDBV3::loadSerie(const qint32 &iID, const QString& szLanguage)
{
cSerie* lpSerie = 0;
cSerie* lpSerie = nullptr;
QNetworkAccessManager networkManager;
QNetworkRequest request(QUrl(QString("https://api.themoviedb.org/3/tv/%1?api_key=%2&language=%3&append_to_response=credits").arg(iID).arg(m_szToken).arg(szLanguage)));
QNetworkRequest request(QUrl(QString("https://api.themoviedb.org/3/tv/%1?api_key=%2&language=%3&append_to_response=credits,external_ids").arg(iID).arg(m_szToken).arg(szLanguage)));
request.setRawHeader("Content-Type", "application/json");
request.setRawHeader("Authorization", QString("Bearer %1").arg(m_szToken).toUtf8());
@ -342,7 +436,7 @@ cSerie* cTheMovieDBV3::loadSerie(const qint32 &iID, const QString& szLanguage)
if (reply->error() == QNetworkReply::NoError)
{
QString strReply = (QString)reply->readAll();
QString strReply = QString(reply->readAll());
QJsonDocument jsonResponse = QJsonDocument::fromJson(strReply.toUtf8());
QJsonObject jsonObj = jsonResponse.object();
@ -403,8 +497,17 @@ cSerie* cTheMovieDBV3::loadSerie(const qint32 &iID, const QString& szLanguage)
lpSerie->setVoteAverage(jsonObj["vote_average"].toDouble());
lpSerie->setVoteCount(jsonObj["vote_count"].toInt());
QJsonObject creditsObj = jsonObj["credits"].toObject();
QJsonObject idsObj = jsonObj["external_ids"].toObject();
if(!idsObj.isEmpty())
{
lpSerie->setIMDBID(idsObj["imdb_id"].toString());
lpSerie->setFreebaseMID(idsObj["freebase_mid"].toString());
lpSerie->setFreebaseID(idsObj["freebase_id"].toString());
lpSerie->setTVDBID(idsObj["tvdb_id"].toInt());
lpSerie->setTVRageID(idsObj["tvrage_id"].toInt());
}
QJsonObject creditsObj = jsonObj["credits"].toObject();
if(!creditsObj.isEmpty())
{
QJsonArray jsonArrayCast = creditsObj["cast"].toArray();
@ -435,7 +538,7 @@ cSerie* cTheMovieDBV3::loadSerie(const qint32 &iID, const QString& szLanguage)
for(int x = 0; x < tmpArray.count();x++)
{
QJsonObject seasonObj = tmpArray.at(x).toObject();
qint16 seasonNumber = seasonObj["season_number"].toInt();
qint32 seasonNumber = seasonObj["season_number"].toInt();
cSeason* lpSeason = lpSerie->addSeason(seasonNumber);
request.setUrl(QUrl(QString("https://api.themoviedb.org/3/tv/%1/season/%2?api_key=%3&language=%4").arg(iID).arg(seasonNumber).arg(m_szToken).arg(szLanguage)));
@ -453,7 +556,7 @@ cSerie* cTheMovieDBV3::loadSerie(const qint32 &iID, const QString& szLanguage)
if (reply->error() == QNetworkReply::NoError)
{
strReply = (QString)reply->readAll();
strReply = QString(reply->readAll());
jsonResponse = QJsonDocument::fromJson(strReply.toUtf8());
QJsonObject jsonEpisodes = jsonResponse.object();
QJsonArray jsonArrayEpisodes = jsonEpisodes["episodes"].toArray();
@ -515,3 +618,402 @@ cSerie* cTheMovieDBV3::loadSerie(const qint32 &iID, const QString& szLanguage)
}
return(lpSerie);
}
QMap<qint32, QString> cTheMovieDBV3::genresMovie(const QString& szLanguage)
{
QMap<qint32, QString> genres;
QNetworkAccessManager networkManager;
QString szRequest = QString("https://api.themoviedb.org/3/genre/movie/list?api_key=%1").arg(m_szToken);
if(!szLanguage.contains("all"))
szRequest.append(QString("&language=%1").arg(szLanguage));
QNetworkReply* reply = networkManager.get(QNetworkRequest(QUrl(szRequest)));
QEventLoop loop;
QObject::connect(reply, SIGNAL(finished()), &loop, SLOT(quit()));
loop.exec();
if(reply->error() == QNetworkReply::NoError)
{
QString strReply = QString(reply->readAll());
QJsonDocument jsonResponse = QJsonDocument::fromJson(strReply.toUtf8());
QJsonObject jsonObj = jsonResponse.object();
QJsonArray jsonArray = jsonObj["genres"].toArray();
for(int z = 0;z < jsonArray.count();z++)
{
QJsonObject genre = jsonArray[z].toObject();
genres.insert(genre["id"].toInt(), genre["name"].toString());
}
}
else
{
qDebug() << reply->errorString();
delete reply;
}
delete reply;
return(genres);
}
QList<cMovie*> cTheMovieDBV3::discoverMovie(cMovieList& movieListOri, const QString& szText, const bool& bAdult, const qint32& iYear, const QList<qint32>& genres, const qreal& voteMin, const qreal& voteMax, const QString& szLanguage)
{
if(m_genres.isEmpty())
m_genres = genresMovie("de-DE");
QList<cMovie*> movieList;
QNetworkAccessManager networkManager;
QString szRequest = QString("https://api.themoviedb.org/3/discover/movie?api_key=%1").arg(m_szToken);
qint32 page = 1;
QSettings settings;
qint32 iResults = settings.value("movieDiscover/results", 100).toInt();
if(!szLanguage.contains("all"))
szRequest.append(QString("&language=%1").arg(szLanguage));
if(!szText.isEmpty())
szRequest.append(QString("&with_keywords=%1").arg(szText));
szRequest.append(QString("&include_adult=%1").arg(bAdult?"true":"false"));
szRequest.append(QString("&include_video=false"));
if(iYear != -1)
szRequest.append(QString("&year=%1").arg(iYear));
if(genres.count())
{
QString tmp = QString::number(genres[0]);
for(int x = 1;x < genres.count();x++)
tmp.append(QString(",%1").arg(genres[x]));
szRequest.append(QString("&with_genres=%1").arg(tmp));
}
szRequest.append(QString("&vote_average.gte=%1").arg(voteMin));
szRequest.append(QString("&vote_average.lte=%1").arg(voteMax));
for(;;)
{
QNetworkRequest request(QUrl(QString("%1&page=%2").arg(szRequest).arg(page)));
QNetworkReply* reply = networkManager.get(request);
QEventLoop loop;
QObject::connect(reply, SIGNAL(finished()), &loop, SLOT(quit()));
loop.exec();
if (reply->error() == QNetworkReply::NoError)
{
QString strReply = (QString)reply->readAll();
QJsonDocument jsonResponse = QJsonDocument::fromJson(strReply.toUtf8());
QJsonObject jsonObj = jsonResponse.object();
QJsonArray jsonArray = jsonObj["results"].toArray();
for(int z = 0;z < jsonArray.count();z++)
{
QJsonObject movie = jsonArray[z].toObject();
if(movieListOri.find(movie["id"].toInt()))
continue;
cMovie* lpMovie = new cMovie;
lpMovie->setMovieTitle(movie["title"].toString());
lpMovie->setMovieID(movie["id"].toInt());
lpMovie->setOriginalTitle(movie["original_title"].toString());
lpMovie->setReleaseDate(movie["release_date"].toString());
lpMovie->setVoteCount(movie["vote_count"].toInt());
lpMovie->setVideo(movie["video"].toBool());
lpMovie->setVoteAverage(movie["vote_average"].toDouble());
lpMovie->setPopularity(movie["popularity"].toDouble());
lpMovie->setPosterPath(movie["poster_path"].toString());
lpMovie->setOriginalLanguage(movie["original_language"].toString());
QJsonArray genresArray = movie["genre_ids"].toArray();
QList<qint32> genresIDs;
for(int y = 0;y < genresArray.count();y++)
genresIDs.append(genresArray[y].toInt());
if(genresIDs.count())
lpMovie->setGenres(genresFromID(genresIDs));
lpMovie->setBackdropPath(movie["backdrop_path"].toString());
lpMovie->setAdult(movie["adult"].toBool());
lpMovie->setOverview(movie["overview"].toString());
lpMovie->setReleaseDate(movie["release_date"].toString());
movieList.append(lpMovie);
if(movieList.count() >= iResults)
break;
}
if(jsonObj["total_pages"].toInt() == page)
break;
page++;
if(movieList.count() >= iResults)
break;
delete reply;
}
else
{
qDebug() << reply->errorString();
delete reply;
}
}
return(movieList);
}
QMap<qint32, QString> cTheMovieDBV3::genresSerie(const QString& szLanguage)
{
QMap<qint32, QString> genres;
QNetworkAccessManager networkManager;
QString szRequest = QString("https://api.themoviedb.org/3/genre/tv/list?api_key=%1").arg(m_szToken);
if(!szLanguage.contains("all"))
szRequest.append(QString("&language=%1").arg(szLanguage));
QNetworkReply* reply = networkManager.get(QNetworkRequest(QUrl(szRequest)));
QEventLoop loop;
QObject::connect(reply, SIGNAL(finished()), &loop, SLOT(quit()));
loop.exec();
if(reply->error() == QNetworkReply::NoError)
{
QString strReply = QString(reply->readAll());
QJsonDocument jsonResponse = QJsonDocument::fromJson(strReply.toUtf8());
QJsonObject jsonObj = jsonResponse.object();
QJsonArray jsonArray = jsonObj["genres"].toArray();
for(int z = 0;z < jsonArray.count();z++)
{
QJsonObject genre = jsonArray[z].toObject();
genres.insert(genre["id"].toInt(), genre["name"].toString());
}
}
else
{
qDebug() << reply->errorString();
delete reply;
}
delete reply;
return(genres);
}
QStringList cTheMovieDBV3::genresFromID(QList<qint32> genres)
{
QStringList szGenres;
for(int x = 0;x < genres.count();x++)
{
qint32 genre = genres[x];
QMapIterator<qint32, QString> iterator(m_genres);
while(iterator.hasNext())
{
iterator.next();
if(iterator.key() == genre)
{
szGenres.append(iterator.value());
break;
}
}
}
return(szGenres);
}
void cTheMovieDBV3::loadCastMovie(cMovie* lpMovie)
{
QNetworkAccessManager networkManager;
QNetworkRequest request(QUrl(QString("https://api.themoviedb.org/3/movie/%1/credits?api_key=%2").arg(lpMovie->movieID()).arg(m_szToken)));
request.setRawHeader("Content-Type", "application/json");
// if(!szLanguage.contains("all"))
// request.setRawHeader("Accept-Language", szLanguage.toUtf8());
// else
// request.setRawHeader("Accept-Language", "en");
request.setRawHeader("Accept-Language", "de");
QNetworkReply* reply = networkManager.get(request);
QEventLoop loop;
QObject::connect(reply, SIGNAL(finished()), &loop, SLOT(quit()));
loop.exec();
if (reply->error() == QNetworkReply::NoError)
{
QString strReply = QString(reply->readAll());
QJsonDocument jsonResponse = QJsonDocument::fromJson(strReply.toUtf8());
QJsonObject jsonCast = jsonResponse.object();
QJsonArray jsonArrayCast = jsonCast["cast"].toArray();
QJsonArray jsonArrayCrew = jsonCast["crew"].toArray();
QJsonObject tmpObj;
QStringList szCast;
QStringList szCrew;
delete reply;
for(int x = 0;x < jsonArrayCast.count();x++)
{
tmpObj = jsonArrayCast.at(x).toObject();
szCast.append(QString("%1,%2").arg(tmpObj["name"].toString()).arg(tmpObj["character"].toString()));
}
if(szCast.count())
lpMovie->setCast(szCast);
for(int x = 0;x < jsonArrayCrew.count();x++)
{
tmpObj = jsonArrayCrew.at(x).toObject();
szCrew.append(QString("%1,%2").arg(tmpObj["name"].toString()).arg(tmpObj["job"].toString()));
}
if(szCrew.count())
lpMovie->setCrew(szCrew);
}
}
QList<cSerie*> cTheMovieDBV3::discoverSerie(cSerieList& serieListOri, const QString& szText, const qint32& iYear, const QList<qint32>& genres, const qreal& voteMin, const qreal& voteMax, const QString& szLanguage)
{
if(m_genres.isEmpty())
m_genres = genresMovie("de-DE");
QList<cSerie*> serieList;
QNetworkAccessManager networkManager;
QString szRequest = QString("https://api.themoviedb.org/3/discover/tv?api_key=%1").arg(m_szToken);
qint32 page = 1;
QSettings settings;
qint32 iResults = settings.value("serieDiscover/results", 100).toInt();
if(!szLanguage.contains("all"))
szRequest.append(QString("&language=%1").arg(szLanguage));
if(!szText.isEmpty())
szRequest.append(QString("&with_keywords=%1").arg(szText));
if(iYear != -1)
szRequest.append(QString("&first_air_date_year=%1").arg(iYear));
if(genres.count())
{
QString tmp = QString::number(genres[0]);
for(int x = 1;x < genres.count();x++)
tmp.append(QString(",%1").arg(genres[x]));
szRequest.append(QString("&with_genres=%1").arg(tmp));
}
szRequest.append(QString("&vote_average.gte=%1").arg(voteMin));
szRequest.append(QString("&vote_average.lte=%1").arg(voteMax));
for(;;)
{
QNetworkRequest request(QUrl(QString("%1&page=%2").arg(szRequest).arg(page)));
QNetworkReply* reply = networkManager.get(request);
QEventLoop loop;
QObject::connect(reply, SIGNAL(finished()), &loop, SLOT(quit()));
loop.exec();
if (reply->error() == QNetworkReply::NoError)
{
QString strReply = QString(reply->readAll());
QJsonDocument jsonResponse = QJsonDocument::fromJson(strReply.toUtf8());
QJsonObject jsonObj = jsonResponse.object();
QJsonArray jsonArray = jsonObj["results"].toArray();
QJsonArray tmpArray;
QStringList tmpList;
for(int z = 0;z < jsonArray.count();z++)
{
QJsonObject serie = jsonArray[z].toObject();
if(serieListOri.find(serie["id"].toInt()))
continue;
cSerie* lpSerie = new cSerie;
lpSerie->setSeriesID(serie["id"].toInt());
lpSerie->setBackdropPath(serie["backdrop_path"].toString());
tmpArray = serie["created_by"].toArray();
for(int x = 0;x < tmpArray.count();x++)
tmpList.append(tmpArray.at(x).toObject()["name"].toString());
lpSerie->setCreatedBy(tmpList);
tmpList.clear();
lpSerie->setFirstAired(serie["first_air_date"].toString());
tmpArray = serie["genres"].toArray();
for(int x = 0;x < tmpArray.count();x++)
tmpList.append(tmpArray.at(x).toObject()["name"].toString());
lpSerie->setGenre(tmpList);
tmpList.clear();
lpSerie->setHomepage(serie["homepage"].toString());
lpSerie->setLastAired(serie["last_air_date"].toString());
tmpArray = serie["languages"].toArray();
for(int x = 0;x < tmpArray.count();x++)
tmpList.append(tmpArray.at(x).toString());
lpSerie->setLanguages(tmpList);
tmpList.clear();
lpSerie->setSeriesName(serie["name"].toString());
tmpArray = serie["networks"].toArray();
for(int x = 0;x < tmpArray.count();x++)
tmpList.append(tmpArray.at(x).toObject()["name"].toString());
lpSerie->setNetworks(tmpList);
tmpList.clear();
lpSerie->setEpisodes(serie["number_of_episodes"].toInt());
lpSerie->setSeasons(serie["number_of_seasons"].toInt());
tmpArray = serie["origin_country"].toArray();
for(int x = 0;x < tmpArray.count();x++)
tmpList.append(tmpArray.at(x).toString());
lpSerie->setOriginCountries(tmpList);
tmpList.clear();
lpSerie->setOriginalLanguage(serie["original_language"].toString());
lpSerie->setOriginalName(serie["original_name"].toString());
lpSerie->setOverview(serie["overview"].toString());
lpSerie->setPopularity(serie["popularity"].toDouble());
lpSerie->setPosterPath(serie["poster_path"].toString());
tmpArray = serie["production_companies"].toArray();
for(int x = 0;x < tmpArray.count();x++)
tmpList.append(tmpArray.at(x).toObject()["name"].toString());
lpSerie->setProductionCompanies(tmpList);
tmpList.clear();
lpSerie->setStatus(serie["status"].toString());
lpSerie->setType(serie["type"].toString());
lpSerie->setVoteAverage(serie["vote_average"].toDouble());
lpSerie->setVoteCount(serie["vote_count"].toInt());
serieList.append(lpSerie);
if(serieList.count() >= iResults)
break;
}
if(jsonObj["total_pages"].toInt() == page)
break;
page++;
if(serieList.count() >= iResults)
break;
delete reply;
}
else
{
qDebug() << reply->errorString();
delete reply;
}
}
return(serieList);
}
void cTheMovieDBV3::loadCastSerie(cSerie* lpSerie)
{
cSerie* lpSerie1 = loadSerie(lpSerie->seriesID(), "DE-de");
lpSerie->setCast(lpSerie1->cast());
lpSerie->setCrew(lpSerie1->crew());
delete lpSerie1;
}

@ -8,24 +8,141 @@
#include <QString>
#include <QList>
#include <QStringList>
#include <QMap>
/*!
\brief
\class cTheMovieDBV3 cthemoviedbv3.h "cthemoviedbv3.h"
*/
class cTheMovieDBV3
{
public:
cTheMovieDBV3();
/*!
\brief
\fn ~cTheMovieDBV3
*/
~cTheMovieDBV3();
/*!
\brief
\fn searchMovie
\param szMovie
\param year
\param szLanguage
\return QList<cMovie *>
*/
QList<cMovie*> searchMovie(cMovieList& movieListOri, const QString& szMovie, const qint32& year = -1, const QString& szLanguage = "all");
/*!
\brief
\fn loadMovie
\param iID
\param szLanguage
\return cMovie
*/
cMovie* loadMovie(const qint32 &iID, const QString& szLanguage);
/*!
\brief
\fn genresMovie
\param szLanguage
\return QMap<qint32, QString>
*/
QMap<qint32, QString> genresMovie(const QString& szLanguage = "all");
/*!
\brief
\fn discoverMovie
\param szText
\param bAdult
\param iYear
\param genres
\param voteMin
\param voteMax
\param szLanguage
\return QList<cMovie *>
*/
QList<cMovie*> discoverMovie(cMovieList& movieListOri, const QString& szText, const bool& bAdult, const qint32& iYear, const QList<qint32>& genres, const qreal& voteMin, const qreal& voteMax, const QString& szLanguage = "all");
/*!
\brief
\fn loadCastMovie
\param lpMovie
*/
void loadCastMovie(cMovie* lpMovie);
QList<cMovie*> searchMovie(const QString& szMovie, const qint16& year = -1, const QString& szLanguage = "all");
cMovie* loadMovie(const qint32 &iID, const QString& szLanguage);
/*!
\brief
QList<cSerie*> searchSerie(const QString& szSerie, const qint16& year = -1, const QString& szLanguage = "all");
cSerie* loadSerie(const qint32 &iID, const QString& szLanguage);
cSerie* loadSerie(const QString& szIMDBID);
\fn searchSerie
\param szSerie
\param year
\param szLanguage
\return QList<cSerie *>
*/
QList<cSerie*> searchSerie(cSerieList& serieListOri, const QString& szSerie, const qint32& year = -1, const QString& szLanguage = "all");
/*!
\brief
\fn loadSerie
\param iID
\param szLanguage
\return cSerie
*/
cSerie* loadSerie(const qint32 &iID, const QString& szLanguage);
/*!
\brief
\fn loadSerie
\param szIMDBID
\return cSerie
*/
cSerie* loadSerie(const QString& szIMDBID);
/*!
\brief
\fn genresSerie
\param szLanguage
\return QMap<qint32, QString>
*/
QMap<qint32, QString> genresSerie(const QString& szLanguage = "all");
/*!
\brief
\fn discoverSerie
\param szText
\param iYear
\param genres
\param voteMin
\param voteMax
\param szLanguage
\return QList<cSerie *>
*/
QList<cSerie*> discoverSerie(cSerieList& serieListOri, const QString& szText, const qint32& iYear, const QList<qint32>& genres, const qreal& voteMin, const qreal& voteMax, const QString& szLanguage = "all");
/*!
\brief
\fn loadCastSerie
\param lpSerie
*/
void loadCastSerie(cSerie* lpSerie);
private:
QString m_szToken;
// QStringList getActors(const qint32& iID);
// void getEpisodes(cSerie* lpSerie, const QString& szLanguage);
// cEpisode* getEpisode(const qint32& iID, const QString& szLanguage);
QString m_szToken; /*!< TODO: describe */
QMap<qint32, QString> m_genres; /*!< TODO: describe */
/*!
\brief
\fn genresFromID
\param genres
\return QStringList
*/
QStringList genresFromID(QList<qint32> genres);
};
#endif // CTHEMOVIEDBV3_H

@ -1,88 +0,0 @@
#include "cupdatethread.h"
#include "cseason.h"
#include "cepisode.h"
#include "cmessagedialog.h"
#include "cthemoviedbv3.h"
#include <QMessageBox>
#include <QDebug>
#include <QTime>
cUpdateThread::cUpdateThread() :
m_bStop(false)
{
}
void cUpdateThread::stop()
{
QMutexLocker locker(&m_mutex);
m_bStop = true;
emit updateAppendMessage(" - cancel pending ...");
}
void cUpdateThread::run()
{
QTime timer;
timer.restart();
QString szFailed;
for(int x = 0;x < m_serieList.count();x++)
{
cSerie* lpSerie = m_serieList.at(x);
if(lpSerie)
{
emit updateMessage(lpSerie->seriesName(), x);
cTheMovieDBV3 theMovieDB;
cSerie* lpSerieNew;
if(lpSerie->seriesID() != -1 && lpSerie->seriesID() < 1000000)
{
lpSerieNew = theMovieDB.loadSerie(lpSerie->seriesID(), "de-DE");
if(!lpSerieNew)
lpSerieNew = theMovieDB.loadSerie(lpSerie->seriesID(), "en");
if(!lpSerieNew)
{
if(szFailed.length())
szFailed += ", ";
szFailed += lpSerie->seriesName();
continue;
}
lpSerieNew->setDownload(lpSerie->download());
for(int x = 0;x < lpSerieNew->seasonList().count();x++)
{
cSeason* lpSeasonNew = lpSerieNew->seasonList().at(x);
for(int y = 0;y < lpSeasonNew->episodeList().count();y++)
{
cEpisode* lpEpisodeNew = lpSeasonNew->episodeList().at(y);
cEpisode* lpEpisode = lpSerie->findEpisode(lpEpisodeNew->id());
if(lpEpisode)
lpEpisodeNew->setState(lpEpisode->state());
}
}
lpSerieNew->setCliffhanger(lpSerie->cliffhanger());
lpSerie->del(m_db);
lpSerieNew->save(m_db);
}
}
QMutexLocker locker(&m_mutex);
if(m_bStop)
break;
msleep(10);
}
if(szFailed.length())
{
QMessageBox msgBox;
msgBox.setText(szFailed + QString(" has failed to update."));
msgBox.exec();
}
}
void cUpdateThread::setData(cMessageDialog* lpMessageDialog, const cSerieList &serieList, const QSqlDatabase& db)
{
connect(lpMessageDialog->cancelButton(), SIGNAL(clicked()), this, SLOT(stop()));
m_serieList = serieList;
m_db = db;
}

@ -1,41 +0,0 @@
#ifndef CUPDATETHREAD_H
#define CUPDATETHREAD_H
#include "cmessagedialog.h"
#include "cserie.h"
#include <QThread>
#include <QMutexLocker>
#include <QList>
#include <QStandardItem>
#include <QSqlDatabase>
class cUpdateThread : public QThread
{
Q_OBJECT
public:
explicit cUpdateThread();
void setData(cMessageDialog *lpMessageDialog, const cSerieList& serieList, const QSqlDatabase& db);
public slots:
void stop();
signals:
void updateMessage(const QString& szMessage, const qint32 &iProgress);
void updateAppendMessage(const QString& szMessage);
private:
QMutex m_mutex;
bool m_bStop;
cSerieList m_serieList;
QSqlDatabase m_db;
QWidget* m_lpParent;
void run();
};
#endif // CUPDATETHREAD_H

@ -5,18 +5,54 @@
#include <QLabel>
/*!
\brief
\class cVerticalLabel cverticallabel.h "cverticallabel.h"
*/
class cVerticalLabel : public QLabel
{
Q_OBJECT
public:
/*!
\brief
\fn cVerticalLabel
\param parent
*/
explicit cVerticalLabel(QWidget *parent = 0);
/*!
\brief
\fn cVerticalLabel
\param text
\param parent
*/
explicit cVerticalLabel(const QString &text, QWidget *parent=0);
signals:
protected:
/*!
\brief
\fn paintEvent
\param
*/
void paintEvent(QPaintEvent*);
/*!
\brief
\fn sizeHint
\return QSize
*/
QSize sizeHint() const ;
/*!
\brief
\fn minimumSizeHint
\return QSize
*/
QSize minimumSizeHint() const;
public slots:

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.0 MiB

@ -2,21 +2,47 @@
#include <QApplication>
#include <QSettings>
#include "csplashscreen.h"
#define SHOW_SPLASH
int main(int argc, char *argv[])
{
QApplication a(argc, argv);
QCoreApplication::setOrganizationName("WIN-DESIGN");
QCoreApplication::setOrganizationDomain("windesign.at");
QCoreApplication::setApplicationName("qtMovies");
QCoreApplication::setApplicationName("qtMultimediaDB");
QSettings settings;
#ifdef SHOW_SPLASH
QPixmap pixmap(":/splash.jpg");
#else
QPixmap pixmap(":/splashEmpty.png");
#endif
QFont splashFont;
splashFont.setPixelSize(18);
splashFont.setBold(true);
cSplashScreen splash(pixmap, splashFont);
splash.setMessageRect(QRect(85, 310, 200, 100));
splash.show();
splash.showStatusMessage("<center><font color='white'>initializing...</font></center>");
a.processEvents();
cMainWindow w;
if(settings.value("main/maximized").toBool())
w.showMaximized();
else
w.show();
splash.finish(&w);
return a.exec();
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 800 KiB

@ -8,11 +8,12 @@ QT += core gui network xml sql
greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
TARGET = qtMovies
TARGET = qtMultimediaDB
TEMPLATE = app
RC_ICONS = qtMultimediaDB.ico
SOURCES += main.cpp\
../weatherData/cmeteodata.cpp \
cmainwindow.cpp \
cserie.cpp \
cseasondelegate.cpp \
@ -21,12 +22,10 @@ SOURCES += main.cpp\
csearch.cpp \
cmessageanimatedialog.cpp \
cedit.cpp \
cimage.cpp \
cseasondetails.cpp \
cverticallabel.cpp \
cepisodedetails.cpp \
cmessagedialog.cpp \
cupdatethread.cpp \
cpicturesthread.cpp \
cthemoviedbv3.cpp \
cmovie.cpp \
@ -34,9 +33,26 @@ SOURCES += main.cpp\
cmovieviewitemdelegate.cpp \
common.cpp \
cmovieedit.cpp \
cmovieimage.cpp
cmovieimage.cpp \
cscrollarea.cpp \
cpixmapwidget.cpp \
cfanart.cpp \
cfanarttv.cpp \
cfanartimage.cpp \
cexportdialog.cpp \
cdiscover.cpp \
cmoviediscover.cpp \
qxtspanslider.cpp \
ccheckboxitemdelegate.cpp \
cmoviedetails.cpp \
cseriedetails.cpp \
ctheaudiodbv1.cpp \
cartist.cpp \
csplashscreen.cpp \
cpreferences.cpp
HEADERS += cmainwindow.h \
../weatherData/cmeteodata.h \
cserie.h \
cseasondelegate.h \
cseason.h \
@ -44,12 +60,10 @@ HEADERS += cmainwindow.h \
csearch.h \
cmessageanimatedialog.h \
cedit.h \
cimage.h \
cseasondetails.h \
cverticallabel.h \
cepisodedetails.h \
cmessagedialog.h \
cupdatethread.h \
cpicturesthread.h \
cthemoviedbv3.h \
cmovie.h \
@ -57,7 +71,24 @@ HEADERS += cmainwindow.h \
cmovieviewitemdelegate.h \
common.h \
cmovieedit.h \
cmovieimage.h
cmovieimage.h \
cscrollarea.h \
cpixmapwidget.h \
cfanart.h \
cfanarttv.h \
cfanartimage.h \
cexportdialog.h \
cdiscover.h \
cmoviediscover.h \
qxtspanslider.h \
qxtspanslider_p.h \
ccheckboxitemdelegate.h \
cmoviedetails.h \
cseriedetails.h \
ctheaudiodbv1.h \
cartist.h \
csplashscreen.h \
cpreferences.h
FORMS += cmainwindow.ui \
csearch.ui \
@ -67,9 +98,20 @@ FORMS += cmainwindow.ui \
cepisodedetails.ui \
cmessagedialog.ui \
cmoviesearch.ui \
cmovieedit.ui
cmovieedit.ui \
cexportdialog.ui \
cdiscover.ui \
cmoviediscover.ui \
cmoviedetails.ui \
cseriedetails.ui \
cpreferences.ui
DISTFILES +=
DISTFILES += \
Doxyfile \
logo.jpg \
splash.jpg \
splashEmpty.png \
qtMultimediaDB.ico
RESOURCES += \
resource.qrc

@ -0,0 +1,750 @@
#include "qxtspanslider.h"
/****************************************************************************
** Copyright (c) 2006 - 2011, the LibQxt project.
** See the Qxt AUTHORS file for a list of authors and copyright holders.
** All rights reserved.
**
** Redistribution and use in source and binary forms, with or without
** modification, are permitted provided that the following conditions are met:
** * Redistributions of source code must retain the above copyright
** notice, this list of conditions and the following disclaimer.
** * Redistributions in binary form must reproduce the above copyright
** notice, this list of conditions and the following disclaimer in the
** documentation and/or other materials provided with the distribution.
** * Neither the name of the LibQxt project nor the
** names of its contributors may be used to endorse or promote products
** derived from this software without specific prior written permission.
**
** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
** ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
** WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
** DISCLAIMED. IN NO EVENT SHALL <COPYRIGHT HOLDER> BE LIABLE FOR ANY
** DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
** (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
** LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
** ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
** SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
**
** <http://libqxt.org> <foundation@libqxt.org>
*****************************************************************************/
#include "qxtspanslider_p.h"
#include <QKeyEvent>
#include <QMouseEvent>
#include <QApplication>
#include <QStylePainter>
#include <QStyleOptionSlider>
QxtSpanSliderPrivate::QxtSpanSliderPrivate() :
lower(0),
upper(0),
lowerPos(0),
upperPos(0),
offset(0),
position(0),
lastPressed(QxtSpanSlider::NoHandle),
mainControl(QxtSpanSlider::LowerHandle),
lowerPressed(QStyle::SC_None),
upperPressed(QStyle::SC_None),
movement(QxtSpanSlider::FreeMovement),
firstMovement(false),
blockTracking(false)
{
}
void QxtSpanSliderPrivate::initStyleOption(QStyleOptionSlider* option, QxtSpanSlider::SpanHandle handle) const
{
const QxtSpanSlider* p = q_ptr;
p->initStyleOption(option);
option->sliderPosition = (handle == QxtSpanSlider::LowerHandle ? lowerPos : upperPos);
option->sliderValue = (handle == QxtSpanSlider::LowerHandle ? lower : upper);
}
int QxtSpanSliderPrivate::pixelPosToRangeValue(int pos) const
{
QStyleOptionSlider opt;
initStyleOption(&opt);
int sliderMin = 0;
int sliderMax = 0;
int sliderLength = 0;
const QSlider* p = q_ptr;
const QRect gr = p->style()->subControlRect(QStyle::CC_Slider, &opt, QStyle::SC_SliderGroove, p);
const QRect sr = p->style()->subControlRect(QStyle::CC_Slider, &opt, QStyle::SC_SliderHandle, p);
if (p->orientation() == Qt::Horizontal)
{
sliderLength = sr.width();
sliderMin = gr.x();
sliderMax = gr.right() - sliderLength + 1;
}
else
{
sliderLength = sr.height();
sliderMin = gr.y();
sliderMax = gr.bottom() - sliderLength + 1;
}
return QStyle::sliderValueFromPosition(p->minimum(), p->maximum(), pos - sliderMin,
sliderMax - sliderMin, opt.upsideDown);
}
void QxtSpanSliderPrivate::handleMousePress(const QPoint& pos, QStyle::SubControl& control, int value, QxtSpanSlider::SpanHandle handle)
{
QStyleOptionSlider opt;
initStyleOption(&opt, handle);
QxtSpanSlider* p = q_ptr;
const QStyle::SubControl oldControl = control;
control = p->style()->hitTestComplexControl(QStyle::CC_Slider, &opt, pos, p);
const QRect sr = p->style()->subControlRect(QStyle::CC_Slider, &opt, QStyle::SC_SliderHandle, p);
if (control == QStyle::SC_SliderHandle)
{
position = value;
offset = pick(pos - sr.topLeft());
lastPressed = handle;
p->setSliderDown(true);
emit p->sliderPressed(handle);
}
if (control != oldControl)
p->update(sr);
}
void QxtSpanSliderPrivate::setupPainter(QPainter* painter, Qt::Orientation orientation, qreal x1, qreal y1, qreal x2, qreal y2) const
{
QColor highlight = q_ptr->palette().color(QPalette::Highlight);
QLinearGradient gradient(x1, y1, x2, y2);
gradient.setColorAt(0, highlight.dark(120));
gradient.setColorAt(1, highlight.light(108));
painter->setBrush(gradient);
if (orientation == Qt::Horizontal)
painter->setPen(QPen(highlight.dark(130), 0));
else
painter->setPen(QPen(highlight.dark(150), 0));
}
void QxtSpanSliderPrivate::drawSpan(QStylePainter* painter, const QRect& rect) const
{
QStyleOptionSlider opt;
initStyleOption(&opt);
const QSlider* p = q_ptr;
// area
QRect groove = p->style()->subControlRect(QStyle::CC_Slider, &opt, QStyle::SC_SliderGroove, p);
if (opt.orientation == Qt::Horizontal)
groove.adjust(0, 0, -1, 0);
else
groove.adjust(0, 0, 0, -1);
// pen & brush
painter->setPen(QPen(p->palette().color(QPalette::Dark).light(110), 0));
if (opt.orientation == Qt::Horizontal)
setupPainter(painter, opt.orientation, groove.center().x(), groove.top(), groove.center().x(), groove.bottom());
else
setupPainter(painter, opt.orientation, groove.left(), groove.center().y(), groove.right(), groove.center().y());
// draw groove
painter->drawRect(rect.intersected(groove));
}
void QxtSpanSliderPrivate::drawHandle(QStylePainter* painter, QxtSpanSlider::SpanHandle handle) const
{
QStyleOptionSlider opt;
initStyleOption(&opt, handle);
opt.subControls = QStyle::SC_SliderHandle;
QStyle::SubControl pressed = (handle == QxtSpanSlider::LowerHandle ? lowerPressed : upperPressed);
if (pressed == QStyle::SC_SliderHandle)
{
opt.activeSubControls = pressed;
opt.state |= QStyle::State_Sunken;
}
painter->drawComplexControl(QStyle::CC_Slider, opt);
}
void QxtSpanSliderPrivate::triggerAction(QAbstractSlider::SliderAction action, bool main)
{
int value = 0;
bool no = false;
bool up = false;
const int min = q_ptr->minimum();
const int max = q_ptr->maximum();
const QxtSpanSlider::SpanHandle altControl = (mainControl == QxtSpanSlider::LowerHandle ? QxtSpanSlider::UpperHandle : QxtSpanSlider::LowerHandle);
blockTracking = true;
switch (action)
{
case QAbstractSlider::SliderSingleStepAdd:
if ((main && mainControl == QxtSpanSlider::UpperHandle) || (!main && altControl == QxtSpanSlider::UpperHandle))
{
value = qBound(min, upper + q_ptr->singleStep(), max);
up = true;
break;
}
value = qBound(min, lower + q_ptr->singleStep(), max);
break;
case QAbstractSlider::SliderSingleStepSub:
if ((main && mainControl == QxtSpanSlider::UpperHandle) || (!main && altControl == QxtSpanSlider::UpperHandle))
{
value = qBound(min, upper - q_ptr->singleStep(), max);
up = true;
break;
}
value = qBound(min, lower - q_ptr->singleStep(), max);
break;
case QAbstractSlider::SliderToMinimum:
value = min;
if ((main && mainControl == QxtSpanSlider::UpperHandle) || (!main && altControl == QxtSpanSlider::UpperHandle))
up = true;
break;
case QAbstractSlider::SliderToMaximum:
value = max;
if ((main && mainControl == QxtSpanSlider::UpperHandle) || (!main && altControl == QxtSpanSlider::UpperHandle))
up = true;
break;
case QAbstractSlider::SliderMove:
if ((main && mainControl == QxtSpanSlider::UpperHandle) || (!main && altControl == QxtSpanSlider::UpperHandle))
up = true;
case QAbstractSlider::SliderNoAction:
no = true;
break;
default:
qWarning("QxtSpanSliderPrivate::triggerAction: Unknown action");
break;
}
if (!no && !up)
{
if (movement == QxtSpanSlider::NoCrossing)
value = qMin(value, upper);
else if (movement == QxtSpanSlider::NoOverlapping)
value = qMin(value, upper - 1);
if (movement == QxtSpanSlider::FreeMovement && value > upper)
{
swapControls();
q_ptr->setUpperPosition(value);
}
else
{
q_ptr->setLowerPosition(value);
}
}
else if (!no)
{
if (movement == QxtSpanSlider::NoCrossing)
value = qMax(value, lower);
else if (movement == QxtSpanSlider::NoOverlapping)
value = qMax(value, lower + 1);
if (movement == QxtSpanSlider::FreeMovement && value < lower)
{
swapControls();
q_ptr->setLowerPosition(value);
}
else
{
q_ptr->setUpperPosition(value);
}
}
blockTracking = false;
q_ptr->setLowerValue(lowerPos);
q_ptr->setUpperValue(upperPos);
}
void QxtSpanSliderPrivate::swapControls()
{
qSwap(lower, upper);
qSwap(lowerPressed, upperPressed);
lastPressed = (lastPressed == QxtSpanSlider::LowerHandle ? QxtSpanSlider::UpperHandle : QxtSpanSlider::LowerHandle);
mainControl = (mainControl == QxtSpanSlider::LowerHandle ? QxtSpanSlider::UpperHandle : QxtSpanSlider::LowerHandle);
}
void QxtSpanSliderPrivate::updateRange(int min, int max)
{
Q_UNUSED(min);
Q_UNUSED(max);
// setSpan() takes care of keeping span in range
q_ptr->setSpan(lower, upper);
}
void QxtSpanSliderPrivate::movePressedHandle()
{
switch (lastPressed)
{
case QxtSpanSlider::LowerHandle:
if (lowerPos != lower)
{
bool main = (mainControl == QxtSpanSlider::LowerHandle);
triggerAction(QAbstractSlider::SliderMove, main);
}
break;
case QxtSpanSlider::UpperHandle:
if (upperPos != upper)
{
bool main = (mainControl == QxtSpanSlider::UpperHandle);
triggerAction(QAbstractSlider::SliderMove, main);
}
break;
default:
break;
}
}
/*!
\class QxtSpanSlider
\inmodule QxtWidgets
\brief The QxtSpanSlider widget is a QSlider with two handles.
QxtSpanSlider is a slider with two handles. QxtSpanSlider is
handy for letting user to choose an span between min/max.
The span color is calculated based on QPalette::Highlight.
The keys are bound according to the following table:
\table
\header \o Orientation \o Key \o Handle
\row \o Qt::Horizontal \o Qt::Key_Left \o lower
\row \o Qt::Horizontal \o Qt::Key_Right \o lower
\row \o Qt::Horizontal \o Qt::Key_Up \o upper
\row \o Qt::Horizontal \o Qt::Key_Down \o upper
\row \o Qt::Vertical \o Qt::Key_Up \o lower
\row \o Qt::Vertical \o Qt::Key_Down \o lower
\row \o Qt::Vertical \o Qt::Key_Left \o upper
\row \o Qt::Vertical \o Qt::Key_Right \o upper
\endtable
Keys are bound by the time the slider is created. A key is bound
to same handle for the lifetime of the slider. So even if the handle
representation might change from lower to upper, the same key binding
remains.
\image qxtspanslider.png "QxtSpanSlider in Plastique style."
\bold {Note:} QxtSpanSlider inherits QSlider for implementation specific
reasons. Adjusting any single handle specific properties like
\list
\o QAbstractSlider::sliderPosition
\o QAbstractSlider::value
\endlist
has no effect. However, all slider specific properties like
\list
\o QAbstractSlider::invertedAppearance
\o QAbstractSlider::invertedControls
\o QAbstractSlider::minimum
\o QAbstractSlider::maximum
\o QAbstractSlider::orientation
\o QAbstractSlider::pageStep
\o QAbstractSlider::singleStep
\o QSlider::tickInterval
\o QSlider::tickPosition
\endlist
are taken into consideration.
*/
/*!
\enum QxtSpanSlider::HandleMovementMode
This enum describes the available handle movement modes.
\value FreeMovement The handles can be moved freely.
\value NoCrossing The handles cannot cross, but they can still overlap each other. The lower and upper values can be the same.
\value NoOverlapping The handles cannot overlap each other. The lower and upper values cannot be the same.
*/
/*!
\enum QxtSpanSlider::SpanHandle
This enum describes the available span handles.
\omitvalue NoHandle \omit Internal only (for now). \endomit
\value LowerHandle The lower boundary handle.
\value UpperHandle The upper boundary handle.
*/
/*!
\fn QxtSpanSlider::lowerValueChanged(int lower)
This signal is emitted whenever the \a lower value has changed.
*/
/*!
\fn QxtSpanSlider::upperValueChanged(int upper)
This signal is emitted whenever the \a upper value has changed.
*/
/*!
\fn QxtSpanSlider::spanChanged(int lower, int upper)
This signal is emitted whenever both the \a lower and the \a upper
values have changed ie. the span has changed.
*/
/*!
\fn QxtSpanSlider::lowerPositionChanged(int lower)
This signal is emitted whenever the \a lower position has changed.
*/
/*!
\fn QxtSpanSlider::upperPositionChanged(int upper)
This signal is emitted whenever the \a upper position has changed.
*/
/*!
\fn QxtSpanSlider::sliderPressed(SpanHandle handle)
This signal is emitted whenever the \a handle has been pressed.
*/
/*!
Constructs a new QxtSpanSlider with \a parent.
*/
QxtSpanSlider::QxtSpanSlider(QWidget* parent) : QSlider(parent), d_ptr(new QxtSpanSliderPrivate())
{
d_ptr->q_ptr = this;
connect(this, SIGNAL(rangeChanged(int, int)), d_ptr, SLOT(updateRange(int, int)));
connect(this, SIGNAL(sliderReleased()), d_ptr, SLOT(movePressedHandle()));
}
/*!
Constructs a new QxtSpanSlider with \a orientation and \a parent.
*/
QxtSpanSlider::QxtSpanSlider(Qt::Orientation orientation, QWidget* parent) : QSlider(orientation, parent), d_ptr(new QxtSpanSliderPrivate())
{
d_ptr->q_ptr = this;
connect(this, SIGNAL(rangeChanged(int, int)), d_ptr, SLOT(updateRange(int, int)));
connect(this, SIGNAL(sliderReleased()), d_ptr, SLOT(movePressedHandle()));
}
/*!
Destructs the span slider.
*/
QxtSpanSlider::~QxtSpanSlider()
{
}
/*!
\property QxtSpanSlider::handleMovementMode
\brief the handle movement mode
*/
QxtSpanSlider::HandleMovementMode QxtSpanSlider::handleMovementMode() const
{
return d_ptr->movement;
}
void QxtSpanSlider::setHandleMovementMode(QxtSpanSlider::HandleMovementMode mode)
{
d_ptr->movement = mode;
}
/*!
\property QxtSpanSlider::lowerValue
\brief the lower value of the span
*/
int QxtSpanSlider::lowerValue() const
{
return qMin(d_ptr->lower, d_ptr->upper);
}
void QxtSpanSlider::setLowerValue(int lower)
{
setSpan(lower, d_ptr->upper);
}
/*!
\property QxtSpanSlider::upperValue
\brief the upper value of the span
*/
int QxtSpanSlider::upperValue() const
{
return qMax(d_ptr->lower, d_ptr->upper);
}
void QxtSpanSlider::setUpperValue(int upper)
{
setSpan(d_ptr->lower, upper);
}
/*!
Sets the span from \a lower to \a upper.
*/
void QxtSpanSlider::setSpan(int lower, int upper)
{
const int low = qBound(minimum(), qMin(lower, upper), maximum());
const int upp = qBound(minimum(), qMax(lower, upper), maximum());
if (low != d_ptr->lower || upp != d_ptr->upper)
{
if (low != d_ptr->lower)
{
d_ptr->lower = low;
d_ptr->lowerPos = low;
emit lowerValueChanged(low);
}
if (upp != d_ptr->upper)
{
d_ptr->upper = upp;
d_ptr->upperPos = upp;
emit upperValueChanged(upp);
}
emit spanChanged(d_ptr->lower, d_ptr->upper);
update();
}
}
/*!
\property QxtSpanSlider::lowerPosition
\brief the lower position of the span
*/
int QxtSpanSlider::lowerPosition() const
{
return d_ptr->lowerPos;
}
void QxtSpanSlider::setLowerPosition(int lower)
{
if (d_ptr->lowerPos != lower)
{
d_ptr->lowerPos = lower;
if (!hasTracking())
update();
if (isSliderDown())
emit lowerPositionChanged(lower);
if (hasTracking() && !d_ptr->blockTracking)
{
bool main = (d_ptr->mainControl == QxtSpanSlider::LowerHandle);
d_ptr->triggerAction(SliderMove, main);
}
}
}
/*!
\property QxtSpanSlider::upperPosition
\brief the upper position of the span
*/
int QxtSpanSlider::upperPosition() const
{
return d_ptr->upperPos;
}
void QxtSpanSlider::setUpperPosition(int upper)
{
if (d_ptr->upperPos != upper)
{
d_ptr->upperPos = upper;
if (!hasTracking())
update();
if (isSliderDown())
emit upperPositionChanged(upper);
if (hasTracking() && !d_ptr->blockTracking)
{
bool main = (d_ptr->mainControl == QxtSpanSlider::UpperHandle);
d_ptr->triggerAction(SliderMove, main);
}
}
}
/*!
\reimp
*/
void QxtSpanSlider::keyPressEvent(QKeyEvent* event)
{
QSlider::keyPressEvent(event);
bool main = true;
SliderAction action = SliderNoAction;
switch (event->key())
{
case Qt::Key_Left:
main = (orientation() == Qt::Horizontal);
action = !invertedAppearance() ? SliderSingleStepSub : SliderSingleStepAdd;
break;
case Qt::Key_Right:
main = (orientation() == Qt::Horizontal);
action = !invertedAppearance() ? SliderSingleStepAdd : SliderSingleStepSub;
break;
case Qt::Key_Up:
main = (orientation() == Qt::Vertical);
action = invertedControls() ? SliderSingleStepSub : SliderSingleStepAdd;
break;
case Qt::Key_Down:
main = (orientation() == Qt::Vertical);
action = invertedControls() ? SliderSingleStepAdd : SliderSingleStepSub;
break;
case Qt::Key_Home:
main = (d_ptr->mainControl == QxtSpanSlider::LowerHandle);
action = SliderToMinimum;
break;
case Qt::Key_End:
main = (d_ptr->mainControl == QxtSpanSlider::UpperHandle);
action = SliderToMaximum;
break;
default:
event->ignore();
break;
}
if (action)
d_ptr->triggerAction(action, main);
}
/*!
\reimp
*/
void QxtSpanSlider::mousePressEvent(QMouseEvent* event)
{
if (minimum() == maximum() || (event->buttons() ^ event->button()))
{
event->ignore();
return;
}
d_ptr->handleMousePress(event->pos(), d_ptr->upperPressed, d_ptr->upper, QxtSpanSlider::UpperHandle);
if (d_ptr->upperPressed != QStyle::SC_SliderHandle)
d_ptr->handleMousePress(event->pos(), d_ptr->lowerPressed, d_ptr->lower, QxtSpanSlider::LowerHandle);
d_ptr->firstMovement = true;
event->accept();
}
/*!
\reimp
*/
void QxtSpanSlider::mouseMoveEvent(QMouseEvent* event)
{
if (d_ptr->lowerPressed != QStyle::SC_SliderHandle && d_ptr->upperPressed != QStyle::SC_SliderHandle)
{
event->ignore();
return;
}
QStyleOptionSlider opt;
d_ptr->initStyleOption(&opt);
const int m = style()->pixelMetric(QStyle::PM_MaximumDragDistance, &opt, this);
int newPosition = d_ptr->pixelPosToRangeValue(d_ptr->pick(event->pos()) - d_ptr->offset);
if (m >= 0)
{
const QRect r = rect().adjusted(-m, -m, m, m);
if (!r.contains(event->pos()))
{
newPosition = d_ptr->position;
}
}
// pick the preferred handle on the first movement
if (d_ptr->firstMovement)
{
if (d_ptr->lower == d_ptr->upper)
{
if (newPosition < lowerValue())
{
d_ptr->swapControls();
d_ptr->firstMovement = false;
}
}
else
{
d_ptr->firstMovement = false;
}
}
if (d_ptr->lowerPressed == QStyle::SC_SliderHandle)
{
if (d_ptr->movement == NoCrossing)
newPosition = qMin(newPosition, upperValue());
else if (d_ptr->movement == NoOverlapping)
newPosition = qMin(newPosition, upperValue() - 1);
if (d_ptr->movement == FreeMovement && newPosition > d_ptr->upper)
{
d_ptr->swapControls();
setUpperPosition(newPosition);
}
else
{
setLowerPosition(newPosition);
}
}
else if (d_ptr->upperPressed == QStyle::SC_SliderHandle)
{
if (d_ptr->movement == NoCrossing)
newPosition = qMax(newPosition, lowerValue());
else if (d_ptr->movement == NoOverlapping)
newPosition = qMax(newPosition, lowerValue() + 1);
if (d_ptr->movement == FreeMovement && newPosition < d_ptr->lower)
{
d_ptr->swapControls();
setLowerPosition(newPosition);
}
else
{
setUpperPosition(newPosition);
}
}
event->accept();
}
/*!
\reimp
*/
void QxtSpanSlider::mouseReleaseEvent(QMouseEvent* event)
{
QSlider::mouseReleaseEvent(event);
setSliderDown(false);
d_ptr->lowerPressed = QStyle::SC_None;
d_ptr->upperPressed = QStyle::SC_None;
update();
}
/*!
\reimp
*/
void QxtSpanSlider::paintEvent(QPaintEvent* event)
{
Q_UNUSED(event);
QStylePainter painter(this);
// groove & ticks
QStyleOptionSlider opt;
d_ptr->initStyleOption(&opt);
opt.sliderValue = 0;
opt.sliderPosition = 0;
opt.subControls = QStyle::SC_SliderGroove | QStyle::SC_SliderTickmarks;
painter.drawComplexControl(QStyle::CC_Slider, opt);
// handle rects
opt.sliderPosition = d_ptr->lowerPos;
const QRect lr = style()->subControlRect(QStyle::CC_Slider, &opt, QStyle::SC_SliderHandle, this);
const int lrv = d_ptr->pick(lr.center());
opt.sliderPosition = d_ptr->upperPos;
const QRect ur = style()->subControlRect(QStyle::CC_Slider, &opt, QStyle::SC_SliderHandle, this);
const int urv = d_ptr->pick(ur.center());
// span
const int minv = qMin(lrv, urv);
const int maxv = qMax(lrv, urv);
const QPoint c = QRect(lr.center(), ur.center()).center();
QRect spanRect;
if (orientation() == Qt::Horizontal)
spanRect = QRect(QPoint(minv, c.y() - 2), QPoint(maxv, c.y() + 1));
else
spanRect = QRect(QPoint(c.x() - 2, minv), QPoint(c.x() + 1, maxv));
d_ptr->drawSpan(&painter, spanRect);
// handles
switch (d_ptr->lastPressed)
{
case QxtSpanSlider::LowerHandle:
d_ptr->drawHandle(&painter, QxtSpanSlider::UpperHandle);
d_ptr->drawHandle(&painter, QxtSpanSlider::LowerHandle);
break;
case QxtSpanSlider::UpperHandle:
default:
d_ptr->drawHandle(&painter, QxtSpanSlider::LowerHandle);
d_ptr->drawHandle(&painter, QxtSpanSlider::UpperHandle);
break;
}
}

@ -0,0 +1,276 @@
#ifndef QXTSPANSLIDER_H
/****************************************************************************
** Copyright (c) 2006 - 2011, the LibQxt project.
** See the Qxt AUTHORS file for a list of authors and copyright holders.
** All rights reserved.
**
** Redistribution and use in source and binary forms, with or without
** modification, are permitted provided that the following conditions are met:
** * Redistributions of source code must retain the above copyright
** notice, this list of conditions and the following disclaimer.
** * Redistributions in binary form must reproduce the above copyright
** notice, this list of conditions and the following disclaimer in the
** documentation and/or other materials provided with the distribution.
** * Neither the name of the LibQxt project nor the
** names of its contributors may be used to endorse or promote products
** derived from this software without specific prior written permission.
**
** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
** ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
** WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
** DISCLAIMED. IN NO EVENT SHALL <COPYRIGHT HOLDER> BE LIABLE FOR ANY
** DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
** (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
** LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
** ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
** SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
**
** <http://libqxt.org> <foundation@libqxt.org>
*****************************************************************************/
#define QXTSPANSLIDER_H
#include <QSlider>
//#include "qxtnamespace.h"
//#include "qxtglobal.h"
class QxtSpanSliderPrivate;
/*!
\brief
\class QxtSpanSlider qxtspanslider.h "qxtspanslider.h"
*/
class QxtSpanSlider : public QSlider {
Q_OBJECT
//QXT_DECLARE_PRIVATE(QxtSpanSlider)
Q_PROPERTY(int lowerValue READ lowerValue WRITE setLowerValue)
Q_PROPERTY(int upperValue READ upperValue WRITE setUpperValue)
Q_PROPERTY(int lowerPosition READ lowerPosition WRITE setLowerPosition)
Q_PROPERTY(int upperPosition READ upperPosition WRITE setUpperPosition)
Q_PROPERTY(HandleMovementMode handleMovementMode READ handleMovementMode WRITE setHandleMovementMode)
Q_ENUMS(HandleMovementMode)
public:
/*!
\brief
\fn QxtSpanSlider
\param parent
*/
explicit QxtSpanSlider(QWidget* parent = 0);
/*!
\brief
\fn QxtSpanSlider
\param orientation
\param parent
*/
explicit QxtSpanSlider(Qt::Orientation orientation, QWidget* parent = 0);
/*!
\brief
\fn ~QxtSpanSlider
*/
virtual ~QxtSpanSlider();
/*!
\brief
\enum HandleMovementMode
*/
enum HandleMovementMode
{
FreeMovement,
NoCrossing,
NoOverlapping
};
/*!
\brief
\enum SpanHandle
*/
enum SpanHandle
{
NoHandle,
LowerHandle,
UpperHandle
};
/*!
\brief
\fn handleMovementMode
\return HandleMovementMode
*/
HandleMovementMode handleMovementMode() const;
/*!
\brief
\fn setHandleMovementMode
\param mode
*/
void setHandleMovementMode(HandleMovementMode mode);
/*!
\brief
\fn lowerValue
\return int
*/
int lowerValue() const;
/*!
\brief
\fn upperValue
\return int
*/
int upperValue() const;
/*!
\brief
\fn lowerPosition
\return int
*/
int lowerPosition() const;
/*!
\brief
\fn upperPosition
\return int
*/
int upperPosition() const;
public Q_SLOTS:
/*!
\brief
\fn setLowerValue
\param lower
*/
void setLowerValue(int lower);
/*!
\brief
\fn setUpperValue
\param upper
*/
void setUpperValue(int upper);
/*!
\brief
\fn setSpan
\param lower
\param upper
*/
void setSpan(int lower, int upper);
/*!
\brief
\fn setLowerPosition
\param lower
*/
void setLowerPosition(int lower);
/*!
\brief
\fn setUpperPosition
\param upper
*/
void setUpperPosition(int upper);
Q_SIGNALS:
/*!
\brief
\fn spanChanged
\param lower
\param upper
*/
void spanChanged(int lower, int upper);
/*!
\brief
\fn lowerValueChanged
\param lower
*/
void lowerValueChanged(int lower);
/*!
\brief
\fn upperValueChanged
\param upper
*/
void upperValueChanged(int upper);
/*!
\brief
\fn lowerPositionChanged
\param lower
*/
void lowerPositionChanged(int lower);
/*!
\brief
\fn upperPositionChanged
\param upper
*/
void upperPositionChanged(int upper);
/*!
\brief
\fn sliderPressed
\param handle
*/
void sliderPressed(SpanHandle handle);
protected:
/*!
\brief
\fn keyPressEvent
\param event
*/
virtual void keyPressEvent(QKeyEvent* event);
/*!
\brief
\fn mousePressEvent
\param event
*/
virtual void mousePressEvent(QMouseEvent* event);
/*!
\brief
\fn mouseMoveEvent
\param event
*/
virtual void mouseMoveEvent(QMouseEvent* event);
/*!
\brief
\fn mouseReleaseEvent
\param event
*/
virtual void mouseReleaseEvent(QMouseEvent* event);
/*!
\brief
\fn paintEvent
\param event
*/
virtual void paintEvent(QPaintEvent* event);
private:
QxtSpanSliderPrivate* d_ptr; /*!< TODO: describe */
friend class QxtSpanSliderPrivate;
};
#endif // QXTSPANSLIDER_H

@ -0,0 +1,173 @@
#ifndef QXTSPANSLIDER_P_H
/****************************************************************************
** Copyright (c) 2006 - 2011, the LibQxt project.
** See the Qxt AUTHORS file for a list of authors and copyright holders.
** All rights reserved.
**
** Redistribution and use in source and binary forms, with or without
** modification, are permitted provided that the following conditions are met:
** * Redistributions of source code must retain the above copyright
** notice, this list of conditions and the following disclaimer.
** * Redistributions in binary form must reproduce the above copyright
** notice, this list of conditions and the following disclaimer in the
** documentation and/or other materials provided with the distribution.
** * Neither the name of the LibQxt project nor the
** names of its contributors may be used to endorse or promote products
** derived from this software without specific prior written permission.
**
** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
** ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
** WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
** DISCLAIMED. IN NO EVENT SHALL <COPYRIGHT HOLDER> BE LIABLE FOR ANY
** DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
** (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
** LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
** ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
** SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
**
** <http://libqxt.org> <foundation@libqxt.org>
*****************************************************************************/
#define QXTSPANSLIDER_P_H
#include <QStyle>
#include <QObject>
#include "qxtspanslider.h"
QT_FORWARD_DECLARE_CLASS(QStylePainter)
QT_FORWARD_DECLARE_CLASS(QStyleOptionSlider)
/*!
\brief
\class QxtSpanSliderPrivate qxtspanslider_p.h "qxtspanslider_p.h"
*/
class QxtSpanSliderPrivate : public QObject {
Q_OBJECT
public:
/*!
\brief
\fn QxtSpanSliderPrivate
*/
QxtSpanSliderPrivate();
/*!
\brief
\fn initStyleOption
\param option
\param handle
*/
void initStyleOption(QStyleOptionSlider* option, QxtSpanSlider::SpanHandle handle = QxtSpanSlider::UpperHandle) const;
/*!
\brief
\fn pick
\param pt
\return int
*/
int pick(const QPoint& pt) const
{
return q_ptr->orientation() == Qt::Horizontal ? pt.x() : pt.y();
}
/*!
\brief
\fn pixelPosToRangeValue
\param pos
\return int
*/
int pixelPosToRangeValue(int pos) const;
/*!
\brief
\fn handleMousePress
\param pos
\param control
\param value
\param handle
*/
void handleMousePress(const QPoint& pos, QStyle::SubControl& control, int value, QxtSpanSlider::SpanHandle handle);
/*!
\brief
\fn drawHandle
\param painter
\param handle
*/
void drawHandle(QStylePainter* painter, QxtSpanSlider::SpanHandle handle) const;
/*!
\brief
\fn setupPainter
\param painter
\param orientation
\param x1
\param y1
\param x2
\param y2
*/
void setupPainter(QPainter* painter, Qt::Orientation orientation, qreal x1, qreal y1, qreal x2, qreal y2) const;
/*!
\brief
\fn drawSpan
\param painter
\param rect
*/
void drawSpan(QStylePainter* painter, const QRect& rect) const;
/*!
\brief
\fn triggerAction
\param action
\param main
*/
void triggerAction(QAbstractSlider::SliderAction action, bool main);
/*!
\brief
\fn swapControls
*/
void swapControls();
int lower; /*!< TODO: describe */
int upper; /*!< TODO: describe */
int lowerPos; /*!< TODO: describe */
int upperPos; /*!< TODO: describe */
int offset; /*!< TODO: describe */
int position; /*!< TODO: describe */
QxtSpanSlider::SpanHandle lastPressed; /*!< TODO: describe */
QxtSpanSlider::SpanHandle mainControl; /*!< TODO: describe */
QStyle::SubControl lowerPressed; /*!< TODO: describe */
QStyle::SubControl upperPressed; /*!< TODO: describe */
QxtSpanSlider::HandleMovementMode movement; /*!< TODO: describe */
bool firstMovement; /*!< TODO: describe */
bool blockTracking; /*!< TODO: describe */
public Q_SLOTS:
/*!
\brief
\fn updateRange
\param min
\param max
*/
void updateRange(int min, int max);
/*!
\brief
\fn movePressedHandle
*/
void movePressedHandle();
private:
QxtSpanSlider* q_ptr; /*!< TODO: describe */
friend class QxtSpanSlider;
};
#endif // QXTSPANSLIDER_P_H

@ -2,5 +2,7 @@
<qresource prefix="/">
<file>empty.db</file>
<file>128279.png</file>
<file>splash.jpg</file>
<file>splashEmpty.png</file>
</qresource>
</RCC>

Binary file not shown.

After

Width:  |  Height:  |  Size: 69 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.0 KiB

Loading…
Cancel
Save