From 875def45456444f677a35e79a5de53eb081aec47 Mon Sep 17 00:00:00 2001 From: birkeh Date: Sat, 29 Oct 2016 22:25:56 +0200 Subject: [PATCH] Init --- cimage.cpp | 59 +++--- cimage.h | 7 +- ckodivideolibrary.cpp | 49 +++++ ckodivideolibrary.h | 38 ++-- cmainwindow.cpp | 17 +- cmyvideos.cpp | 450 ++++++++++++++++++++++++++++++++++++++++++ cmyvideos.h | 240 ++++++++++++++++++++++ cvideowidget.cpp | 47 +++-- 8 files changed, 832 insertions(+), 75 deletions(-) diff --git a/cimage.cpp b/cimage.cpp index f324f43..0ce84e6 100644 --- a/cimage.cpp +++ b/cimage.cpp @@ -42,10 +42,11 @@ cImage::cImage(cKodiVideoLibrary* lpKodiVideoLibrary, cKodiTexturesLibrary* lpKo { if(m_lpKodiTexturesLibrary->texture(m_szURL, m_textureID, m_szCachedURL)) { - QString str = m_szPath + QDir::separator() + "Userdata" + QDir::separator() + "Thumbnails" + QDir::separator() + m_szCachedURL; - if(m_szCachedURL.length()) - m_image.load(str); + { + m_szFileName = m_szPath + QDir::separator() + "Userdata" + QDir::separator() + "Thumbnails" + QDir::separator() + m_szCachedURL; + m_image.load(m_szFileName); + } return; } @@ -69,6 +70,11 @@ qint32 cImage::idMovie() return(m_idMovie); } +QString cImage::fileName() +{ + return(m_szFileName); +} + QPixmap cImage::image() { return(m_image); @@ -81,7 +87,7 @@ cImageList::cImageList(cKodiVideoLibrary *lpKodiVideoLibrary, cKodiTexturesLibra { } -QPixmap cImageList::get(cImage::MEDIATYPE mediaType, cImage::TYPE type, qint32 idMovie) +cImage* cImageList::find(cImage::MEDIATYPE mediaType, cImage::TYPE type, qint32 idMovie) { cImage* lpImage = 0; for(int z = 0;z < count();z++) @@ -89,8 +95,7 @@ QPixmap cImageList::get(cImage::MEDIATYPE mediaType, cImage::TYPE type, qint32 i if(mediaType == at(z)->mediaType() && type == at(z)->type() && idMovie == at(z)->idMovie()) { lpImage = at(z); - return(lpImage->image()); - break; + return(lpImage); } } @@ -98,38 +103,20 @@ QPixmap cImageList::get(cImage::MEDIATYPE mediaType, cImage::TYPE type, qint32 i { lpImage = new cImage(m_lpKodiVideoLibrary, m_lpKodiTexturesLibrary, mediaType, type, idMovie, m_szPath); append(lpImage); - return(lpImage->image()); + return(lpImage); } - return(QPixmap()); + + return(0); } -QPixmap cImage::downloadFile(const QString& /*szFileName*/) +QPixmap cImageList::get(cImage::MEDIATYPE mediaType, cImage::TYPE type, qint32 idMovie) { - QPixmap pixmap; - -// QString szPath = QDir::homePath() + QDir::separator() + "qtseries" + QDir::separator() + szFileName; -// QString szURL = "http://thetvdb.com/banners/" + szFileName; - -// QNetworkAccessManager networkManager; -// QUrl url(szURL); -// QNetworkRequest request(url); -// request.setHeader(QNetworkRequest::ContentTypeHeader, "application/xml"); - -// QNetworkReply* reply = networkManager.get(request); -// QEventLoop loop; - -// QObject::connect(reply, SIGNAL(finished()), &loop, SLOT(quit())); -// loop.exec(); - -// QByteArray szData = reply->readAll(); -// delete reply; - -// pixmap.loadFromData(szData); - -// QDir dir(szPath); -// QFileInfo fileInfo(szPath); -// dir.mkpath(dir.filePath(fileInfo.absolutePath())); -// pixmap.save(szPath); - - return(pixmap); + cImage* lpImage = find(mediaType, type, idMovie); + return(lpImage->image()); +} + +QString cImageList::fileName(cImage::MEDIATYPE mediaType, cImage::TYPE type, qint32 idMovie) +{ + cImage* lpImage = find(mediaType, type, idMovie); + return(lpImage->fileName()); } diff --git a/cimage.h b/cimage.h index dd264a3..409100f 100644 --- a/cimage.h +++ b/cimage.h @@ -40,6 +40,7 @@ public: cImage::MEDIATYPE mediaType(); cImage::TYPE type(); qint32 idMovie(); + QString fileName(); QPixmap image(); private: @@ -57,8 +58,6 @@ private: QString m_szPath; QPixmap m_image; - - QPixmap downloadFile(const QString& szFileName); }; Q_DECLARE_METATYPE (cImage*) @@ -68,11 +67,13 @@ class cImageList : public QList public: cImageList(cKodiVideoLibrary* lpKodiVideoLibrary, cKodiTexturesLibrary* lpKodiTexturesLibrary, const QString& szPath); QPixmap get(cImage::MEDIATYPE mediaType, cImage::TYPE type, qint32 idMovie); - + QString fileName(cImage::MEDIATYPE mediaType, cImage::TYPE type, qint32 idMovie); private: cKodiVideoLibrary* m_lpKodiVideoLibrary; cKodiTexturesLibrary* m_lpKodiTexturesLibrary; QString m_szPath; + + cImage* find(cImage::MEDIATYPE mediaType, cImage::TYPE type, qint32 idMovie); }; #endif // CIMAGE_H diff --git a/ckodivideolibrary.cpp b/ckodivideolibrary.cpp index 3f2b588..d37a773 100644 --- a/ckodivideolibrary.cpp +++ b/ckodivideolibrary.cpp @@ -63,6 +63,10 @@ qint16 cKodiVideoLibrary::version() qint32 cKodiVideoLibrary::load() { loadActors(); + loadCountries(); + loadGenres(); + loadStudios(); + return(loadVideos()); } @@ -82,6 +86,51 @@ qint32 cKodiVideoLibrary::loadActors() return(m_videosActorList.count()); } +qint32 cKodiVideoLibrary::loadCountries() +{ + QSqlQuery query(m_db); + + query.exec("SELECT country_id, name FROM country ORDER BY name;"); + while(query.next()) + { + m_videosCountryList.add( + query.value("country_id").toInt(), + query.value("name").toString()); + + } + return(m_videosCountryList.count()); +} + +qint32 cKodiVideoLibrary::loadGenres() +{ + QSqlQuery query(m_db); + + query.exec("SELECT genre_id, name FROM genre ORDER BY name;"); + while(query.next()) + { + m_videosGenreList.add( + query.value("genre_id").toInt(), + query.value("name").toString()); + + } + return(m_videosGenreList.count()); +} + +qint32 cKodiVideoLibrary::loadStudios() +{ + QSqlQuery query(m_db); + + query.exec("SELECT studio_id, name FROM studio ORDER BY name;"); + while(query.next()) + { + m_videosStudioList.add( + query.value("studio_id").toInt(), + query.value("name").toString()); + + } + return(m_videosStudioList.count()); +} + qint32 cKodiVideoLibrary::loadVideos() { QSqlQuery query(m_db); diff --git a/ckodivideolibrary.h b/ckodivideolibrary.h index 035d325..833046b 100644 --- a/ckodivideolibrary.h +++ b/ckodivideolibrary.h @@ -18,27 +18,33 @@ public: cKodiVideoLibrary(const QString& szFileName); ~cKodiVideoLibrary(); - qint16 init(); - qint16 version(); + qint16 init(); + qint16 version(); - qint32 load(); - bool art(const QString& szMediaType, const QString& szType, qint32 idMovie, qint32& artID, QString& szURL); + qint32 load(); + bool art(const QString& szMediaType, const QString& szType, qint32 idMovie, qint32& artID, QString& szURL); - void fillVideoList(QStandardItemModel* lpModel); - void fillActorList(QStandardItemModel* lpList, cMyVideos* lpVideos); - void fillDirectorsList(QStandardItemModel* lpList, cMyVideos* lpVideos); - void fillWritersList(QStandardItemModel* lpList, cMyVideos* lpVideos); + void fillVideoList(QStandardItemModel* lpModel); + void fillActorList(QStandardItemModel* lpList, cMyVideos* lpVideos); + void fillDirectorsList(QStandardItemModel* lpList, cMyVideos* lpVideos); + void fillWritersList(QStandardItemModel* lpList, cMyVideos* lpVideos); private: - QSqlDatabase m_db; - QString m_szFileName; - bool m_bConnected; - qint16 m_iVersion; + QSqlDatabase m_db; + QString m_szFileName; + bool m_bConnected; + qint16 m_iVersion; - cMyVideosActorList m_videosActorList; - cMyVideosList m_videosList; + cMyVideosActorList m_videosActorList; + cMyVideosCountryList m_videosCountryList; + cMyVideosGenreList m_videosGenreList; + cMyVideosStudioList m_videosStudioList; + cMyVideosList m_videosList; - qint32 loadActors(); - qint32 loadVideos(); + qint32 loadActors(); + qint32 loadCountries(); + qint32 loadGenres(); + qint32 loadStudios(); + qint32 loadVideos(); }; #endif // CKODIVIDEOLIBRARY_H diff --git a/cmainwindow.cpp b/cmainwindow.cpp index cca0a6d..874dced 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); @@ -64,6 +64,7 @@ void cMainWindow::initUI() void cMainWindow::initDB() { m_lpKodiLibrary = new cKodiLibrary(ui->m_lpStatusBar, QDir::homePath() + QDir::separator() + QString(".kodi")); +// m_lpKodiLibrary = new cKodiLibrary(ui->m_lpStatusBar, "\\\\MEDIAPC\\system"); m_lpKodiLibrary->init(); m_lpVideoWidget->setLibrary(m_lpKodiLibrary->videoLibrary(), m_lpKodiLibrary->imageList()); } diff --git a/cmyvideos.cpp b/cmyvideos.cpp index 9d320bd..2d484f1 100644 --- a/cmyvideos.cpp +++ b/cmyvideos.cpp @@ -268,6 +268,408 @@ cMyVideosWriterLink* cMyVideosWriterLinkList::add(cMyVideosActor *lpActor) return(lpNew); } +cMyVideosCountryValues::cMyVideosCountryValues() : + m_countryID(-1), + m_szName("UNSET") +{ +} + +cMyVideosCountryValues::cMyVideosCountryValues(qint32 countryID, const QString& szName) : + m_countryID(countryID), + m_szName(szName) +{ +} + +void cMyVideosCountryValues::set(qint32 countryID, const QString& szName) +{ + m_countryID = countryID; + m_szName = szName; +} + +inline bool cMyVideosCountryValues::operator==(const cMyVideosCountryValues b) const +{ + if(m_countryID != b.m_countryID) return(false); + if(m_szName != b.m_szName) return(false); + return(true); +} + +inline bool cMyVideosCountryValues::operator!=(const cMyVideosCountryValues b) const +{ + if(m_countryID != b.m_countryID + || m_szName != b.m_szName) + return(true); + return(false); +} + +cMyVideosCountry::cMyVideosCountry(qint32 countryID, const QString& szName) : + m_values(countryID, szName) +{ + m_oValues = m_values; +} + +qint32 cMyVideosCountry::countryID() +{ + return(m_values.m_countryID); +} + +QString cMyVideosCountry::name() +{ + return(m_values.m_szName); +} + +bool cMyVideosCountry::isNew() +{ + if(m_values.m_countryID == -1) + return(true); + return(false); +} + +bool cMyVideosCountry::isChanged() +{ + if(m_values != m_oValues) + return(true); + return(false); +} + +cMyVideosCountryList::cMyVideosCountryList() +{ +} + +cMyVideosCountry* cMyVideosCountryList::add(qint32 countryID, const QString& szName) +{ + cMyVideosCountry* lpNew = new cMyVideosCountry(countryID, szName); + append(lpNew); + return(lpNew); +} + +cMyVideosCountry* cMyVideosCountryList::find(qint32 countryID) +{ + for(int z = 0;z < count();z++) + { + if(at(z)->countryID() == countryID) + return(at(z)); + } + return(0); +} + +cMyVideosCountryLinkValues::cMyVideosCountryLinkValues() : + m_lpCountry(0) +{ +} + +cMyVideosCountryLinkValues::cMyVideosCountryLinkValues(cMyVideosCountry* lpCountry) : + m_lpCountry(lpCountry) +{ +} + +void cMyVideosCountryLinkValues::set(cMyVideosCountry* lpCountry) +{ + m_lpCountry = lpCountry; +} + +inline bool cMyVideosCountryLinkValues::operator==(const cMyVideosCountryLinkValues b) const +{ + if(m_lpCountry!= b.m_lpCountry) return(false); + return(true); +} + +inline bool cMyVideosCountryLinkValues::operator!=(const cMyVideosCountryLinkValues b) const +{ + if(m_lpCountry!= b.m_lpCountry) + return(true); + return(false); +} + +cMyVideosCountryLink::cMyVideosCountryLink(cMyVideosCountry* lpCountry) : + m_values(lpCountry) +{ + m_oValues = m_values; +} + +cMyVideosCountry* cMyVideosCountryLink::country() +{ + return(m_values.m_lpCountry); +} + +cMyVideosCountryLinkList::cMyVideosCountryLinkList() +{ +} + +cMyVideosCountryLink* cMyVideosCountryLinkList::add(cMyVideosCountry *lpCountry) +{ + cMyVideosCountryLink* lpNew = new cMyVideosCountryLink(lpCountry); + append(lpNew); + return(lpNew); +} + +cMyVideosGenreValues::cMyVideosGenreValues() : + m_genreID(-1), + m_szName("UNSET") +{ +} + +cMyVideosGenreValues::cMyVideosGenreValues(qint32 genreID, const QString& szName) : + m_genreID(genreID), + m_szName(szName) +{ +} + +void cMyVideosGenreValues::set(qint32 genreID, const QString& szName) +{ + m_genreID = genreID; + m_szName = szName; +} + +inline bool cMyVideosGenreValues::operator==(const cMyVideosGenreValues b) const +{ + if(m_genreID != b.m_genreID) return(false); + if(m_szName != b.m_szName) return(false); + return(true); +} + +inline bool cMyVideosGenreValues::operator!=(const cMyVideosGenreValues b) const +{ + if(m_genreID != b.m_genreID + || m_szName != b.m_szName) + return(true); + return(false); +} + +cMyVideosGenre::cMyVideosGenre(qint32 genreID, const QString& szName) : + m_values(genreID, szName) +{ + m_oValues = m_values; +} + +qint32 cMyVideosGenre::genreID() +{ + return(m_values.m_genreID); +} + +QString cMyVideosGenre::name() +{ + return(m_values.m_szName); +} + +bool cMyVideosGenre::isNew() +{ + if(m_values.m_genreID == -1) + return(true); + return(false); +} + +bool cMyVideosGenre::isChanged() +{ + if(m_values != m_oValues) + return(true); + return(false); +} + +cMyVideosGenreList::cMyVideosGenreList() +{ +} + +cMyVideosGenre* cMyVideosGenreList::add(qint32 genreID, const QString& szName) +{ + cMyVideosGenre* lpNew = new cMyVideosGenre(genreID, szName); + append(lpNew); + return(lpNew); +} + +cMyVideosGenre* cMyVideosGenreList::find(qint32 genreID) +{ + for(int z = 0;z < count();z++) + { + if(at(z)->genreID() == genreID) + return(at(z)); + } + return(0); +} + +cMyVideosGenreLinkValues::cMyVideosGenreLinkValues() : + m_lpGenre(0) +{ +} + +cMyVideosGenreLinkValues::cMyVideosGenreLinkValues(cMyVideosGenre* lpGenre) : + m_lpGenre(lpGenre) +{ +} + +void cMyVideosGenreLinkValues::set(cMyVideosGenre* lpGenre) +{ + m_lpGenre = lpGenre; +} + +inline bool cMyVideosGenreLinkValues::operator==(const cMyVideosGenreLinkValues b) const +{ + if(m_lpGenre!= b.m_lpGenre) return(false); + return(true); +} + +inline bool cMyVideosGenreLinkValues::operator!=(const cMyVideosGenreLinkValues b) const +{ + if(m_lpGenre!= b.m_lpGenre) + return(true); + return(false); +} + +cMyVideosGenreLink::cMyVideosGenreLink(cMyVideosGenre* lpGenre) : + m_values(lpGenre) +{ + m_oValues = m_values; +} + +cMyVideosGenre* cMyVideosGenreLink::genre() +{ + return(m_values.m_lpGenre); +} + +cMyVideosGenreLinkList::cMyVideosGenreLinkList() +{ +} + +cMyVideosGenreLink* cMyVideosGenreLinkList::add(cMyVideosGenre *lpGenre) +{ + cMyVideosGenreLink* lpNew = new cMyVideosGenreLink(lpGenre); + append(lpNew); + return(lpNew); +} + +cMyVideosStudioValues::cMyVideosStudioValues() : + m_studioID(-1), + m_szName("UNSET") +{ +} + +cMyVideosStudioValues::cMyVideosStudioValues(qint32 studioID, const QString& szName) : + m_studioID(studioID), + m_szName(szName) +{ +} + +void cMyVideosStudioValues::set(qint32 studioID, const QString& szName) +{ + m_studioID = studioID; + m_szName = szName; +} + +inline bool cMyVideosStudioValues::operator==(const cMyVideosStudioValues b) const +{ + if(m_studioID != b.m_studioID) return(false); + if(m_szName != b.m_szName) return(false); + return(true); +} + +inline bool cMyVideosStudioValues::operator!=(const cMyVideosStudioValues b) const +{ + if(m_studioID != b.m_studioID + || m_szName != b.m_szName) + return(true); + return(false); +} + +cMyVideosStudio::cMyVideosStudio(qint32 studioID, const QString& szName) : + m_values(studioID, szName) +{ + m_oValues = m_values; +} + +qint32 cMyVideosStudio::studioID() +{ + return(m_values.m_studioID); +} + +QString cMyVideosStudio::name() +{ + return(m_values.m_szName); +} + +bool cMyVideosStudio::isNew() +{ + if(m_values.m_studioID == -1) + return(true); + return(false); +} + +bool cMyVideosStudio::isChanged() +{ + if(m_values != m_oValues) + return(true); + return(false); +} + +cMyVideosStudioList::cMyVideosStudioList() +{ +} + +cMyVideosStudio* cMyVideosStudioList::add(qint32 studioID, const QString& szName) +{ + cMyVideosStudio* lpNew = new cMyVideosStudio(studioID, szName); + append(lpNew); + return(lpNew); +} + +cMyVideosStudio* cMyVideosStudioList::find(qint32 studioID) +{ + for(int z = 0;z < count();z++) + { + if(at(z)->studioID() == studioID) + return(at(z)); + } + return(0); +} + +cMyVideosStudioLinkValues::cMyVideosStudioLinkValues() : + m_lpStudio(0) +{ +} + +cMyVideosStudioLinkValues::cMyVideosStudioLinkValues(cMyVideosStudio* lpStudio) : + m_lpStudio(lpStudio) +{ +} + +void cMyVideosStudioLinkValues::set(cMyVideosStudio* lpStudio) +{ + m_lpStudio = lpStudio; +} + +inline bool cMyVideosStudioLinkValues::operator==(const cMyVideosStudioLinkValues b) const +{ + if(m_lpStudio!= b.m_lpStudio) return(false); + return(true); +} + +inline bool cMyVideosStudioLinkValues::operator!=(const cMyVideosStudioLinkValues b) const +{ + if(m_lpStudio!= b.m_lpStudio) + return(true); + return(false); +} + +cMyVideosStudioLink::cMyVideosStudioLink(cMyVideosStudio* lpStudio) : + m_values(lpStudio) +{ + m_oValues = m_values; +} + +cMyVideosStudio* cMyVideosStudioLink::studio() +{ + return(m_values.m_lpStudio); +} + +cMyVideosStudioLinkList::cMyVideosStudioLinkList() +{ +} + +cMyVideosStudioLink* cMyVideosStudioLinkList::add(cMyVideosStudio *lpStudio) +{ + cMyVideosStudioLink* lpNew = new cMyVideosStudioLink(lpStudio); + append(lpNew); + return(lpNew); +} + cMyVideosValues::cMyVideosValues() : m_idMovie(-1), m_idFile(-1), m_szLocalMovieTitle("UNSET"), m_szMoviePlot("UNSET"), m_szMoviePlotOutline("UNSET"), m_szMovieTagline("UNSET"), m_iRatingVotes(-1), m_dRating(-1), m_szWriters("UNSET"), m_iYearReleased(-1), @@ -513,6 +915,54 @@ void cMyVideos::loadWriters(QSqlDatabase& m_db, cMyVideosActorList videosActorLi m_oValues.m_writers = m_values.m_writers; } +void cMyVideos::loadCountries(QSqlDatabase& m_db, cMyVideosCountryList videosCountryList) +{ + if(m_values.m_countries.count()) + return; + + QSqlQuery query(m_db); + query.exec(QString("SELECT country_id FROM country_link WHERE media_id=%1 AND media_type='movie';").arg(m_values.m_idMovie)); + while(query.next()) + { + cMyVideosCountry* lpCountry = videosCountryList.find(query.value("country_id").toInt()); + if(lpCountry) + m_values.m_countries.add(lpCountry); + } + m_oValues.m_countries = m_values.m_countries; +} + +void cMyVideos::loadGenres(QSqlDatabase& m_db, cMyVideosGenreList videosGenreList) +{ + if(m_values.m_genres.count()) + return; + + QSqlQuery query(m_db); + query.exec(QString("SELECT genre_id FROM genre_link WHERE media_id=%1 AND media_type='movie';").arg(m_values.m_idMovie)); + while(query.next()) + { + cMyVideosGenre* lpGenre = videosGenreList.find(query.value("genre_id").toInt()); + if(lpGenre) + m_values.m_genres.add(lpGenre); + } + m_oValues.m_genres = m_values.m_genres; +} + +void cMyVideos::loadStudios(QSqlDatabase& m_db, cMyVideosStudioList videosStudioList) +{ + if(m_values.m_studios.count()) + return; + + QSqlQuery query(m_db); + query.exec(QString("SELECT studio_id FROM studio_link WHERE media_id=%1 AND media_type='movie';").arg(m_values.m_idMovie)); + while(query.next()) + { + cMyVideosStudio* lpStudio = videosStudioList.find(query.value("studio_id").toInt()); + if(lpStudio) + m_values.m_studios.add(lpStudio); + } + m_oValues.m_studios = m_values.m_studios; +} + void cMyVideos::fillActorsList(QStandardItemModel *lpView) { for(int z = 0;z < m_values.m_actors.count();z++) diff --git a/cmyvideos.h b/cmyvideos.h index 09df0a0..8515036 100644 --- a/cmyvideos.h +++ b/cmyvideos.h @@ -175,6 +175,240 @@ public: cMyVideosDirectorLink *add(cMyVideosActor* lpActor); }; +class cMyVideosCountryValues +{ +public: + cMyVideosCountryValues(); + cMyVideosCountryValues(qint32 countryID, const QString& szName); + + void set(qint32 countryID, const QString& szName); + + inline bool operator==(const cMyVideosCountryValues b) const; + inline bool operator!=(const cMyVideosCountryValues b) const; + + qint32 m_countryID; + QString m_szName; +}; + +class cMyVideosCountry +{ +public: + cMyVideosCountry(qint32 countryID, const QString& szName); + + qint32 countryID(); + QString name(); + + bool isNew(); + bool isChanged(); +private: + cMyVideosCountryValues m_values; + cMyVideosCountryValues m_oValues; +}; + +Q_DECLARE_METATYPE(cMyVideosCountry*) + +class cMyVideosCountryList : public QList +{ +public: + cMyVideosCountryList(); + cMyVideosCountry* add(qint32 countryID, const QString& szName); + cMyVideosCountry* find(qint32 countryID); +private: +}; + +class cMyVideosCountryLinkValues +{ +public: + cMyVideosCountryLinkValues(); + cMyVideosCountryLinkValues(cMyVideosCountry* lpCountry); + + void set(cMyVideosCountry* lpCountry); + + inline bool operator==(const cMyVideosCountryLinkValues b) const; + inline bool operator!=(const cMyVideosCountryLinkValues b) const; + + cMyVideosCountry* m_lpCountry; +}; + +class cMyVideosCountryLink +{ +public: + cMyVideosCountryLink(cMyVideosCountry* lpCountry); + + cMyVideosCountry* country(); + + bool isNew(); + bool isChanged(); + + cMyVideosCountryLinkValues m_values; + cMyVideosCountryLinkValues m_oValues; +}; + +Q_DECLARE_METATYPE(cMyVideosCountryLink*) + +class cMyVideosCountryLinkList : public QList +{ +public: + cMyVideosCountryLinkList(); + cMyVideosCountryLink *add(cMyVideosCountry* lpCountry); +}; + +class cMyVideosGenreValues +{ +public: + cMyVideosGenreValues(); + cMyVideosGenreValues(qint32 genreID, const QString& szName); + + void set(qint32 genreID, const QString& szName); + + inline bool operator==(const cMyVideosGenreValues b) const; + inline bool operator!=(const cMyVideosGenreValues b) const; + + qint32 m_genreID; + QString m_szName; +}; + +class cMyVideosGenre +{ +public: + cMyVideosGenre(qint32 genreID, const QString& szName); + + qint32 genreID(); + QString name(); + + bool isNew(); + bool isChanged(); +private: + cMyVideosGenreValues m_values; + cMyVideosGenreValues m_oValues; +}; + +Q_DECLARE_METATYPE(cMyVideosGenre*) + +class cMyVideosGenreList : public QList +{ +public: + cMyVideosGenreList(); + cMyVideosGenre* add(qint32 genreID, const QString& szName); + cMyVideosGenre* find(qint32 genreID); +private: +}; + +class cMyVideosGenreLinkValues +{ +public: + cMyVideosGenreLinkValues(); + cMyVideosGenreLinkValues(cMyVideosGenre* lpGenre); + + void set(cMyVideosGenre* lpGenre); + + inline bool operator==(const cMyVideosGenreLinkValues b) const; + inline bool operator!=(const cMyVideosGenreLinkValues b) const; + + cMyVideosGenre* m_lpGenre; +}; + +class cMyVideosGenreLink +{ +public: + cMyVideosGenreLink(cMyVideosGenre* lpGenre); + + cMyVideosGenre* genre(); + + bool isNew(); + bool isChanged(); + + cMyVideosGenreLinkValues m_values; + cMyVideosGenreLinkValues m_oValues; +}; + +Q_DECLARE_METATYPE(cMyVideosGenreLink*) + +class cMyVideosGenreLinkList : public QList +{ +public: + cMyVideosGenreLinkList(); + cMyVideosGenreLink *add(cMyVideosGenre* lpGenre); +}; + +class cMyVideosStudioValues +{ +public: + cMyVideosStudioValues(); + cMyVideosStudioValues(qint32 studioID, const QString& szName); + + void set(qint32 studioID, const QString& szName); + + inline bool operator==(const cMyVideosStudioValues b) const; + inline bool operator!=(const cMyVideosStudioValues b) const; + + qint32 m_studioID; + QString m_szName; +}; + +class cMyVideosStudio +{ +public: + cMyVideosStudio(qint32 actorID, const QString& szName); + + qint32 studioID(); + QString name(); + + bool isNew(); + bool isChanged(); +private: + cMyVideosStudioValues m_values; + cMyVideosStudioValues m_oValues; +}; + +Q_DECLARE_METATYPE(cMyVideosStudio*) + +class cMyVideosStudioList : public QList +{ +public: + cMyVideosStudioList(); + cMyVideosStudio* add(qint32 studioID, const QString& szName); + cMyVideosStudio* find(qint32 studioID); +private: +}; + +class cMyVideosStudioLinkValues +{ +public: + cMyVideosStudioLinkValues(); + cMyVideosStudioLinkValues(cMyVideosStudio* lpStudio); + + void set(cMyVideosStudio* lpStudio); + + inline bool operator==(const cMyVideosStudioLinkValues b) const; + inline bool operator!=(const cMyVideosStudioLinkValues b) const; + + cMyVideosStudio* m_lpStudio; +}; + +class cMyVideosStudioLink +{ +public: + cMyVideosStudioLink(cMyVideosStudio* lpStudio); + + cMyVideosStudio* studio(); + + bool isNew(); + bool isChanged(); + + cMyVideosStudioLinkValues m_values; + cMyVideosStudioLinkValues m_oValues; +}; + +Q_DECLARE_METATYPE(cMyVideosStudioLink*) + +class cMyVideosStudioLinkList : public QList +{ +public: + cMyVideosStudioLinkList(); + cMyVideosStudioLink *add(cMyVideosStudio* lpStudio); +}; + class cMyVideosValues { public: @@ -239,6 +473,9 @@ public: cMyVideosActorLinkList m_actors; cMyVideosDirectorLinkList m_directors; cMyVideosWriterLinkList m_writers; + cMyVideosCountryLinkList m_countries; + cMyVideosGenreLinkList m_genres; + cMyVideosStudioLinkList m_studios; }; class cMyVideos @@ -256,6 +493,9 @@ public: 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 fillActorsList(QStandardItemModel *lpView); void fillDirectorsList(QStandardItemModel *lpView); diff --git a/cvideowidget.cpp b/cvideowidget.cpp index 808a47b..de996c3 100644 --- a/cvideowidget.cpp +++ b/cvideowidget.cpp @@ -95,11 +95,10 @@ void cVideoWidget::videoSelectionChanged(const QItemSelection& /*newSelection*/, QPixmap fanart; QPixmap poster; QPixmap banner; - - ui->m_lpThumb->clear(); - ui->m_lpFanart->clear(); - ui->m_lpPoster->clear(); - ui->m_lpBanner->clear(); + QString szThumb; + QString szFanart; + QString szPoster; + QString szBanner; const QModelIndex index = ui->m_lpVideoView->selectionModel()->currentIndex(); cMyVideos* lpVideos = index.data(Qt::UserRole).value(); @@ -150,6 +149,11 @@ void cVideoWidget::videoSelectionChanged(const QItemSelection& /*newSelection*/, fanart = m_lpImageList->get(cImage::MEDIATYPE_set, cImage::TYPE_fanart, lpVideos->idSet()); poster = m_lpImageList->get(cImage::MEDIATYPE_set, cImage::TYPE_poster, lpVideos->idSet()); banner = m_lpImageList->get(cImage::MEDIATYPE_set, cImage::TYPE_banner, lpVideos->idSet()); + + szThumb = m_lpImageList->fileName(cImage::MEDIATYPE_set, cImage::TYPE_thumb, lpVideos->idSet()); + szFanart = m_lpImageList->fileName(cImage::MEDIATYPE_set, cImage::TYPE_fanart, lpVideos->idSet()); + szPoster = m_lpImageList->fileName(cImage::MEDIATYPE_set, cImage::TYPE_poster, lpVideos->idSet()); + szBanner = m_lpImageList->fileName(cImage::MEDIATYPE_set, cImage::TYPE_banner, lpVideos->idSet()); } else { @@ -157,56 +161,70 @@ void cVideoWidget::videoSelectionChanged(const QItemSelection& /*newSelection*/, fanart = m_lpImageList->get(cImage::MEDIATYPE_movie, cImage::TYPE_fanart, lpVideos->idMovie()); poster = m_lpImageList->get(cImage::MEDIATYPE_movie, cImage::TYPE_poster, lpVideos->idMovie()); banner = m_lpImageList->get(cImage::MEDIATYPE_movie, cImage::TYPE_banner, lpVideos->idMovie()); + + szThumb = m_lpImageList->fileName(cImage::MEDIATYPE_movie, cImage::TYPE_thumb, lpVideos->idMovie()); + szFanart = m_lpImageList->fileName(cImage::MEDIATYPE_movie, cImage::TYPE_fanart, lpVideos->idMovie()); + szPoster = m_lpImageList->fileName(cImage::MEDIATYPE_movie, cImage::TYPE_poster, lpVideos->idMovie()); + szBanner = m_lpImageList->fileName(cImage::MEDIATYPE_movie, cImage::TYPE_banner, lpVideos->idMovie()); } if(thumb.width()) { - ui->m_lpThumb->setPixmap(thumb.scaled(480, 270, Qt::KeepAspectRatio)); + ui->m_lpThumb->setPixmap(thumb.scaled(480, 270, 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); } else { ui->m_lpThumb->clear(); ui->m_lpThumbBox->setTitle("Thumb"); + ui->m_lpThumb->setToolTip(""); } if(fanart.width()) { - ui->m_lpFanart->setPixmap(fanart.scaled(480, 270, Qt::KeepAspectRatio)); + ui->m_lpFanart->setPixmap(fanart.scaled(480, 270, 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); } else { ui->m_lpFanart->clear(); ui->m_lpFanartBox->setTitle(tr("Fanart")); + ui->m_lpFanart->setToolTip(""); } if(poster.width()) { - ui->m_lpPoster->setPixmap(poster.scaled(480, 270, Qt::KeepAspectRatio)); + ui->m_lpPoster->setPixmap(poster.scaled(480, 270, 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); } else { ui->m_lpPoster->clear(); ui->m_lpPosterBox->setTitle(tr("Poster")); + ui->m_lpPoster->setToolTip(""); } if(banner.width()) { - ui->m_lpBanner->setPixmap(banner.scaled(480, 270, Qt::KeepAspectRatio)); + ui->m_lpBanner->setPixmap(banner.scaled(480, 270, 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); } else { ui->m_lpBanner->clear(); ui->m_lpBannerBox->setTitle(tr("Banner")); + ui->m_lpBanner->setToolTip(""); } } void cVideoWidget::castSelectionChanged(const QItemSelection& /*newSelection*/, const QItemSelection& /*oldSelection*/) { ui->m_lpCastPicture->clear(); + ui->m_lpCastPicture->setToolTip(""); const QModelIndex index = ui->m_lpCastView->selectionModel()->currentIndex(); cMyVideosActorLink* lpActor = index.data(Qt::UserRole).value(); @@ -217,12 +235,14 @@ void cVideoWidget::castSelectionChanged(const QItemSelection& /*newSelection*/, QPixmap picture = m_lpImageList->get(cImage::MEDIATYPE_actor, cImage::TYPE_thumb, lpActor->m_values.m_lpActor->actorID()); if(picture.isNull()) return; - ui->m_lpCastPicture->setPixmap(picture.scaled(191, 191, Qt::KeepAspectRatio)); + ui->m_lpCastPicture->setPixmap(picture.scaled(191, 191, Qt::KeepAspectRatio, Qt::SmoothTransformation)); + ui->m_lpCastPicture->setToolTip(m_lpImageList->fileName(cImage::MEDIATYPE_actor, cImage::TYPE_thumb, lpActor->m_values.m_lpActor->actorID())); } void cVideoWidget::directorSelectionChanged(const QItemSelection& /*newSelection*/, const QItemSelection& /*oldSelection*/) { ui->m_lpDirectorPicture->clear(); + ui->m_lpDirectorPicture->setToolTip(""); const QModelIndex index = ui->m_lpDirectorView->selectionModel()->currentIndex(); cMyVideosDirectorLink* lpDirector = index.data(Qt::UserRole).value(); @@ -233,12 +253,14 @@ void cVideoWidget::directorSelectionChanged(const QItemSelection& /*newSelection QPixmap picture = m_lpImageList->get(cImage::MEDIATYPE_actor, cImage::TYPE_thumb, lpDirector->m_values.m_lpActor->actorID()); if(picture.isNull()) return; - ui->m_lpDirectorPicture->setPixmap(picture.scaled(191, 191, Qt::KeepAspectRatio)); + ui->m_lpDirectorPicture->setPixmap(picture.scaled(191, 191, Qt::KeepAspectRatio, Qt::SmoothTransformation)); + ui->m_lpDirectorPicture->setToolTip(m_lpImageList->fileName(cImage::MEDIATYPE_actor, cImage::TYPE_thumb, lpDirector->m_values.m_lpActor->actorID())); } void cVideoWidget::writerSelectionChanged(const QItemSelection& /*newSelection*/, const QItemSelection& /*oldSelection*/) { ui->m_lpWriterPicture->clear(); + ui->m_lpWriterPicture->setToolTip(""); const QModelIndex index = ui->m_lpWriterView->selectionModel()->currentIndex(); cMyVideosWriterLink* lpWriter = index.data(Qt::UserRole).value(); @@ -249,5 +271,6 @@ void cVideoWidget::writerSelectionChanged(const QItemSelection& /*newSelection*/ QPixmap picture = m_lpImageList->get(cImage::MEDIATYPE_actor, cImage::TYPE_thumb, lpWriter->m_values.m_lpActor->actorID()); if(picture.isNull()) return; - ui->m_lpWriterPicture->setPixmap(picture.scaled(191, 191, Qt::KeepAspectRatio)); + ui->m_lpWriterPicture->setPixmap(picture.scaled(191, 191, Qt::KeepAspectRatio, Qt::SmoothTransformation)); + ui->m_lpWriterPicture->setToolTip(m_lpImageList->fileName(cImage::MEDIATYPE_actor, cImage::TYPE_thumb, lpWriter->m_values.m_lpActor->actorID())); }