From c8e082f7adb7aba3e93e647a7011261d73d32f9c Mon Sep 17 00:00:00 2001 From: birkeh Date: Wed, 12 Apr 2017 19:34:08 +0200 Subject: [PATCH] init --- ckodilibrary.cpp | 2 +- ckodivideolibrary.cpp | 133 +++++- ckodivideolibrary.h | 7 +- cmainwindow.cpp | 17 +- cmyvideos.cpp | 376 +++++++++++++++++ cmyvideos.h | 139 +++++++ common.h | 15 + ctvshowwidget.cpp | 131 +++++- ctvshowwidget.h | 27 ++ ctvshowwidget.ui | 928 +++++++++++++++++++++++++++++++++++++++++- cvideowidget.cpp | 13 +- qtKodiDB.pro | 3 +- 12 files changed, 1747 insertions(+), 44 deletions(-) create mode 100644 common.h diff --git a/ckodilibrary.cpp b/ckodilibrary.cpp index 84b88dd..2b3424a 100644 --- a/ckodilibrary.cpp +++ b/ckodilibrary.cpp @@ -70,7 +70,7 @@ bool cKodiLibrary::init() m_lpKodiVideoLibrary = new cKodiVideoLibrary(m_szMyVideos); if(m_lpKodiVideoLibrary->init() != -1) - iVideoCount = m_lpKodiVideoLibrary->load(); + iVideoCount = m_lpKodiVideoLibrary->load(m_lpMainWindowStatusBar); m_lpMainWindowStatusBar->showMessage("Initializing Textures ..."); diff --git a/ckodivideolibrary.cpp b/ckodivideolibrary.cpp index 3a9ed98..fba47fb 100644 --- a/ckodivideolibrary.cpp +++ b/ckodivideolibrary.cpp @@ -9,6 +9,8 @@ #include #include +#include +#include cKodiVideoLibrary::cKodiVideoLibrary(const QString& szFileName) : @@ -60,15 +62,27 @@ qint16 cKodiVideoLibrary::version() return(m_iVersion); } -qint32 cKodiVideoLibrary::load() +qint32 cKodiVideoLibrary::load(QStatusBar *lpStatusBar) { + lpStatusBar->showMessage("Loading actors ..."); loadActors(); + lpStatusBar->showMessage("Loading countries ..."); loadCountries(); + lpStatusBar->showMessage("Loading genres ..."); loadGenres(); + lpStatusBar->showMessage("Loading studios ..."); loadStudios(); + lpStatusBar->showMessage("Loading sets ..."); loadSets(); - return(loadVideos()); + lpStatusBar->showMessage("Loading videos ..."); + loadVideos(); + lpStatusBar->showMessage("Loading tv shows ..."); + loadTVShows(); + + lpStatusBar->showMessage("done."); + + return(1); } qint32 cKodiVideoLibrary::loadActors() @@ -150,7 +164,6 @@ qint32 cKodiVideoLibrary::loadVideos() { QSqlQuery query(m_db); - //query.exec("SELECT idMovie, idFile, c00, c01, c02, c03, c04, c05, c06, c07, c08, c09, c10, c11, c12, c13, c14, c15, c16, c17, c18, c19, c20, c21, c22, c23, idSet, userrating, strSet, strSetOverview, strFileName, strPath, playCount, lastPlayed, dateAdded, resumeTimeInSeconds, totalTimeInSeconds FROM movie_view ORDER BY c00;"); query.exec("SELECT idMovie," " idFile," " c00," @@ -196,7 +209,7 @@ qint32 cKodiVideoLibrary::loadVideos() " FROM movie_view" " )" " ORDER BY sortText," - " c07;"); + " CAST(c07 AS INTEGER);"); while(query.next()) { m_videosList.add( @@ -238,6 +251,83 @@ qint32 cKodiVideoLibrary::loadVideos() return(m_videosList.count()); } +qint32 cKodiVideoLibrary::loadTVShows() +{ + QSqlQuery query(m_db); + + query.exec("SELECT idEpisode," + " idFile," + " c00," + " c01," + " c03," + " c04," + " c05," + " c06," + " c09," + " c10," + " c12," + " c13," + " c15," + " c16," + " c17," + " c18," + " idShow," + " userrating," + " idSeason," + " strFileName," + " strPath," + " playCount," + " lastPlayed," + " dateAdded," + " strTitle," + " genre," + " studio," + " premiered," + " mpaa," + " resumeTimeInSeconds," + " totalTimeInSeconds" + " FROM episode_view" + " ORDER BY strTitle," + " CAST(c12 AS INTEGER)," + " CAST(c13 AS INTEGER);"); + while(query.next()) + { + m_tvShowsList.add( + query.value("idEpisode").toInt(), + query.value("idFile").toInt(), + query.value("c00").toString(), + query.value("c01").toString(), + query.value("c03").toDouble(), + query.value("c04").toString(), + QDateTime::fromString(query.value("c05").toString(), "yyyy-MM-dd"), + query.value("c06").toString(), + query.value("c09").toInt(), + query.value("c10").toString(), + query.value("c12").toInt(), + query.value("c13").toInt(), + query.value("c15").toInt(), + query.value("c16").toInt(), + query.value("c17").toInt(), + query.value("c18").toString(), + query.value("idShow").toInt(), + query.value("userrating").toInt(), + query.value("idSeason").toInt(), + query.value("strFileName").toString(), + query.value("strPath").toString(), + query.value("playCount").toInt(), + QDateTime::fromString(query.value("lastPlayed").toString(), "yyyy-MM-dd HH:mm:ss"), + QDateTime::fromString(query.value("dateAdded").toString(), "yyyy-MM-dd HH:mm:ss"), + query.value("strTitle").toString(), + query.value("genre").toString(), + query.value("studio").toString(), + QDateTime::fromString(query.value("premiered").toString(), "yyyy-MM-dd"), + query.value("mpaa").toString(), + query.value("resumeTimeInSeconds").toDouble(), + query.value("totalTimeInSeconds").toDouble()); + } + return(m_tvShowsList.count()); +} + bool cKodiVideoLibrary::art(const QString& szMediaType, const QString& szType, qint32 idMovie, qint32& artID, QString& szURL) { QSqlQuery query(m_db); @@ -286,6 +376,41 @@ void cKodiVideoLibrary::fillVideoList(QStandardItemModel* lpModel) } } +void cKodiVideoLibrary::fillTVShowList(QStandardItemModel* lpModel) +{ + lpModel->clear(); + + QStandardItem* lpRoot = 0; + QStandardItem* lpSeason = 0; + QString szOldTVShow = ""; + qint32 iOldSeason = -1; + + for(int z = 0;z < m_tvShowsList.count();z++) + { + cMyTVShows* lpTVShows = m_tvShowsList.at(z); + + if(szOldTVShow != lpTVShows->title()) + { + iOldSeason = -1; + szOldTVShow = lpTVShows->title(); + lpRoot = new QStandardItem(QString("%1
%2").arg(lpTVShows->title()).arg(lpTVShows->premierDate().date().year())); + lpModel->appendRow(lpRoot); + } + + if(iOldSeason != lpTVShows->seasonNumber()) + { + iOldSeason = lpTVShows->seasonNumber(); + lpSeason = new QStandardItem(QString("Season %1").arg(lpTVShows->seasonNumber())); + lpRoot->appendRow(lpSeason); + } + + QStandardItem* lpItem = new QStandardItem(QString("Episode %1: %2
%3  %4").arg(lpTVShows->episodeNumber()).arg(lpTVShows->episodeTitle()).arg(lpTVShows->firstAired().date().toString(Qt::SystemLocaleShortDate)).arg(lpTVShows->plotSummary())); + QVariant v = qVariantFromValue(lpTVShows); + lpItem->setData(v, Qt::UserRole); + lpSeason->appendRow(lpItem); + } +} + void cKodiVideoLibrary::fillCountriesList(QStandardItemModel *lpModel) { lpModel->clear(); diff --git a/ckodivideolibrary.h b/ckodivideolibrary.h index 1f2c9bb..5633ea3 100644 --- a/ckodivideolibrary.h +++ b/ckodivideolibrary.h @@ -22,10 +22,11 @@ public: qint16 init(); qint16 version(); - qint32 load(); + qint32 load(QStatusBar* lpStatusBar); bool art(const QString& szMediaType, const QString& szType, qint32 idMovie, qint32& artID, QString& szURL); void fillVideoList(QStandardItemModel* lpModel); + void fillTVShowList(QStandardItemModel* lpModel); void fillCountriesList(QStandardItemModel* lpModel); void fillGenresList(QStandardItemModel* lpModel); void fillStudiosList(QStandardItemModel* lpModel); @@ -39,7 +40,6 @@ public: 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; @@ -53,11 +53,14 @@ private: cMyVideosSetList m_videosSetList; cMyVideosList m_videosList; + cMyTVShowsList m_tvShowsList; + qint32 loadActors(); qint32 loadCountries(); qint32 loadGenres(); qint32 loadStudios(); qint32 loadVideos(); + qint32 loadTVShows(); qint32 loadSets(); }; diff --git a/cmainwindow.cpp b/cmainwindow.cpp index 1984c95..ff530dd 100644 --- a/cmainwindow.cpp +++ b/cmainwindow.cpp @@ -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); @@ -67,4 +67,5 @@ void cMainWindow::initDB() // m_lpKodiLibrary = new cKodiLibrary(ui->m_lpStatusBar, "\\\\MEDIAPC\\system"); m_lpKodiLibrary->init(); m_lpVideoWidget->setLibrary(m_lpKodiLibrary->videoLibrary(), m_lpKodiLibrary->imageList()); + m_lpTVShowWidget->setLibrary(m_lpKodiLibrary->videoLibrary(), m_lpKodiLibrary->imageList()); } diff --git a/cmyvideos.cpp b/cmyvideos.cpp index 91f3902..53ae7b6 100644 --- a/cmyvideos.cpp +++ b/cmyvideos.cpp @@ -1688,3 +1688,379 @@ bool cMyVideos::isChanged() { return(m_values != m_oValues); } + +cMyTVShowsValues::cMyTVShowsValues() : + m_idEpisode(-1), + m_idFile(-1), + m_szEpisodeTitle("UNSET"), + m_szPlotSummary("UNSET"), + m_dRating(-1), + m_szWriters("UNSET"), + m_szThumbnailUrl("UNSET"), + m_iEpisodeLength(-1), + m_szDirector("UNSET"), + m_iSeasonNumber(-1), + m_iEpisodeNumber(-1), + m_iSeasonFormattedForSorting(-1), + m_iEpisodeFormattedForSorting(-1), + m_iBookmark(-1), + m_szFullPath("UNSET"), + m_idShow(-1), + m_iUserrating(-1), + m_idSeason(-1), + m_szFileName("UNSET"), + m_szPath("UNSET"), + m_iPlayCount(-1), + m_szTitle("UNSET"), + m_szGenre("UNSET"), + m_szStudio("UNSET"), + m_szMPAA("UNSET"), + m_dResumeTimeInSeconds(-1), + m_dTotalTimeInSeconds(-1) +{ +} + +cMyTVShowsValues::cMyTVShowsValues(qint32 idEpisode, qint32 idFile, const QString& szEpisodeTitle, const QString& szPlotSummary, qreal dRating, const QString& szWriters, const QDateTime firstAired, + const QString& szThumbnailUrl, qint32 iEpisodeLength, const QString& szDirector, qint32 iSeasonNumber, qint32 iEpisodeNumber, + qint32 iSeasonFormattetForSorting, qint32 iEpisodeFormattedForSorting, qint32 iBookmark, const QString& szFullPath, qint32 idShow, qint32 iUserrating, + qint32 idSeason, const QString& szFileName, const QString& szPath, qint32 iPlayCount, const QDateTime& lastPlayed, const QDateTime& dateAdded, + const QString& szTitle, const QString& szGenre, const QString& szStudio, const QDateTime& premiereDate, const QString& szMPAA, + qreal dResumeTimeInSeconds, qreal dTotalTimeInSeconds) : + m_idEpisode(idEpisode), + m_idFile(idFile), + m_szEpisodeTitle(szEpisodeTitle), + m_szPlotSummary(szPlotSummary), + m_dRating(dRating), + m_szWriters(szWriters), + m_firstAired(firstAired), + m_szThumbnailUrl(szThumbnailUrl), + m_iEpisodeLength(iEpisodeLength), + m_szDirector(szDirector), + m_iSeasonNumber(iSeasonNumber), + m_iEpisodeNumber(iEpisodeNumber), + m_iSeasonFormattedForSorting(iSeasonFormattetForSorting), + m_iEpisodeFormattedForSorting(iEpisodeFormattedForSorting), + m_iBookmark(iBookmark), + m_szFullPath(szFullPath), + m_idShow(idShow), + m_iUserrating(iUserrating), + m_idSeason(idSeason), + m_szFileName(szFileName), + m_szPath(szPath), + m_iPlayCount(iPlayCount), + m_lastPlayed(lastPlayed), + m_dateAdded(dateAdded), + m_szTitle(szTitle), + m_szGenre(szGenre), + m_szStudio(szStudio), + m_premiereDate(premiereDate), + m_szMPAA(szMPAA), + m_dResumeTimeInSeconds(dResumeTimeInSeconds), + m_dTotalTimeInSeconds(dTotalTimeInSeconds) +{ +} + +void cMyTVShowsValues::set(qint32 idEpisode, qint32 idFile, const QString& szEpisodeTitle, const QString& szPlotSummary, qreal dRating, const QString& szWriters, const QDateTime firstAired, + const QString& szThumbnailUrl, qint32 iEpisodeLength, const QString& szDirector, qint32 iSeasonNumber, qint32 iEpisodeNumber, + qint32 iSeasonFormattedForSorting, qint32 iEpisodeFormattedForSorting, qint32 iBookmark, const QString& szFullPath, qint32 idShow, qint32 iUserrating, + qint32 idSeason, const QString& szFileName, const QString& szPath, qint32 iPlayCount, const QDateTime& lastPlayed, const QDateTime& dateAdded, + const QString& szTitle, const QString& szGenre, const QString& szStudio, const QDateTime& premiereDate, const QString& szMPAA, + qreal dResumeTimeInSeconds, qreal dTotalTimeInSeconds) +{ + m_idEpisode = idEpisode; + m_idFile = idFile; + m_szEpisodeTitle = szEpisodeTitle; + m_szPlotSummary = szPlotSummary; + m_dRating = dRating; + m_szWriters = szWriters; + m_firstAired = firstAired; + m_szThumbnailUrl = szThumbnailUrl; + m_iEpisodeLength = iEpisodeLength; + m_szDirector = szDirector; + m_iSeasonNumber = iSeasonNumber; + m_iEpisodeNumber = iEpisodeNumber; + m_iSeasonFormattedForSorting = iSeasonFormattedForSorting; + m_iEpisodeFormattedForSorting = iEpisodeFormattedForSorting; + m_iBookmark = iBookmark; + m_szFullPath = szFullPath; + m_idShow = idShow; + m_iUserrating = iUserrating; + m_idSeason = idSeason; + m_szFileName = szFileName; + m_szPath = szPath; + m_iPlayCount = iPlayCount; + m_lastPlayed = lastPlayed; + m_dateAdded = dateAdded; + m_szTitle = szTitle; + m_szGenre = szGenre; + m_szStudio = szStudio; + m_premiereDate = premiereDate; + m_szMPAA = szMPAA; + m_dResumeTimeInSeconds = dResumeTimeInSeconds; + m_dTotalTimeInSeconds = dTotalTimeInSeconds; +} + +inline bool cMyTVShowsValues::operator==(const cMyTVShowsValues b) const +{ + if(m_idEpisode != b.m_idEpisode) return(false); + if(m_idFile != b.m_idFile) return(false); + if(m_szEpisodeTitle != b.m_szEpisodeTitle) return(false); + if(m_szPlotSummary != b.m_szPlotSummary) return(false); + if(m_dRating != b.m_dRating) return(false); + if(m_szWriters != b.m_szWriters) return(false); + if(m_firstAired != b.m_firstAired) return(false); + if(m_szThumbnailUrl != b.m_szThumbnailUrl) return(false); + if(m_iEpisodeLength != b.m_iEpisodeLength) return(false); + if(m_szDirector != b.m_szDirector) return(false); + if(m_iSeasonNumber != b.m_iSeasonNumber) return(false); + if(m_iEpisodeNumber != b.m_iEpisodeNumber) return(false); + if(m_iSeasonFormattedForSorting != b.m_iSeasonFormattedForSorting) return(false); + if(m_iEpisodeFormattedForSorting != b.m_iEpisodeFormattedForSorting) return(false); + if(m_iBookmark != b.m_iBookmark) return(false); + if(m_szFullPath != b.m_szFullPath) return(false); + if(m_idShow != b.m_idShow) return(false); + if(m_iUserrating != b.m_iUserrating) return(false); + if(m_idSeason != b.m_idSeason) return(false); + if(m_szFileName != b.m_szFileName) return(false); + if(m_szPath != b.m_szPath) return(false); + if(m_iPlayCount != b.m_iPlayCount) return(false); + if(m_lastPlayed != b.m_lastPlayed) return(false); + if(m_dateAdded != b.m_dateAdded) return(false); + if(m_szTitle != b.m_szTitle) return(false); + if(m_szGenre != b.m_szGenre) return(false); + if(m_szStudio != b.m_szStudio) return(false); + if(m_premiereDate != b.m_premiereDate) return(false); + if(m_szMPAA != b.m_szMPAA) return(false); + if(m_dResumeTimeInSeconds != b.m_dResumeTimeInSeconds) return(false); + if(m_dTotalTimeInSeconds != b.m_dTotalTimeInSeconds) return(false); + return(true); +} + +inline bool cMyTVShowsValues::operator!=(const cMyTVShowsValues b) const +{ + if(m_idEpisode != b.m_idEpisode + || m_idFile != b.m_idFile + || m_szEpisodeTitle != b.m_szEpisodeTitle + || m_szPlotSummary != b.m_szPlotSummary + || m_dRating != b.m_dRating + || m_szWriters != b.m_szWriters + || m_firstAired != b.m_firstAired + || m_szThumbnailUrl != b.m_szThumbnailUrl + || m_iEpisodeLength != b.m_iEpisodeLength + || m_szDirector != b.m_szDirector + || m_iSeasonNumber != b.m_iSeasonNumber + || m_iEpisodeNumber != b.m_iEpisodeNumber + || m_iSeasonFormattedForSorting != b.m_iSeasonFormattedForSorting + || m_iEpisodeFormattedForSorting != b.m_iEpisodeFormattedForSorting + || m_iBookmark != b.m_iBookmark + || m_szFullPath != b.m_szFullPath + || m_idShow != b.m_idShow + || m_iUserrating != b.m_iUserrating + || m_idSeason != b.m_idSeason + || m_szFileName != b.m_szFileName + || m_szPath != b.m_szPath + || m_iPlayCount != b.m_iPlayCount + || m_lastPlayed != b.m_lastPlayed + || m_dateAdded != b.m_dateAdded + || m_szTitle != b.m_szTitle + || m_szGenre != b.m_szGenre + || m_szStudio != b.m_szStudio + || m_premiereDate != b.m_premiereDate + || m_szMPAA != b.m_szMPAA + || m_dResumeTimeInSeconds != b.m_dResumeTimeInSeconds + || m_dTotalTimeInSeconds != b.m_dTotalTimeInSeconds) + return(true); + return(false); +} + +cMyTVShows::cMyTVShows(qint32 idEpisode, qint32 idFile, const QString& szEpisodeTitle, const QString& szPlotSummary, qreal dRating, const QString& szWriters, const QDateTime firstAired, + const QString& szThumbnailUrl, qint32 iEpisodeLength, const QString& szDirector, qint32 iSeasonNumber, qint32 iEpisodeNumber, + qint32 iSeasonFormattedForSorting, qint32 iEpisodeFormattedForSorting, qint32 iBookmark, const QString& szFullPath, qint32 idShow, qint32 iUserrating, + qint32 idSeason, const QString& szFileName, const QString& szPath, qint32 iPlayCount, const QDateTime& lastPlayed, const QDateTime& dateAdded, + const QString& szTitle, const QString& szGenre, const QString& szStudio, const QDateTime& premiereDate, const QString& szMPAA, + qreal dResumeTimeInSeconds, qreal dTotalTimeInSeconds) : + m_values(idEpisode, idFile, szEpisodeTitle, szPlotSummary, dRating, szWriters, firstAired, + szThumbnailUrl, iEpisodeLength, szDirector, iSeasonNumber, iEpisodeNumber, + iSeasonFormattedForSorting, iEpisodeFormattedForSorting, iBookmark, szFullPath, idShow, iUserrating, + idSeason, szFileName, szPath, iPlayCount, lastPlayed, dateAdded, + szTitle, szGenre, szStudio, premiereDate, szMPAA, + dResumeTimeInSeconds, dTotalTimeInSeconds) +{ + m_oValues = m_values; +} + +qint32 cMyTVShows::idEpisode() +{ + return(m_values.m_idEpisode); +} + +qint32 cMyTVShows::idFile() +{ + return(m_values.m_idFile); +} + +QString cMyTVShows::episodeTitle() +{ + return(m_values.m_szEpisodeTitle); +} + +QString cMyTVShows::plotSummary() +{ + return(m_values.m_szPlotSummary); +} + +qreal cMyTVShows::rating() +{ + return(m_values.m_dRating); +} + +QStringList cMyTVShows::writers() +{ + return(m_values.m_szWriters.split(", ")); +} + +QDateTime cMyTVShows::firstAired() +{ + return(m_values.m_firstAired); +} + +QString cMyTVShows::thumbnailUrl() +{ + return(m_values.m_szThumbnailUrl); +} + +qint32 cMyTVShows::episodeLength() +{ + return(m_values.m_iEpisodeLength); +} + +QStringList cMyTVShows::director() +{ + return(m_values.m_szDirector.split(", ")); +} + +qint32 cMyTVShows::seasonNumber() +{ + return(m_values.m_iSeasonNumber); +} + +qint32 cMyTVShows::episodeNumber() +{ + return(m_values.m_iEpisodeNumber); +} + +qint32 cMyTVShows::seasonFormattedForSorting() +{ + return(m_values.m_iSeasonFormattedForSorting); +} + +qint32 cMyTVShows::episodeFormattedForSorting() +{ + return(m_values.m_iEpisodeFormattedForSorting); +} + +qint32 cMyTVShows::bookmark() +{ + return(m_values.m_iBookmark); +} + +QString cMyTVShows::fullPath() +{ + return(m_values.m_szFullPath); +} + +qint32 cMyTVShows::idShow() +{ + return(m_values.m_idShow); +} + +qint32 cMyTVShows::userRating() +{ + return(m_values.m_iUserrating); +} + +qint32 cMyTVShows::idSeason() +{ + return(m_values.m_idSeason); +} + +QString cMyTVShows::fileName() +{ + return(m_values.m_szFileName); +} + +QString cMyTVShows::path() +{ + return(m_values.m_szPath); +} + +qint32 cMyTVShows::playCount() +{ + return(m_values.m_iPlayCount); +} + +QDateTime cMyTVShows::lastPlayed() +{ + return(m_values.m_lastPlayed); +} + +QDateTime cMyTVShows::dateAdded() +{ + return(m_values.m_dateAdded); +} + +QString cMyTVShows::title() +{ + return(m_values.m_szTitle); +} + +QStringList cMyTVShows::genre() +{ + return(m_values.m_szGenre.split(", ")); +} + +QStringList cMyTVShows::studio() +{ + return(m_values.m_szStudio.split(", ")); +} + +QDateTime cMyTVShows::premierDate() +{ + return(m_values.m_premiereDate); +} + +QString cMyTVShows::mpaaRating() +{ + return(m_values.m_szMPAA); +} + +qreal cMyTVShows::resumeTimeInSeconds() +{ + return(m_values.m_dResumeTimeInSeconds); +} + +qreal cMyTVShows::totalTimeInSeconds() +{ + return(m_values.m_dTotalTimeInSeconds); +} + +cMyTVShowsList::cMyTVShowsList() +{ +} + +cMyTVShows* cMyTVShowsList::add(qint32 idEpisode, qint32 idFile, const QString& szEpisodeTitle, const QString& szPlotSummary, qreal dRating, const QString& szWriters, const QDateTime firstAired, + const QString& szThumbnailUrl, qint32 iEpisodeLength, const QString& szDirector, qint32 iSeasonNumber, qint32 iEpisodeNumber, + qint32 iSeasonFormattetForSorting, qint32 iEpisodeFormattedForSorting, qint32 iBookmark, const QString& szFullPath, qint32 idShow, qint32 iUserrating, + qint32 idSeason, const QString& szFileName, const QString& szPath, qint32 iPlayCount, const QDateTime& lastPlayed, const QDateTime& dateAdded, + const QString& szTitle, const QString& szGenre, const QString& szStudio, const QDateTime& premiereDate, const QString& szMPAA, + qreal dResumeTimeInSeconds, qreal dTotalTimeInSeconds) +{ + cMyTVShows* lpNew = new cMyTVShows(idEpisode, idFile, szEpisodeTitle, szPlotSummary, dRating, szWriters, firstAired, + szThumbnailUrl, iEpisodeLength, szDirector, iSeasonNumber, iEpisodeNumber, + iSeasonFormattetForSorting, iEpisodeFormattedForSorting, iBookmark, szFullPath, idShow, iUserrating, + idSeason, szFileName, szPath, iPlayCount, lastPlayed, dateAdded, + szTitle, szGenre, szStudio, premiereDate, szMPAA, + dResumeTimeInSeconds, dTotalTimeInSeconds); + append(lpNew); + return(lpNew); +} diff --git a/cmyvideos.h b/cmyvideos.h index 4fbe8ac..620dd36 100644 --- a/cmyvideos.h +++ b/cmyvideos.h @@ -742,4 +742,143 @@ public: private: }; +class cMyTVShowsValues +{ +public: + cMyTVShowsValues(); + cMyTVShowsValues(qint32 idEpisode, qint32 idFile, const QString& szEpisodeTitle, const QString& szPlotSummary, qreal dRating, const QString& szWriters, const QDateTime firstAired, + const QString& szThumbnailUrl, qint32 iEpisodeLength, const QString& szDirector, qint32 iSeasonNumber, qint32 iEpisodeNumber, + qint32 iSeasonFormattetForSorting, qint32 iEpisodeFormattedForSorting, qint32 iBookmark, const QString& szFullPath, qint32 idShow, qint32 iUserrating, + qint32 idSeason, const QString& szFileName, const QString& szPath, qint32 iPlayCount, const QDateTime& lastPlayed, const QDateTime& dateAdded, + const QString& szTitle, const QString& szGenre, const QString& szStudio, const QDateTime& premiereDate, const QString& szMPAA, + qreal dResumeTimeInSeconds, qreal dTotalTimeInSeconds); + + void set(qint32 idEpisode, qint32 idFile, const QString& szepisodeTitle, const QString& szPlotSummary, qreal dRating, const QString& szWriters, const QDateTime firstAired, + const QString& szThumbnailUrl, qint32 iEpisodeLength, const QString& szDirector, qint32 iSeasonNumber, qint32 iEpisodeNumber, + qint32 iSeasonFormattedForSorting, qint32 iEpisodeFormattedForSorting, qint32 iBookmark, const QString& szFullPath, qint32 idShow, qint32 iUserrating, + qint32 idSeason, const QString& szFileName, const QString& szPath, qint32 iPlayCount, const QDateTime& lastPlayed, const QDateTime& dateAdded, + const QString& szTitle, const QString& szGenre, const QString& szStudio, const QDateTime& premiereDate, const QString& szMPAA, + qreal dResumeTimeInSeconds, qreal dTotalTimeInSeconds); + + inline bool operator==(const cMyTVShowsValues b) const; + inline bool operator!=(const cMyTVShowsValues b) const; + + qint32 m_idEpisode; + qint32 m_idFile; + QString m_szEpisodeTitle; // c00 + QString m_szPlotSummary; // c01 + qreal m_dRating; // c03 + QString m_szWriters; // c04 + QDateTime m_firstAired; // c05 + QString m_szThumbnailUrl; // c06 + qint32 m_iEpisodeLength; // c09 + QString m_szDirector; // c10 + qint32 m_iSeasonNumber; // c12 + qint32 m_iEpisodeNumber; // c13 + qint32 m_iSeasonFormattedForSorting; // c15 + qint32 m_iEpisodeFormattedForSorting; // c16 + qint32 m_iBookmark; // c17 + QString m_szFullPath; // c18 + qint32 m_idShow; + qint32 m_iUserrating; // userrating + qint32 m_idSeason; + QString m_szFileName; // strFileName + QString m_szPath; // strPath + qint32 m_iPlayCount; // playCount + QDateTime m_lastPlayed; // lastPlayed + QDateTime m_dateAdded; // dateAdded + QString m_szTitle; // strTitle + QString m_szGenre; // genre + QString m_szStudio; // studio + QDateTime m_premiereDate; // premiered + QString m_szMPAA; // mpaa + qreal m_dResumeTimeInSeconds; // resumeTimeInSeconds + qreal m_dTotalTimeInSeconds; // totalTimeInSeconds +}; + +class cMyTVShows +{ +public: + cMyTVShows(qint32 idEpisode, qint32 idFile, const QString& szEpisodeTitle, const QString& szPlotSummary, qreal dRating, const QString& szWriters, const QDateTime firstAired, + const QString& szThumbnailUrl, qint32 iEpisodeLength, const QString& szDirector, qint32 iSeasonNumber, qint32 iEpisodeNumber, + qint32 iSeasonFormattedForSorting, qint32 iEpisodeFormattedForSorting, qint32 iBookmark, const QString& szFullPath, qint32 idShow, qint32 iUserrating, + qint32 idSeason, const QString& szFileName, const QString& szPath, qint32 iPlayCount, const QDateTime& lastPlayed, const QDateTime& dateAdded, + const QString& szTitle, const QString& szGenre, const QString& szStudio, const QDateTime& premiereDate, const QString& szMPAA, + qreal dResumeTimeInSeconds, qreal dTotalTimeInSeconds); + + void loadActors(QSqlDatabase& m_db, cMyVideosActorList videosActorList); + void loadDirectors(QSqlDatabase& m_db, cMyVideosActorList videosActorList); + void loadWriters(QSqlDatabase& m_db, cMyVideosActorList videosActorList); + 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 idEpisode(); + qint32 idFile(); + QString episodeTitle(); + QString plotSummary(); + qreal rating(); + QStringList writers(); + QDateTime firstAired(); + QString thumbnailUrl(); + qint32 episodeLength(); + QStringList director(); + qint32 seasonNumber(); + qint32 episodeNumber(); + qint32 seasonFormattedForSorting(); + qint32 episodeFormattedForSorting(); + qint32 bookmark(); + QString fullPath(); + qint32 idShow(); + qint32 userRating(); + qint32 idSeason(); + QString fileName(); + QString path(); + qint32 playCount(); + QDateTime lastPlayed(); + QDateTime dateAdded(); + QString title(); + QStringList genre(); + QStringList studio(); + QDateTime premierDate(); + QString mpaaRating(); + qreal resumeTimeInSeconds(); + qreal totalTimeInSeconds(); + + bool isNew(); + bool isChanged(); + + cMyTVShowsValues m_values; + cMyTVShowsValues m_oValues; +}; + +Q_DECLARE_METATYPE(cMyTVShows*) + +class cMyTVShowsList : public QList +{ +public: + cMyTVShowsList(); + cMyTVShows* add(qint32 idEpisode, qint32 idFile, const QString& szEpisodeTitle, const QString& szPlotSummary, qreal dRating, const QString& szWriters, const QDateTime firstAired, + const QString& szThumbnailUrl, qint32 iEpisodeLength, const QString& szDirector, qint32 iSeasonNumber, qint32 iEpisodeNumber, + qint32 iSeasonFormattetForSorting, qint32 iEpisodeFormattedForSorting, qint32 iBookmark, const QString& szFullPath, qint32 idShow, qint32 iUserrating, + qint32 idSeason, const QString& szFileName, const QString& szPath, qint32 iPlayCount, const QDateTime& lastPlayed, const QDateTime& dateAdded, + const QString& szTitle, const QString& szGenre, const QString& szStudio, const QDateTime& premiereDate, const QString& szMPAA, + qreal dResumeTimeInSeconds, qreal dTotalTimeInSeconds); + +private: +}; + #endif // CMYVIDEOS_H diff --git a/common.h b/common.h new file mode 100644 index 0000000..bbbb143 --- /dev/null +++ b/common.h @@ -0,0 +1,15 @@ +#ifndef COMMON_H +#define COMMON_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 + +#endif // COMMON_H diff --git a/ctvshowwidget.cpp b/ctvshowwidget.cpp index 2b8c2b6..d08451e 100644 --- a/ctvshowwidget.cpp +++ b/ctvshowwidget.cpp @@ -1,14 +1,141 @@ #include "ctvshowwidget.h" #include "ui_ctvshowwidget.h" +#include "cimage.h" + +#include "cvideoviewitemdelegate.h" +#include "ccheckboxitemdelegate.h" + +#include "common.h" + cTVShowWidget::cTVShowWidget(QWidget *parent) : QWidget(parent), - ui(new Ui::cTVShowWidget) + ui(new Ui::cTVShowWidget), + m_lpTVShowModel(0), + m_lpImageList(0) { - ui->setupUi(this); + initUI(); } cTVShowWidget::~cTVShowWidget() { + DELETE(m_lpTVShowModel); + 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; } + +void cTVShowWidget::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_lpTVShowModel = new QStandardItemModel(0, 1); + QStringList headerLabels = QStringList() << tr("TV Show"); + m_lpTVShowModel->setHorizontalHeaderLabels(headerLabels); + ui->m_lpTVShowView->setModel(m_lpTVShowModel); + ui->m_lpTVShowView->setItemDelegate(new cVideoViewItemDelegate()); + + + m_lpCastModel = new QStandardItemModel(0, 2); + headerLabels = QStringList() << tr("Name") << tr("Role"); + m_lpCastModel->setHorizontalHeaderLabels(headerLabels); + ui->m_lpCastView->setModel(m_lpCastModel); + + m_lpDirectorModel = new QStandardItemModel(0, 1); + headerLabels = QStringList() << tr("Name"); + m_lpDirectorModel->setHorizontalHeaderLabels(headerLabels); + ui->m_lpDirectorView->setModel(m_lpDirectorModel); + + 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 sizes; + sizes << 500 << 1000; + ui->m_lpSplitter->setSizes(sizes); + +// QItemSelectionModel* selectionModel = ui->m_lpVideoView->selectionModel(); +// connect(selectionModel, SIGNAL(selectionChanged(QItemSelection,QItemSelection)), this, SLOT(videoSelectionChanged(QItemSelection,QItemSelection))); + +// selectionModel = ui->m_lpCastView->selectionModel(); +// connect(selectionModel, SIGNAL(selectionChanged(QItemSelection,QItemSelection)), this, SLOT(castSelectionChanged(QItemSelection,QItemSelection))); + +// selectionModel = ui->m_lpDirectorView->selectionModel(); +// connect(selectionModel, SIGNAL(selectionChanged(QItemSelection,QItemSelection)), this, SLOT(directorSelectionChanged(QItemSelection,QItemSelection))); + +// selectionModel = ui->m_lpWriterView->selectionModel(); +// connect(selectionModel, SIGNAL(selectionChanged(QItemSelection,QItemSelection)), this, SLOT(writerSelectionChanged(QItemSelection,QItemSelection))); +} + +void cTVShowWidget::setLibrary(cKodiVideoLibrary* lpVideoLibrary, cImageList* lpImageList) +{ + m_lpVideoLibrary = lpVideoLibrary; + m_lpImageList = lpImageList; + showList(); +} + +void cTVShowWidget::showList() +{ + m_lpTVShowModel->clear(); + m_lpVideoLibrary->fillTVShowList(m_lpTVShowModel); + ui->m_lpTVShowView->resizeColumnToContents(0); + ui->m_lpTVShowView->selectionModel()->setCurrentIndex(m_lpTVShowModel->index(0, 0), QItemSelectionModel::Select | QItemSelectionModel::Current); + + m_lpCountryModel->clear(); + m_lpVideoLibrary->fillCountriesList(m_lpCountryModel); + + m_lpGenreModel->clear(); + m_lpVideoLibrary->fillGenresList(m_lpGenreModel); + + m_lpStudioModel->clear(); + m_lpVideoLibrary->fillStudiosList(m_lpStudioModel); + + ui->m_lpSet->clear(); + m_lpVideoLibrary->fillSetsList(ui->m_lpSet); +} diff --git a/ctvshowwidget.h b/ctvshowwidget.h index 2cac865..70eba36 100644 --- a/ctvshowwidget.h +++ b/ctvshowwidget.h @@ -1,12 +1,26 @@ #ifndef CTVSHOWWIDGET_H #define CTVSHOWWIDGET_H + +#include "ckodivideolibrary.h" + #include +#include +#include +#include +#include +#include +#include + namespace Ui { class cTVShowWidget; } + +class cImage; +class cImageList; + class cTVShowWidget : public QWidget { Q_OBJECT @@ -15,8 +29,21 @@ public: explicit cTVShowWidget(QWidget *parent = 0); ~cTVShowWidget(); + void setLibrary(cKodiVideoLibrary* lpVideoLibrary, cImageList* lpImageList); private: Ui::cTVShowWidget *ui; + QStandardItemModel* m_lpTVShowModel; + QStandardItemModel* m_lpCastModel; + QStandardItemModel* m_lpDirectorModel; + QStandardItemModel* m_lpWriterModel; + QStandardItemModel* m_lpCountryModel; + QStandardItemModel* m_lpGenreModel; + QStandardItemModel* m_lpStudioModel; + cKodiVideoLibrary* m_lpVideoLibrary; + cImageList* m_lpImageList; + + void initUI(); + void showList(); }; #endif // CTVSHOWWIDGET_H diff --git a/ctvshowwidget.ui b/ctvshowwidget.ui index ce0fb71..2f51a0e 100644 --- a/ctvshowwidget.ui +++ b/ctvshowwidget.ui @@ -6,26 +6,924 @@ 0 0 - 400 - 300 + 953 + 778 Form - - - - 90 - 90 - 91 - 16 - - - - TV Show - - + + + + + + 0 + 0 + + + + Qt::Horizontal + + + + + 0 + 0 + + + + + 0 + 0 + + + + QAbstractItemView::NoEditTriggers + + + true + + + true + + + + + + 1 + 0 + + + + true + + + + + 0 + 0 + 899 + 881 + + + + + + + 0 + + + + Basic + + + + + + + + Set + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + + + + + + + + Rating + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + + + + + Tagline + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + + + + + + + + + + Votes + + + + + + + 99999 + + + + + + + Top 250 + + + + + + + 99999 + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + + + Original Title + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + + + + + + + + + + + Name + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + + + + + + + + Title for Sorting + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + + + + + Released + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + + + + + + + + Trailer + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + + + + + Certification + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + + + + + Outline + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + + + + + + + + + + > + + + + + + + + + + + 2999 + + + + + + + Runtime + + + + + + + 99999 + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + + + + + + + + + Play Count + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + + + + + + + 99999 + + + + + + + Last Played + + + + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + + + Plot + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + + + + + + + + + + + + + + + + + Qt::Vertical + + + + 20 + 40 + + + + + + + + + Extended + + + + + + + + Genres + + + + + + QAbstractItemView::NoEditTriggers + + + true + + + + + + + + + + Studios + + + + + + QAbstractItemView::NoEditTriggers + + + true + + + + + + + + + + Countries + + + + + + QAbstractItemView::NoEditTriggers + + + true + + + + + + + + + + + + Qt::Vertical + + + + 20 + 40 + + + + + + + + + Crew + + + + + + + + Writer + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + + + + + Director + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + + + + + Cast + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + + + + + + + + + + + + + + + + + + + + + + + + + + QAbstractItemView::NoEditTriggers + + + true + + + false + + + false + + + + + + + true + + + + + + + true + + + + + + + + + Qt::Vertical + + + + 20 + 40 + + + + + + + + + Stream + + + + + + + + + 0 + 0 + + + + Video Streams + + + + + + + 0 + 0 + + + + + 0 + 10 + + + + + 16777215 + 100 + + + + QAbstractItemView::NoEditTriggers + + + true + + + + + + + + + + + 0 + 0 + + + + Audio Streams + + + + + + + 0 + 0 + + + + + 0 + 10 + + + + + 16777215 + 100 + + + + QAbstractItemView::NoEditTriggers + + + true + + + + + + + + + + + 0 + 0 + + + + Subtitles + + + + + + + 0 + 0 + + + + + 0 + 10 + + + + + 16777215 + 100 + + + + QAbstractItemView::NoEditTriggers + + + true + + + + + + + + + + Qt::Vertical + + + + 20 + 40 + + + + + + + + + + Video Duration + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + + + + + + + + + + + + 0 + 0 + + + + Poster + + + + + + + 0 + 0 + + + + + 220 + 390 + + + + + + + + + + + + + + + 0 + 0 + + + + Thumb + + + + + + + 0 + 0 + + + + + 220 + 390 + + + + + + + + + + + + + + + 0 + 0 + + + + + 0 + 0 + + + + + 0 + 0 + + + + Fanart + + + + + + + 0 + 0 + + + + + 480 + 270 + + + + + + + + + + + + + + + 0 + 0 + + + + Banner + + + + + + + 0 + 0 + + + + + 480 + 90 + + + + + + + + + + + + + + + + + + diff --git a/cvideowidget.cpp b/cvideowidget.cpp index 4622ca7..d3cfa80 100644 --- a/cvideowidget.cpp +++ b/cvideowidget.cpp @@ -5,17 +5,7 @@ #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 +#include "common.h" cVideoWidget::cVideoWidget(QWidget *parent) : @@ -134,6 +124,7 @@ void cVideoWidget::showList() m_lpVideoModel->clear(); m_lpVideoLibrary->fillVideoList(m_lpVideoModel); ui->m_lpVideoView->resizeColumnToContents(0); + ui->m_lpVideoView->selectionModel()->setCurrentIndex(m_lpVideoModel->index(0, 0), QItemSelectionModel::Select | QItemSelectionModel::Current); m_lpCountryModel->clear(); m_lpVideoLibrary->fillCountriesList(m_lpCountryModel); diff --git a/qtKodiDB.pro b/qtKodiDB.pro index 6fd961b..649c1c5 100644 --- a/qtKodiDB.pro +++ b/qtKodiDB.pro @@ -42,7 +42,8 @@ HEADERS += cmainwindow.h \ cvideoviewitemdelegate.h \ ckoditextureslibrary.h \ cimage.h \ - ccheckboxitemdelegate.h + ccheckboxitemdelegate.h \ + common.h FORMS += cmainwindow.ui \ ctvshowwidget.ui \