41 Commits

Author SHA1 Message Date
birkeh 464f546cfe migrate 2023-03-28 10:21:53 +02:00
birkeh 824238b995 update routine 2019-03-26 11:40:03 +01:00
birkeh 217fac56e4 added resolution to series and movies 2019-02-20 22:59:28 +01:00
birkeh 44fda299d2 added resolution field 2019-02-20 12:16:15 +01:00
birkeh 8915a0a216 added resolution field for series 2019-02-19 17:24:12 +01:00
birkeh 445ec6e3ba bug fixing 2019-02-13 14:01:25 +01:00
birkeh b0f5698610 added local path information to series 2019-01-24 08:51:31 +01:00
birkeh 6defbf5e83 Preferences Dialog 2018-11-24 22:45:04 +01:00
birkeh 5d55ee6dc4 sorting enabled 2018-11-22 13:52:32 +01:00
birkeh 7c79287e17 changed dialog titles 2018-11-22 13:32:11 +01:00
Herwig Birke 1790ec58e6 . 2018-11-20 09:37:09 +01:00
birkeh a1d8412143 minor changes 2018-11-12 16:44:13 +01:00
birkeh a9cce71939 project renamed 2018-11-12 13:21:34 +01:00
birkeh 8b17ebe2b5 some details added 2018-11-12 13:15:12 +01:00
birkeh b8c816af8d splash screen 2018-11-12 13:14:42 +01:00
Herwig Birke 775e183721 added AudioDB 2018-11-09 14:59:32 +01:00
Herwig Birke a568a7d985 Movie & Serie Discover 2018-11-08 10:20:52 +01:00
Herwig Birke b057e1d73a switched from QTreeWidget to QTreeView 2018-11-07 17:42:15 +01:00
Herwig Birke 8f63d174f3 added Doxygen 2018-11-07 13:08:42 +01:00
birkeh 1fb97e1891 added serie discover 2018-11-06 20:23:28 +01:00
birkeh ae35df6499 added movie discover 2018-11-04 20:45:20 +01:00
birkeh 0d610927ae added preview to movie search 2018-11-04 20:45:01 +01:00
birkeh 29feba342c Movie and Serie Discover 2018-11-03 22:32:05 +01:00
Herwig Birke f7d4f14b28 implemented export dialog 2018-10-25 10:10:33 +02:00
birkeh 1a5d4ad0ba removed cUpdateThread 2018-10-24 21:05:04 +02:00
birkeh ddcb197a6b added search function 2018-06-20 16:19:28 +02:00
birkeh 8c484e4739 added possibility to open all download links at once 2018-01-03 11:01:28 +01:00
birkeh 9bac9843b6 add application icon 2018-01-03 10:46:50 +01:00
Herwig Birke 395005b9fb added filter functionality, changed display procedure for movies 2017-12-07 16:40:46 +01:00
birkeh 940a51080e Merge branch 'master' of https://github.com/birkeh/qtMovies 2017-11-22 20:52:22 +01:00
birkeh 65abda249c . 2017-11-22 20:50:23 +01:00
birkeh cfc76f257f . 2017-11-21 08:32:39 +01:00
birkeh 86ef83024b . 2017-11-20 16:57:50 +01:00
birkeh 0cb0e3516c . 2017-11-20 16:22:53 +01:00
birkeh a28d2587f5 . 2017-11-13 14:01:49 +01:00
birkeh 7ab6d2eb2a . 2017-11-09 10:10:02 +01:00
birkeh 1b76553f2a . 2017-11-07 13:08:58 +01:00
birkeh 4caa5f7eb7 . 2017-11-06 18:14:50 +01:00
birkeh e010208520 . 2017-11-06 16:29:19 +01:00
birkeh dbb113e0da . 2017-11-04 11:41:41 +01:00
birkeh b9116dc732 . 2017-11-02 21:18:31 +01:00
94 changed files with 13786 additions and 1309 deletions
+2511
View File
File diff suppressed because it is too large Load Diff
+378
View File
@@ -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);
}
+124
View File
@@ -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
+29
View File
@@ -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));
}
+37
View File
@@ -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
+160
View File
@@ -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);
}
+85
View File
@@ -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
+233
View File
@@ -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>
+91 -41
View File
@@ -2,6 +2,8 @@
#include "ui_cedit.h" #include "ui_cedit.h"
#include "cmovieimage.h" #include "cmovieimage.h"
#include "cfanartimage.h"
#include "cseasondetails.h" #include "cseasondetails.h"
#include "cmessageanimatedialog.h" #include "cmessageanimatedialog.h"
@@ -17,6 +19,8 @@
#include <QLabel> #include <QLabel>
#include <QButtonGroup> #include <QButtonGroup>
#include <QSqlQuery>
#include <QDebug> #include <QDebug>
#include <QTime> #include <QTime>
@@ -25,27 +29,49 @@ cEdit::cEdit(QWidget *parent) :
QDialog(parent), QDialog(parent),
ui(new Ui::cEdit), ui(new Ui::cEdit),
m_bLoaded(false), m_bLoaded(false),
m_lpButton1(0), m_lpButton1(nullptr),
m_lpButton2(0), m_lpButton2(nullptr),
m_lpButton3(0), m_lpButton3(nullptr),
m_lpInit(0), m_lpInit(nullptr),
m_lpProgress(0), m_lpProgress(nullptr),
m_lpDone(0), m_lpDone(nullptr),
m_lpGroupBox(0), m_lpGroupBox(nullptr),
m_lpGridLayout(0), m_lpGridLayout(nullptr),
m_lpGrid(0), m_lpGrid(nullptr),
m_lpLabel(0), m_lpLabel(nullptr),
m_lpLabel1(0), m_lpLabel1(nullptr),
m_lpSpacer(0), m_lpSpacer(nullptr),
m_lpGroup(0), m_lpGroup(nullptr),
m_lpAllInit(0), m_lpAllInit(nullptr),
m_lpAllProgress(0), m_lpAllProgress(nullptr),
m_lpAllDone(0), m_lpAllDone(nullptr),
m_lpVerticalSpacer(0), m_lpVerticalSpacer(nullptr),
m_lpSerie(0) m_lpDetailsActorsModel(nullptr),
m_lpDetailsGenreModel(nullptr),
m_lpSerie(nullptr)
{ {
ui->setupUi(this); 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_lpAllInit, SIGNAL(clicked()), this, SLOT(lpAllInit_clicked()));
connect(ui->m_lpAllProgress, SIGNAL(clicked()), this, SLOT(lpAllProgress_clicked())); connect(ui->m_lpAllProgress, SIGNAL(clicked()), this, SLOT(lpAllProgress_clicked()));
connect(ui->m_lpAllDone, SIGNAL(clicked()), this, SLOT(lpAllDone_clicked())); connect(ui->m_lpAllDone, SIGNAL(clicked()), this, SLOT(lpAllDone_clicked()));
@@ -69,14 +95,17 @@ cEdit::~cEdit()
cEpisode* lpEpisode = episodeList.at(y); cEpisode* lpEpisode = episodeList.at(y);
if(lpEpisode) if(lpEpisode)
{ {
lpEpisode->setButton1(0); lpEpisode->setButton1(nullptr);
lpEpisode->setButton2(0); lpEpisode->setButton2(nullptr);
lpEpisode->setButton3(0); lpEpisode->setButton3(nullptr);
} }
} }
} }
} }
delete m_lpDetailsActorsModel;
delete m_lpDetailsGenreModel;
delete ui; delete ui;
} }
@@ -86,11 +115,23 @@ void cEdit::setSerie(cSerie* lpSerie)
if(!lpSerie) if(!lpSerie)
return; return;
ui->m_lpName->setText(lpSerie->seriesName()); ui->m_lpName->setText(lpSerie->seriesName());
ui->m_lpFirstAired->setDate(lpSerie->firstAired()); ui->m_lpFirstAired->setDate(lpSerie->firstAired());
ui->m_lpCliffhanger->setChecked(lpSerie->cliffhanger()); ui->m_lpCliffhanger->setChecked(lpSerie->cliffhanger());
ui->m_lpDownloadLink->setText(lpSerie->download()); 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; int x;
QList<cSeason*> seasonList = lpSerie->seasonList(); QList<cSeason*> seasonList = lpSerie->seasonList();
@@ -132,6 +173,7 @@ void cEdit::setSerie(cSerie* lpSerie)
m_lpGroup = new QButtonGroup(this); m_lpGroup = new QButtonGroup(this);
lpEpisode->setGroup(m_lpGroup); lpEpisode->setGroup(m_lpGroup);
m_lpLabel = new QLabel(QString("%1").arg(lpEpisode->episodeNumber()), m_lpGroupBox); m_lpLabel = new QLabel(QString("%1").arg(lpEpisode->episodeNumber()), m_lpGroupBox);
lpEpisode->setLabel(m_lpLabel); lpEpisode->setLabel(m_lpLabel);
if(bFirst) if(bFirst)
@@ -190,6 +232,11 @@ void cEdit::setSerie(cSerie* lpSerie)
m_lpVerticalSpacer = new QSpacerItem(20, 40, QSizePolicy::Minimum, QSizePolicy::Expanding); m_lpVerticalSpacer = new QSpacerItem(20, 40, QSizePolicy::Minimum, QSizePolicy::Expanding);
ui->m_lpGridLayoutScroll->addItem(m_lpVerticalSpacer, x+1, 0, 1, 1); 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() void cEdit::lpAllInit_clicked()
@@ -209,19 +256,19 @@ void cEdit::lpAllDone_clicked()
void cEdit::allInit_clicked() void cEdit::allInit_clicked()
{ {
QPushButton* lpButton = (QPushButton*)sender(); QPushButton* lpButton = static_cast<QPushButton*>(sender());
m_lpSerie->seasonInit(lpButton); m_lpSerie->seasonInit(lpButton);
} }
void cEdit::allProgress_clicked() void cEdit::allProgress_clicked()
{ {
QPushButton* lpButton = (QPushButton*)sender(); QPushButton* lpButton = static_cast<QPushButton*>(sender());
m_lpSerie->seasonProgress(lpButton); m_lpSerie->seasonProgress(lpButton);
} }
void cEdit::allDone_clicked() void cEdit::allDone_clicked()
{ {
QPushButton* lpButton = (QPushButton*)sender(); QPushButton* lpButton = static_cast<QPushButton*>(sender());
m_lpSerie->seasonDone(lpButton); m_lpSerie->seasonDone(lpButton);
} }
@@ -230,6 +277,16 @@ QString cEdit::download()
return(ui->m_lpDownloadLink->text()); 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) void cEdit::on_m_lpTabWidget_tabBarClicked(int index)
{ {
if(index == 1) if(index == 1)
@@ -242,35 +299,28 @@ void cEdit::on_m_lpTabWidget_tabBarClicked(int index)
lpDialog->show(); lpDialog->show();
cMovieImage image; cMovieImage image;
QPixmap backdrop = image.getImage(m_lpSerie->backdropPath()); QPixmap poster = image.getImage(m_lpSerie->posterPath());
//QPalette palette; ui->m_lpDetailsImage->setPixmap(poster.scaledToHeight(200));
//palette.setBrush(this->backgroundRole(), QBrush(backdrop.toImage()));
//this->setPalette(palette);
// ui->m_lpDetailsBackdrop->setPixmap(backdrop);
ui->m_lpDetailsOverview->setText(m_lpSerie->overview()); ui->m_lpDetailsOverview->setText(m_lpSerie->overview());
ui->m_lpDetailsSeasonTab->clear(); ui->m_lpDetailsSeasonTab->clear();
QTreeWidgetItem* lpItem;
for(int x = 0;x < m_lpSerie->cast().count();x++) for(int x = 0;x < m_lpSerie->cast().count();x++)
{ {
QList<QStandardItem*> items;
QStringList tmp = m_lpSerie->cast().at(x).split(","); QStringList tmp = m_lpSerie->cast().at(x).split(",");
lpItem = new QTreeWidgetItem(ui->m_lpDetailsActors);
lpItem->setText(0, tmp.at(0));
if(tmp.count() > 1)
lpItem->setText(1, tmp.at(1));
ui->m_lpDetailsActors->addTopLevelItem(lpItem); items.append(new QStandardItem(tmp.at(0)));
if(tmp.count() > 1)
items.append(new QStandardItem(tmp.at(1)));
m_lpDetailsActorsModel->appendRow(items);
} }
ui->m_lpDetailsActors->resizeColumnToContents(0); ui->m_lpDetailsActors->resizeColumnToContents(0);
ui->m_lpDetailsActors->resizeColumnToContents(1); ui->m_lpDetailsActors->resizeColumnToContents(1);
for(int x = 0;x < m_lpSerie->genre().count();x++) for(int x = 0;x < m_lpSerie->genre().count();x++)
{ m_lpDetailsGenreModel->appendRow(new QStandardItem(m_lpSerie->genre().at(x)));
lpItem = new QTreeWidgetItem(ui->m_lpDetailsGenre);
lpItem->setText(0, m_lpSerie->genre().at(x));
ui->m_lpDetailsGenre->addTopLevelItem(lpItem);
}
for(int x = 0;x < m_lpSerie->seasonList().count();x++) for(int x = 0;x < m_lpSerie->seasonList().count();x++)
{ {
cSeason* lpSeason = m_lpSerie->seasonList().at(x); cSeason* lpSeason = m_lpSerie->seasonList().at(x);
+113 -20
View File
@@ -5,61 +5,154 @@
#include "cserie.h" #include "cserie.h"
#include <QDialog> #include <QDialog>
#include <QStandardItemModel>
namespace Ui { namespace Ui {
class cEdit; class cEdit;
} }
/*!
\brief
\class cEdit cedit.h "cedit.h"
*/
class cEdit : public QDialog class cEdit : public QDialog
{ {
Q_OBJECT Q_OBJECT
public: public:
/*!
\brief
\fn cEdit
\param parent
*/
explicit cEdit(QWidget *parent = 0); explicit cEdit(QWidget *parent = 0);
/*!
\brief
\fn ~cEdit
*/
~cEdit(); ~cEdit();
/*!
\brief
\fn setSerie
\param lpSerie
*/
void setSerie(cSerie* lpSerie); void setSerie(cSerie* lpSerie);
/*!
\brief
\fn download
\return QString
*/
QString download(); QString download();
/*!
\brief
\fn localPath
\return QString
*/
QString localPath();
/*!
\brief
\fn resolution
\return QString
*/
QString resolution();
private slots: private slots:
/*!
\brief
\fn lpAllInit_clicked
*/
void lpAllInit_clicked(); void lpAllInit_clicked();
/*!
\brief
\fn lpAllProgress_clicked
*/
void lpAllProgress_clicked(); void lpAllProgress_clicked();
/*!
\brief
\fn lpAllDone_clicked
*/
void lpAllDone_clicked(); void lpAllDone_clicked();
/*!
\brief
\fn allInit_clicked
*/
void allInit_clicked(); void allInit_clicked();
/*!
\brief
\fn allProgress_clicked
*/
void allProgress_clicked(); void allProgress_clicked();
/*!
\brief
\fn allDone_clicked
*/
void allDone_clicked(); void allDone_clicked();
/*!
\brief
\fn on_m_lpTabWidget_tabBarClicked
\param index
*/
void on_m_lpTabWidget_tabBarClicked(int index); void on_m_lpTabWidget_tabBarClicked(int index);
/*!
\brief
\fn on_m_lpCliffhanger_clicked
*/
void 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); void on_m_lpFirstAired_dateChanged(const QDate &date);
private: private:
Ui::cEdit* ui; Ui::cEdit* ui; /*!< TODO: describe */
bool m_bLoaded; bool m_bLoaded; /*!< TODO: describe */
QRadioButton* m_lpButton1; QRadioButton* m_lpButton1; /*!< TODO: describe */
QRadioButton* m_lpButton2; QRadioButton* m_lpButton2; /*!< TODO: describe */
QRadioButton* m_lpButton3; QRadioButton* m_lpButton3; /*!< TODO: describe */
QPushButton* m_lpInit; QPushButton* m_lpInit; /*!< TODO: describe */
QPushButton* m_lpProgress; QPushButton* m_lpProgress; /*!< TODO: describe */
QPushButton* m_lpDone; QPushButton* m_lpDone; /*!< TODO: describe */
QGroupBox* m_lpGroupBox; QGroupBox* m_lpGroupBox; /*!< TODO: describe */
QGridLayout* m_lpGridLayout; QGridLayout* m_lpGridLayout; /*!< TODO: describe */
QGridLayout* m_lpGrid; QGridLayout* m_lpGrid; /*!< TODO: describe */
QLabel* m_lpLabel; QLabel* m_lpLabel; /*!< TODO: describe */
QLabel* m_lpLabel1; QLabel* m_lpLabel1; /*!< TODO: describe */
QSpacerItem* m_lpSpacer; QSpacerItem* m_lpSpacer; /*!< TODO: describe */
QButtonGroup* m_lpGroup; QButtonGroup* m_lpGroup; /*!< TODO: describe */
QPushButton* m_lpAllInit; QPushButton* m_lpAllInit; /*!< TODO: describe */
QPushButton* m_lpAllProgress; QPushButton* m_lpAllProgress; /*!< TODO: describe */
QPushButton* m_lpAllDone; QPushButton* m_lpAllDone; /*!< TODO: describe */
QSpacerItem* m_lpVerticalSpacer; QSpacerItem* m_lpVerticalSpacer; /*!< TODO: describe */
cSerie* m_lpSerie; QStandardItemModel* m_lpDetailsActorsModel;
QStandardItemModel* m_lpDetailsGenreModel;
cSerie* m_lpSerie; /*!< TODO: describe */
}; };
#endif // CEDIT_H #endif // CEDIT_H
+127 -98
View File
@@ -6,12 +6,12 @@
<rect> <rect>
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>804</width> <width>702</width>
<height>732</height> <height>458</height>
</rect> </rect>
</property> </property>
<property name="windowTitle"> <property name="windowTitle">
<string>Edit</string> <string>Edit Serie</string>
</property> </property>
<layout class="QGridLayout" name="gridLayout_2"> <layout class="QGridLayout" name="gridLayout_2">
<item row="0" column="0"> <item row="0" column="0">
@@ -19,15 +19,22 @@
<item> <item>
<widget class="QTabWidget" name="m_lpTabWidget"> <widget class="QTabWidget" name="m_lpTabWidget">
<property name="currentIndex"> <property name="currentIndex">
<number>1</number> <number>0</number>
</property> </property>
<widget class="QWidget" name="tab"> <widget class="cPixmapWidget" name="m_lpProgressTab">
<attribute name="title"> <attribute name="title">
<string>Progress</string> <string>Progress</string>
</attribute> </attribute>
<layout class="QGridLayout" name="gridLayout"> <layout class="QGridLayout" name="gridLayout">
<item row="0" column="0"> <item row="0" column="0">
<layout class="QVBoxLayout" name="verticalLayout"> <layout class="QVBoxLayout" name="verticalLayout">
<item>
<widget class="QLabel" name="m_lpBanner">
<property name="text">
<string/>
</property>
</widget>
</item>
<item> <item>
<layout class="QVBoxLayout" name="m_lpVerticalLayout"> <layout class="QVBoxLayout" name="m_lpVerticalLayout">
<item> <item>
@@ -59,9 +66,9 @@
</layout> </layout>
</item> </item>
<item> <item>
<layout class="QHBoxLayout" name="horizontalLayout_2"> <layout class="QHBoxLayout" name="horizontalLayout_2" stretch="0,4,0,2,0,0">
<item> <item>
<widget class="QLabel" name="label"> <widget class="QLabel" name="m_lpDownloadLinkLabel">
<property name="text"> <property name="text">
<string>Download Link:</string> <string>Download Link:</string>
</property> </property>
@@ -70,6 +77,26 @@
<item> <item>
<widget class="QLineEdit" name="m_lpDownloadLink"/> <widget class="QLineEdit" name="m_lpDownloadLink"/>
</item> </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> </layout>
</item> </item>
<item> <item>
@@ -107,10 +134,13 @@
<rect> <rect>
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>754</width> <width>652</width>
<height>546</height> <height>253</height>
</rect> </rect>
</property> </property>
<property name="autoFillBackground">
<bool>true</bool>
</property>
<layout class="QGridLayout" name="m_lpGridLayoutScroll"/> <layout class="QGridLayout" name="m_lpGridLayoutScroll"/>
</widget> </widget>
</widget> </widget>
@@ -121,19 +151,85 @@
</item> </item>
</layout> </layout>
</widget> </widget>
<widget class="QWidget" name="tab_2"> <widget class="QWidget" name="m_lpDetailsTab">
<attribute name="title"> <attribute name="title">
<string>Details</string> <string>Details</string>
</attribute> </attribute>
<layout class="QGridLayout" name="gridLayout_3"> <layout class="QGridLayout" name="gridLayout_4">
<item row="0" column="0"> <item row="0" column="0">
<layout class="QVBoxLayout" name="verticalLayout_3" stretch="0,1,1"> <layout class="QGridLayout" name="gridLayout_3">
<item row="0" column="6">
<layout class="QHBoxLayout" name="horizontalLayout_4">
<item> <item>
<widget class="QLabel" name="m_lpDetailsBackdrop"> <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>16777215</width>
<height>16777215</height>
</size>
</property>
<property name="readOnly">
<bool>true</bool>
</property>
</widget>
</item>
<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"> <property name="minimumSize">
<size> <size>
<width>758</width> <width>0</width>
<height>140</height> <height>0</height>
</size> </size>
</property> </property>
<property name="frameShape"> <property name="frameShape">
@@ -148,94 +244,23 @@
</widget> </widget>
</item> </item>
<item> <item>
<widget class="QScrollArea" name="scrollArea"> <spacer name="verticalSpacer">
<property name="widgetResizable"> <property name="orientation">
<bool>true</bool> <enum>Qt::Vertical</enum>
</property> </property>
<widget class="QWidget" name="scrollAreaWidgetContents"> <property name="sizeHint" stdset="0">
<property name="geometry"> <size>
<rect> <width>20</width>
<x>0</x> <height>40</height>
<y>0</y> </size>
<width>756</width>
<height>241</height>
</rect>
</property> </property>
<layout class="QGridLayout" name="gridLayout_4"> </spacer>
<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> </item>
</layout> </layout>
</item> </item>
</layout> </layout>
</item> </item>
</layout> <item row="1" column="0">
</item>
</layout>
</widget>
</widget>
</item>
<item>
<widget class="QTabWidget" name="m_lpDetailsSeasonTab"> <widget class="QTabWidget" name="m_lpDetailsSeasonTab">
<property name="currentIndex"> <property name="currentIndex">
<number>0</number> <number>0</number>
@@ -248,8 +273,6 @@
</widget> </widget>
</item> </item>
</layout> </layout>
</item>
</layout>
</widget> </widget>
</widget> </widget>
</item> </item>
@@ -273,6 +296,12 @@
<extends>QLabel</extends> <extends>QLabel</extends>
<header>cverticallabel.h</header> <header>cverticallabel.h</header>
</customwidget> </customwidget>
<customwidget>
<class>cPixmapWidget</class>
<extends>QWidget</extends>
<header>cpixmapwidget.h</header>
<container>1</container>
</customwidget>
</customwidgets> </customwidgets>
<resources/> <resources/>
<connections> <connections>
+11 -11
View File
@@ -2,7 +2,7 @@
#include "common.h" #include "common.h"
#define DELETE(x) { if(x) delete x;x = 0;} #define DELETE(x) { if(x) delete x;x = nullptr;}
cEpisode::cEpisode() : cEpisode::cEpisode() :
m_iID(-1), m_iID(-1),
@@ -54,12 +54,12 @@ QString cEpisode::name()
return(m_szName); return(m_szName);
} }
void cEpisode::setEpisodeNumber(const qint16& iEpisodeNumber) void cEpisode::setEpisodeNumber(const qint32& iEpisodeNumber)
{ {
m_iEpisodeNumber = iEpisodeNumber; m_iEpisodeNumber = iEpisodeNumber;
} }
qint16 cEpisode::episodeNumber() qint32 cEpisode::episodeNumber()
{ {
return(m_iEpisodeNumber); return(m_iEpisodeNumber);
} }
@@ -114,12 +114,12 @@ QString cEpisode::productionCode()
return(m_szProductionCode); return(m_szProductionCode);
} }
void cEpisode::setSeasonNumber(const qint16& iSeasonNumber) void cEpisode::setSeasonNumber(const qint32& iSeasonNumber)
{ {
m_iSeasonNumber = iSeasonNumber; m_iSeasonNumber = iSeasonNumber;
} }
qint16 cEpisode::seasonNumber() qint32 cEpisode::seasonNumber()
{ {
return(m_iSeasonNumber); return(m_iSeasonNumber);
} }
@@ -164,12 +164,12 @@ qreal cEpisode::voteAverage()
return(m_dVoteAverage); return(m_dVoteAverage);
} }
void cEpisode::setVoteCount(const qint16& iVoteCount) void cEpisode::setVoteCount(const qint32& iVoteCount)
{ {
m_iVoteCount = iVoteCount; m_iVoteCount = iVoteCount;
} }
qint16 cEpisode::voteCount() qint32 cEpisode::voteCount()
{ {
return(m_iVoteCount); return(m_iVoteCount);
} }
@@ -238,22 +238,22 @@ QString cEpisode::fileName()
return(m_szFileName); return(m_szFileName);
} }
void cEpisode::setThumbHeight(const qint16& iThumbHeight) void cEpisode::setThumbHeight(const qint32& iThumbHeight)
{ {
m_iThumbHeight = iThumbHeight; m_iThumbHeight = iThumbHeight;
} }
qint16 cEpisode::thumbHeight() qint32 cEpisode::thumbHeight()
{ {
return(m_iThumbHeight); return(m_iThumbHeight);
} }
void cEpisode::setThumbWidth(const qint16& iThumbWidth) void cEpisode::setThumbWidth(const qint32& iThumbWidth)
{ {
m_iThumbWidth = iThumbWidth; m_iThumbWidth = iThumbWidth;
} }
qint16 cEpisode::thumbWidth() qint32 cEpisode::thumbWidth()
{ {
return(m_iThumbWidth); return(m_iThumbWidth);
} }
+326 -30
View File
@@ -11,9 +11,19 @@
#include <QRadioButton> #include <QRadioButton>
/*!
\brief
\class cEpisode cepisode.h "cepisode.h"
*/
class cEpisode class cEpisode
{ {
public: public:
/*!
\brief
\enum State
*/
enum State enum State
{ {
StateUnknown = 0, StateUnknown = 0,
@@ -23,98 +33,384 @@ public:
}; };
cEpisode(); cEpisode();
/*!
\brief
\fn ~cEpisode
*/
~cEpisode(); ~cEpisode();
/*!
\brief
\fn setID
\param iID
*/
void setID(const qint32& iID); void setID(const qint32& iID);
/*!
\brief
\fn id
\return qint32
*/
qint32 id(); qint32 id();
/*!
\brief
\fn setName
\param szName
*/
void setName(const QString& szName); void setName(const QString& szName);
/*!
\brief
\fn name
\return QString
*/
QString name(); 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); void setAirDate(const QString& szAirDate);
/*!
\brief
\fn setAirDate
\param airDate
*/
void setAirDate(const QDate& airDate); void setAirDate(const QDate& airDate);
/*!
\brief
\fn airDate
\return QDate
*/
QDate airDate(); QDate airDate();
/*!
\brief
\fn setGuestStars
\param szGuestStars
*/
void setGuestStars(const QString& szGuestStars); void setGuestStars(const QString& szGuestStars);
/*!
\brief
\fn setGuestStars
\param szGuestStars
*/
void setGuestStars(const QStringList& szGuestStars); void setGuestStars(const QStringList& szGuestStars);
/*!
\brief
\fn guestStars
\return QStringList
*/
QStringList guestStars(); QStringList guestStars();
/*!
\brief
\fn setOverview
\param szOverview
*/
void setOverview(const QString& szOverview); void setOverview(const QString& szOverview);
/*!
\brief
\fn overview
\return QString
*/
QString overview(); QString overview();
/*!
\brief
\fn setProductionCode
\param szProductionCode
*/
void setProductionCode(const QString& szProductionCode); void setProductionCode(const QString& szProductionCode);
/*!
\brief
\fn productionCode
\return QString
*/
QString productionCode(); 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); void setSeasonID(const qint32& iSeasonID);
/*!
\brief
\fn seasonID
\return qint32
*/
qint32 seasonID(); qint32 seasonID();
/*!
\brief
\fn setSeriesID
\param iSeriesID
*/
void setSeriesID(const qint32& iSeriesID); void setSeriesID(const qint32& iSeriesID);
/*!
\brief
\fn seriesID
\return qint32
*/
qint32 seriesID(); qint32 seriesID();
/*!
\brief
\fn setStillPath
\param szStillPath
*/
void setStillPath(const QString& szStillPath); void setStillPath(const QString& szStillPath);
/*!
\brief
\fn stillPath
\return QString
*/
QString stillPath(); QString stillPath();
/*!
\brief
\fn setVoteAverage
\param dVoteAverage
*/
void setVoteAverage(const qreal& dVoteAverage); void setVoteAverage(const qreal& dVoteAverage);
/*!
\brief
\fn voteAverage
\return qreal
*/
qreal voteAverage(); 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); void setCrew(const QString& szCrew);
/*!
\brief
\fn setCrew
\param szCrew
*/
void setCrew(const QStringList& szCrew); void setCrew(const QStringList& szCrew);
/*!
\brief
\fn crew
\return QStringList
*/
QStringList crew(); QStringList crew();
/*!
\brief
\fn setState
\param state
*/
void setState(const State& state); void setState(const State& state);
/*!
\brief
\fn state
\return State
*/
State state(); State state();
/*!
\brief
\fn setFileName
\param szFileName
*/
void setFileName(const QString& szFileName); void setFileName(const QString& szFileName);
/*!
\brief
\fn fileName
\return QString
*/
QString fileName(); QString fileName();
void setThumbHeight(const qint16& iThumbHeight); /*!
qint16 thumbHeight(); \brief
void setThumbWidth(const qint16& iThumbWidth); \fn setThumbHeight
qint16 thumbWidth(); \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(); bool isValid();
/*!
\brief
\fn setGroup
\param lpGroup
*/
void setGroup(QButtonGroup* lpGroup); void setGroup(QButtonGroup* lpGroup);
/*!
\brief
\fn setLabel
\param lpLabel
*/
void setLabel(QLabel* lpLabel); void setLabel(QLabel* lpLabel);
/*!
\brief
\fn setButton1
\param lpButton1
*/
void setButton1(QRadioButton* lpButton1); void setButton1(QRadioButton* lpButton1);
/*!
\brief
\fn setButton2
\param lpButton2
*/
void setButton2(QRadioButton* lpButton2); void setButton2(QRadioButton* lpButton2);
/*!
\brief
\fn setButton3
\param lpButton3
*/
void setButton3(QRadioButton* lpButton3); void setButton3(QRadioButton* lpButton3);
/*!
\brief
\fn updateState
*/
void updateState(); void updateState();
/*!
\brief
\fn deleteResources
*/
void deleteResources(); void deleteResources();
private: private:
qint32 m_iID; qint32 m_iID; /*!< TODO: describe */
QString m_szName; QString m_szName; /*!< TODO: describe */
qint16 m_iEpisodeNumber; qint32 m_iEpisodeNumber; /*!< TODO: describe */
QDate m_airDate; QDate m_airDate; /*!< TODO: describe */
QStringList m_szGuestStars; QStringList m_szGuestStars; /*!< TODO: describe */
QString m_szOverview; QString m_szOverview; /*!< TODO: describe */
QString m_szProductionCode; QString m_szProductionCode; /*!< TODO: describe */
qint16 m_iSeasonNumber; qint32 m_iSeasonNumber; /*!< TODO: describe */
qint32 m_iSeasonID; qint32 m_iSeasonID; /*!< TODO: describe */
qint32 m_iSeriesID; qint32 m_iSeriesID; /*!< TODO: describe */
QString m_szStillPath; QString m_szStillPath; /*!< TODO: describe */
qreal m_dVoteAverage; qreal m_dVoteAverage; /*!< TODO: describe */
qint16 m_iVoteCount; qint32 m_iVoteCount; /*!< TODO: describe */
QStringList m_szCrew; QStringList m_szCrew; /*!< TODO: describe */
State m_state; State m_state; /*!< TODO: describe */
QButtonGroup* m_lpGroup; QButtonGroup* m_lpGroup; /*!< TODO: describe */
QLabel* m_lpLabel; QLabel* m_lpLabel; /*!< TODO: describe */
QRadioButton* m_lpButton1; QRadioButton* m_lpButton1; /*!< TODO: describe */
QRadioButton* m_lpButton2; QRadioButton* m_lpButton2; /*!< TODO: describe */
QRadioButton* m_lpButton3; QRadioButton* m_lpButton3; /*!< TODO: describe */
}; };
Q_DECLARE_METATYPE(cEpisode*) Q_DECLARE_METATYPE(cEpisode*)
Q_DECLARE_METATYPE(cEpisode::State)
#endif // CEPISODE_H #endif // CEPISODE_H
+21 -1
View File
@@ -5,19 +5,25 @@
#include "cmessageanimatedialog.h" #include "cmessageanimatedialog.h"
#include <QDebug> #include <QDebug>
#include <QTreeWidgetItem>
cEpisodeDetails::cEpisodeDetails(QWidget *parent) : cEpisodeDetails::cEpisodeDetails(QWidget *parent) :
QWidget(parent), QWidget(parent),
ui(new Ui::cEpisodeDetails), ui(new Ui::cEpisodeDetails),
m_lpDetailsActorsModel(0),
m_lpEpisode(0), m_lpEpisode(0),
m_bLoaded(false) m_bLoaded(false)
{ {
ui->setupUi(this); ui->setupUi(this);
m_lpDetailsActorsModel = new QStandardItemModel(0, 0);
ui->m_lpDetailsActors->setModel(m_lpDetailsActorsModel);
} }
cEpisodeDetails::~cEpisodeDetails() cEpisodeDetails::~cEpisodeDetails()
{ {
delete m_lpDetailsActorsModel;
delete ui; delete ui;
} }
@@ -26,6 +32,20 @@ void cEpisodeDetails::setEpisode(cEpisode* lpEpisode)
m_lpEpisode = lpEpisode; m_lpEpisode = lpEpisode;
ui->m_lpEpisodeTitle->setText(lpEpisode->name()); ui->m_lpEpisodeTitle->setText(lpEpisode->name());
ui->m_lpOverview->setText(lpEpisode->overview()); 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() void cEpisodeDetails::loadImages()
@@ -42,7 +62,7 @@ void cEpisodeDetails::loadImages()
lpDialog->show(); lpDialog->show();
cMovieImage image; 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); ui->m_lpEpisodeThumb->setPixmap(pixmap);
delete lpDialog; delete lpDialog;
+32 -3
View File
@@ -2,6 +2,7 @@
#define CEPISODEDETAILS_H #define CEPISODEDETAILS_H
#include <QWidget> #include <QWidget>
#include <QStandardItemModel>
#include "cepisode.h" #include "cepisode.h"
@@ -10,20 +11,48 @@ namespace Ui {
class cEpisodeDetails; class cEpisodeDetails;
} }
/*!
\brief
\class cEpisodeDetails cepisodedetails.h "cepisodedetails.h"
*/
class cEpisodeDetails : public QWidget class cEpisodeDetails : public QWidget
{ {
Q_OBJECT Q_OBJECT
public: public:
/*!
\brief
\fn cEpisodeDetails
\param parent
*/
explicit cEpisodeDetails(QWidget *parent = 0); explicit cEpisodeDetails(QWidget *parent = 0);
/*!
\brief
\fn ~cEpisodeDetails
*/
~cEpisodeDetails(); ~cEpisodeDetails();
/*!
\brief
\fn setEpisode
\param lpEpisode
*/
void setEpisode(cEpisode* lpEpisode); void setEpisode(cEpisode* lpEpisode);
/*!
\brief
\fn loadImages
*/
void loadImages(); void loadImages();
private: private:
Ui::cEpisodeDetails* ui; Ui::cEpisodeDetails* ui; /*!< TODO: describe */
cEpisode* m_lpEpisode; QStandardItemModel* m_lpDetailsActorsModel;
bool m_bLoaded; cEpisode* m_lpEpisode; /*!< TODO: describe */
bool m_bLoaded; /*!< TODO: describe */
}; };
#endif // CEPISODEDETAILS_H #endif // CEPISODEDETAILS_H
+52 -14
View File
@@ -6,8 +6,8 @@
<rect> <rect>
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>400</width> <width>759</width>
<height>300</height> <height>502</height>
</rect> </rect>
</property> </property>
<property name="windowTitle"> <property name="windowTitle">
@@ -15,16 +15,7 @@
</property> </property>
<layout class="QGridLayout" name="gridLayout"> <layout class="QGridLayout" name="gridLayout">
<item row="0" column="0"> <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/>
</property>
</widget>
</item>
<item>
<layout class="QVBoxLayout" name="verticalLayout">
<item> <item>
<widget class="QLineEdit" name="m_lpEpisodeTitle"> <widget class="QLineEdit" name="m_lpEpisodeTitle">
<property name="font"> <property name="font">
@@ -39,6 +30,46 @@
</property> </property>
</widget> </widget>
</item> </item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_2">
<item>
<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> <item>
<widget class="QScrollArea" name="m_lpScrollArea"> <widget class="QScrollArea" name="m_lpScrollArea">
<property name="widgetResizable"> <property name="widgetResizable">
@@ -49,8 +80,8 @@
<rect> <rect>
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>365</width> <width>363</width>
<height>245</height> <height>447</height>
</rect> </rect>
</property> </property>
<layout class="QGridLayout" name="gridLayout_2"> <layout class="QGridLayout" name="gridLayout_2">
@@ -71,6 +102,13 @@
</item> </item>
</layout> </layout>
</widget> </widget>
<customwidgets>
<customwidget>
<class>cVerticalLabel</class>
<extends>QLabel</extends>
<header>cverticallabel.h</header>
</customwidget>
</customwidgets>
<resources/> <resources/>
<connections/> <connections/>
</ui> </ui>
+58
View File
@@ -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();
}
+64
View File
@@ -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
+98
View File
@@ -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>
+150
View File
@@ -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);
}
+237
View File
@@ -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
+9 -8
View File
@@ -1,6 +1,6 @@
#include "common.h" #include "common.h"
#include "cimage.h" #include "cfanartimage.h"
#include <QDir> #include <QDir>
#include <QFile> #include <QFile>
@@ -11,15 +11,16 @@
#include <QUrl> #include <QUrl>
cImage::cImage() cFanartImage::cFanartImage()
{ {
} }
QPixmap cImage::getImage(const QString& szFileName) QPixmap cFanartImage::getImage(const QString& szFileName)
{ {
QPixmap pixmap; QPixmap pixmap;
QString szPath = rootPath() + QDir::separator() + szFileName; QString szPath = rootPath() + QDir::separator() + szFileName.mid(25);
szPath.replace("/", QDir::separator());
if(szFileName.isEmpty()) if(szFileName.isEmpty())
pixmap.load(rootPath() + QDir::separator() + QDir::separator() + "empty.jpg"); pixmap.load(rootPath() + QDir::separator() + QDir::separator() + "empty.jpg");
@@ -32,13 +33,13 @@ QPixmap cImage::getImage(const QString& szFileName)
return(pixmap); return(pixmap);
} }
QPixmap cImage::downloadFile(const QString& szFileName) QPixmap cFanartImage::downloadFile(const QString& szFileName)
{ {
QPixmap pixmap; QPixmap pixmap;
QString szPath = rootPath() + QDir::separator() + szFileName; QString szPath = rootPath() + QDir::separator() + szFileName.mid(25);
// QString szURL = "http://thetvdb.com/banners/" + szFileName; szPath.replace("/", QDir::separator());
QString szURL = "https://www.thetvdb.com/banners/" + szFileName; QString szURL = szFileName;
QNetworkAccessManager networkManager; QNetworkAccessManager networkManager;
QUrl url(szURL); QUrl url(szURL);
+36
View File
@@ -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
+163
View File
@@ -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);
}
+50
View File
@@ -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
-17
View File
@@ -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
+1264 -264
View File
File diff suppressed because it is too large Load Diff
+529 -16
View File
@@ -5,7 +5,7 @@
#include "cserie.h" #include "cserie.h"
#include "cmovie.h" #include "cmovie.h"
#include "cupdatethread.h" //#include "cupdatethread.h"
#include "cpicturesthread.h" #include "cpicturesthread.h"
#include <QMainWindow> #include <QMainWindow>
@@ -28,101 +28,614 @@ namespace Ui {
class cMainWindow; class cMainWindow;
} }
/*!
\brief
\class cMainWindow cmainwindow.h "cmainwindow.h"
*/
class cMainWindow : public QMainWindow class cMainWindow : public QMainWindow
{ {
Q_OBJECT Q_OBJECT
public: public:
explicit cMainWindow(QWidget *parent = 0); /*!
\brief
\fn cMainWindow
\param parent
*/
explicit cMainWindow(QWidget *parent = nullptr);
/*!
\brief
\fn ~cMainWindow
*/
~cMainWindow(); ~cMainWindow();
/*!
\brief
\fn initDone
*/
void initDone(); void initDone();
private slots: private slots:
/*!
\brief
\fn on_m_lpSeriesList1_customContextMenuRequested
\param pos
*/
void on_m_lpSeriesList1_customContextMenuRequested(const QPoint &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); void on_m_lpSeriesList1_doubleClicked(const QModelIndex &index);
/*!
\brief
\fn on_m_lpSeriesList1_pressed
\param index
*/
void on_m_lpSeriesList1_pressed(const QModelIndex &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); void on_m_lpSeriesList2_customContextMenuRequested(const QPoint &pos);
/*!
\brief
\fn on_m_lpSeriesList2_doubleClicked
\param index
*/
void on_m_lpSeriesList2_doubleClicked(const QModelIndex &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); void on_m_lpSeriesList2_pressed(const QModelIndex &index);
/*!
\brief
\fn on_m_lpMoviesList_customContextMenuRequested
\param pos
*/
void on_m_lpMoviesList_customContextMenuRequested(const QPoint &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); void on_m_lpMoviesList_doubleClicked(const QModelIndex &index);
/*!
\brief
\fn onActionAdd
*/
void onActionAdd(); void onActionAdd();
/*!
\brief
\fn onActionUpdateAll
*/
void onActionUpdateAll(); void onActionUpdateAll();
/*!
\brief
\fn onActionUpdateUnfinished
*/
void onActionUpdateUnfinished(); void onActionUpdateUnfinished();
/*!
\brief
\fn onActionUpdate
*/
void onActionUpdate(); void onActionUpdate();
/*!
\brief
\fn onActionDelete
*/
void onActionDelete(); void onActionDelete();
/*!
\brief
\fn onActionEdit
*/
void onActionEdit(); void onActionEdit();
/*!
\brief
\fn onActionGotoDownload
*/
void onActionGotoDownload(); void onActionGotoDownload();
/*!
\brief
\fn onActionCopyDownload
*/
void onActionCopyDownload(); void onActionCopyDownload();
/*!
\brief
\fn onActionGotoIMDB
*/
void onActionGotoIMDB();
/*!
\brief
\fn onActionLoadPictures
*/
void 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(); void onActionMovieAdd();
/*!
\brief
\fn onActionMovieUpdateAll
*/
void onActionMovieUpdateAll(); void onActionMovieUpdateAll();
/*!
\brief
\fn onActionMovieUpdate
*/
void onActionMovieUpdate(); void onActionMovieUpdate();
/*!
\brief
\fn onActionMovieDelete
*/
void onActionMovieDelete(); void onActionMovieDelete();
/*!
\brief
\fn onActionMovieEdit
*/
void onActionMovieEdit(); void onActionMovieEdit();
/*!
\brief
\fn onActionMovieGotoIMDB
*/
void onActionMovieGotoIMDB(); void onActionMovieGotoIMDB();
/*!
\brief
\fn onActionMovieLoadPictures
*/
void 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(); 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); void updateMessage(const QString& szMessage, const qint32 &iProgress);
/*!
\brief
\fn updateAppendMessage
\param szMessage
*/
void updateAppendMessage(const QString& szMessage); void updateAppendMessage(const QString& szMessage);
/*!
\brief
\fn updateDone
*/
void updateDone(); void updateDone();
/*!
\brief
\fn picturesMessage
\param szMessage
\param iProgress
*/
void picturesMessage(const QString& szMessage, const qint32 &iProgress); void picturesMessage(const QString& szMessage, const qint32 &iProgress);
/*!
\brief
\fn picturesAppendMessage
\param szMessage
*/
void picturesAppendMessage(const QString& szMessage); void picturesAppendMessage(const QString& szMessage);
/*!
\brief
\fn picturesDone
*/
void picturesDone(); void picturesDone();
/*!
\brief
\fn selectionChanged1
\param selected
\param deselected
*/
void selectionChanged1(const QItemSelection &selected, const QItemSelection &deselected); void selectionChanged1(const QItemSelection &selected, const QItemSelection &deselected);
/*!
\brief
\fn selectionChanged2
\param selected
\param deselected
*/
void selectionChanged2(const QItemSelection &selected, const QItemSelection &deselected); void selectionChanged2(const QItemSelection &selected, const QItemSelection &deselected);
/*!
\brief
\fn scrollbarValueChanged1
\param value
*/
void scrollbarValueChanged1(int value); void scrollbarValueChanged1(int value);
/*!
\brief
\fn scrollbarValueChanged2
\param value
*/
void scrollbarValueChanged2(int 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: private:
Ui::cMainWindow* ui; Ui::cMainWindow* ui; /*!< TODO: describe */
cSerieList m_serieList; cSerieList m_serieList; /*!< TODO: describe */
cMovieList m_movieList; cMovieList m_movieList; /*!< TODO: describe */
QSqlDatabase m_db; QSqlDatabase m_db; /*!< TODO: describe */
QString m_szOldSelected; QString m_szOldSelected; /*!< TODO: describe */
cMessageDialog* m_lpMessageDialog; cMessageDialog* m_lpMessageDialog; /*!< TODO: describe */
cUpdateThread* m_lpUpdateThread; cPicturesThread* m_lpPicturesThread; /*!< TODO: describe */
cPicturesThread* m_lpPicturesThread;
QTime m_timer; QStandardItemModel* m_lpSeriesListModel; /*!< TODO: describe */
QStandardItemModel* m_lpMoviesListModel; /*!< TODO: describe */
QStandardItemModel* m_lpSeriesListModel; bool m_bProcessing; /*!< TODO: describe */
QStandardItemModel* m_lpMoviesListModel;
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(); void initDB();
/*!
\brief
\fn loadDB
*/
void loadDB(); void loadDB();
void convertSeries(); /*!
\brief
\fn loadSeriesDB
*/
void loadSeriesDB(); void loadSeriesDB();
/*!
\brief
\fn loadMoviesDB
*/
void loadMoviesDB(); void loadMoviesDB();
/*!
\brief
\fn displaySeries
*/
void displaySeries(); void displaySeries();
/*!
\brief
\fn displayMovies
*/
void displayMovies(); void displayMovies();
/*!
\brief
\fn runEdit
\param lpSerie
\param szDownload
\return bool
*/
bool runEdit(cSerie *lpSerie, QString& szDownload); bool runEdit(cSerie *lpSerie, QString& szDownload);
/*!
\brief
\fn runMovieEdit
\param lpMovie
\return bool
*/
bool runMovieEdit(cMovie *lpMovie); bool runMovieEdit(cMovie *lpMovie);
/*!
\brief
\fn showSeriesContextMenu
\param lpTreeView
\param pos
*/
void showSeriesContextMenu(QTreeView* lpTreeView, const QPoint &pos); void showSeriesContextMenu(QTreeView* lpTreeView, const QPoint &pos);
/*!
\brief
\fn doUpdate
\param serieList
*/
void doUpdate(cSerieList& serieList); void doUpdate(cSerieList& serieList);
/*!
\brief
\fn showMoviesContextMenu
\param lpTreeView
\param pos
*/
void showMoviesContextMenu(QTreeView* lpTreeView, const QPoint &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: protected:
/*!
\brief
\fn closeEvent
\param event
*/
void closeEvent(QCloseEvent *event); void closeEvent(QCloseEvent *event);
}; };
+183 -7
View File
@@ -11,22 +11,111 @@
</rect> </rect>
</property> </property>
<property name="windowTitle"> <property name="windowTitle">
<string>qtSeries</string> <string>qtMultimediaDB</string>
</property> </property>
<widget class="QWidget" name="centralWidget"> <widget class="QWidget" name="centralWidget">
<layout class="QGridLayout" name="gridLayout_2"> <layout class="QGridLayout" name="gridLayout_2">
<item row="0" column="0"> <item row="0" column="1">
<widget class="QTabWidget" name="m_lpMainTab"> <widget class="QTabWidget" name="m_lpMainTab">
<property name="currentIndex"> <property name="currentIndex">
<number>1</number> <number>0</number>
</property> </property>
<widget class="QWidget" name="m_lpTVShowsTab"> <widget class="QWidget" name="m_lpTVShowsTab">
<attribute name="title"> <attribute name="title">
<string>TV Shows</string> <string>TV Shows</string>
</attribute> </attribute>
<layout class="QGridLayout" name="gridLayout_5">
<item row="0" column="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"> <layout class="QGridLayout" name="gridLayout">
<item row="0" column="0"> <item row="0" column="0">
<layout class="QVBoxLayout" name="verticalLayout" stretch="1,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> <item>
<layout class="QHBoxLayout" name="horizontalLayout_3"> <layout class="QHBoxLayout" name="horizontalLayout_3">
<item> <item>
@@ -167,8 +256,69 @@
<attribute name="title"> <attribute name="title">
<string>Movies</string> <string>Movies</string>
</attribute> </attribute>
<layout class="QGridLayout" name="gridLayout_3"> <layout class="QGridLayout" name="gridLayout_7">
<item row="0" column="0"> <item row="0" column="0">
<layout class="QVBoxLayout" name="verticalLayout_2" stretch="0,1,0">
<item>
<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="QTreeView" name="m_lpMoviesList"> <widget class="QTreeView" name="m_lpMoviesList">
<property name="contextMenuPolicy"> <property name="contextMenuPolicy">
<enum>Qt::CustomContextMenu</enum> <enum>Qt::CustomContextMenu</enum>
@@ -193,7 +343,7 @@
</attribute> </attribute>
</widget> </widget>
</item> </item>
<item row="1" column="0"> <item>
<layout class="QHBoxLayout" name="horizontalLayout"> <layout class="QHBoxLayout" name="horizontalLayout">
<item> <item>
<widget class="QLabel" name="label"> <widget class="QLabel" name="label">
@@ -225,12 +375,14 @@
</layout> </layout>
</item> </item>
</layout> </layout>
</item>
</layout>
</widget> </widget>
</widget> </widget>
</item> </item>
</layout> </layout>
</widget> </widget>
<widget class="QMenuBar" name="menuBar"> <widget class="QMenuBar" name="m_lpMenuBar">
<property name="geometry"> <property name="geometry">
<rect> <rect>
<x>0</x> <x>0</x>
@@ -249,6 +401,30 @@
</attribute> </attribute>
</widget> </widget>
<widget class="QStatusBar" name="statusBar"/> <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> </widget>
<layoutdefault spacing="6" margin="11"/> <layoutdefault spacing="6" margin="11"/>
<resources/> <resources/>
+5
View File
@@ -27,6 +27,11 @@ namespace Ui {
class cMessageAnimateDialog; class cMessageAnimateDialog;
} }
/*!
\brief
\class cMessageAnimateDialog cmessageanimatedialog.h "cmessageanimatedialog.h"
*/
class cMessageAnimateDialog : public QDialog class cMessageAnimateDialog : public QDialog
{ {
Q_OBJECT Q_OBJECT
+1 -1
View File
@@ -14,7 +14,7 @@
</rect> </rect>
</property> </property>
<property name="windowTitle"> <property name="windowTitle">
<string>Dialog</string> <string>Message</string>
</property> </property>
<layout class="QGridLayout" name="gridLayout"> <layout class="QGridLayout" name="gridLayout">
<item row="0" column="0"> <item row="0" column="0">
+48 -1
View File
@@ -7,22 +7,69 @@ namespace Ui {
class cMessageDialog; class cMessageDialog;
} }
/*!
\brief
\class cMessageDialog cmessagedialog.h "cmessagedialog.h"
*/
class cMessageDialog : public QDialog class cMessageDialog : public QDialog
{ {
Q_OBJECT Q_OBJECT
public: public:
/*!
\brief
\fn cMessageDialog
\param parent
*/
explicit cMessageDialog(QWidget *parent = 0); explicit cMessageDialog(QWidget *parent = 0);
/*!
\brief
\fn ~cMessageDialog
*/
~cMessageDialog(); ~cMessageDialog();
/*!
\brief
\fn setMessage
\param szMessage
*/
void setMessage(const QString& szMessage); void setMessage(const QString& szMessage);
/*!
\brief
\fn addMessage
\param szMessage
*/
void addMessage(const QString& szMessage); void addMessage(const QString& szMessage);
/*!
\brief
\fn setProgress
\param iMin
\param iMax
*/
void setProgress(qint32 iMin, qint32 iMax); void setProgress(qint32 iMin, qint32 iMax);
/*!
\brief
\fn setProgress
\param iValue
*/
void setProgress(qint32 iValue); void setProgress(qint32 iValue);
/*!
\brief
\fn cancelButton
\return QPushButton
*/
QPushButton* cancelButton(); QPushButton* cancelButton();
private: private:
Ui::cMessageDialog *ui; Ui::cMessageDialog *ui; /*!< TODO: describe */
}; };
#endif // CMESSAGEDIALOG_H #endif // CMESSAGEDIALOG_H
+1 -1
View File
@@ -11,7 +11,7 @@
</rect> </rect>
</property> </property>
<property name="windowTitle"> <property name="windowTitle">
<string>Dialog</string> <string>Message</string>
</property> </property>
<layout class="QGridLayout" name="gridLayout"> <layout class="QGridLayout" name="gridLayout">
<item row="0" column="0"> <item row="0" column="0">
+86 -10
View File
@@ -1,4 +1,5 @@
#include "cmovie.h" #include "cmovie.h"
#include "cfanarttv.h"
#include "common.h" #include "common.h"
#include <QStringList> #include <QStringList>
@@ -22,7 +23,9 @@ cMovie::cMovie() :
m_bVideo(false), m_bVideo(false),
m_dVoteAverage(0.0), m_dVoteAverage(0.0),
m_iVoteCount(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); 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) bool cMovie::save(QSqlDatabase &db)
{ {
QSqlQuery query; QSqlQuery query;
QSqlQuery queryMovie; 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)" 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);"); " 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(); db.transaction();
query.exec(QString("SELECT movieID FROM movie WHERE movieID=%1;").arg(movieID())); 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(":cast", cast().join("|"));
queryMovie.bindValue(":crew", crew().join("|")); queryMovie.bindValue(":crew", crew().join("|"));
queryMovie.bindValue(":state", state()); queryMovie.bindValue(":state", state());
queryMovie.bindValue(":localPath", localPath());
queryMovie.bindValue(":resolution", resolution());
if(queryMovie.exec()) 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 else
qDebug() << queryMovie.lastError().text(); qDebug() << queryMovie.lastError().text();
@@ -383,6 +444,14 @@ bool cMovie::del(QSqlDatabase& db)
QSqlQuery query; QSqlQuery query;
db.transaction(); 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.prepare("DELETE FROM movie WHERE movieID=:movieID;");
query.bindValue(":movieID", movieID()); query.bindValue(":movieID", movieID());
query.exec(); query.exec();
@@ -394,12 +463,9 @@ bool cMovie::del(QSqlDatabase& db)
cMovie* cMovieList::add(const qint32& iID) cMovie* cMovieList::add(const qint32& iID)
{ {
for(int z = 0;z < count();z++) cMovie* lpNew = find(iID);
{ if(!lpNew)
if(at(z)->movieID() == iID) lpNew = new cMovie;
return(at(z));
}
cMovie* lpNew = new cMovie;
lpNew->setMovieID(iID); lpNew->setMovieID(iID);
append(lpNew); append(lpNew);
return(lpNew); return(lpNew);
@@ -410,8 +476,18 @@ cMovie* cMovieList::add(cMovie* lpMovie)
for(int z = 0;z < count();z++) for(int z = 0;z < count();z++)
{ {
if(at(z) == lpMovie) if(at(z) == lpMovie)
return(0); return(nullptr);
} }
append(lpMovie); append(lpMovie);
return(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);
}
+499 -31
View File
@@ -2,6 +2,8 @@
#define CMOVIE_H #define CMOVIE_H
#include "cfanart.h"
#include <QMetaType> #include <QMetaType>
#include <QDate> #include <QDate>
#include <QSqlDatabase> #include <QSqlDatabase>
@@ -9,9 +11,19 @@
#include <QMap> #include <QMap>
/*!
\brief
\class cMovie cmovie.h "cmovie.h"
*/
class cMovie class cMovie
{ {
public: public:
/*!
\brief
\enum State
*/
enum State enum State
{ {
StateUnknown = 0, StateUnknown = 0,
@@ -22,135 +34,591 @@ public:
cMovie(); cMovie();
/*!
\brief
\fn setMovieTitle
\param szTitle
*/
void setMovieTitle(const QString& szTitle); void setMovieTitle(const QString& szTitle);
/*!
\brief
\fn movieTitle
\return QString
*/
QString movieTitle(); QString movieTitle();
/*!
\brief
\fn setMovieID
\param iID
*/
void setMovieID(const qint32 iID); void setMovieID(const qint32 iID);
/*!
\brief
\fn movieID
\return qint32
*/
qint32 movieID(); qint32 movieID();
/*!
\brief
\fn setOriginalTitle
\param szOriginalTitle
*/
void setOriginalTitle(const QString& szOriginalTitle); void setOriginalTitle(const QString& szOriginalTitle);
/*!
\brief
\fn originalTitle
\return QString
*/
QString originalTitle(); QString originalTitle();
/*!
\brief
\fn setReleaseDate
\param szDate
*/
void setReleaseDate(const QString& szDate); void setReleaseDate(const QString& szDate);
/*!
\brief
\fn releaseDate
\return QDate
*/
QDate releaseDate(); QDate releaseDate();
/*!
\brief
\fn setAdult
\param bAdult
*/
void setAdult(const bool bAdult); void setAdult(const bool bAdult);
/*!
\brief
\fn adult
\return bool
*/
bool adult(); bool adult();
/*!
\brief
\fn setBackdropPath
\param szBackdropPath
*/
void setBackdropPath(const QString& szBackdropPath); void setBackdropPath(const QString& szBackdropPath);
/*!
\brief
\fn backdropPath
\return QString
*/
QString backdropPath(); QString backdropPath();
/*!
\brief
\fn setBelongsToCollection
\param szBelongsToCollection
*/
void setBelongsToCollection(const QString& szBelongsToCollection); void setBelongsToCollection(const QString& szBelongsToCollection);
/*!
\brief
\fn belongsToCollection
\return QString
*/
QString belongsToCollection(); QString belongsToCollection();
/*!
\brief
\fn setBudget
\param dBudget
*/
void setBudget(const qreal dBudget); void setBudget(const qreal dBudget);
/*!
\brief
\fn budget
\return qreal
*/
qreal budget(); qreal budget();
/*!
\brief
\fn setGenres
\param szGenres
*/
void setGenres(const QString& szGenres); void setGenres(const QString& szGenres);
/*!
\brief
\fn setGenres
\param szGenres
*/
void setGenres(const QStringList& szGenres); void setGenres(const QStringList& szGenres);
/*!
\brief
\fn genres
\return QStringList
*/
QStringList genres(); QStringList genres();
/*!
\brief
\fn setHomepage
\param szHomepage
*/
void setHomepage(const QString& szHomepage); void setHomepage(const QString& szHomepage);
/*!
\brief
\fn homepage
\return QString
*/
QString homepage(); QString homepage();
/*!
\brief
\fn setIMDBID
\param szIMDBID
*/
void setIMDBID(const QString& szIMDBID); void setIMDBID(const QString& szIMDBID);
/*!
\brief
\fn imdbID
\return QString
*/
QString imdbID(); QString imdbID();
/*!
\brief
\fn setOriginalLanguage
\param szOriginalLanguage
*/
void setOriginalLanguage(const QString& szOriginalLanguage); void setOriginalLanguage(const QString& szOriginalLanguage);
/*!
\brief
\fn originalLanguage
\return QString
*/
QString originalLanguage(); QString originalLanguage();
/*!
\brief
\fn setOverview
\param szOverview
*/
void setOverview(const QString& szOverview); void setOverview(const QString& szOverview);
/*!
\brief
\fn overview
\return QString
*/
QString overview(); QString overview();
/*!
\brief
\fn setPopularity
\param dPopularity
*/
void setPopularity(const qreal dPopularity); void setPopularity(const qreal dPopularity);
/*!
\brief
\fn popularity
\return qreal
*/
qreal popularity(); qreal popularity();
/*!
\brief
\fn setPosterPath
\param szPosterPath
*/
void setPosterPath(const QString& szPosterPath); void setPosterPath(const QString& szPosterPath);
/*!
\brief
\fn posterPath
\return QString
*/
QString posterPath(); QString posterPath();
/*!
\brief
\fn setProductionCompanies
\param szProductionCompanies
*/
void setProductionCompanies(const QString& szProductionCompanies); void setProductionCompanies(const QString& szProductionCompanies);
/*!
\brief
\fn setProductionCompanies
\param szProductionCompanies
*/
void setProductionCompanies(const QStringList& szProductionCompanies); void setProductionCompanies(const QStringList& szProductionCompanies);
/*!
\brief
\fn productionCompanies
\return QStringList
*/
QStringList productionCompanies(); QStringList productionCompanies();
/*!
\brief
\fn setProductionCountries
\param szProductionCountries
*/
void setProductionCountries(const QString& szProductionCountries); void setProductionCountries(const QString& szProductionCountries);
/*!
\brief
\fn setProductionCountries
\param szProductionCountries
*/
void setProductionCountries(const QStringList& szProductionCountries); void setProductionCountries(const QStringList& szProductionCountries);
/*!
\brief
\fn productionCountries
\return QStringList
*/
QStringList productionCountries(); QStringList productionCountries();
/*!
\brief
\fn setRevenue
\param dRevenue
*/
void setRevenue(const qreal dRevenue); void setRevenue(const qreal dRevenue);
/*!
\brief
\fn revenue
\return qreal
*/
qreal revenue(); qreal revenue();
/*!
\brief
\fn setRuntime
\param iRuntime
*/
void setRuntime(const qint32 iRuntime); void setRuntime(const qint32 iRuntime);
/*!
\brief
\fn runtime
\return qint32
*/
qint32 runtime(); qint32 runtime();
/*!
\brief
\fn setSpokenLanguages
\param szSpokenLanguages
*/
void setSpokenLanguages(const QString& szSpokenLanguages); void setSpokenLanguages(const QString& szSpokenLanguages);
/*!
\brief
\fn setSpokenLanguages
\param szSpokenLanguages
*/
void setSpokenLanguages(const QStringList& szSpokenLanguages); void setSpokenLanguages(const QStringList& szSpokenLanguages);
/*!
\brief
\fn spokenLanguages
\return QStringList
*/
QStringList spokenLanguages(); QStringList spokenLanguages();
/*!
\brief
\fn setStatus
\param szStatus
*/
void setStatus(const QString& szStatus); void setStatus(const QString& szStatus);
/*!
\brief
\fn status
\return QString
*/
QString status(); QString status();
/*!
\brief
\fn setTagline
\param szTagline
*/
void setTagline(const QString& szTagline); void setTagline(const QString& szTagline);
/*!
\brief
\fn tagline
\return QString
*/
QString tagline(); QString tagline();
/*!
\brief
\fn setVideo
\param bVideo
*/
void setVideo(const bool bVideo); void setVideo(const bool bVideo);
/*!
\brief
\fn video
\return bool
*/
bool video(); bool video();
/*!
\brief
\fn setVoteAverage
\param dVoteAverage
*/
void setVoteAverage(const qreal dVoteAverage); void setVoteAverage(const qreal dVoteAverage);
/*!
\brief
\fn voteAverage
\return qreal
*/
qreal voteAverage(); qreal voteAverage();
/*!
\brief
\fn setVoteCount
\param iVoteCount
*/
void setVoteCount(const qint32 iVoteCount); void setVoteCount(const qint32 iVoteCount);
/*!
\brief
\fn voteCount
\return qint32
*/
qint32 voteCount(); qint32 voteCount();
/*!
\brief
\fn setCast
\param szCast
*/
void setCast(const QStringList& szCast); void setCast(const QStringList& szCast);
/*!
\brief
\fn cast
\return QStringList
*/
QStringList cast(); QStringList cast();
/*!
\brief
\fn setCrew
\param szCrew
*/
void setCrew(const QStringList& szCrew); void setCrew(const QStringList& szCrew);
/*!
\brief
\fn crew
\return QStringList
*/
QStringList crew(); QStringList crew();
/*!
\brief
\fn setState
\param state
*/
void setState(const State state); void setState(const State state);
/*!
\brief
\fn state
\return State
*/
State state(); State state();
bool save(QSqlDatabase& db); /*!
bool del(QSqlDatabase& db); \brief
private:
QString m_szMovieTitle;
qint32 m_iID;
QString m_szOriginalTitle;
QDate m_releaseDate;
bool m_bAdult; \fn setLocalPath
QString m_szBackdropPath; \param szLocalPath
QString m_szBelongsToCollection; */
qreal m_dBudget; void setLocalPath(const QString& szLocalPath);
QStringList m_szGenres; /*!
QString m_szHomepage; \brief
QString m_szIMDBID;
QString m_szOriginalLanguage; \fn localPath
QString m_szOverview; \return QString
qreal m_dPopularity; */
QString m_szPosterPath; QString localPath();
QStringList m_szProductionCompanies;
QStringList m_szProductionCountries; /*!
qreal m_dRevenue; \brief
qint32 m_iRuntime;
QStringList m_szSpokenLanguages; \fn setResolution
QString m_szStatus; \param szResolution
QString m_szTagline; */
bool m_bVideo; void setResolution(const QString& szResolution);
qreal m_dVoteAverage; /*!
qint32 m_iVoteCount; \brief
QStringList m_szCast;
QStringList m_szCrew; \fn resolution
State m_iState; \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; /*!< 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*)
Q_DECLARE_METATYPE(cMovie::State)
/*!
\brief
\class cMovieList cmovie.h "cmovie.h"
*/
class cMovieList : public QList<cMovie*> class cMovieList : public QList<cMovie*>
{ {
public: public:
/*!
\brief
\fn add
\param iID
\return cMovie
*/
cMovie* add(const qint32& iID); cMovie* add(const qint32& iID);
/*!
\brief
\fn add
\param lpMovie
\return cMovie
*/
cMovie* add(cMovie* lpMovie); cMovie* add(cMovie* lpMovie);
/*!
\brief
\fn find
\param iID
\return cMovie
*/
cMovie* find(const qint32& iID);
}; };
#endif // CMOVIE_H #endif // CMOVIE_H
+63
View File
@@ -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);
}
+52
View File
@@ -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
+206
View File
@@ -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>
+159
View File
@@ -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);
}
+85
View File
@@ -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
+241
View File
@@ -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>
+41 -20
View File
@@ -3,17 +3,39 @@
#include "ui_cmovieedit.h" #include "ui_cmovieedit.h"
#include <QSqlQuery>
cMovieEdit::cMovieEdit(QWidget *parent) : cMovieEdit::cMovieEdit(QWidget *parent) :
QDialog(parent), QDialog(parent),
ui(new Ui::cMovieEdit), ui(new Ui::cMovieEdit),
m_lpMovie(0) m_lpMovie(nullptr),
m_lpActorsModel(nullptr),
m_lpGenreModel(nullptr)
{ {
ui->setupUi(this); 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() cMovieEdit::~cMovieEdit()
{ {
delete m_lpActorsModel;
delete m_lpGenreModel;
delete ui; delete ui;
} }
@@ -26,6 +48,8 @@ void cMovieEdit::setMovie(cMovie *lpMovie)
ui->m_lpName->setText(lpMovie->movieTitle()); ui->m_lpName->setText(lpMovie->movieTitle());
ui->m_lpFirstAired->setDate(lpMovie->releaseDate()); ui->m_lpFirstAired->setDate(lpMovie->releaseDate());
ui->m_lpLocalPath->setText(lpMovie->localPath());
ui->m_lpResolution->setCurrentText(lpMovie->resolution());
switch(lpMovie->state()) switch(lpMovie->state())
{ {
@@ -38,6 +62,8 @@ void cMovieEdit::setMovie(cMovie *lpMovie)
case cMovie::StateDone: case cMovie::StateDone:
ui->m_lpDone->setChecked(true); ui->m_lpDone->setChecked(true);
break; break;
default:
break;
} }
if(!m_lpMovie->backdropPath().isEmpty()) if(!m_lpMovie->backdropPath().isEmpty())
@@ -49,36 +75,31 @@ void cMovieEdit::setMovie(cMovie *lpMovie)
ui->m_lpDetailsOverview->setText(m_lpMovie->overview()); ui->m_lpDetailsOverview->setText(m_lpMovie->overview());
QTreeWidgetItem* lpItem;
for(int x = 0;x < m_lpMovie->cast().count();x++) for(int x = 0;x < m_lpMovie->cast().count();x++)
{ {
QList<QStandardItem*> items;
QStringList str = m_lpMovie->cast().at(x).split(","); QStringList str = m_lpMovie->cast().at(x).split(",");
lpItem = new QTreeWidgetItem(ui->m_lpDetailsActors);
lpItem->setText(0, str.at(0)); items.append(new QStandardItem(str.at(0)));
lpItem->setText(1, str.at(1)); items.append(new QStandardItem(str.at(1)));
ui->m_lpDetailsActors->addTopLevelItem(lpItem); m_lpActorsModel->appendRow(items);
} }
ui->m_lpDetailsActors->resizeColumnToContents(0); ui->m_lpDetailsActors->resizeColumnToContents(0);
for(int x = 0;x < m_lpMovie->genres().count();x++) for(int x = 0;x < m_lpMovie->genres().count();x++)
{ m_lpGenreModel->appendRow(new QStandardItem(m_lpMovie->genres().at(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); ui->m_lpDetailsGenre->resizeColumnToContents(0);
} }
void cMovieEdit::on_m_lpInit_clicked() void cMovieEdit::on_buttonBox_accepted()
{ {
m_lpMovie->setLocalPath(ui->m_lpLocalPath->text());
m_lpMovie->setResolution(ui->m_lpResolution->currentText());
if(ui->m_lpInit->isChecked())
m_lpMovie->setState(cMovie::StateInit); m_lpMovie->setState(cMovie::StateInit);
} else if(ui->m_lpProgress->isChecked())
void cMovieEdit::on_m_lpProgress_clicked()
{
m_lpMovie->setState(cMovie::StateProgress); m_lpMovie->setState(cMovie::StateProgress);
} else
void cMovieEdit::on_m_lpDone_clicked()
{
m_lpMovie->setState(cMovie::StateDone); m_lpMovie->setState(cMovie::StateDone);
} }
+34 -8
View File
@@ -5,31 +5,57 @@
#include "cmovie.h" #include "cmovie.h"
#include <QDialog> #include <QDialog>
#include <QStandardItemModel>
namespace Ui { namespace Ui {
class cMovieEdit; class cMovieEdit;
} }
/*!
\brief
\class cMovieEdit cmovieedit.h "cmovieedit.h"
*/
class cMovieEdit : public QDialog class cMovieEdit : public QDialog
{ {
Q_OBJECT Q_OBJECT
public: public:
explicit cMovieEdit(QWidget *parent = 0); /*!
\brief
\fn cMovieEdit
\param parent
*/
explicit cMovieEdit(QWidget *parent = nullptr);
/*!
\brief
\fn ~cMovieEdit
*/
~cMovieEdit(); ~cMovieEdit();
/*!
\brief
\fn setMovie
\param lpMovie
*/
void setMovie(cMovie* lpMovie); void setMovie(cMovie* lpMovie);
private slots: private slots:
void on_m_lpInit_clicked(); /*!
\brief
void on_m_lpProgress_clicked(); \fn on_buttonBox_accepted
*/
void on_m_lpDone_clicked(); void on_buttonBox_accepted();
private: private:
Ui::cMovieEdit *ui; Ui::cMovieEdit* ui; /*!< TODO: describe */
cMovie* m_lpMovie; /*!< TODO: describe */
cMovie* m_lpMovie; QStandardItemModel* m_lpActorsModel; /*!< TODO: describe */
QStandardItemModel* m_lpGenreModel; /*!< TODO: describe */
}; };
#endif // CMOVIEEDIT_H #endif // CMOVIEEDIT_H
+37 -27
View File
@@ -11,7 +11,7 @@
</rect> </rect>
</property> </property>
<property name="windowTitle"> <property name="windowTitle">
<string>Dialog</string> <string>Edit Movie</string>
</property> </property>
<layout class="QGridLayout" name="gridLayout"> <layout class="QGridLayout" name="gridLayout">
<item row="0" column="0"> <item row="0" column="0">
@@ -43,6 +43,30 @@
</item> </item>
</layout> </layout>
</item> </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> <item>
<layout class="QHBoxLayout" name="horizontalLayout"> <layout class="QHBoxLayout" name="horizontalLayout">
<item> <item>
@@ -140,23 +164,16 @@
</widget> </widget>
</item> </item>
<item> <item>
<widget class="QTreeWidget" name="m_lpDetailsActors"> <widget class="QTreeView" name="m_lpDetailsActors">
<property name="columnCount"> <property name="editTriggers">
<number>2</number> <set>QAbstractItemView::NoEditTriggers</set>
</property>
<property name="alternatingRowColors">
<bool>true</bool>
</property> </property>
<attribute name="headerVisible"> <attribute name="headerVisible">
<bool>false</bool> <bool>false</bool>
</attribute> </attribute>
<column>
<property name="text">
<string notr="true">1</string>
</property>
</column>
<column>
<property name="text">
<string notr="true">2</string>
</property>
</column>
</widget> </widget>
</item> </item>
</layout> </layout>
@@ -171,23 +188,16 @@
</widget> </widget>
</item> </item>
<item> <item>
<widget class="QTreeWidget" name="m_lpDetailsGenre"> <widget class="QTreeView" name="m_lpDetailsGenre">
<property name="columnCount"> <property name="editTriggers">
<number>2</number> <set>QAbstractItemView::NoEditTriggers</set>
</property>
<property name="alternatingRowColors">
<bool>true</bool>
</property> </property>
<attribute name="headerVisible"> <attribute name="headerVisible">
<bool>false</bool> <bool>false</bool>
</attribute> </attribute>
<column>
<property name="text">
<string notr="true">1</string>
</property>
</column>
<column>
<property name="text">
<string notr="true">2</string>
</property>
</column>
</widget> </widget>
</item> </item>
</layout> </layout>
+19
View File
@@ -5,12 +5,31 @@
#include <QPixmap> #include <QPixmap>
/*!
\brief
\class cMovieImage cmovieimage.h "cmovieimage.h"
*/
class cMovieImage class cMovieImage
{ {
public: public:
cMovieImage(); cMovieImage();
/*!
\brief
\fn getImage
\param szFileName
\return QPixmap
*/
QPixmap getImage(const QString& szFileName); QPixmap getImage(const QString& szFileName);
private: private:
/*!
\brief
\fn downloadFile
\param szFileName
\return QPixmap
*/
QPixmap downloadFile(const QString& szFileName); QPixmap downloadFile(const QString& szFileName);
}; };
+76 -32
View File
@@ -9,10 +9,11 @@
#include <QList> #include <QList>
cMovieSearch::cMovieSearch(const cMovieList& movieList, QWidget *parent) :
cMovieSearch::cMovieSearch(QWidget *parent) :
QDialog(parent), QDialog(parent),
ui(new Ui::cMovieSearch) ui(new Ui::cMovieSearch),
m_lpResultsModel(nullptr),
m_movieList(movieList)
{ {
ui->setupUi(this); ui->setupUi(this);
ui->m_lpSearchButton->setEnabled(false); ui->m_lpSearchButton->setEnabled(false);
@@ -21,6 +22,9 @@ cMovieSearch::cMovieSearch(QWidget *parent) :
ui->m_lpButtonBox->button(QDialogButtonBox::Ok)->setEnabled(false); ui->m_lpButtonBox->button(QDialogButtonBox::Ok)->setEnabled(false);
ui->m_lpSearch->setFocus(); ui->m_lpSearch->setFocus();
ui->m_lpSearchButton->setDefault(true); ui->m_lpSearchButton->setDefault(true);
m_lpResultsModel = new QStandardItemModel(0, 0);
ui->m_lpResults->setModel(m_lpResultsModel);
} }
cMovieSearch::~cMovieSearch() cMovieSearch::~cMovieSearch()
@@ -28,7 +32,7 @@ cMovieSearch::~cMovieSearch()
delete ui; 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()) if(ui->m_lpSearch->text().isEmpty())
ui->m_lpSearchButton->setEnabled(false); ui->m_lpSearchButton->setEnabled(false);
@@ -38,6 +42,8 @@ void cMovieSearch::on_m_lpSearch_textChanged(const QString &arg1)
void cMovieSearch::on_m_lpSearchButton_clicked() void cMovieSearch::on_m_lpSearchButton_clicked()
{ {
setCursor(Qt::WaitCursor);
cMessageAnimateDialog* lpDialog = new cMessageAnimateDialog(this); cMessageAnimateDialog* lpDialog = new cMessageAnimateDialog(this);
lpDialog->setTitle("Search"); lpDialog->setTitle("Search");
lpDialog->setMessage("Searching"); lpDialog->setMessage("Searching");
@@ -45,7 +51,7 @@ void cMovieSearch::on_m_lpSearchButton_clicked()
cTheMovieDBV3 theMovieDBV3; cTheMovieDBV3 theMovieDBV3;
QString szSearchText = ui->m_lpSearch->text(); QString szSearchText = ui->m_lpSearch->text();
qint16 iYear = -1; qint32 iYear = -1;
if(szSearchText.contains("(") && szSearchText.contains(")")) 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++) for(int z = 0;z < movieList.count();z++)
{ {
cMovie* lpMovie = movieList.at(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);
}
ui->m_lpResults->resizeColumnToContents(0);
ui->m_lpResults->resizeColumnToContents(1);
ui->m_lpResults->sortItems(0, Qt::AscendingOrder); 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);
}
for(int x = 0;x < headerLabels.count();x++)
ui->m_lpResults->resizeColumnToContents(x);
m_lpResultsModel->sort(0, Qt::AscendingOrder);
delete lpDialog; 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(); qint32 iID = ui->m_lpSearch->text().toInt();
if(iID) if(iID)
return(iID); idList.append(iID);
return(-1); return(idList);
} }
return(ui->m_lpResults->selectedItems().at(0)->data(0, Qt::UserRole).toInt()); return(idList);
} }
QString cMovieSearch::placeholderName() QString cMovieSearch::placeholderName()
@@ -102,22 +129,35 @@ bool cMovieSearch::placeholder()
return(ui->m_lpTabWidget->currentIndex() == 1); return(ui->m_lpTabWidget->currentIndex() == 1);
} }
qint16 cMovieSearch::year() qint32 cMovieSearch::year()
{ {
return(ui->m_lpYear->value()); 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(); setButtonBox();
setCursor(Qt::ArrowCursor);
} }
void cMovieSearch::on_m_lpPlaceholderName_textChanged(const QString &arg1) void cMovieSearch::on_m_lpPlaceholderName_textChanged(const QString &/*arg1*/)
{ {
setButtonBox(); setButtonBox();
} }
void cMovieSearch::on_m_lpYear_valueChanged(int arg1) void cMovieSearch::on_m_lpYear_valueChanged(int /*arg1*/)
{ {
setButtonBox(); setButtonBox();
} }
@@ -126,12 +166,16 @@ void cMovieSearch::setButtonBox()
{ {
if(ui->m_lpTabWidget->currentIndex() == 0) 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); 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; return;
} }
}
}
if(ui->m_lpPlaceholderName->text().isEmpty()) if(ui->m_lpPlaceholderName->text().isEmpty())
{ {
@@ -148,8 +192,8 @@ void cMovieSearch::setButtonBox()
ui->m_lpButtonBox->button(QDialogButtonBox::Ok)->setEnabled(true); ui->m_lpButtonBox->button(QDialogButtonBox::Ok)->setEnabled(true);
} }
void cMovieSearch::on_m_lpResults_doubleClicked(const QModelIndex &index) //void cMovieSearch::on_m_lpResults_doubleClicked(const QModelIndex &index)
{ //{
if(index.isValid()) // if(index.isValid())
accept(); // accept();
} //}
+85 -6
View File
@@ -2,39 +2,118 @@
#define CMOVIESEARCH_H #define CMOVIESEARCH_H
#include <QDialog> #include <QDialog>
#include <QList>
#include <QStandardItemModel>
#include "cmovie.h"
namespace Ui { namespace Ui {
class cMovieSearch; class cMovieSearch;
} }
/*!
\brief
\class cMovieSearch cmoviesearch.h "cmoviesearch.h"
*/
class cMovieSearch : public QDialog class cMovieSearch : public QDialog
{ {
Q_OBJECT Q_OBJECT
public: public:
explicit cMovieSearch(QWidget *parent = 0); /*!
\brief
\fn cMovieSearch
\param parent
*/
explicit cMovieSearch(const cMovieList& movieList, QWidget *parent = nullptr);
/*!
\brief
\fn ~cMovieSearch
*/
~cMovieSearch(); ~cMovieSearch();
qint32 id(); /*!
\brief
\fn id
\return QList<qint32>
*/
QList<qint32> id();
/*!
\brief
\fn placeholderName
\return QString
*/
QString placeholderName(); QString placeholderName();
/*!
\brief
\fn placeholder
\return bool
*/
bool placeholder(); bool placeholder();
qint16 year(); /*!
\brief
\fn year
\return qint32
*/
qint32 year();
private slots: private slots:
/*!
\brief
\fn on_m_lpSearchButton_clicked
*/
void 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); void on_m_lpSearch_textChanged(const QString &arg1);
/*!
\brief
\fn on_m_lpPlaceholderName_textChanged
\param arg1
*/
void on_m_lpPlaceholderName_textChanged(const QString &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_lpYear_valueChanged(int arg1);
/*!
\brief
\fn on_m_lpResults_clicked
\param index
*/
void on_m_lpResults_clicked(const QModelIndex &index); void on_m_lpResults_clicked(const QModelIndex &index);
void on_m_lpResults_doubleClicked(const QModelIndex &index);
private: private:
Ui::cMovieSearch *ui; Ui::cMovieSearch* ui; /*!< TODO: describe */
QStandardItemModel* m_lpResultsModel;
cMovieList m_movieList; /*!< TODO: describe */
/*!
\brief
\fn setButtonBox
*/
void setButtonBox(); void setButtonBox();
}; };
+44 -24
View File
@@ -6,12 +6,12 @@
<rect> <rect>
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>334</width> <width>900</width>
<height>460</height> <height>500</height>
</rect> </rect>
</property> </property>
<property name="windowTitle"> <property name="windowTitle">
<string>Dialog</string> <string>Search Movies</string>
</property> </property>
<layout class="QGridLayout" name="gridLayout_3"> <layout class="QGridLayout" name="gridLayout_3">
<item row="1" column="0"> <item row="1" column="0">
@@ -35,9 +35,7 @@
</attribute> </attribute>
<layout class="QGridLayout" name="gridLayout"> <layout class="QGridLayout" name="gridLayout">
<item row="0" column="0"> <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">
<item> <item>
<layout class="QHBoxLayout" name="horizontalLayout"> <layout class="QHBoxLayout" name="horizontalLayout">
<item> <item>
@@ -53,31 +51,45 @@
</layout> </layout>
</item> </item>
<item> <item>
<widget class="QTreeWidget" name="m_lpResults"> <widget class="QSplitter" name="m_lpSplitter">
<property name="columnCount"> <property name="orientation">
<number>3</number> <enum>Qt::Horizontal</enum>
</property> </property>
<attribute name="headerVisible"> <widget class="QTreeView" name="m_lpResults">
<bool>false</bool> <property name="editTriggers">
</attribute> <set>QAbstractItemView::NoEditTriggers</set>
<column>
<property name="text">
<string notr="true">1</string>
</property> </property>
</column> <property name="alternatingRowColors">
<column> <bool>true</bool>
<property name="text">
<string notr="true">2</string>
</property> </property>
</column> <property name="selectionMode">
<column> <enum>QAbstractItemView::SingleSelection</enum>
<property name="text"> </property>
<string notr="true">3</string> <property name="sortingEnabled">
<bool>true</bool>
</property> </property>
</column>
</widget> </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> </item>
</layout> </layout>
</widget>
</widget>
</widget>
</item> </item>
</layout> </layout>
</item> </item>
@@ -142,6 +154,14 @@
</item> </item>
</layout> </layout>
</widget> </widget>
<customwidgets>
<customwidget>
<class>cMovieDetails</class>
<extends>QWidget</extends>
<header>cmoviedetails.h</header>
<container>1</container>
</customwidget>
</customwidgets>
<tabstops> <tabstops>
<tabstop>m_lpSearch</tabstop> <tabstop>m_lpSearch</tabstop>
<tabstop>m_lpSearchButton</tabstop> <tabstop>m_lpSearchButton</tabstop>
+2
View File
@@ -55,6 +55,8 @@ void cMovieViewItemDelegate::paint(QPainter* painter, const QStyleOptionViewItem
case cMovie::StateDone: case cMovie::StateDone:
statusDone++; statusDone++;
break; break;
default:
break;
} }
} }
x++; x++;
+21
View File
@@ -5,11 +5,32 @@
#include <QStyledItemDelegate> #include <QStyledItemDelegate>
/*!
\brief
\class cMovieViewItemDelegate cmovieviewitemdelegate.h "cmovieviewitemdelegate.h"
*/
class cMovieViewItemDelegate : public QStyledItemDelegate class cMovieViewItemDelegate : public QStyledItemDelegate
{ {
public: public:
protected: protected:
/*!
\brief
\fn paint
\param painter
\param option
\param index
*/
void paint(QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index) const; 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; QSize sizeHint(const QStyleOptionViewItem &option, const QModelIndex &index) const;
}; };
+13
View File
@@ -5,7 +5,20 @@
#include <QString> #include <QString>
/*!
\brief
\fn rootPath
\return QString
*/
QString rootPath(); QString rootPath();
/*!
\brief
\fn cleanList
\param list
\return QStringList
*/
QStringList cleanList(const QStringList& list); QStringList cleanList(const QStringList& list);
+1 -1
View File
@@ -22,7 +22,7 @@ void cPicturesThread::stop()
void cPicturesThread::run() void cPicturesThread::run()
{ {
qint16 iCurrent = 0; qint32 iCurrent = 0;
for(int z = 0;z < m_items.count();z++) for(int z = 0;z < m_items.count();z++)
{ {
+44 -4
View File
@@ -10,27 +10,67 @@
#include <QList> #include <QList>
/*!
\brief
\class cPicturesThread cpicturesthread.h "cpicturesthread.h"
*/
class cPicturesThread : public QThread class cPicturesThread : public QThread
{ {
Q_OBJECT Q_OBJECT
public: public:
/*!
\brief
\fn cPicturesThread
*/
explicit cPicturesThread(); explicit cPicturesThread();
/*!
\brief
\fn setData
\param lpMessageDialog
\param list
*/
void setData(cMessageDialog *lpMessageDialog, const QList<cSerie*>& list); void setData(cMessageDialog *lpMessageDialog, const QList<cSerie*>& list);
public slots: public slots:
/*!
\brief
\fn stop
*/
void stop(); void stop();
signals: signals:
/*!
\brief
\fn picturesMessage
\param szMessage
\param iProgress
*/
void picturesMessage(const QString& szMessage, const qint32 &iProgress); void picturesMessage(const QString& szMessage, const qint32 &iProgress);
/*!
\brief
\fn picturesAppendMessage
\param szMessage
*/
void picturesAppendMessage(const QString& szMessage); void picturesAppendMessage(const QString& szMessage);
private: private:
QMutex m_mutex; QMutex m_mutex; /*!< TODO: describe */
bool m_bStop; bool m_bStop; /*!< TODO: describe */
QList<cSerie*> m_items; QList<cSerie*> m_items; /*!< TODO: describe */
QWidget* m_lpParent; QWidget* m_lpParent; /*!< TODO: describe */
/*!
\brief
\fn run
*/
void run(); void run();
}; };
+24
View File
@@ -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);
}
+48
View File
@@ -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
+74
View File
@@ -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);
}
+29
View File
@@ -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
+207
View File
@@ -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>
+23
View File
@@ -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);
}
+36
View File
@@ -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
+44 -14
View File
@@ -9,9 +9,11 @@
#include <QList> #include <QList>
cSearch::cSearch(QWidget *parent) : cSearch::cSearch(const cSerieList& serieList, QWidget *parent) :
QDialog(parent), QDialog(parent),
ui(new Ui::cSearch) ui(new Ui::cSearch),
m_lpResultsModel(nullptr),
m_serieList(serieList)
{ {
ui->setupUi(this); ui->setupUi(this);
ui->m_lpSearchButton->setEnabled(false); ui->m_lpSearchButton->setEnabled(false);
@@ -20,10 +22,14 @@ cSearch::cSearch(QWidget *parent) :
ui->m_lpButtonBox->button(QDialogButtonBox::Ok)->setEnabled(false); ui->m_lpButtonBox->button(QDialogButtonBox::Ok)->setEnabled(false);
ui->m_lpSearch->setFocus(); ui->m_lpSearch->setFocus();
ui->m_lpSearchButton->setDefault(true); ui->m_lpSearchButton->setDefault(true);
m_lpResultsModel = new QStandardItemModel(0, 0);
ui->m_lpResults->setModel(m_lpResultsModel);
} }
cSearch::~cSearch() cSearch::~cSearch()
{ {
delete m_lpResultsModel;
delete ui; delete ui;
} }
@@ -37,6 +43,8 @@ void cSearch::on_m_lpSearch_textChanged(const QString& /*arg1*/)
void cSearch::on_m_lpSearchButton_clicked() void cSearch::on_m_lpSearchButton_clicked()
{ {
setCursor(Qt::WaitCursor);
cMessageAnimateDialog* lpDialog = new cMessageAnimateDialog(this); cMessageAnimateDialog* lpDialog = new cMessageAnimateDialog(this);
lpDialog->setTitle("Search"); lpDialog->setTitle("Search");
lpDialog->setMessage("Searching"); lpDialog->setMessage("Searching");
@@ -44,37 +52,46 @@ void cSearch::on_m_lpSearchButton_clicked()
cTheMovieDBV3 theMovieDBV3; 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++) for(int z = 0;z < serieList3.count();z++)
{ {
cSerie* lpSerie = serieList3.at(z); cSerie* lpSerie = serieList3.at(z);
QTreeWidgetItem* lpNew = new QTreeWidgetItem(ui->m_lpResults);
lpNew->setText(0, lpSerie->seriesName()); QList<QStandardItem*> items;
lpNew->setText(2, QString("%1").arg(lpSerie->firstAired().year()));
lpNew->setData(0, Qt::UserRole, QVariant::fromValue(lpSerie->seriesID())); items.append(new QStandardItem(lpSerie->seriesName()));
ui->m_lpResults->addTopLevelItem(lpNew); 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(0);
ui->m_lpResults->resizeColumnToContents(1); ui->m_lpResults->resizeColumnToContents(1);
ui->m_lpResults->sortItems(0, Qt::AscendingOrder); m_lpResultsModel->sort(0);
delete lpDialog; delete lpDialog;
setCursor(Qt::ArrowCursor);
} }
qint32 cSearch::id() qint32 cSearch::id()
{ {
if(!ui->m_lpResults->selectedItems().count()) if(!ui->m_lpResults->selectionModel()->selectedRows().count())
{ {
qint32 iID = ui->m_lpSearch->text().toInt(); qint32 iID = ui->m_lpSearch->text().toInt();
if(iID) if(iID)
return(iID); return(iID);
return(-1); 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() QString cSearch::placeholderName()
@@ -87,14 +104,27 @@ bool cSearch::placeholder()
return(ui->m_lpTabWidget->currentIndex() == 1); return(ui->m_lpTabWidget->currentIndex() == 1);
} }
qint16 cSearch::year() qint32 cSearch::year()
{ {
return(ui->m_lpYear->value()); 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(); setButtonBox();
setCursor(Qt::ArrowCursor);
} }
void cSearch::on_m_lpPlaceholderName_textChanged(const QString& /*arg1*/) 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_lpTabWidget->currentIndex() == 0)
{ {
if(ui->m_lpResults->selectedItems().count()) if(ui->m_lpResults->selectionModel()->selectedIndexes().count())
ui->m_lpButtonBox->button(QDialogButtonBox::Ok)->setEnabled(true); ui->m_lpButtonBox->button(QDialogButtonBox::Ok)->setEnabled(true);
else else
ui->m_lpButtonBox->button(QDialogButtonBox::Ok)->setEnabled(false); ui->m_lpButtonBox->button(QDialogButtonBox::Ok)->setEnabled(false);
+90 -3
View File
@@ -1,39 +1,126 @@
#ifndef CSEARCH_H #ifndef CSEARCH_H
#define CSEARCH_H #define CSEARCH_H
#include <QDialog> #include <QDialog>
#include <QStandardItemModel>
#include "cserie.h"
namespace Ui { namespace Ui {
class cSearch; class cSearch;
} }
/*!
\brief
\class cSearch csearch.h "csearch.h"
*/
class cSearch : public QDialog class cSearch : public QDialog
{ {
Q_OBJECT Q_OBJECT
public: public:
explicit cSearch(QWidget *parent = 0); /*!
\brief
\fn cSearch
\param parent
*/
explicit cSearch(const cSerieList& serieList, QWidget *parent = 0);
/*!
\brief
\fn ~cSearch
*/
~cSearch(); ~cSearch();
/*!
\brief
\fn id
\return qint32
*/
qint32 id(); qint32 id();
/*!
\brief
\fn placeholderName
\return QString
*/
QString placeholderName(); QString placeholderName();
/*!
\brief
\fn placeholder
\return bool
*/
bool placeholder(); bool placeholder();
qint16 year(); /*!
\brief
\fn year
\return qint32
*/
qint32 year();
private slots: private slots:
/*!
\brief
\fn on_m_lpSearchButton_clicked
*/
void 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); void on_m_lpSearch_textChanged(const QString &arg1);
/*!
\brief
\fn on_m_lpResults_clicked
\param index
*/
void on_m_lpResults_clicked(const QModelIndex &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); 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_lpYear_valueChanged(int arg1);
/*!
\brief
\fn on_m_lpResults_doubleClicked
\param index
*/
void on_m_lpResults_doubleClicked(const QModelIndex &index); void on_m_lpResults_doubleClicked(const QModelIndex &index);
private: private:
Ui::cSearch *ui; Ui::cSearch* ui; /*!< TODO: describe */
QStandardItemModel* m_lpResultsModel;
cSerieList m_serieList; /*!< TODO: describe */
/*!
\brief
\fn setButtonBox
*/
void setButtonBox(); void setButtonBox();
}; };
+44 -24
View File
@@ -6,12 +6,12 @@
<rect> <rect>
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>334</width> <width>900</width>
<height>460</height> <height>500</height>
</rect> </rect>
</property> </property>
<property name="windowTitle"> <property name="windowTitle">
<string>Dialog</string> <string>Search Series</string>
</property> </property>
<layout class="QGridLayout" name="gridLayout_3"> <layout class="QGridLayout" name="gridLayout_3">
<item row="1" column="0"> <item row="1" column="0">
@@ -35,9 +35,7 @@
</attribute> </attribute>
<layout class="QGridLayout" name="gridLayout"> <layout class="QGridLayout" name="gridLayout">
<item row="0" column="0"> <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">
<item> <item>
<layout class="QHBoxLayout" name="horizontalLayout"> <layout class="QHBoxLayout" name="horizontalLayout">
<item> <item>
@@ -53,31 +51,45 @@
</layout> </layout>
</item> </item>
<item> <item>
<widget class="QTreeWidget" name="m_lpResults"> <widget class="QSplitter" name="splitter">
<property name="columnCount"> <property name="orientation">
<number>3</number> <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> </property>
<attribute name="headerVisible"> <attribute name="headerVisible">
<bool>false</bool> <bool>false</bool>
</attribute> </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> </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> </item>
</layout> </layout>
</widget>
</widget>
</widget>
</item> </item>
</layout> </layout>
</item> </item>
@@ -142,6 +154,14 @@
</item> </item>
</layout> </layout>
</widget> </widget>
<customwidgets>
<customwidget>
<class>cSerieDetails</class>
<extends>QWidget</extends>
<header>cseriedetails.h</header>
<container>1</container>
</customwidget>
</customwidgets>
<tabstops> <tabstops>
<tabstop>m_lpSearch</tabstop> <tabstop>m_lpSearch</tabstop>
<tabstop>m_lpSearchButton</tabstop> <tabstop>m_lpSearchButton</tabstop>
+56 -22
View File
@@ -1,6 +1,6 @@
#include "cseason.h" #include "cseason.h"
#define DELETE(x) { if(x) delete x; x=0; } #define DELETE(x) { if(x) delete x; x=nullptr; }
cSeason::cSeason() : cSeason::cSeason() :
m_i_ID(-1), m_i_ID(-1),
@@ -10,15 +10,15 @@ cSeason::cSeason() :
m_iID(-1), m_iID(-1),
m_szPosterPath(""), m_szPosterPath(""),
m_iSeasonNumber(-1), m_iSeasonNumber(-1),
m_lpGroupBox(0), m_lpGroupBox(nullptr),
m_lpGridLayout(0), m_lpGridLayout(nullptr),
m_lpGrid(0), m_lpGrid(nullptr),
m_lpLabel1(0), m_lpLabel1(nullptr),
m_lpAllInit(0), m_lpAllInit(nullptr),
m_lpAllProgress(0), m_lpAllProgress(nullptr),
m_lpAllDone(0), m_lpAllDone(nullptr),
m_lpSpacer(0), m_lpSpacer(nullptr),
m_lpSerie(0) m_lpSerie(nullptr)
{ {
} }
@@ -28,11 +28,12 @@ cSeason::~cSeason()
deleteResources(); deleteResources();
} }
void cSeason::set_ID(const qint16& _iID) void cSeason::set_ID(const qint32& _iID)
{ {
m_i_ID = _iID; m_i_ID = _iID;
} }
qint16 cSeason::_id()
qint32 cSeason::_id()
{ {
return(m_i_ID); return(m_i_ID);
} }
@@ -72,12 +73,12 @@ QString cSeason::overview()
return(m_szOverview); return(m_szOverview);
} }
void cSeason::setID(const qint16& iID) void cSeason::setID(const qint32& iID)
{ {
m_iID = iID; m_iID = iID;
} }
qint16 cSeason::id() qint32 cSeason::id()
{ {
return(m_iID); return(m_iID);
} }
@@ -92,12 +93,12 @@ QString cSeason::posterPath()
return(m_szPosterPath); return(m_szPosterPath);
} }
void cSeason::setSeasonNumber(const qint16& iSeasonNumber) void cSeason::setSeasonNumber(const qint32& iSeasonNumber)
{ {
m_iSeasonNumber = iSeasonNumber; m_iSeasonNumber = iSeasonNumber;
} }
qint16 cSeason::seasonNumber() qint32 cSeason::seasonNumber()
{ {
return(m_iSeasonNumber); return(m_iSeasonNumber);
} }
@@ -112,7 +113,7 @@ cSerie* cSeason::serie()
return(m_lpSerie); return(m_lpSerie);
} }
cEpisode* cSeason::addEpisode(qint16 iNumber) cEpisode* cSeason::addEpisode(qint32 iNumber)
{ {
cEpisode* lpNew = new cEpisode; cEpisode* lpNew = new cEpisode;
lpNew->setEpisodeNumber(iNumber); lpNew->setEpisodeNumber(iNumber);
@@ -124,7 +125,7 @@ cEpisode* cSeason::addEpisode(qint16 iNumber)
cEpisode* cSeason::addEpisode(cEpisode* lpEpisode) cEpisode* cSeason::addEpisode(cEpisode* lpEpisode)
{ {
if(episodeList().contains(lpEpisode)) if(episodeList().contains(lpEpisode))
return(0); return(nullptr);
m_episodeList.append(lpEpisode); m_episodeList.append(lpEpisode);
return(lpEpisode); return(lpEpisode);
} }
@@ -134,19 +135,19 @@ QList<cEpisode*> cSeason::episodeList()
return(m_episodeList); return(m_episodeList);
} }
cEpisode* cSeason::findEpisode(qint16 iNumber) cEpisode* cSeason::findEpisode(qint32 iNumber)
{ {
for(int x = 0;x < m_episodeList.count();x++) for(int x = 0;x < m_episodeList.count();x++)
{ {
if(m_episodeList.at(x)->episodeNumber() == iNumber) if(m_episodeList.at(x)->episodeNumber() == iNumber)
return(m_episodeList.at(x)); 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++) for(int z = 0;z < m_episodeList.count();z++)
{ {
cEpisode* lpEpisode = m_episodeList.at(z); cEpisode* lpEpisode = m_episodeList.at(z);
@@ -179,6 +180,39 @@ void cSeason::setLabel1(QLabel* lpLabel1)
m_lpLabel1 = 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) void cSeason::setAllInit(QPushButton* lpAllInit)
{ {
m_lpAllInit = lpAllInit; m_lpAllInit = lpAllInit;
+284 -26
View File
@@ -16,81 +16,339 @@
class cSerie; class cSerie;
/*!
\brief
\class cSeason cseason.h "cseason.h"
*/
class cSeason class cSeason
{ {
public: public:
cSeason(); cSeason();
/*!
\brief
\fn ~cSeason
*/
~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); void setAirDate(const QString& szAirDate);
/*!
\brief
\fn setAirDate
\param airDate
*/
void setAirDate(const QDate& airDate); void setAirDate(const QDate& airDate);
/*!
\brief
\fn airDate
\return QDate
*/
QDate airDate(); QDate airDate();
/*!
\brief
\fn setName
\param szName
*/
void setName(const QString& szName); void setName(const QString& szName);
/*!
\brief
\fn name
\return QString
*/
QString name(); QString name();
/*!
\brief
\fn setOverview
\param szOverview
*/
void setOverview(const QString& szOverview); void setOverview(const QString& szOverview);
/*!
\brief
\fn overview
\return QString
*/
QString overview(); 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); void setPosterPath(const QString& szPosterPath);
/*!
\brief
\fn posterPath
\return QString
*/
QString posterPath(); 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); void setSerie(cSerie* lpSerie);
/*!
\brief
\fn serie
\return cSerie
*/
cSerie* serie(); 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); cEpisode* addEpisode(cEpisode* lpEpisode);
/*!
\brief
\fn episodeList
\return QList<cEpisode *>
*/
QList<cEpisode*> episodeList(); 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); void setGroupBox(QGroupBox* lpGroupBox);
/*!
\brief
\fn setGridLayout
\param lpGridLayout
*/
void setGridLayout(QGridLayout* lpGridLayout); void setGridLayout(QGridLayout* lpGridLayout);
/*!
\brief
\fn setGrid
\param lpGrid
*/
void setGrid(QGridLayout* lpGrid); void setGrid(QGridLayout* lpGrid);
/*!
\brief
\fn setLabel1
\param lpLabel1
*/
void setLabel1(QLabel* lpLabel1); void setLabel1(QLabel* lpLabel1);
/*!
\brief
\fn setAllInit
\param lpAllInit
*/
void setAllInit(QPushButton* lpAllInit); void setAllInit(QPushButton* lpAllInit);
/*!
\brief
\fn setAllProgress
\param lpAllProgress
*/
void setAllProgress(QPushButton* lpAllProgress); void setAllProgress(QPushButton* lpAllProgress);
/*!
\brief
\fn setAllDone
\param lpAllDone
*/
void setAllDone(QPushButton* lpAllDone); void setAllDone(QPushButton* lpAllDone);
/*!
\brief
\fn setSpacer
\param lpSpacer
*/
void setSpacer(QSpacerItem* lpSpacer); void setSpacer(QSpacerItem* lpSpacer);
/*!
\brief
\fn updateState
*/
void updateState(); void updateState();
/*!
\brief
\fn deleteResources
*/
void 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(); void allInit();
/*!
\brief
\fn allProgress
*/
void allProgress(); void allProgress();
/*!
\brief
\fn allDone
*/
void allDone(); void allDone();
/*!
\brief
\fn allInitButton
\return QPushButton
*/
QPushButton* allInitButton(); QPushButton* allInitButton();
/*!
\brief
\fn allProgressButton
\return QPushButton
*/
QPushButton* allProgressButton(); QPushButton* allProgressButton();
/*!
\brief
\fn allDoneButton
\return QPushButton
*/
QPushButton* allDoneButton(); QPushButton* allDoneButton();
private: private:
qint16 m_i_ID; qint32 m_i_ID; /*!< TODO: describe */
QDate m_airDate; QDate m_airDate; /*!< TODO: describe */
QString m_szName; QString m_szName; /*!< TODO: describe */
QString m_szOverview; QString m_szOverview; /*!< TODO: describe */
qint16 m_iID; qint32 m_iID; /*!< TODO: describe */
QString m_szPosterPath; QString m_szPosterPath; /*!< TODO: describe */
qint16 m_iSeasonNumber; qint32 m_iSeasonNumber; /*!< TODO: describe */
QList<cEpisode*> m_episodeList; QList<cEpisode*> m_episodeList; /*!< TODO: describe */
QGroupBox* m_lpGroupBox; QGroupBox* m_lpGroupBox; /*!< TODO: describe */
QGridLayout* m_lpGridLayout; QGridLayout* m_lpGridLayout; /*!< TODO: describe */
QGridLayout* m_lpGrid; QGridLayout* m_lpGrid; /*!< TODO: describe */
QLabel* m_lpLabel1; QLabel* m_lpLabel1; /*!< TODO: describe */
QPushButton* m_lpAllInit; QPushButton* m_lpAllInit; /*!< TODO: describe */
QPushButton* m_lpAllProgress; QPushButton* m_lpAllProgress; /*!< TODO: describe */
QPushButton* m_lpAllDone; QPushButton* m_lpAllDone; /*!< TODO: describe */
QSpacerItem* m_lpSpacer; QSpacerItem* m_lpSpacer; /*!< TODO: describe */
cSerie* m_lpSerie; cSerie* m_lpSerie; /*!< TODO: describe */
}; };
Q_DECLARE_METATYPE(cSeason*) Q_DECLARE_METATYPE(cSeason*)
+6 -9
View File
@@ -25,9 +25,9 @@
void cSeasonDelegate::paint(QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index) const 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*>()) if(index.data(Qt::UserRole).canConvert<cSeason*>())
lpSeason = qvariant_cast<cSeason*>(index.data(Qt::UserRole)); 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 QSize cSeasonDelegate::sizeHint(const QStyleOptionViewItem &option, const QModelIndex &index) const
{ {
if(index.column() > 2) if(index.column() > 3)
{ {
qint16 iTotal = -1; qint32 iTotal = -1;
qint16 z; qint32 z;
cSeason* lpSeason = 0; cSeason* lpSeason = nullptr;
if(index.data(Qt::UserRole).canConvert<cSeason*>()) if(index.data(Qt::UserRole).canConvert<cSeason*>())
lpSeason = qvariant_cast<cSeason*>(index.data(Qt::UserRole)); 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) if(iTotal > 0 && lpSeason->seasonNumber() != 0)
return(QSize((iTotal+1)*FIELD_STEP, HEIGHT)); return(QSize((iTotal+1)*FIELD_STEP, HEIGHT));
//return(QSize((iTotal+1)*FIELD_STEP, FIELD_HEIGHT));
else else
return(QSize(FIELD_STEP*40, HEIGHT)); return(QSize(FIELD_STEP*40, HEIGHT));
//return(QSize(FIELD_STEP*40, FIELD_HEIGHT));
} }
return(QSize(FIELD_STEP, HEIGHT)); return(QSize(FIELD_STEP, HEIGHT));
//return(QSize(FIELD_STEP, FIELD_HEIGHT));
} }
return QSize(QStyledItemDelegate::sizeHint(option, index).width(), HEIGHT); return QSize(QStyledItemDelegate::sizeHint(option, index).width(), HEIGHT);
} }
+22 -4
View File
@@ -5,18 +5,36 @@
#include <QStyledItemDelegate> #include <QStyledItemDelegate>
/*!
\brief
\class cSeasonDelegate cseasondelegate.h "cseasondelegate.h"
*/
class cSeasonDelegate : public QStyledItemDelegate class cSeasonDelegate : public QStyledItemDelegate
{ {
Q_OBJECT Q_OBJECT
public: 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; 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; 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 #endif // CSEASONDELEGATE_H
+9
View File
@@ -6,6 +6,8 @@
#include "cmessageanimatedialog.h" #include "cmessageanimatedialog.h"
#include "cmovieimage.h"
#include <QDebug> #include <QDebug>
@@ -23,6 +25,13 @@ cSeasonDetails::~cSeasonDetails()
void cSeasonDetails::setSeason(cSeason* lpSeason) 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++) for(int x = 0;x < lpSeason->episodeList().count();x++)
{ {
cEpisode* lpEpisode = lpSeason->episodeList().at(x); cEpisode* lpEpisode = lpSeason->episodeList().at(x);
+29 -1
View File
@@ -11,21 +11,49 @@ namespace Ui {
class cSeasonDetails; class cSeasonDetails;
} }
/*!
\brief
\class cSeasonDetails cseasondetails.h "cseasondetails.h"
*/
class cSeasonDetails : public QWidget class cSeasonDetails : public QWidget
{ {
Q_OBJECT Q_OBJECT
public: public:
/*!
\brief
\fn cSeasonDetails
\param parent
*/
explicit cSeasonDetails(QWidget *parent = 0); explicit cSeasonDetails(QWidget *parent = 0);
/*!
\brief
\fn ~cSeasonDetails
*/
~cSeasonDetails(); ~cSeasonDetails();
/*!
\brief
\fn setSeason
\param lpSeason
*/
void setSeason(cSeason* lpSeason); void setSeason(cSeason* lpSeason);
private slots: private slots:
/*!
\brief
\fn on_m_lpDetailsEpisodeTab_tabBarClicked
\param index
*/
void on_m_lpDetailsEpisodeTab_tabBarClicked(int index); void on_m_lpDetailsEpisodeTab_tabBarClicked(int index);
private: private:
Ui::cSeasonDetails* ui; Ui::cSeasonDetails* ui; /*!< TODO: describe */
}; };
#endif // CSEASONDETAILS_H #endif // CSEASONDETAILS_H
+39
View File
@@ -15,6 +15,43 @@
</property> </property>
<layout class="QGridLayout" name="gridLayout"> <layout class="QGridLayout" name="gridLayout">
<item row="0" column="0"> <item row="0" column="0">
<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"> <widget class="QTabWidget" name="m_lpDetailsEpisodeTab">
<property name="currentIndex"> <property name="currentIndex">
<number>-1</number> <number>-1</number>
@@ -22,6 +59,8 @@
</widget> </widget>
</item> </item>
</layout> </layout>
</item>
</layout>
</widget> </widget>
<resources/> <resources/>
<connections/> <connections/>
+219 -35
View File
@@ -1,4 +1,5 @@
#include "cserie.h" #include "cserie.h"
#include "cfanarttv.h"
#include "common.h" #include "common.h"
#include <QStringList> #include <QStringList>
@@ -25,8 +26,14 @@ cSerie::cSerie() :
m_iVoteCount(-1), m_iVoteCount(-1),
m_szOverview(""), m_szOverview(""),
m_firstAired(QDate(1900, 1, 1)), m_firstAired(QDate(1900, 1, 1)),
m_szIMDBID(""),
m_szFreebaseMID(""),
m_szFreebaseID(""),
m_iTVDBID(-1),
m_iTVRageID(-1),
m_szStatus(""), m_szStatus(""),
m_szDownload(""), m_szDownload(""),
m_szLocalPath(""),
m_bCliffhanger(false) m_bCliffhanger(false)
{ {
} }
@@ -140,22 +147,22 @@ QStringList cSerie::networks()
return(m_szNetworks); return(m_szNetworks);
} }
void cSerie::setEpisodes(const qint16& iEpisodes) void cSerie::setEpisodes(const qint32& iEpisodes)
{ {
m_iEpisodes = iEpisodes; m_iEpisodes = iEpisodes;
} }
qint16 cSerie::episodes() qint32 cSerie::episodes()
{ {
return(m_iEpisodes); return(m_iEpisodes);
} }
void cSerie::setSeasons(const qint16& iSeasons) void cSerie::setSeasons(const qint32& iSeasons)
{ {
m_iSeasons = iSeasons; m_iSeasons = iSeasons;
} }
qint16 cSerie::seasons() qint32 cSerie::seasons()
{ {
return(m_iSeasons); return(m_iSeasons);
} }
@@ -239,12 +246,12 @@ qreal cSerie::voteAverage()
return(m_dVoteAverage); return(m_dVoteAverage);
} }
void cSerie::setVoteCount(const qint16& iVoteCount) void cSerie::setVoteCount(const qint32& iVoteCount)
{ {
m_iVoteCount = iVoteCount; m_iVoteCount = iVoteCount;
} }
qint16 cSerie::voteCount() qint32 cSerie::voteCount()
{ {
return(m_iVoteCount); return(m_iVoteCount);
} }
@@ -311,6 +318,56 @@ QStringList cSerie::genre()
return(m_szGenre); 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) void cSerie::setStatus(const QString& szStatus)
{ {
m_szStatus = szStatus; m_szStatus = szStatus;
@@ -331,6 +388,26 @@ QString cSerie::download()
return(m_szDownload); 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) void cSerie::setCliffhanger(const bool& bCliffhanger)
{ {
m_bCliffhanger = bCliffhanger; m_bCliffhanger = bCliffhanger;
@@ -341,7 +418,7 @@ bool cSerie::cliffhanger()
return(m_bCliffhanger); return(m_bCliffhanger);
} }
cSeason* cSerie::addSeason(const qint16& iSeason) cSeason* cSerie::addSeason(const qint32& iSeason)
{ {
cSeason* lpNew = new cSeason; cSeason* lpNew = new cSeason;
lpNew->setSeasonNumber(iSeason); lpNew->setSeasonNumber(iSeason);
@@ -350,14 +427,14 @@ cSeason* cSerie::addSeason(const qint16& iSeason)
return(lpNew); return(lpNew);
} }
cSeason* cSerie::findSeason(const qint16& iSeason) cSeason* cSerie::findSeason(const qint32& iSeason)
{ {
for(int z = 0;z < m_seasonList.count();z++) for(int z = 0;z < m_seasonList.count();z++)
{ {
if(m_seasonList.at(z)->seasonNumber() == iSeason) if(m_seasonList.at(z)->seasonNumber() == iSeason)
return(m_seasonList.at(z)); return(m_seasonList.at(z));
} }
return(0); return(nullptr);
} }
QList<cSeason*> cSerie::seasonList() QList<cSeason*> cSerie::seasonList()
@@ -365,9 +442,9 @@ QList<cSeason*> cSerie::seasonList()
return(m_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++) for(int z = 0;z < m_seasonList.count();z++)
{ {
if(m_seasonList.at(z)->seasonNumber() < iMin) if(m_seasonList.at(z)->seasonNumber() < iMin)
@@ -378,9 +455,9 @@ qint16 cSerie::minSeason()
return(iMin); return(iMin);
} }
qint16 cSerie::maxSeason() qint32 cSerie::maxSeason()
{ {
qint16 iMax = -1; qint32 iMax = -1;
for(int z = 0;z < m_seasonList.count();z++) for(int z = 0;z < m_seasonList.count();z++)
{ {
if(m_seasonList.at(z)->seasonNumber() > iMax) if(m_seasonList.at(z)->seasonNumber() > iMax)
@@ -401,7 +478,7 @@ cEpisode* cSerie::findEpisode(const qint32& id)
return(lpEpisode); return(lpEpisode);
} }
} }
return(0); return(nullptr);
} }
bool cSerie::isValid() bool cSerie::isValid()
@@ -412,9 +489,9 @@ bool cSerie::isValid()
return(false); return(false);
} }
qint16 cSerie::maxEpisode() qint32 cSerie::maxEpisode()
{ {
qint16 iMax = -1; qint32 iMax = -1;
for(int z = 0;z < m_seasonList.count();z++) for(int z = 0;z < m_seasonList.count();z++)
{ {
if(m_seasonList.at(z)->episodeCount() > iMax) if(m_seasonList.at(z)->episodeCount() > iMax)
@@ -423,18 +500,63 @@ qint16 cSerie::maxEpisode()
return(iMax); 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) bool cSerie::save(QSqlDatabase &db)
{ {
QSqlQuery query; QSqlQuery query;
QSqlQuery querySerie; QSqlQuery querySerie;
QSqlQuery querySeason; QSqlQuery querySeason;
QSqlQuery queryEpisode; 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)" 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,: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,: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);"); 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)" 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);"); " 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(); db.transaction();
query.exec(QString("SELECT seriesID FROM serie WHERE seriesID=%1;").arg(seriesID())); query.exec(QString("SELECT seriesID FROM serie WHERE seriesID=%1;").arg(seriesID()));
if(!query.next()) if(!query.next())
@@ -465,8 +587,15 @@ bool cSerie::save(QSqlDatabase &db)
querySerie.bindValue(":cast", cast().join("|")); querySerie.bindValue(":cast", cast().join("|"));
querySerie.bindValue(":crew", crew().join("|")); querySerie.bindValue(":crew", crew().join("|"));
querySerie.bindValue(":genre", genre().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(":status", status());
querySerie.bindValue(":download", download()); querySerie.bindValue(":download", download());
querySerie.bindValue(":localPath", localPath());
querySerie.bindValue(":resolution", resolution());
querySerie.bindValue(":cliffhanger", cliffhanger()); querySerie.bindValue(":cliffhanger", cliffhanger());
if(querySerie.exec()) if(querySerie.exec())
{ {
@@ -491,10 +620,6 @@ bool cSerie::save(QSqlDatabase &db)
{ {
cEpisode* lpEpisode = episodeList.at(episode); cEpisode* lpEpisode = episodeList.at(episode);
//query.bindValue(":episodeID", lpEpisode->id());
//query.exec();
//if(!query.next())
{
queryEpisode.bindValue(":id", lpEpisode->id()); queryEpisode.bindValue(":id", lpEpisode->id());
queryEpisode.bindValue(":name", lpEpisode->name()); queryEpisode.bindValue(":name", lpEpisode->name());
queryEpisode.bindValue(":episodeNumber", lpEpisode->episodeNumber()); queryEpisode.bindValue(":episodeNumber", lpEpisode->episodeNumber());
@@ -515,6 +640,23 @@ bool cSerie::save(QSqlDatabase &db)
} }
} }
} }
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 else
@@ -530,6 +672,14 @@ bool cSerie::del(QSqlDatabase& db)
QSqlQuery query; QSqlQuery query;
db.transaction(); 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.prepare("DELETE FROM episode WHERE seriesID=:seriesID;");
query.bindValue(":seriesID", seriesID()); query.bindValue(":seriesID", seriesID());
query.exec(); query.exec();
@@ -612,14 +762,38 @@ void cSerie::deleteResources()
m_seasonList.at(z)->deleteResources(); m_seasonList.at(z)->deleteResources();
} }
void cSerie::loadFanart()
{
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++)
{
cFanart* lpFanartTV = m_fanartList.at(x);
if(lpFanartTV->type() == cFanart::TypeTVBanner)
return(lpFanartTV->url());
}
return("");
}
cSerie* cSerieList::add(const qint32& iID) cSerie* cSerieList::add(const qint32& iID)
{ {
for(int z = 0;z < count();z++) cSerie* lpNew = find(iID);
{ if(!lpNew)
if(at(z)->seriesID() == iID) lpNew = new cSerie;
return(at(z));
}
cSerie* lpNew = new cSerie;
lpNew->setSeriesID(iID); lpNew->setSeriesID(iID);
append(lpNew); append(lpNew);
return(lpNew); return(lpNew);
@@ -630,15 +804,25 @@ cSerie* cSerieList::add(cSerie* lpSerie)
for(int z = 0;z < count();z++) for(int z = 0;z < count();z++)
{ {
if(at(z) == lpSerie) if(at(z) == lpSerie)
return(0); return(nullptr);
} }
append(lpSerie); append(lpSerie);
return(lpSerie); return(lpSerie);
} }
qint16 cSerieList::minSeason() cSerie* cSerieList::find(const qint32& iID)
{ {
qint16 iMin = 9999; for(int x = 0;x < count();x++)
{
if(at(x)->seriesID() == iID)
return(at(x));
}
return(nullptr);
}
qint32 cSerieList::minSeason()
{
qint32 iMin = 9999;
for(int z = 0;z < count();z++) for(int z = 0;z < count();z++)
{ {
if(at(z)->minSeason() < iMin) if(at(z)->minSeason() < iMin)
@@ -650,9 +834,9 @@ qint16 cSerieList::minSeason()
return(iMin); return(iMin);
} }
qint16 cSerieList::maxSeason() qint32 cSerieList::maxSeason()
{ {
qint16 iMax = -1; qint32 iMax = -1;
for(int z = 0;z < count();z++) for(int z = 0;z < count();z++)
{ {
if(at(z)->maxSeason() > iMax) if(at(z)->maxSeason() > iMax)
@@ -665,9 +849,9 @@ qint16 cSerieList::maxSeason()
return(iMax); return(iMax);
} }
qint16 cSerieList::maxEpisode() qint32 cSerieList::maxEpisode()
{ {
qint16 iMax = -1; qint32 iMax = -1;
for(int z = 0;z < count();z++) for(int z = 0;z < count();z++)
{ {
if(at(z)->maxEpisode() > iMax) if(at(z)->maxEpisode() > iMax)
+739 -42
View File
@@ -3,176 +3,873 @@
#include "cseason.h" #include "cseason.h"
#include "cfanart.h"
#include <QMetaType> #include <QMetaType>
#include <QDate> #include <QDate>
#include <QSqlDatabase> #include <QSqlDatabase>
/*!
\brief
\class cSerie cserie.h "cserie.h"
*/
class cSerie class cSerie
{ {
public: public:
cSerie(); cSerie();
/*!
\brief
\fn setSeriesName
\param szSeriesName
*/
void setSeriesName(const QString& szSeriesName); void setSeriesName(const QString& szSeriesName);
/*!
\brief
\fn seriesName
\return QString
*/
QString seriesName(); QString seriesName();
/*!
\brief
\fn setOriginalName
\param szOriginalName
*/
void setOriginalName(const QString& szOriginalName); void setOriginalName(const QString& szOriginalName);
/*!
\brief
\fn originalName
\return QString
*/
QString originalName(); QString originalName();
/*!
\brief
\fn setSeriesID
\param iSeriesID
*/
void setSeriesID(const qint32& iSeriesID); void setSeriesID(const qint32& iSeriesID);
/*!
\brief
\fn seriesID
\return qint32
*/
qint32 seriesID(); qint32 seriesID();
/*!
\brief
\fn setBackdropPath
\param szBackdropPath
*/
void setBackdropPath(const QString& szBackdropPath); void setBackdropPath(const QString& szBackdropPath);
/*!
\brief
\fn backdropPath
\return QString
*/
QString backdropPath(); QString backdropPath();
/*!
\brief
\fn setCreatedBy
\param szCreatedBy
*/
void setCreatedBy(const QStringList& szCreatedBy); void setCreatedBy(const QStringList& szCreatedBy);
/*!
\brief
\fn setCreatedBy
\param szCreatedBy
*/
void setCreatedBy(const QString& szCreatedBy); void setCreatedBy(const QString& szCreatedBy);
/*!
\brief
\fn createdBy
\return QStringList
*/
QStringList createdBy(); QStringList createdBy();
/*!
\brief
\fn setHomepage
\param szHomepage
*/
void setHomepage(const QString& szHomepage); void setHomepage(const QString& szHomepage);
/*!
\brief
\fn homepage
\return QString
*/
QString homepage(); QString homepage();
/*!
\brief
\fn setLastAired
\param szLAstAired
*/
void setLastAired(const QString& szLAstAired); void setLastAired(const QString& szLAstAired);
/*!
\brief
\fn setLastAired
\param lastAired
*/
void setLastAired(const QDate& lastAired); void setLastAired(const QDate& lastAired);
/*!
\brief
\fn lastAired
\return QDate
*/
QDate lastAired(); QDate lastAired();
/*!
\brief
\fn setLanguages
\param szLanguages
*/
void setLanguages(const QString& szLanguages); void setLanguages(const QString& szLanguages);
/*!
\brief
\fn setLanguages
\param szLanguages
*/
void setLanguages(const QStringList& szLanguages); void setLanguages(const QStringList& szLanguages);
/*!
\brief
\fn languages
\return QStringList
*/
QStringList languages(); QStringList languages();
/*!
\brief
\fn setNetworks
\param szNetworks
*/
void setNetworks(const QStringList& szNetworks); void setNetworks(const QStringList& szNetworks);
/*!
\brief
\fn setNetworks
\param szNetworks
*/
void setNetworks(const QString& szNetworks); void setNetworks(const QString& szNetworks);
/*!
\brief
\fn networks
\return QStringList
*/
QStringList networks(); QStringList networks();
void setEpisodes(const qint16& iEpisodes); /*!
qint16 episodes(); \brief
void setSeasons(const qint16& iSeasons); \fn setEpisodes
qint16 seasons(); \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); void setOriginCountries(const QStringList& szOriginCountries);
/*!
\brief
\fn setOriginCountries
\param szOriginCountries
*/
void setOriginCountries(const QString& szOriginCountries); void setOriginCountries(const QString& szOriginCountries);
/*!
\brief
\fn originCountries
\return QStringList
*/
QStringList originCountries(); QStringList originCountries();
/*!
\brief
\fn setOriginalLanguage
\param szOriginalLanguage
*/
void setOriginalLanguage(const QString& szOriginalLanguage); void setOriginalLanguage(const QString& szOriginalLanguage);
/*!
\brief
\fn originalLanguage
\return QString
*/
QString originalLanguage(); QString originalLanguage();
/*!
\brief
\fn setPopularity
\param dPopularity
*/
void setPopularity(const qreal& dPopularity); void setPopularity(const qreal& dPopularity);
/*!
\brief
\fn popularity
\return qreal
*/
qreal popularity(); qreal popularity();
/*!
\brief
\fn setPosterPath
\param szPosterPath
*/
void setPosterPath(const QString& szPosterPath); void setPosterPath(const QString& szPosterPath);
/*!
\brief
\fn posterPath
\return QString
*/
QString posterPath(); QString posterPath();
/*!
\brief
\fn setProductionCompanies
\param szProductionCompanies
*/
void setProductionCompanies(const QStringList& szProductionCompanies); void setProductionCompanies(const QStringList& szProductionCompanies);
/*!
\brief
\fn setProductionCompanies
\param szProductionCompanies
*/
void setProductionCompanies(const QString& szProductionCompanies); void setProductionCompanies(const QString& szProductionCompanies);
/*!
\brief
\fn productionCompanies
\return QStringList
*/
QStringList productionCompanies(); QStringList productionCompanies();
/*!
\brief
\fn setType
\param szType
*/
void setType(const QString& szType); void setType(const QString& szType);
/*!
\brief
\fn type
\return QString
*/
QString type(); QString type();
/*!
\brief
\fn setVoteAverage
\param dVoteAverage
*/
void setVoteAverage(const qreal& dVoteAverage); void setVoteAverage(const qreal& dVoteAverage);
/*!
\brief
\fn voteAverage
\return qreal
*/
qreal voteAverage(); 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); void setOverview(const QString& szOverview);
/*!
\brief
\fn overview
\return QString
*/
QString overview(); QString overview();
/*!
\brief
\fn setFirstAired
\param szFirstAired
*/
void setFirstAired(const QString& szFirstAired); void setFirstAired(const QString& szFirstAired);
/*!
\brief
\fn setFirstAired
\param firstAired
*/
void setFirstAired(const QDate& firstAired); void setFirstAired(const QDate& firstAired);
/*!
\brief
\fn firstAired
\return QDate
*/
QDate firstAired(); QDate firstAired();
/*!
\brief
\fn setCast
\param szCast
*/
void setCast(const QStringList& szCast); void setCast(const QStringList& szCast);
/*!
\brief
\fn cast
\return QStringList
*/
QStringList cast(); QStringList cast();
/*!
\brief
\fn setCrew
\param szCrew
*/
void setCrew(const QStringList& szCrew); void setCrew(const QStringList& szCrew);
/*!
\brief
\fn crew
\return QStringList
*/
QStringList crew(); QStringList crew();
/*!
\brief
\fn setGenre
\param szGenre
*/
void setGenre(const QString& szGenre); void setGenre(const QString& szGenre);
/*!
\brief
\fn setGenre
\param szGenre
*/
void setGenre(const QStringList& szGenre); void setGenre(const QStringList& szGenre);
/*!
\brief
\fn genre
\return QStringList
*/
QStringList genre(); 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); void setStatus(const QString& szStatus);
/*!
\brief
\fn status
\return QString
*/
QString status(); QString status();
/*!
\brief
\fn setDownload
\param szDownload
*/
void setDownload(const QString& szDownload); void setDownload(const QString& szDownload);
/*!
\brief
\fn download
\return QString
*/
QString download(); 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); void setCliffhanger(const bool& bCliffhanger);
/*!
\brief
\fn cliffhanger
\return bool
*/
bool cliffhanger(); bool cliffhanger();
cSeason* addSeason(const qint16& iSeason); /*!
\brief
\fn addSeason
\param iSeason
\return cSeason
*/
cSeason* addSeason(const qint32& iSeason);
/*!
\brief
\fn seasonList
\return QList<cSeason *>
*/
QList<cSeason*> seasonList(); QList<cSeason*> seasonList();
cSeason* findSeason(const qint16& iSeason); /*!
\brief
qint16 minSeason(); \fn findSeason
qint16 maxSeason(); \param iSeason
\return cSeason
*/
cSeason* findSeason(const qint32& iSeason);
qint16 maxEpisode(); /*!
\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); cEpisode* findEpisode(const qint32& id);
/*!
\brief
\fn isValid
\return bool
*/
bool isValid(); 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); bool save(QSqlDatabase& db);
/*!
\brief
\fn del
\param db
\return bool
*/
bool del(QSqlDatabase& db); bool del(QSqlDatabase& db);
/*!
\brief
\fn allInit
*/
void allInit(); void allInit();
/*!
\brief
\fn allProgress
*/
void allProgress(); void allProgress();
/*!
\brief
\fn allDone
*/
void allDone(); void allDone();
/*!
\brief
\fn seasonInit
\param lpButton
*/
void seasonInit(QPushButton* lpButton); void seasonInit(QPushButton* lpButton);
/*!
\brief
\fn seasonProgress
\param lpButton
*/
void seasonProgress(QPushButton* lpButton); void seasonProgress(QPushButton* lpButton);
/*!
\brief
\fn seasonDone
\param lpButton
*/
void seasonDone(QPushButton* lpButton); void seasonDone(QPushButton* lpButton);
/*!
\brief
\fn updateState
*/
void updateState(); void updateState();
/*!
\brief
\fn deleteResources
*/
void 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: private:
QString m_szSeriesName; QString m_szSeriesName; /*!< TODO: describe */
QString m_szOriginalName; QString m_szOriginalName; /*!< TODO: describe */
qint32 m_iSeriesID; qint32 m_iSeriesID; /*!< TODO: describe */
QString m_szBackdropPath; QString m_szBackdropPath; /*!< TODO: describe */
QStringList m_szCreatedBy; QStringList m_szCreatedBy; /*!< TODO: describe */
QString m_szHomepage; QString m_szHomepage; /*!< TODO: describe */
QDate m_lastAired; QDate m_lastAired; /*!< TODO: describe */
QStringList m_szLanguages; QStringList m_szLanguages; /*!< TODO: describe */
QStringList m_szNetworks; QStringList m_szNetworks; /*!< TODO: describe */
qint16 m_iEpisodes; qint32 m_iEpisodes; /*!< TODO: describe */
qint16 m_iSeasons; qint32 m_iSeasons; /*!< TODO: describe */
QStringList m_szOriginCountries; QStringList m_szOriginCountries; /*!< TODO: describe */
QString m_szOriginalLanguage; QString m_szOriginalLanguage; /*!< TODO: describe */
qreal m_dPopularity; qreal m_dPopularity; /*!< TODO: describe */
QString m_szPosterPath; QString m_szPosterPath; /*!< TODO: describe */
QStringList m_szProductionCompanies; QStringList m_szProductionCompanies; /*!< TODO: describe */
QString m_szType; QString m_szType; /*!< TODO: describe */
qreal m_dVoteAverage; qreal m_dVoteAverage; /*!< TODO: describe */
qint16 m_iVoteCount; qint32 m_iVoteCount; /*!< TODO: describe */
QString m_szOverview; QString m_szOverview; /*!< TODO: describe */
QDate m_firstAired; QDate m_firstAired; /*!< TODO: describe */
QStringList m_szCast; QStringList m_szCast; /*!< TODO: describe */
QStringList m_szCrew; QStringList m_szCrew; /*!< TODO: describe */
QStringList m_szGenre; QStringList m_szGenre; /*!< TODO: describe */
QString m_szStatus; QString m_szIMDBID; /*!< TODO: describe */
QString m_szDownload; QString m_szFreebaseMID; /*!< TODO: describe */
bool m_bCliffhanger; QString m_szFreebaseID; /*!< TODO: describe */
QList<cSeason*> m_seasonList; 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*) Q_DECLARE_METATYPE(cSerie*)
/*!
\brief
\class cSerieList cserie.h "cserie.h"
*/
class cSerieList : public QList<cSerie*> class cSerieList : public QList<cSerie*>
{ {
public: public:
/*!
\brief
\fn add
\param iID
\return cSerie
*/
cSerie* add(const qint32& iID); cSerie* add(const qint32& iID);
/*!
\brief
\fn add
\param lpSerie
\return cSerie
*/
cSerie* add(cSerie* lpSerie); cSerie* add(cSerie* lpSerie);
qint16 minSeason(); /*!
qint16 maxSeason(); \brief
qint16 maxEpisode(); \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 #endif // CSERIE_H
+63
View File
@@ -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);
}
+52
View File
@@ -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
+206
View File
@@ -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>
+35
View File
@@ -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());
}
+26
View File
@@ -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
+96
View File
@@ -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);
}
+24
View File
@@ -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
+523 -21
View File
@@ -10,7 +10,9 @@
#include <QJsonObject> #include <QJsonObject>
#include <QJsonArray> #include <QJsonArray>
using std::pair; #include <QApplication>
#include <QSettings>
cTheMovieDBV3::cTheMovieDBV3() cTheMovieDBV3::cTheMovieDBV3()
@@ -18,12 +20,21 @@ cTheMovieDBV3::cTheMovieDBV3()
m_szToken = "a33271b9e54cdcb9a80680eaf5522f1b"; 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; QList<cMovie*> movieList;
QNetworkAccessManager networkManager; QNetworkAccessManager networkManager;
QString szRequest = QString("https://api.themoviedb.org/3/search/movie?api_key=%1").arg(m_szToken); 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")) if(!szLanguage.contains("all"))
szRequest.append(QString("&language=%1").arg(szLanguage)); 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) if (reply->error() == QNetworkReply::NoError)
{ {
QString strReply = (QString)reply->readAll(); QString strReply = QString(reply->readAll());
QJsonDocument jsonResponse = QJsonDocument::fromJson(strReply.toUtf8()); QJsonDocument jsonResponse = QJsonDocument::fromJson(strReply.toUtf8());
QJsonObject jsonObj = jsonResponse.object(); QJsonObject jsonObj = jsonResponse.object();
QJsonArray jsonArray = jsonObj["results"].toArray(); 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++) for(int z = 0;z < jsonArray.count();z++)
{ {
QJsonObject movie = jsonArray[z].toObject(); QJsonObject movie = jsonArray[z].toObject();
if(movieListOri.find(movie["id"].toInt()))
continue;
cMovie* lpMovie = new cMovie; cMovie* lpMovie = new cMovie;
lpMovie->setMovieTitle(movie["title"].toString()); lpMovie->setMovieTitle(movie["title"].toString());
lpMovie->setMovieID(movie["id"].toInt()); lpMovie->setMovieID(movie["id"].toInt());
lpMovie->setOriginalTitle(movie["original_title"].toString()); lpMovie->setOriginalTitle(movie["original_title"].toString());
lpMovie->setReleaseDate(movie["release_date"].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); movieList.append(lpMovie);
if(movieList.count() >= iResults)
break;
} }
if(jsonObj["total_pages"].toInt() == page) if(jsonObj["total_pages"].toInt() == page)
break; break;
page++; page++;
if(page > 20)
if(movieList.count() >= iResults)
break; break;
delete reply; delete reply;
@@ -80,12 +117,14 @@ QList<cMovie*> cTheMovieDBV3::searchMovie(const QString& szMovie, const qint16&
return(movieList); 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; QList<cSerie*> serieList;
QNetworkAccessManager networkManager; QNetworkAccessManager networkManager;
QString szRequest = QString("https://api.themoviedb.org/3/search/tv?api_key=%1").arg(m_szToken); 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")) if(!szLanguage.contains("all"))
szRequest.append(QString("&language=%1").arg(szLanguage)); 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()); QJsonDocument jsonResponse = QJsonDocument::fromJson(strReply.toUtf8());
QJsonObject jsonObj = jsonResponse.object(); QJsonObject jsonObj = jsonResponse.object();
QJsonArray jsonArray = jsonObj["results"].toArray(); QJsonArray jsonArray = jsonObj["results"].toArray();
QJsonArray tmpArray;
QStringList tmpList;
for(int z = 0;z < jsonArray.count();z++) for(int z = 0;z < jsonArray.count();z++)
{ {
QJsonObject serie = jsonArray[z].toObject(); QJsonObject serie = jsonArray[z].toObject();
if(serieListOri.find(serie["id"].toInt()))
continue;
cSerie* lpSerie = new cSerie; cSerie* lpSerie = new cSerie;
lpSerie->setSeriesName(serie["name"].toString());
lpSerie->setSeriesID(serie["id"].toInt()); 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()); 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); serieList.append(lpSerie);
if(serieList.count() >= iResults)
break;
} }
if(jsonObj["total_pages"].toInt() == page) if(jsonObj["total_pages"].toInt() == page)
break; break;
page++; page++;
if(page > 20)
if(serieList.count() >= iResults)
break; break;
delete reply; 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* cTheMovieDBV3::loadMovie(const qint32 &iID, const QString &szLanguage)
{ {
cMovie* lpMovie = 0; cMovie* lpMovie = nullptr;
QNetworkAccessManager networkManager; 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))); 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) if (reply->error() == QNetworkReply::NoError)
{ {
QString strReply = (QString)reply->readAll(); QString strReply = QString(reply->readAll());
QJsonDocument jsonResponse = QJsonDocument::fromJson(strReply.toUtf8()); QJsonDocument jsonResponse = QJsonDocument::fromJson(strReply.toUtf8());
QJsonObject jsonObj = jsonResponse.object(); QJsonObject jsonObj = jsonResponse.object();
@@ -248,7 +342,7 @@ cMovie* cTheMovieDBV3::loadMovie(const qint32 &iID, const QString &szLanguage)
if (reply->error() == QNetworkReply::NoError) if (reply->error() == QNetworkReply::NoError)
{ {
strReply = (QString)reply->readAll(); strReply = QString(reply->readAll());
jsonResponse = QJsonDocument::fromJson(strReply.toUtf8()); jsonResponse = QJsonDocument::fromJson(strReply.toUtf8());
QJsonObject jsonCast = jsonResponse.object(); QJsonObject jsonCast = jsonResponse.object();
QJsonArray jsonArrayCast = jsonCast["cast"].toArray(); QJsonArray jsonArrayCast = jsonCast["cast"].toArray();
@@ -301,7 +395,7 @@ cSerie* cTheMovieDBV3::loadSerie(const QString& szIMDBID)
if (reply->error() == QNetworkReply::NoError) if (reply->error() == QNetworkReply::NoError)
{ {
QString strReply = (QString)reply->readAll(); QString strReply = QString(reply->readAll());
QJsonDocument jsonResponse = QJsonDocument::fromJson(strReply.toUtf8()); QJsonDocument jsonResponse = QJsonDocument::fromJson(strReply.toUtf8());
QJsonObject jsonObj = jsonResponse.object(); QJsonObject jsonObj = jsonResponse.object();
@@ -318,14 +412,14 @@ cSerie* cTheMovieDBV3::loadSerie(const QString& szIMDBID)
} }
else else
qDebug() << reply->errorString(); qDebug() << reply->errorString();
return(0); return(nullptr);
} }
cSerie* cTheMovieDBV3::loadSerie(const qint32 &iID, const QString& szLanguage) cSerie* cTheMovieDBV3::loadSerie(const qint32 &iID, const QString& szLanguage)
{ {
cSerie* lpSerie = 0; cSerie* lpSerie = nullptr;
QNetworkAccessManager networkManager; 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("Content-Type", "application/json");
request.setRawHeader("Authorization", QString("Bearer %1").arg(m_szToken).toUtf8()); 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) if (reply->error() == QNetworkReply::NoError)
{ {
QString strReply = (QString)reply->readAll(); QString strReply = QString(reply->readAll());
QJsonDocument jsonResponse = QJsonDocument::fromJson(strReply.toUtf8()); QJsonDocument jsonResponse = QJsonDocument::fromJson(strReply.toUtf8());
QJsonObject jsonObj = jsonResponse.object(); QJsonObject jsonObj = jsonResponse.object();
@@ -403,8 +497,17 @@ cSerie* cTheMovieDBV3::loadSerie(const qint32 &iID, const QString& szLanguage)
lpSerie->setVoteAverage(jsonObj["vote_average"].toDouble()); lpSerie->setVoteAverage(jsonObj["vote_average"].toDouble());
lpSerie->setVoteCount(jsonObj["vote_count"].toInt()); 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()) if(!creditsObj.isEmpty())
{ {
QJsonArray jsonArrayCast = creditsObj["cast"].toArray(); 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++) for(int x = 0; x < tmpArray.count();x++)
{ {
QJsonObject seasonObj = tmpArray.at(x).toObject(); QJsonObject seasonObj = tmpArray.at(x).toObject();
qint16 seasonNumber = seasonObj["season_number"].toInt(); qint32 seasonNumber = seasonObj["season_number"].toInt();
cSeason* lpSeason = lpSerie->addSeason(seasonNumber); 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))); 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) if (reply->error() == QNetworkReply::NoError)
{ {
strReply = (QString)reply->readAll(); strReply = QString(reply->readAll());
jsonResponse = QJsonDocument::fromJson(strReply.toUtf8()); jsonResponse = QJsonDocument::fromJson(strReply.toUtf8());
QJsonObject jsonEpisodes = jsonResponse.object(); QJsonObject jsonEpisodes = jsonResponse.object();
QJsonArray jsonArrayEpisodes = jsonEpisodes["episodes"].toArray(); QJsonArray jsonArrayEpisodes = jsonEpisodes["episodes"].toArray();
@@ -515,3 +618,402 @@ cSerie* cTheMovieDBV3::loadSerie(const qint32 &iID, const QString& szLanguage)
} }
return(lpSerie); 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;
}
+123 -6
View File
@@ -8,24 +8,141 @@
#include <QString> #include <QString>
#include <QList> #include <QList>
#include <QStringList> #include <QStringList>
#include <QMap>
/*!
\brief
\class cTheMovieDBV3 cthemoviedbv3.h "cthemoviedbv3.h"
*/
class cTheMovieDBV3 class cTheMovieDBV3
{ {
public: public:
cTheMovieDBV3(); cTheMovieDBV3();
/*!
\brief
QList<cMovie*> searchMovie(const QString& szMovie, const qint16& year = -1, const QString& szLanguage = "all"); \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); cMovie* loadMovie(const qint32 &iID, const QString& szLanguage);
/*!
\brief
QList<cSerie*> searchSerie(const QString& szSerie, const qint16& year = -1, const QString& szLanguage = "all"); \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);
/*!
\brief
\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); cSerie* loadSerie(const qint32 &iID, const QString& szLanguage);
/*!
\brief
\fn loadSerie
\param szIMDBID
\return cSerie
*/
cSerie* loadSerie(const QString& szIMDBID); 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: private:
QString m_szToken; QString m_szToken; /*!< TODO: describe */
// QStringList getActors(const qint32& iID); QMap<qint32, QString> m_genres; /*!< TODO: describe */
// void getEpisodes(cSerie* lpSerie, const QString& szLanguage);
// cEpisode* getEpisode(const qint32& iID, const QString& szLanguage); /*!
\brief
\fn genresFromID
\param genres
\return QStringList
*/
QStringList genresFromID(QList<qint32> genres);
}; };
#endif // CTHEMOVIEDBV3_H #endif // CTHEMOVIEDBV3_H
-88
View File
@@ -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;
}
-41
View File
@@ -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
+36
View File
@@ -5,18 +5,54 @@
#include <QLabel> #include <QLabel>
/*!
\brief
\class cVerticalLabel cverticallabel.h "cverticallabel.h"
*/
class cVerticalLabel : public QLabel class cVerticalLabel : public QLabel
{ {
Q_OBJECT Q_OBJECT
public: public:
/*!
\brief
\fn cVerticalLabel
\param parent
*/
explicit cVerticalLabel(QWidget *parent = 0); explicit cVerticalLabel(QWidget *parent = 0);
/*!
\brief
\fn cVerticalLabel
\param text
\param parent
*/
explicit cVerticalLabel(const QString &text, QWidget *parent=0); explicit cVerticalLabel(const QString &text, QWidget *parent=0);
signals: signals:
protected: protected:
/*!
\brief
\fn paintEvent
\param
*/
void paintEvent(QPaintEvent*); void paintEvent(QPaintEvent*);
/*!
\brief
\fn sizeHint
\return QSize
*/
QSize sizeHint() const ; QSize sizeHint() const ;
/*!
\brief
\fn minimumSizeHint
\return QSize
*/
QSize minimumSizeHint() const; QSize minimumSizeHint() const;
public slots: public slots:
BIN
View File
Binary file not shown.

After

Width:  |  Height:  |  Size: 1.0 MiB

+27 -1
View File
@@ -2,21 +2,47 @@
#include <QApplication> #include <QApplication>
#include <QSettings> #include <QSettings>
#include "csplashscreen.h"
#define SHOW_SPLASH
int main(int argc, char *argv[]) int main(int argc, char *argv[])
{ {
QApplication a(argc, argv); QApplication a(argc, argv);
QCoreApplication::setOrganizationName("WIN-DESIGN"); QCoreApplication::setOrganizationName("WIN-DESIGN");
QCoreApplication::setOrganizationDomain("windesign.at"); QCoreApplication::setOrganizationDomain("windesign.at");
QCoreApplication::setApplicationName("qtMovies"); QCoreApplication::setApplicationName("qtMultimediaDB");
QSettings settings; 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; cMainWindow w;
if(settings.value("main/maximized").toBool()) if(settings.value("main/maximized").toBool())
w.showMaximized(); w.showMaximized();
else else
w.show(); w.show();
splash.finish(&w);
return a.exec(); return a.exec();
} }
Binary file not shown.

After

Width:  |  Height:  |  Size: 800 KiB

+52 -10
View File
@@ -8,11 +8,12 @@ QT += core gui network xml sql
greaterThan(QT_MAJOR_VERSION, 4): QT += widgets greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
TARGET = qtMovies TARGET = qtMultimediaDB
TEMPLATE = app TEMPLATE = app
RC_ICONS = qtMultimediaDB.ico
SOURCES += main.cpp\ SOURCES += main.cpp\
../weatherData/cmeteodata.cpp \
cmainwindow.cpp \ cmainwindow.cpp \
cserie.cpp \ cserie.cpp \
cseasondelegate.cpp \ cseasondelegate.cpp \
@@ -21,12 +22,10 @@ SOURCES += main.cpp\
csearch.cpp \ csearch.cpp \
cmessageanimatedialog.cpp \ cmessageanimatedialog.cpp \
cedit.cpp \ cedit.cpp \
cimage.cpp \
cseasondetails.cpp \ cseasondetails.cpp \
cverticallabel.cpp \ cverticallabel.cpp \
cepisodedetails.cpp \ cepisodedetails.cpp \
cmessagedialog.cpp \ cmessagedialog.cpp \
cupdatethread.cpp \
cpicturesthread.cpp \ cpicturesthread.cpp \
cthemoviedbv3.cpp \ cthemoviedbv3.cpp \
cmovie.cpp \ cmovie.cpp \
@@ -34,9 +33,26 @@ SOURCES += main.cpp\
cmovieviewitemdelegate.cpp \ cmovieviewitemdelegate.cpp \
common.cpp \ common.cpp \
cmovieedit.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 \ HEADERS += cmainwindow.h \
../weatherData/cmeteodata.h \
cserie.h \ cserie.h \
cseasondelegate.h \ cseasondelegate.h \
cseason.h \ cseason.h \
@@ -44,12 +60,10 @@ HEADERS += cmainwindow.h \
csearch.h \ csearch.h \
cmessageanimatedialog.h \ cmessageanimatedialog.h \
cedit.h \ cedit.h \
cimage.h \
cseasondetails.h \ cseasondetails.h \
cverticallabel.h \ cverticallabel.h \
cepisodedetails.h \ cepisodedetails.h \
cmessagedialog.h \ cmessagedialog.h \
cupdatethread.h \
cpicturesthread.h \ cpicturesthread.h \
cthemoviedbv3.h \ cthemoviedbv3.h \
cmovie.h \ cmovie.h \
@@ -57,7 +71,24 @@ HEADERS += cmainwindow.h \
cmovieviewitemdelegate.h \ cmovieviewitemdelegate.h \
common.h \ common.h \
cmovieedit.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 \ FORMS += cmainwindow.ui \
csearch.ui \ csearch.ui \
@@ -67,9 +98,20 @@ FORMS += cmainwindow.ui \
cepisodedetails.ui \ cepisodedetails.ui \
cmessagedialog.ui \ cmessagedialog.ui \
cmoviesearch.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 += \ RESOURCES += \
resource.qrc resource.qrc
+750
View File
@@ -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;
}
}
+276
View File
@@ -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
+173
View File
@@ -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
View File
@@ -2,5 +2,7 @@
<qresource prefix="/"> <qresource prefix="/">
<file>empty.db</file> <file>empty.db</file>
<file>128279.png</file> <file>128279.png</file>
<file>splash.jpg</file>
<file>splashEmpty.png</file>
</qresource> </qresource>
</RCC> </RCC>
BIN
View File
Binary file not shown.

After

Width:  |  Height:  |  Size: 69 KiB

BIN
View File
Binary file not shown.

After

Width:  |  Height:  |  Size: 1.0 KiB