diff --git a/cedit.cpp b/cedit.cpp index d348db4..b89ad7a 100644 --- a/cedit.cpp +++ b/cedit.cpp @@ -109,6 +109,7 @@ void cEdit::setSerie(cSerie* lpSerie) ui->m_lpCliffhanger->setChecked(lpSerie->cliffhanger()); ui->m_lpDownloadLink->setText(lpSerie->download()); ui->m_lpLocalPath->setText(lpSerie->localPath()); + ui->m_lpResolution->setText(lpSerie->resolution()); QString szBanner = lpSerie->fanartBanner(); { @@ -270,6 +271,11 @@ QString cEdit::localPath() return(ui->m_lpLocalPath->text()); } +QString cEdit::resolution() +{ + return(ui->m_lpResolution->text()); +} + void cEdit::on_m_lpTabWidget_tabBarClicked(int index) { if(index == 1) diff --git a/cedit.h b/cedit.h index d05cac7..be73433 100644 --- a/cedit.h +++ b/cedit.h @@ -57,6 +57,13 @@ public: \return QString */ QString localPath(); + /*! + \brief + + \fn resolution + \return QString + */ + QString resolution(); private slots: /*! \brief diff --git a/cedit.ui b/cedit.ui index b8d8e9a..20461e4 100644 --- a/cedit.ui +++ b/cedit.ui @@ -66,7 +66,7 @@ - + @@ -87,6 +87,16 @@ + + + + Resolution: + + + + + + @@ -206,7 +216,7 @@ false - 0 + 35 diff --git a/cmainwindow.cpp b/cmainwindow.cpp index f47d2cf..1dead2a 100644 --- a/cmainwindow.cpp +++ b/cmainwindow.cpp @@ -274,6 +274,7 @@ void cMainWindow::initDB() " status STRING," " download STRING," " localPath STRING," + " resolution STRING," " cliffhanger BOOL);"); } @@ -357,6 +358,7 @@ void cMainWindow::initDB() " video BOOL," " cast TEXT," " crew TEXT," + " localPath STRING," " state INTEGER);"); } } @@ -469,6 +471,7 @@ void cMainWindow::loadSeriesDB() " serie.status status," " serie.download download," " serie.localPath localPath," + " serie.resolution resolution," " serie.cliffhanger cliffhanger," " season._id s__id," " season.airDate s_airDate," @@ -545,6 +548,7 @@ void cMainWindow::loadSeriesDB() lpSerie->setStatus(query.value("status").toString()); lpSerie->setDownload(query.value("download").toString()); lpSerie->setLocalPath(query.value("localPath").toString()); + lpSerie->setResolution(query.value("resolution").toString()); lpSerie->setCliffhanger(query.value("cliffhanger").toBool()); } @@ -1189,6 +1193,7 @@ bool cMainWindow::runEdit(cSerie* lpSerie, QString& szDownload) lpSerie->setDownload(szDownload); lpSerie->setLocalPath(lpEdit->localPath()); + lpSerie->setResolution(lpEdit->resolution()); lpSerie->updateState(); @@ -1695,15 +1700,6 @@ void cMainWindow::doUpdate(cSerieList& serieList) updateDone(); - -// m_lpUpdateThread = new cUpdateThread; -// m_lpUpdateThread->setData(m_lpMessageDialog, serieList, m_db); - -// connect(m_lpUpdateThread, SIGNAL(finished()), this, SLOT(updateDone())); -// connect(m_lpUpdateThread, SIGNAL(updateMessage(QString,qint32)), this, SLOT(updateMessage(QString,qint32))); -// connect(m_lpUpdateThread, SIGNAL(updateAppendMessage(QString)), this, SLOT(updateAppendMessage(QString))); - -// m_lpUpdateThread->start(); } } @@ -1722,10 +1718,6 @@ void cMainWindow::updateAppendMessage(const QString& szMessage) void cMainWindow::updateDone() { -// if(m_lpUpdateThread) -// delete m_lpUpdateThread; -// m_lpUpdateThread = 0; - loadDB(); displaySeries(); applySeriesFilter(); diff --git a/cserie.cpp b/cserie.cpp index d61132e..95e52a0 100644 --- a/cserie.cpp +++ b/cserie.cpp @@ -540,8 +540,8 @@ bool cSerie::save(QSqlDatabase &db) QSqlQuery queryEpisode; QSqlQuery queryFanart; - querySerie.prepare("INSERT INTO serie (seriesID,seriesName,originalName,backdropPath,createdBy,homepage,lastAired,languages,networks,nrEpisodes,nrSeasons,originCountries,originalLanguage,popularity,posterPath,productionCompanies,type,voteAverage,voteCount,overview,firstAired,cast,crew,genre,imdbid,freebasemid,freebaseid,tvdbid,tvrageid,status,download,localPath,cliffhanger)" - " VALUES (:seriesID,:seriesName,:originalName,:backdropPath,:createdBy,:homepage,:lastAired,:languages,:networks,:nrEpisodes,:nrSeasons,:originCountries,:originalLanguage,:popularity,:posterPath,:productionCompanies,:type,:voteAverage,:voteCount,:overview,:firstAired,:cast,:crew,:genre,:imdbid,:freebasemid,:freebaseid,:tvdbid,:tvrageid,:status,:download,:localPath,:cliffhanger);"); + querySerie.prepare("INSERT INTO serie (seriesID,seriesName,originalName,backdropPath,createdBy,homepage,lastAired,languages,networks,nrEpisodes,nrSeasons,originCountries,originalLanguage,popularity,posterPath,productionCompanies,type,voteAverage,voteCount,overview,firstAired,cast,crew,genre,imdbid,freebasemid,freebaseid,tvdbid,tvrageid,status,download,localPath,resolution,cliffhanger)" + " VALUES (:seriesID,:seriesName,:originalName,:backdropPath,:createdBy,:homepage,:lastAired,:languages,:networks,:nrEpisodes,:nrSeasons,:originCountries,:originalLanguage,:popularity,:posterPath,:productionCompanies,:type,:voteAverage,:voteCount,:overview,:firstAired,:cast,:crew,:genre,:imdbid,:freebasemid,:freebaseid,:tvdbid,:tvrageid,:status,:download,:localPath,:resolution,:cliffhanger);"); querySeason.prepare("INSERT INTO season (_id,airDate,name,overview,id,posterPath,seasonNumber,seriesID) VALUES (:_id,:airDate,:name,:overview,:id,:posterPath,:seasonNumber,:seriesID);"); queryEpisode.prepare("INSERT INTO episode (id,name,episodeNumber,airDate,guestStars,overview,productioncode,seasonNumber,seasonID,seriesID,stillPath,voteAverage,voteCount,crew,state)" " VALUES (:id,:name,:episodeNumber,:airDate,:guestStars,:overview,:productioncode,:seasonNumber,:seasonID,:seriesID,:stillPath,:voteAverage,:voteCount,:crew,:state);"); @@ -585,6 +585,7 @@ bool cSerie::save(QSqlDatabase &db) querySerie.bindValue(":status", status()); querySerie.bindValue(":download", download()); querySerie.bindValue(":localPath", localPath()); + querySerie.bindValue(":resolution", resolution()); querySerie.bindValue(":cliffhanger", cliffhanger()); if(querySerie.exec()) { diff --git a/cserie.h b/cserie.h index 277920f..7557258 100644 --- a/cserie.h +++ b/cserie.h @@ -562,6 +562,29 @@ public: \fn setCliffhanger \param bCliffhanger */ + + /*! + \brief + + \fn setResolution + \param szResolution + */ + void setResolution(const QString& szResolution); + /*! + \brief + + \fn resolution + \return QString + */ + QString resolution(); + + /*! + \brief + + \fn setCliffhanger + \param bCliffhanger + */ + void setCliffhanger(const bool& bCliffhanger); /*! \brief @@ -790,6 +813,7 @@ private: QString m_szStatus; /*!< TODO: describe */ QString m_szDownload; /*!< TODO: describe */ QString m_szLocalPath; /*!< TODO: describe */ + QString m_szResolution; /*!< TODO: describe */ bool m_bCliffhanger; /*!< TODO: describe */ cFanartList m_fanartList; /*!< TODO: describe */ QList m_seasonList; /*!< TODO: describe */ diff --git a/cupdatethread.cpp b/cupdatethread.cpp deleted file mode 100644 index d9bdb3b..0000000 --- a/cupdatethread.cpp +++ /dev/null @@ -1,107 +0,0 @@ -#include "cupdatethread.h" -#include "cseason.h" -#include "cepisode.h" -#include "cmessagedialog.h" -#include "cthemoviedbv3.h" - -#include - -#include -#include - - -cUpdateThread::cUpdateThread() : - m_bStop(false) -{ -} - -void cUpdateThread::stop() -{ - QMutexLocker locker(&m_mutex); - m_bStop = true; - emit updateAppendMessage(" - cancel pending ..."); -} - -void cUpdateThread::run() -{ - QTime timer; - timer.restart(); - QString szFailed; - - for(int x = 0;x < m_serieList.count();x++) - { - cSerie* lpSerie = m_serieList.at(x); - if(lpSerie) - { - emit updateMessage(lpSerie->seriesName(), x); - cTheMovieDBV3 theMovieDB; - cSerie* lpSerieNew; - - if(lpSerie->seriesID() != -1 && lpSerie->seriesID() < 1000000) - { - lpSerieNew = theMovieDB.loadSerie(lpSerie->seriesID(), "de-DE"); - if(!lpSerieNew) - lpSerieNew = theMovieDB.loadSerie(lpSerie->seriesID(), "en"); - if(!lpSerieNew) - { - if(szFailed.length()) - szFailed += ", "; - szFailed += lpSerie->seriesName(); - continue; - } - lpSerieNew->loadFanart(); - cFanartList fanartList = lpSerie->fanartList(); - cFanartList fanartListNew = lpSerieNew->fanartList(); - for(int x = 0;x < fanartListNew.count();x++) - { - cFanart* lpFanartNew = fanartListNew.at(x); - - for(int y = 0;y < fanartList.count();y++) - { - cFanart* lpFanart = fanartList.at(y); - if(lpFanartNew->id() == lpFanart->id()) - { - lpFanartNew->setActive(lpFanart->active()); - break; - } - } - } - lpSerieNew->setDownload(lpSerie->download()); - for(int x = 0;x < lpSerieNew->seasonList().count();x++) - { - cSeason* lpSeasonNew = lpSerieNew->seasonList().at(x); - for(int y = 0;y < lpSeasonNew->episodeList().count();y++) - { - cEpisode* lpEpisodeNew = lpSeasonNew->episodeList().at(y); - cEpisode* lpEpisode = lpSerie->findEpisode(lpEpisodeNew->id()); - if(lpEpisode) - lpEpisodeNew->setState(lpEpisode->state()); - } - } - lpSerieNew->setCliffhanger(lpSerie->cliffhanger()); - if(!m_db.isOpen()) - m_db.open(); - lpSerie->del(m_db); - lpSerieNew->save(m_db); - } - } - - QMutexLocker locker(&m_mutex); - if(m_bStop) - break; - msleep(10); - } - if(szFailed.length()) - { - QMessageBox msgBox; - msgBox.setText(szFailed + QString(" has failed to update.")); - msgBox.exec(); - } -} - -void cUpdateThread::setData(cMessageDialog* lpMessageDialog, const cSerieList &serieList, const QSqlDatabase& db) -{ - connect(lpMessageDialog->cancelButton(), SIGNAL(clicked()), this, SLOT(stop())); - m_serieList = serieList; - m_db = db; -} diff --git a/cupdatethread.h b/cupdatethread.h deleted file mode 100644 index cf5013f..0000000 --- a/cupdatethread.h +++ /dev/null @@ -1,82 +0,0 @@ -#ifndef CUPDATETHREAD_H -#define CUPDATETHREAD_H - - -#include "cmessagedialog.h" - -#include "cserie.h" - -#include -#include -#include -#include -#include - - -/*! - \brief - - \class cUpdateThread cupdatethread.h "cupdatethread.h" -*/ -class cUpdateThread : public QThread -{ - Q_OBJECT - -public: - /*! - \brief - - \fn cUpdateThread - */ - explicit cUpdateThread(); - - /*! - \brief - - \fn setData - \param lpMessageDialog - \param serieList - \param db - */ - void setData(cMessageDialog *lpMessageDialog, const cSerieList& serieList, const QSqlDatabase& db); -public slots: - /*! - \brief - - \fn stop - */ - void stop(); - -signals: - /*! - \brief - - \fn updateMessage - \param szMessage - \param iProgress - */ - void updateMessage(const QString& szMessage, const qint32 &iProgress); - /*! - \brief - - \fn updateAppendMessage - \param szMessage - */ - void updateAppendMessage(const QString& szMessage); - -private: - QMutex m_mutex; /*!< TODO: describe */ - bool m_bStop; /*!< TODO: describe */ - cSerieList m_serieList; /*!< TODO: describe */ - QSqlDatabase m_db; /*!< TODO: describe */ - QWidget* m_lpParent; /*!< TODO: describe */ - - /*! - \brief - - \fn run - */ - void run(); -}; - -#endif // CUPDATETHREAD_H diff --git a/qtMultimediaDB.pro b/qtMultimediaDB.pro index 8d649e6..4305428 100644 --- a/qtMultimediaDB.pro +++ b/qtMultimediaDB.pro @@ -25,7 +25,6 @@ SOURCES += main.cpp\ cverticallabel.cpp \ cepisodedetails.cpp \ cmessagedialog.cpp \ - cupdatethread.cpp \ cpicturesthread.cpp \ cthemoviedbv3.cpp \ cmovie.cpp \ @@ -63,7 +62,6 @@ HEADERS += cmainwindow.h \ cverticallabel.h \ cepisodedetails.h \ cmessagedialog.h \ - cupdatethread.h \ cpicturesthread.h \ cthemoviedbv3.h \ cmovie.h \