This commit is contained in:
2016-10-31 16:24:32 +01:00
parent 875def4545
commit 2c62df08d5
11 changed files with 1650 additions and 685 deletions
+28
View File
@@ -0,0 +1,28 @@
#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));
}
+16
View File
@@ -0,0 +1,16 @@
#ifndef CCHECKBOXITEMDELEGATE_H
#define CCHECKBOXITEMDELEGATE_H
#include <QStyledItemDelegate>
class cCheckBoxItemDelegate : public QStyledItemDelegate
{
public:
protected:
void paint(QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index) const;
QSize sizeHint(const QStyleOptionViewItem &option, const QModelIndex &index) const;
};
#endif // CCHECKBOXITEMDELEGATE_H
+149
View File
@@ -241,6 +241,8 @@ bool cKodiVideoLibrary::art(const QString& szMediaType, const QString& szType, q
void cKodiVideoLibrary::fillVideoList(QStandardItemModel* lpModel)
{
lpModel->clear();
QStandardItem* lpRoot = 0;
QString szOldSet("");
@@ -272,6 +274,54 @@ void cKodiVideoLibrary::fillVideoList(QStandardItemModel* lpModel)
}
}
void cKodiVideoLibrary::fillCountriesList(QStandardItemModel *lpModel)
{
lpModel->clear();
for(int z = 0;z < m_videosCountryList.count();z++)
{
cMyVideosCountry* lpCountry = m_videosCountryList.at(z);
QStandardItem* lpItem = new QStandardItem(lpCountry->name());
QVariant v = qVariantFromValue(lpCountry);
lpItem->setData(v, Qt::UserRole);
lpItem->setCheckable(true);
lpModel->appendRow(lpItem);
}
}
void cKodiVideoLibrary::fillGenresList(QStandardItemModel *lpModel)
{
lpModel->clear();
for(int z = 0;z < m_videosGenreList.count();z++)
{
cMyVideosGenre* lpGenre = m_videosGenreList.at(z);
QStandardItem* lpItem = new QStandardItem(lpGenre->name());
QVariant v = qVariantFromValue(lpGenre);
lpItem->setData(v, Qt::UserRole);
lpItem->setCheckable(true);
lpModel->appendRow(lpItem);
}
}
void cKodiVideoLibrary::fillStudiosList(QStandardItemModel *lpModel)
{
lpModel->clear();
for(int z = 0;z < m_videosStudioList.count();z++)
{
cMyVideosStudio* lpStudio = m_videosStudioList.at(z);
QStandardItem* lpItem = new QStandardItem(lpStudio->name());
QVariant v = qVariantFromValue(lpStudio);
lpItem->setData(v, Qt::UserRole);
lpItem->setCheckable(true);
lpModel->appendRow(lpItem);
}
}
void cKodiVideoLibrary::fillActorList(QStandardItemModel *lpList, cMyVideos* lpVideos)
{
lpList->clear();
@@ -295,3 +345,102 @@ void cKodiVideoLibrary::fillWritersList(QStandardItemModel *lpList, cMyVideos* l
lpVideos->loadWriters(m_db, m_videosActorList);
lpVideos->fillWritersList(lpList);
}
void cKodiVideoLibrary::fillCountriesList(QStandardItemModel *lpList, cMyVideos* lpVideos)
{
lpVideos->loadCountries(m_db, m_videosCountryList);
for(int x = 0;x < lpList->rowCount();x++)
lpList->item(x, 0)->setCheckState(Qt::Unchecked);
for(int z = 0;z < lpVideos->m_values.m_countries.count();z++)
{
for(int x = 0;x < lpList->rowCount();x++)
{
QStandardItem* lpItem = lpList->item(x, 0);
cMyVideosCountry* lpCountry = lpItem->data(Qt::UserRole).value<cMyVideosCountry*>();
if(lpVideos->m_values.m_countries.at(z)->country()->countryID() == lpCountry->countryID())
{
lpItem->setCheckState(Qt::Checked);
break;
}
}
}
}
void cKodiVideoLibrary::fillGenresList(QStandardItemModel *lpList, cMyVideos* lpVideos)
{
lpVideos->loadGenres(m_db, m_videosGenreList);
for(int x = 0;x < lpList->rowCount();x++)
lpList->item(x, 0)->setCheckState(Qt::Unchecked);
for(int z = 0;z < lpVideos->m_values.m_genres.count();z++)
{
for(int x = 0;x < lpList->rowCount();x++)
{
QStandardItem* lpItem = lpList->item(x, 0);
cMyVideosGenre* lpGenre = lpItem->data(Qt::UserRole).value<cMyVideosGenre*>();
if(lpVideos->m_values.m_genres.at(z)->genre()->genreID() == lpGenre->genreID())
{
lpItem->setCheckState(Qt::Checked);
break;
}
}
}
}
void cKodiVideoLibrary::fillStudiosList(QStandardItemModel *lpList, cMyVideos* lpVideos)
{
lpVideos->loadStudios(m_db, m_videosStudioList);
for(int x = 0;x < lpList->rowCount();x++)
lpList->item(x, 0)->setCheckState(Qt::Unchecked);
for(int z = 0;z < lpVideos->m_values.m_studios.count();z++)
{
for(int x = 0;x < lpList->rowCount();x++)
{
QStandardItem* lpItem = lpList->item(x, 0);
cMyVideosStudio* lpStudio = lpItem->data(Qt::UserRole).value<cMyVideosStudio*>();
if(lpVideos->m_values.m_studios.at(z)->studio()->studioID() == lpStudio->studioID())
{
lpItem->setCheckState(Qt::Checked);
break;
}
}
}
}
void cKodiVideoLibrary::fillVideoStreamList(QStandardItemModel* lpModel, cMyVideos* lpVideos)
{
lpModel->clear();
QStringList headerLabels = QStringList() << QObject::tr("Codec") << QObject::tr("Ratio") << QObject::tr("Width") << QObject::tr("Height");
lpModel->setHorizontalHeaderLabels(headerLabels);
lpVideos->loadVideoStream(m_db);
lpVideos->fillVideoStreamList(lpModel);
}
void cKodiVideoLibrary::fillAudioStreamList(QStandardItemModel* lpModel, cMyVideos* lpVideos)
{
lpModel->clear();
QStringList headerLabels = QStringList() << QObject::tr("Codec") << QObject::tr("Channels") << QObject::tr("Language") << QObject::tr("Mode");
lpModel->setHorizontalHeaderLabels(headerLabels);
lpVideos->loadAudioStream(m_db);
lpVideos->fillAudioStreamList(lpModel);
}
void cKodiVideoLibrary::fillSubtitleStreamList(QStandardItemModel* lpModel, cMyVideos* lpVideos)
{
lpModel->clear();
QStringList headerLabels = QStringList() << QObject::tr("Language");
lpModel->setHorizontalHeaderLabels(headerLabels);
lpVideos->loadSubtitleStream(m_db);
lpVideos->fillSubtitleStreamList(lpModel);
}
+10
View File
@@ -25,9 +25,19 @@ public:
bool art(const QString& szMediaType, const QString& szType, qint32 idMovie, qint32& artID, QString& szURL);
void fillVideoList(QStandardItemModel* lpModel);
void fillCountriesList(QStandardItemModel* lpModel);
void fillGenresList(QStandardItemModel* lpModel);
void fillStudiosList(QStandardItemModel* lpModel);
void fillActorList(QStandardItemModel* lpList, cMyVideos* lpVideos);
void fillDirectorsList(QStandardItemModel* lpList, cMyVideos* lpVideos);
void fillWritersList(QStandardItemModel* lpList, cMyVideos* lpVideos);
void fillCountriesList(QStandardItemModel* lpList, cMyVideos* lpVideos);
void fillGenresList(QStandardItemModel* lpList, cMyVideos* lpVideos);
void fillStudiosList(QStandardItemModel* lpList, cMyVideos* lpVideos);
void fillVideoStreamList(QStandardItemModel* lpModel, cMyVideos* lpVideos);
void fillAudioStreamList(QStandardItemModel* lpModel, cMyVideos* lpVideos);
void fillSubtitleStreamList(QStandardItemModel* lpModel, cMyVideos* lpVideos);
private:
QSqlDatabase m_db;
QString m_szFileName;
+8 -8
View File
@@ -47,14 +47,14 @@ void cMainWindow::initUI()
m_lpMusicWidget = new cMusicWidget(this);
m_lpMusicVideoWidget = new cMusicVideosWidget(this);
ui->m_lpMainTab->addTab(m_lpVideoWidget, QIcon(":/icons/Videos.ico"), "Movies");
ui->m_lpMainTab->addTab(m_lpTVShowWidget, QIcon(":/icons/TV Shows.ico"), "TV Shows");
ui->m_lpMainTab->addTab(m_lpMusicWidget, QIcon(":/icons/Musics.ico"), "Music");
ui->m_lpMainTab->addTab(m_lpMusicVideoWidget, QIcon(":/icons/Videos.ico"), "Music Videos");
// ui->m_lpMainTab->addTab(m_lpVideoWidget, QIcon(":/icons/empty.ico"), tr("Movies"));
// ui->m_lpMainTab->addTab(m_lpTVShowWidget, QIcon(":/icons/empty.ico"), tr("TV Shows"));
// ui->m_lpMainTab->addTab(m_lpMusicWidget, QIcon(":/icons/empty.ico"), tr("Music"));
// ui->m_lpMainTab->addTab(m_lpMusicVideoWidget, QIcon(":/icons/empty.ico"), tr("Music Videos"));
// ui->m_lpMainTab->addTab(m_lpVideoWidget, QIcon(":/icons/Videos.ico"), "Movies");
// ui->m_lpMainTab->addTab(m_lpTVShowWidget, QIcon(":/icons/TV Shows.ico"), "TV Shows");
// ui->m_lpMainTab->addTab(m_lpMusicWidget, QIcon(":/icons/Musics.ico"), "Music");
// ui->m_lpMainTab->addTab(m_lpMusicVideoWidget, QIcon(":/icons/Videos.ico"), "Music Videos");
ui->m_lpMainTab->addTab(m_lpVideoWidget, QIcon(":/icons/empty.ico"), tr("Movies"));
ui->m_lpMainTab->addTab(m_lpTVShowWidget, QIcon(":/icons/empty.ico"), tr("TV Shows"));
ui->m_lpMainTab->addTab(m_lpMusicWidget, QIcon(":/icons/empty.ico"), tr("Music"));
ui->m_lpMainTab->addTab(m_lpMusicVideoWidget, QIcon(":/icons/empty.ico"), tr("Music Videos"));
ui->m_lpMainTab->setCurrentIndex(0);
+389 -3
View File
@@ -4,6 +4,252 @@
#include <QStandardItem>
cMyVideosStreamDetailsVideoValues::cMyVideosStreamDetailsVideoValues() :
m_szVideoCodec("UNSET"),
m_dAspectRatio(-1),
m_iWidth(-1),
m_iHeight(-1)
{
}
cMyVideosStreamDetailsVideoValues::cMyVideosStreamDetailsVideoValues(const QString& szVideoCodec, qreal dAspectRatio, qint32 iWidth, qint32 iHeight) :
m_szVideoCodec(szVideoCodec),
m_dAspectRatio(dAspectRatio),
m_iWidth(iWidth),
m_iHeight(iHeight)
{
}
void cMyVideosStreamDetailsVideoValues::set(const QString& szVideoCodec, qreal dAspectRatio, qint32 iWidth, qint32 iHeight)
{
m_szVideoCodec = szVideoCodec;
m_dAspectRatio = dAspectRatio;
m_iWidth = iWidth;
m_iHeight = iHeight;
}
inline bool cMyVideosStreamDetailsVideoValues::operator==(const cMyVideosStreamDetailsVideoValues b) const
{
if(m_szVideoCodec != b.m_szVideoCodec) return(false);
if(m_dAspectRatio != b.m_dAspectRatio) return(false);
if(m_iWidth != b.m_iWidth) return(false);
if(m_iHeight != b.m_iHeight) return(false);
return(true);
}
inline bool cMyVideosStreamDetailsVideoValues::operator!=(const cMyVideosStreamDetailsVideoValues b) const
{
if(m_szVideoCodec != b.m_szVideoCodec
|| m_dAspectRatio != b.m_dAspectRatio
|| m_iWidth != b.m_iWidth
|| m_iHeight != b.m_iHeight)
return(true);
return(false);
}
cMyVideosStreamDetailsVideo::cMyVideosStreamDetailsVideo(const QString& szVideoCodec, qreal dAspectRatio, qint32 iWidth, qint32 iHeight) :
m_values(szVideoCodec, dAspectRatio, iWidth, iHeight)
{
m_oValues = m_values;
}
QString cMyVideosStreamDetailsVideo::videoCodec()
{
return(m_values.m_szVideoCodec);
}
qreal cMyVideosStreamDetailsVideo::aspectRatio()
{
return(m_values.m_dAspectRatio);
}
qint32 cMyVideosStreamDetailsVideo::width()
{
return(m_values.m_iWidth);
}
qint32 cMyVideosStreamDetailsVideo::height()
{
return(m_values.m_iHeight);
}
bool cMyVideosStreamDetailsVideo::isNew()
{
return(false);
}
bool cMyVideosStreamDetailsVideo::isChanged()
{
if(m_values != m_oValues)
return(true);
return(false);
}
cMyVideosStreamDetailsVideoList::cMyVideosStreamDetailsVideoList()
{
}
cMyVideosStreamDetailsVideo* cMyVideosStreamDetailsVideoList::add(const QString& szVideoCodec, qreal dAspectRatio, qint32 iWidth, qint32 iHeight)
{
cMyVideosStreamDetailsVideo* lpNew = new cMyVideosStreamDetailsVideo(szVideoCodec, dAspectRatio, iWidth, iHeight);
append(lpNew);
return(lpNew);
}
cMyVideosStreamDetailsAudioValues::cMyVideosStreamDetailsAudioValues() :
m_szAudioCodec("UNSET"),
m_iAudioChannels(-1),
m_szAudioLanguage("UNSET"),
m_szStereoMode("UNSET")
{
}
cMyVideosStreamDetailsAudioValues::cMyVideosStreamDetailsAudioValues(const QString& szAudioCodec, qint32 iAudioChannels, const QString& szAudioLanguage, const QString& szStereoMode) :
m_szAudioCodec(szAudioCodec),
m_iAudioChannels(iAudioChannels),
m_szAudioLanguage(szAudioLanguage),
m_szStereoMode(szStereoMode)
{
}
void cMyVideosStreamDetailsAudioValues::set(const QString& szAudioCodec, qint32 iAudioChannels, const QString& szAudioLanguage, const QString& szStereoMode)
{
m_szAudioCodec = szAudioCodec;
m_iAudioChannels = iAudioChannels;
m_szAudioLanguage = szAudioLanguage;
m_szStereoMode = szStereoMode;
}
inline bool cMyVideosStreamDetailsAudioValues::operator==(const cMyVideosStreamDetailsAudioValues b) const
{
if(m_szAudioCodec != b.m_szAudioCodec) return(false);
if(m_iAudioChannels != b.m_iAudioChannels) return(false);
if(m_szAudioLanguage != b.m_szAudioLanguage) return(false);
if(m_szStereoMode != b.m_szStereoMode) return(false);
return(true);
}
inline bool cMyVideosStreamDetailsAudioValues::operator!=(const cMyVideosStreamDetailsAudioValues b) const
{
if(m_szAudioCodec != b.m_szAudioCodec
|| m_iAudioChannels != b.m_iAudioChannels
|| m_szAudioLanguage != b.m_szAudioLanguage
|| m_szStereoMode != b.m_szStereoMode)
return(true);
return(false);
}
cMyVideosStreamDetailsAudio::cMyVideosStreamDetailsAudio(const QString& szAudioCodec, qint32 iAudioChannels, const QString& szAudioLanguage, const QString& szStereoMode) :
m_values(szAudioCodec, iAudioChannels, szAudioLanguage, szStereoMode)
{
m_oValues = m_values;
}
QString cMyVideosStreamDetailsAudio::audioCodec()
{
return(m_values.m_szAudioCodec);
}
qint32 cMyVideosStreamDetailsAudio::audioChannels()
{
return(m_values.m_iAudioChannels);
}
QString cMyVideosStreamDetailsAudio::audioLanguage()
{
return(m_values.m_szAudioLanguage);
}
QString cMyVideosStreamDetailsAudio::stereoMode()
{
return(m_values.m_szStereoMode);
}
bool cMyVideosStreamDetailsAudio::isNew()
{
return(false);
}
bool cMyVideosStreamDetailsAudio::isChanged()
{
if(m_values != m_oValues)
return(true);
return(false);
}
cMyVideosStreamDetailsAudioList::cMyVideosStreamDetailsAudioList()
{
}
cMyVideosStreamDetailsAudio* cMyVideosStreamDetailsAudioList::add(const QString& szAudioCodec, qint32 iAudioChannels, const QString& szAudioLanguage, const QString& szStereoMode)
{
cMyVideosStreamDetailsAudio* lpNew = new cMyVideosStreamDetailsAudio(szAudioCodec, iAudioChannels, szAudioLanguage, szStereoMode);
append(lpNew);
return(lpNew);
}
cMyVideosStreamDetailsSubtitleValues::cMyVideosStreamDetailsSubtitleValues() :
m_szSubtitleLanguage("UNSET")
{
}
cMyVideosStreamDetailsSubtitleValues::cMyVideosStreamDetailsSubtitleValues(const QString& szSubtitleLanguage) :
m_szSubtitleLanguage(szSubtitleLanguage)
{
}
void cMyVideosStreamDetailsSubtitleValues::set(const QString& szSubtitleLanguage)
{
m_szSubtitleLanguage = szSubtitleLanguage;
}
inline bool cMyVideosStreamDetailsSubtitleValues::operator==(const cMyVideosStreamDetailsSubtitleValues b) const
{
if(m_szSubtitleLanguage != b.m_szSubtitleLanguage) return(false);
return(true);
}
inline bool cMyVideosStreamDetailsSubtitleValues::operator!=(const cMyVideosStreamDetailsSubtitleValues b) const
{
if(m_szSubtitleLanguage != b.m_szSubtitleLanguage)
return(true);
return(false);
}
cMyVideosStreamDetailsSubtitle::cMyVideosStreamDetailsSubtitle(const QString& szSubtitleLanguage) :
m_values(szSubtitleLanguage)
{
m_oValues = m_values;
}
QString cMyVideosStreamDetailsSubtitle::subtitleLanguage()
{
return(m_values.m_szSubtitleLanguage);
}
bool cMyVideosStreamDetailsSubtitle::isNew()
{
return(false);
}
bool cMyVideosStreamDetailsSubtitle::isChanged()
{
if(m_values != m_oValues)
return(true);
return(false);
}
cMyVideosStreamDetailsSubtitleList::cMyVideosStreamDetailsSubtitleList()
{
}
cMyVideosStreamDetailsSubtitle* cMyVideosStreamDetailsSubtitleList::add(const QString& szSubtitleLanguage)
{
cMyVideosStreamDetailsSubtitle* lpNew = new cMyVideosStreamDetailsSubtitle(szSubtitleLanguage);
append(lpNew);
return(lpNew);
}
cMyVideosActorValues::cMyVideosActorValues() :
m_actorID(-1),
m_szName("UNSET"),
@@ -677,7 +923,7 @@ cMyVideosValues::cMyVideosValues() :
m_szMPAARating("UNSET"), m_iIMDBTop250Ranking(-1), m_szGenre("UNSET"), m_szDirector("UNSET"), m_szOriginalMovieTitle("UNSET"),
m_szStudio("UNSET"), m_szTrailerURL("UNSET"), m_szFanartURLs("UNSET"), m_szCountry("UNSET"), m_szFilePath("UNSET"), m_idPath(-1), m_idSet(-1),
m_iUserrating(-1), m_szSet("UNSET"), m_szSetOverview("UNSET"), m_szFileName("UNSET"), m_szPathURL("UNSET"), m_iPlayCount(-1),
m_dResumeTimeInSeconds(-1), m_dTotalTimeInSeconds(-1)
m_dResumeTimeInSeconds(-1), m_dTotalTimeInSeconds(-1), m_iVideoDuration(-1)
{
}
@@ -695,7 +941,7 @@ cMyVideosValues::cMyVideosValues(qint32 idMovie, qint32 idFile, const QString& s
m_szMPAARating(szMPAARating), m_iIMDBTop250Ranking(iIMDBTop250Ranking), m_szGenre(szGenre), m_szDirector(szDirector), m_szOriginalMovieTitle(szOriginalMovieTitle),
m_szStudio(szStudio), m_szTrailerURL(szTrailerURL), m_szFanartURLs(szFanartURLs), m_szCountry(szCountry), m_szFilePath(szFilePath), m_idPath(idPath), m_idSet(idSet),
m_iUserrating(iUserrating), m_szSet(szSet), m_szSetOverview(szSetOverview), m_szFileName(szFileName), m_szPathURL(szPathURL), m_iPlayCount(iPlayCount),
m_lastPlayed(lastPlayed), m_dateAdded(dateAdded), m_dResumeTimeInSeconds(dResumeTimeInSeconds), m_dTotalTimeInSeconds(dTotalTimeInSeconds)
m_lastPlayed(lastPlayed), m_dateAdded(dateAdded), m_dResumeTimeInSeconds(dResumeTimeInSeconds), m_dTotalTimeInSeconds(dTotalTimeInSeconds), m_iVideoDuration(-1)
{
}
@@ -784,6 +1030,7 @@ inline bool cMyVideosValues::operator==(const cMyVideosValues b) const
if(m_dateAdded != b.m_dateAdded) return(false);
if(m_dResumeTimeInSeconds != b.m_dResumeTimeInSeconds) return(false);
if(m_dTotalTimeInSeconds != b.m_dTotalTimeInSeconds) return(false);
if(m_iVideoDuration != b.m_iVideoDuration) return(false);
return(true);
}
@@ -824,7 +1071,8 @@ inline bool cMyVideosValues::operator!=(const cMyVideosValues b) const
|| m_lastPlayed != b.m_lastPlayed
|| m_dateAdded != b.m_dateAdded
|| m_dResumeTimeInSeconds != b.m_dResumeTimeInSeconds
|| m_dTotalTimeInSeconds != b.m_dTotalTimeInSeconds)
|| m_dTotalTimeInSeconds != b.m_dTotalTimeInSeconds
|| m_iVideoDuration != b.m_iVideoDuration)
return(true);
return(false);
}
@@ -963,6 +1211,49 @@ void cMyVideos::loadStudios(QSqlDatabase& m_db, cMyVideosStudioList videosStudio
m_oValues.m_studios = m_values.m_studios;
}
void cMyVideos::loadVideoStream(QSqlDatabase& m_db)
{
if(m_values.m_streamVideo.count())
return;
QSqlQuery query(m_db);
query.exec(QString("SELECT strVideoCodec, fVideoAspect, iVideoWidth, iVideoHeight, iVideoDuration FROM streamdetails WHERE idFile=%1 AND iStreamType=0;").arg(m_values.m_idFile));
while(query.next())
{
m_values.m_streamVideo.add(query.value("strVideoCodec").toString(), query.value("fVideoAspect").toDouble(), query.value("iVideoWidth").toInt(), query.value("iVideoHeight").toInt());
this->m_values.m_iVideoDuration = query.value("iVideoDuration").toInt();
this->m_oValues.m_iVideoDuration = query.value("iVideoDuration").toInt();
}
m_oValues.m_streamVideo = m_values.m_streamVideo;
}
void cMyVideos::loadAudioStream(QSqlDatabase& m_db)
{
if(m_values.m_streamAudio.count())
return;
QSqlQuery query(m_db);
query.exec(QString("SELECT strAudioCodec, iAudioChannels, strAudioLanguage, strStereoMode FROM streamdetails WHERE idFile=%1 AND iStreamType=1;").arg(m_values.m_idFile));
while(query.next())
m_values.m_streamAudio.add(query.value("strAudioCodec").toString(), query.value("iAudioChannels").toInt(), query.value("strAudioLanguage").toString(), query.value("strStereoMode").toString());
m_oValues.m_streamAudio = m_values.m_streamAudio;
}
void cMyVideos::loadSubtitleStream(QSqlDatabase& m_db)
{
if(m_values.m_streamSubtitle.count())
return;
QSqlQuery query(m_db);
query.exec(QString("SELECT strSubtitleLanguage FROM streamdetails WHERE idFile=%1 AND iStreamType=2;").arg(m_values.m_idFile));
while(query.next())
m_values.m_streamSubtitle.add(query.value("strSubtitleLanguage").toString());
m_oValues.m_streamSubtitle = m_values.m_streamSubtitle;
}
void cMyVideos::fillActorsList(QStandardItemModel *lpView)
{
for(int z = 0;z < m_values.m_actors.count();z++)
@@ -1007,6 +1298,101 @@ void cMyVideos::fillWritersList(QStandardItemModel *lpView)
}
}
void cMyVideos::fillCountriesList(QStandardItemModel* lpView)
{
for(int z = 0;z < m_values.m_countries.count();z++)
{
QStringList list = m_values.m_countries.at(z)->m_values.m_lpCountry->name().split(", ");
for(int x = 0;x < list.count();x++)
{
QStandardItem* lpItem = new QStandardItem(list.at(x));
QVariant v = qVariantFromValue(m_values.m_countries.at(z));
lpItem->setData(v, Qt::UserRole);
lpView->appendRow(lpItem);
}
}
}
void cMyVideos::fillGenresList(QStandardItemModel* lpView)
{
for(int z = 0;z < m_values.m_genres.count();z++)
{
QStringList list = m_values.m_genres.at(z)->m_values.m_lpGenre->name().split(", ");
for(int x = 0;x < list.count();x++)
{
QStandardItem* lpItem = new QStandardItem(list.at(x));
QVariant v = qVariantFromValue(m_values.m_genres.at(z));
lpItem->setData(v, Qt::UserRole);
lpView->appendRow(lpItem);
}
}
}
void cMyVideos::fillStudiosList(QStandardItemModel* lpView)
{
for(int z = 0;z < m_values.m_studios.count();z++)
{
QStringList list = m_values.m_studios.at(z)->m_values.m_lpStudio->name().split(", ");
for(int x = 0;x < list.count();x++)
{
QStandardItem* lpItem = new QStandardItem(list.at(x));
QVariant v = qVariantFromValue(m_values.m_studios.at(z));
lpItem->setData(v, Qt::UserRole);
lpView->appendRow(lpItem);
}
}
}
void cMyVideos::fillVideoStreamList(QStandardItemModel* lpView)
{
for(int z = 0;z < m_values.m_streamVideo.count();z++)
{
cMyVideosStreamDetailsVideo* lpVideo = m_values.m_streamVideo.at(z);
QList<QStandardItem*> items;
items.append(new QStandardItem(lpVideo->videoCodec()));
items.append(new QStandardItem(QString("%1").arg(lpVideo->aspectRatio())));
items.append(new QStandardItem(QString("%1").arg(lpVideo->width())));
items.append(new QStandardItem(QString("%1").arg(lpVideo->height())));
QVariant v = qVariantFromValue(lpVideo);
items[0]->setData(v, Qt::UserRole);
items[1]->setData(v, Qt::UserRole);
items[2]->setData(v, Qt::UserRole);
items[3]->setData(v, Qt::UserRole);
lpView->appendRow(items);
}
}
void cMyVideos::fillAudioStreamList(QStandardItemModel* lpView)
{
for(int z = 0;z < m_values.m_streamAudio.count();z++)
{
cMyVideosStreamDetailsAudio* lpAudio = m_values.m_streamAudio.at(z);
QList<QStandardItem*> items;
items.append(new QStandardItem(lpAudio->audioCodec()));
items.append(new QStandardItem(QString("%1").arg(lpAudio->audioChannels())));
items.append(new QStandardItem(lpAudio->audioLanguage()));
items.append(new QStandardItem(lpAudio->stereoMode()));
QVariant v = qVariantFromValue(lpAudio);
items[0]->setData(v, Qt::UserRole);
items[1]->setData(v, Qt::UserRole);
items[2]->setData(v, Qt::UserRole);
items[3]->setData(v, Qt::UserRole);
lpView->appendRow(items);
}
}
void cMyVideos::fillSubtitleStreamList(QStandardItemModel* lpView)
{
for(int z = 0;z < m_values.m_streamSubtitle.count();z++)
{
cMyVideosStreamDetailsSubtitle* lpSubtitle = m_values.m_streamSubtitle.at(z);
QStandardItem* lpItem = new QStandardItem(lpSubtitle->subtitleLanguage());
QVariant v = qVariantFromValue(lpSubtitle);
lpItem->setData(v, Qt::UserRole);
lpView->appendRow(lpItem);
}
}
qint32 cMyVideos::idMovie()
{
return(m_values.m_idMovie);
+144 -5
View File
@@ -17,6 +17,132 @@ typedef struct tagSTRING2
QString _2;
} STRING2;
class cMyVideosStreamDetailsVideoValues
{
public:
cMyVideosStreamDetailsVideoValues();
cMyVideosStreamDetailsVideoValues(const QString& szVideoCodec, qreal dAspectRatio, qint32 iWidth, qint32 iHeight);
void set(const QString& szVideoCodec, qreal dAspectRatio, qint32 iWidth, qint32 iHeight);
inline bool operator==(const cMyVideosStreamDetailsVideoValues b) const;
inline bool operator!=(const cMyVideosStreamDetailsVideoValues b) const;
QString m_szVideoCodec;
qreal m_dAspectRatio;
qint32 m_iWidth;
qint32 m_iHeight;
};
class cMyVideosStreamDetailsAudioValues
{
public:
cMyVideosStreamDetailsAudioValues();
cMyVideosStreamDetailsAudioValues(const QString& szAudioCodec, qint32 iAudioChannels, const QString& szAudioLanguage, const QString& szStereoMode);
void set(const QString& szAudioCodec, qint32 iAudioChannels, const QString& szAudioLanguage, const QString& szStereoMode);
inline bool operator==(const cMyVideosStreamDetailsAudioValues b) const;
inline bool operator!=(const cMyVideosStreamDetailsAudioValues b) const;
QString m_szAudioCodec;
qint32 m_iAudioChannels;
QString m_szAudioLanguage;
QString m_szStereoMode;
};
class cMyVideosStreamDetailsSubtitleValues
{
public:
cMyVideosStreamDetailsSubtitleValues();
cMyVideosStreamDetailsSubtitleValues(const QString& szSubtitleLanguage);
void set(const QString& szSubtitleLanguage);
inline bool operator==(const cMyVideosStreamDetailsSubtitleValues b) const;
inline bool operator!=(const cMyVideosStreamDetailsSubtitleValues b) const;
QString m_szSubtitleLanguage;
};
class cMyVideosStreamDetailsVideo
{
public:
cMyVideosStreamDetailsVideo(const QString& szVideoCodec, qreal dAspectRatio, qint32 iWidth, qint32 iHeight);
QString videoCodec();
qreal aspectRatio();
qint32 width();
qint32 height();
bool isNew();
bool isChanged();
cMyVideosStreamDetailsVideoValues m_values;
cMyVideosStreamDetailsVideoValues m_oValues;
};
Q_DECLARE_METATYPE(cMyVideosStreamDetailsVideo*)
class cMyVideosStreamDetailsVideoList : public QList<cMyVideosStreamDetailsVideo*>
{
public:
cMyVideosStreamDetailsVideoList();
cMyVideosStreamDetailsVideo* add(const QString& szVideoCodec, qreal dAspectRatio, qint32 iWidth, qint32 iHeight);
private:
};
class cMyVideosStreamDetailsAudio
{
public:
cMyVideosStreamDetailsAudio(const QString& szAudioCodec, qint32 iAudioChannels, const QString& szAudioLanguage, const QString& szStereoMode);
QString audioCodec();
qint32 audioChannels();
QString audioLanguage();
QString stereoMode();
bool isNew();
bool isChanged();
cMyVideosStreamDetailsAudioValues m_values;
cMyVideosStreamDetailsAudioValues m_oValues;
};
Q_DECLARE_METATYPE(cMyVideosStreamDetailsAudio*)
class cMyVideosStreamDetailsAudioList : public QList<cMyVideosStreamDetailsAudio*>
{
public:
cMyVideosStreamDetailsAudioList();
cMyVideosStreamDetailsAudio* add(const QString& szAudioCodec, qint32 iAudioChannels, const QString& szAudioLanguage, const QString& szStereoMode);
private:
};
class cMyVideosStreamDetailsSubtitle
{
public:
cMyVideosStreamDetailsSubtitle(const QString& szSubtitleLanguage);
QString subtitleLanguage();
bool isNew();
bool isChanged();
cMyVideosStreamDetailsSubtitleValues m_values;
cMyVideosStreamDetailsSubtitleValues m_oValues;
};
Q_DECLARE_METATYPE(cMyVideosStreamDetailsSubtitle*)
class cMyVideosStreamDetailsSubtitleList : public QList<cMyVideosStreamDetailsSubtitle*>
{
public:
cMyVideosStreamDetailsSubtitleList();
cMyVideosStreamDetailsSubtitle* add(const QString& szSubtitleLanguage);
private:
};
class cMyVideosActorValues
{
public:
@@ -200,7 +326,7 @@ public:
bool isNew();
bool isChanged();
private:
cMyVideosCountryValues m_values;
cMyVideosCountryValues m_oValues;
};
@@ -278,7 +404,7 @@ public:
bool isNew();
bool isChanged();
private:
cMyVideosGenreValues m_values;
cMyVideosGenreValues m_oValues;
};
@@ -356,7 +482,7 @@ public:
bool isNew();
bool isChanged();
private:
cMyVideosStudioValues m_values;
cMyVideosStudioValues m_oValues;
};
@@ -476,6 +602,10 @@ public:
cMyVideosCountryLinkList m_countries;
cMyVideosGenreLinkList m_genres;
cMyVideosStudioLinkList m_studios;
cMyVideosStreamDetailsVideoList m_streamVideo;
cMyVideosStreamDetailsAudioList m_streamAudio;
cMyVideosStreamDetailsSubtitleList m_streamSubtitle;
qint32 m_iVideoDuration;
};
class cMyVideos
@@ -484,7 +614,7 @@ public:
cMyVideos(qint32 idMovie, qint32 idFile, const QString& szLocalMovieTitle, const QString& szMoviePlot, const QString& szMoviePlotOutline,
const QString& szMovieTagline, qint32 iRatingVotes, qreal dRating, const QString& szWriters, qint32 iYearReleased,
const QString& szThumbnails, const QString& szIMDBID, const QString& szTitleFormattedForSorting, qint32 iRuntime,
const QString& szMPAARating,qint32 iIMDBTop250Ranking, const QString& szGenre, const QString& szDirector,
const QString& szMPAARating, qint32 iIMDBTop250Ranking, const QString& szGenre, const QString& szDirector,
const QString& szOriginalMovieTitle, const QString& szStudio, const QString& szTrailerURL, const QString& szFanartURLs,
const QString& szCountry, const QString& szFilePath, qint32 idPath, qint32 idSet, qint32 iUserrating, const QString& szSet, const QString& szSetOverview,
const QString& szFileName, const QString& szPathURL, qint32 iPlayCount, const QDateTime& lastPlayed, const QDateTime& dateAdded,
@@ -496,10 +626,19 @@ public:
void loadCountries(QSqlDatabase& m_db, cMyVideosCountryList videosCountryList);
void loadGenres(QSqlDatabase& m_db, cMyVideosGenreList videosGenreList);
void loadStudios(QSqlDatabase& m_db, cMyVideosStudioList videosStudioList);
void loadVideoStream(QSqlDatabase& m_db);
void loadAudioStream(QSqlDatabase& m_db);
void loadSubtitleStream(QSqlDatabase& m_db);
void fillActorsList(QStandardItemModel *lpView);
void fillDirectorsList(QStandardItemModel *lpView);
void fillWritersList(QStandardItemModel *lpView);
void fillCountriesList(QStandardItemModel* lpView);
void fillGenresList(QStandardItemModel* lpView);
void fillStudiosList(QStandardItemModel* lpView);
void fillVideoStreamList(QStandardItemModel* lpView);
void fillAudioStreamList(QStandardItemModel* lpView);
void fillSubtitleStreamList(QStandardItemModel* lpView);
qint32 idMovie();
qint32 idFile();
@@ -539,7 +678,7 @@ public:
bool isNew();
bool isChanged();
private:
cMyVideosValues m_values;
cMyVideosValues m_oValues;
};
+96 -20
View File
@@ -3,6 +3,19 @@
#include "cimage.h"
#include "cvideoviewitemdelegate.h"
#include "ccheckboxitemdelegate.h"
#define DELETE(x) { if(x) delete x, x=0; }
#define THUMB_WIDTH 220
#define THUMB_HEIGHT 390
#define FANART_WIDTH 480
#define FANART_HEIGHT 270
#define POSTER_WIDTH 220
#define POSTER_HEIGHT 390
#define BANNER_WIDTH 480
#define BANNER_HEIGHT 90
cVideoWidget::cVideoWidget(QWidget *parent) :
@@ -16,17 +29,16 @@ cVideoWidget::cVideoWidget(QWidget *parent) :
cVideoWidget::~cVideoWidget()
{
if(m_lpVideoModel)
delete m_lpVideoModel;
if(m_lpCastModel)
delete m_lpCastModel;
if(m_lpDirectorModel)
delete m_lpDirectorModel;
if(m_lpWriterModel)
delete m_lpWriterModel;
DELETE(m_lpVideoModel);
DELETE(m_lpCastModel);
DELETE(m_lpDirectorModel);
DELETE(m_lpWriterModel);
DELETE(m_lpCountryModel);
DELETE(m_lpGenreModel);
DELETE(m_lpStudioModel);
DELETE(m_lpVideoStreamModel);
DELETE(m_lpAudioStreamModel);
DELETE(m_lpSubtitleStreamModel);
delete ui;
}
@@ -34,6 +46,11 @@ cVideoWidget::~cVideoWidget()
void cVideoWidget::initUI()
{
ui->setupUi(this);
ui->m_lpBanner->setMinimumSize(BANNER_WIDTH, BANNER_HEIGHT);
ui->m_lpFanart->setMinimumSize(FANART_WIDTH, FANART_HEIGHT);
ui->m_lpPoster->setMinimumSize(POSTER_WIDTH, POSTER_HEIGHT);
ui->m_lpThumb->setMinimumSize(THUMB_WIDTH, THUMB_HEIGHT);
ui->m_lpInformationTab->setCurrentIndex(0);
m_lpVideoModel = new QStandardItemModel(0, 1);
@@ -52,11 +69,42 @@ void cVideoWidget::initUI()
m_lpDirectorModel->setHorizontalHeaderLabels(headerLabels);
ui->m_lpDirectorView->setModel(m_lpDirectorModel);
m_lpWriterModel = new QStandardItemModel(0, 1);
m_lpWriterModel = new QStandardItemModel(0, 1);
headerLabels = QStringList() << tr("Name");
m_lpWriterModel->setHorizontalHeaderLabels(headerLabels);
ui->m_lpWriterView->setModel(m_lpWriterModel);
m_lpCountryModel = new QStandardItemModel(0, 1);
headerLabels = QStringList() << tr("Name");
m_lpCountryModel->setHorizontalHeaderLabels(headerLabels);
ui->m_lpCountryView->setModel(m_lpCountryModel);
ui->m_lpCountryView->setItemDelegate(new cCheckBoxItemDelegate());
m_lpGenreModel = new QStandardItemModel(0, 1);
headerLabels = QStringList() << tr("Name");
m_lpGenreModel->setHorizontalHeaderLabels(headerLabels);
ui->m_lpGenreView->setModel(m_lpGenreModel);
ui->m_lpGenreView->setItemDelegate(new cCheckBoxItemDelegate());
m_lpStudioModel = new QStandardItemModel(0, 1);
headerLabels = QStringList() << tr("Name");
m_lpStudioModel->setHorizontalHeaderLabels(headerLabels);
ui->m_lpStudioView->setModel(m_lpStudioModel);
ui->m_lpStudioView->setItemDelegate(new cCheckBoxItemDelegate());
m_lpVideoStreamModel = new QStandardItemModel(0, 4);
ui->m_lpVideoStreamView->setModel(m_lpVideoStreamModel);
m_lpAudioStreamModel = new QStandardItemModel(0, 4);
ui->m_lpAudioStreamView->setModel(m_lpAudioStreamModel);
m_lpSubtitleStreamModel = new QStandardItemModel(0, 1);
ui->m_lpSubtitleStreamView->setModel(m_lpSubtitleStreamModel);
ui->m_lpCountryView->setWrapping(true);
ui->m_lpGenreView->setWrapping(true);
ui->m_lpStudioView->setWrapping(true);
QList<int> sizes;
sizes << 500 << 1000;
ui->m_lpSplitter->setSizes(sizes);
@@ -84,9 +132,17 @@ void cVideoWidget::setLibrary(cKodiVideoLibrary* lpVideoLibrary, cImageList* lpI
void cVideoWidget::showList()
{
m_lpVideoModel->clear();
m_lpVideoLibrary->fillVideoList(m_lpVideoModel);
ui->m_lpVideoView->resizeColumnToContents(0);
m_lpCountryModel->clear();
m_lpVideoLibrary->fillCountriesList(m_lpCountryModel);
m_lpGenreModel->clear();
m_lpVideoLibrary->fillGenresList(m_lpGenreModel);
m_lpStudioModel->clear();
m_lpVideoLibrary->fillStudiosList(m_lpStudioModel);
}
void cVideoWidget::videoSelectionChanged(const QItemSelection& /*newSelection*/, const QItemSelection& /*oldSelection*/)
@@ -126,9 +182,9 @@ void cVideoWidget::videoSelectionChanged(const QItemSelection& /*newSelection*/,
ui->m_lpOutline->setText(lpVideos->moviePlotOutline());
// Extended Tab
ui->m_lpGenres->addItems(lpVideos->genre());
ui->m_lpCountries->addItems(lpVideos->country());
ui->m_lpStudios->addItems(lpVideos->studio());
m_lpVideoLibrary->fillCountriesList(m_lpCountryModel, lpVideos);
m_lpVideoLibrary->fillGenresList(m_lpGenreModel, lpVideos);
m_lpVideoLibrary->fillStudiosList(m_lpStudioModel, lpVideos);
// Crew Tab
ui->m_lpCastPicture->clear();
@@ -143,6 +199,26 @@ void cVideoWidget::videoSelectionChanged(const QItemSelection& /*newSelection*/,
m_lpVideoLibrary->fillWritersList(m_lpWriterModel, lpVideos);
// Stream Tab
m_lpVideoLibrary->fillVideoStreamList(m_lpVideoStreamModel, lpVideos);
ui->m_lpVideoStreamView->resizeColumnToContents(0);
ui->m_lpVideoStreamView->resizeColumnToContents(1);
ui->m_lpVideoStreamView->resizeColumnToContents(2);
ui->m_lpVideoStreamView->resizeColumnToContents(3);
m_lpVideoLibrary->fillAudioStreamList(m_lpAudioStreamModel, lpVideos);
ui->m_lpAudioStreamView->resizeColumnToContents(0);
ui->m_lpAudioStreamView->resizeColumnToContents(1);
ui->m_lpAudioStreamView->resizeColumnToContents(2);
ui->m_lpAudioStreamView->resizeColumnToContents(3);
m_lpVideoLibrary->fillSubtitleStreamList(m_lpSubtitleStreamModel, lpVideos);
if(lpVideos->m_values.m_iVideoDuration != -1)
ui->m_lpVideoDuration->setTime(QTime::fromMSecsSinceStartOfDay(lpVideos->m_values.m_iVideoDuration*1000));
else
ui->m_lpVideoDuration->setTime(QTime::fromMSecsSinceStartOfDay(0));
if(m_lpVideoModel->itemFromIndex(index)->hasChildren())
{
thumb = m_lpImageList->get(cImage::MEDIATYPE_set, cImage::TYPE_thumb, lpVideos->idSet());
@@ -170,7 +246,7 @@ void cVideoWidget::videoSelectionChanged(const QItemSelection& /*newSelection*/,
if(thumb.width())
{
ui->m_lpThumb->setPixmap(thumb.scaled(480, 270, Qt::KeepAspectRatio, Qt::SmoothTransformation));
ui->m_lpThumb->setPixmap(thumb.scaled(THUMB_WIDTH, THUMB_HEIGHT, Qt::KeepAspectRatio, Qt::SmoothTransformation));
ui->m_lpThumbBox->setTitle(QString(tr("Thumb (%1 x %2)")).arg(thumb.width()).arg(thumb.height()));
ui->m_lpThumb->setToolTip(szThumb);
}
@@ -183,7 +259,7 @@ void cVideoWidget::videoSelectionChanged(const QItemSelection& /*newSelection*/,
if(fanart.width())
{
ui->m_lpFanart->setPixmap(fanart.scaled(480, 270, Qt::KeepAspectRatio, Qt::SmoothTransformation));
ui->m_lpFanart->setPixmap(fanart.scaled(FANART_WIDTH, FANART_HEIGHT, Qt::KeepAspectRatio, Qt::SmoothTransformation));
ui->m_lpFanartBox->setTitle(QString(tr("Fanart (%1 x %2)")).arg(fanart.width()).arg(fanart.height()));
ui->m_lpFanart->setToolTip(szFanart);
}
@@ -196,7 +272,7 @@ void cVideoWidget::videoSelectionChanged(const QItemSelection& /*newSelection*/,
if(poster.width())
{
ui->m_lpPoster->setPixmap(poster.scaled(480, 270, Qt::KeepAspectRatio, Qt::SmoothTransformation));
ui->m_lpPoster->setPixmap(poster.scaled(POSTER_WIDTH, POSTER_HEIGHT, Qt::KeepAspectRatio, Qt::SmoothTransformation));
ui->m_lpPosterBox->setTitle(QString(tr("Poster (%1 x %2)")).arg(poster.width()).arg(poster.height()));
ui->m_lpPoster->setToolTip(szPoster);
}
@@ -209,7 +285,7 @@ void cVideoWidget::videoSelectionChanged(const QItemSelection& /*newSelection*/,
if(banner.width())
{
ui->m_lpBanner->setPixmap(banner.scaled(480, 270, Qt::KeepAspectRatio, Qt::SmoothTransformation));
ui->m_lpBanner->setPixmap(banner.scaled(BANNER_WIDTH, BANNER_HEIGHT, Qt::KeepAspectRatio, Qt::SmoothTransformation));
ui->m_lpBannerBox->setTitle(QString(tr("Banner (%1 x %2)")).arg(banner.width()).arg(banner.height()));
ui->m_lpBanner->setToolTip(szBanner);
}
+6
View File
@@ -32,6 +32,12 @@ private:
QStandardItemModel* m_lpCastModel;
QStandardItemModel* m_lpDirectorModel;
QStandardItemModel* m_lpWriterModel;
QStandardItemModel* m_lpCountryModel;
QStandardItemModel* m_lpGenreModel;
QStandardItemModel* m_lpStudioModel;
QStandardItemModel* m_lpVideoStreamModel;
QStandardItemModel* m_lpAudioStreamModel;
QStandardItemModel* m_lpSubtitleStreamModel;
cKodiVideoLibrary* m_lpVideoLibrary;
cImageList* m_lpImageList;
+800 -647
View File
File diff suppressed because it is too large Load Diff
+4 -2
View File
@@ -26,7 +26,8 @@ SOURCES += main.cpp\
cvideowidget.cpp \
cvideoviewitemdelegate.cpp \
ckoditextureslibrary.cpp \
cimage.cpp
cimage.cpp \
ccheckboxitemdelegate.cpp
HEADERS += cmainwindow.h \
ckodivideolibrary.h \
@@ -40,7 +41,8 @@ HEADERS += cmainwindow.h \
cvideowidget.h \
cvideoviewitemdelegate.h \
ckoditextureslibrary.h \
cimage.h
cimage.h \
ccheckboxitemdelegate.h
FORMS += cmainwindow.ui \
ctvshowwidget.ui \