diff --git a/cmainwindow.cpp b/cmainwindow.cpp index c411950..b8be9fd 100644 --- a/cmainwindow.cpp +++ b/cmainwindow.cpp @@ -125,7 +125,7 @@ cMainWindow::cMainWindow(QWidget *parent) : ui->m_lpMoviesFilterProgress->setCheckState(static_cast(settings.value("movieFilter/hasProgress", Qt::PartiallyChecked).toUInt())); ui->m_lpMoviesFilterDone->setCheckState(static_cast(settings.value("movieFilter/hasDone", Qt::PartiallyChecked).toUInt())); - m_lpSeriesListModel = new QStandardItemModel(0, 3); + m_lpSeriesListModel = new QStandardItemModel(0, 4); initDB(); ui->m_lpSeriesList1->setModel(m_lpSeriesListModel); @@ -164,7 +164,7 @@ cMainWindow::cMainWindow(QWidget *parent) : qint32 iWidth1 = 0; qint32 iWidth2; - for(int z = 0;z < 3;z++) + for(int z = 0;z < 4;z++) iWidth1 += ui->m_lpSeriesList1->columnWidth(z); iWidth1 += 2; @@ -693,6 +693,7 @@ void cMainWindow::setSeriesStyle(QListlpItems) lpItems.at(0)->setForeground(QBrush(Qt::black)); lpItems.at(1)->setForeground(QBrush(Qt::black)); lpItems.at(2)->setForeground(QBrush(Qt::black)); + lpItems.at(3)->setForeground(QBrush(Qt::black)); QList seasonList = lpSerie->seasonList(); for(int season = 0;season < seasonList.count();season++) @@ -706,7 +707,7 @@ void cMainWindow::setSeriesStyle(QListlpItems) if(!lpSeason->seasonNumber() && !bDisplaySeason0) continue; - lpItems.at(lpSeason->seasonNumber()+3-iMin)->setData(QVariant::fromValue(lpSeason), Qt::UserRole); + lpItems.at(lpSeason->seasonNumber()+4-iMin)->setData(QVariant::fromValue(lpSeason), Qt::UserRole); for(int y = 0;y < lpSeason->episodeList().count();y++) { @@ -781,6 +782,7 @@ void cMainWindow::setSeriesStyle(QListlpItems) lpItems.at(0)->setFont(font); lpItems.at(1)->setFont(font); lpItems.at(2)->setFont(font); + lpItems.at(3)->setFont(font); } if(lpSerie->cliffhanger()) @@ -788,9 +790,11 @@ void cMainWindow::setSeriesStyle(QListlpItems) lpItems.at(0)->setFont(fontI); lpItems.at(1)->setFont(fontI); lpItems.at(2)->setFont(fontI); + lpItems.at(3)->setFont(fontI); lpItems.at(0)->setForeground(QBrush(Qt::red)); lpItems.at(1)->setForeground(QBrush(Qt::red)); lpItems.at(2)->setForeground(QBrush(Qt::red)); + lpItems.at(3)->setForeground(QBrush(Qt::red)); } if(bHasProg) @@ -798,21 +802,25 @@ void cMainWindow::setSeriesStyle(QListlpItems) lpItems.at(0)->setForeground(QBrush(Qt::white)); lpItems.at(1)->setForeground(QBrush(Qt::white)); lpItems.at(2)->setForeground(QBrush(Qt::white)); + lpItems.at(3)->setForeground(QBrush(Qt::white)); lpItems.at(0)->setBackground(QBrush(Qt::blue)); lpItems.at(1)->setBackground(QBrush(Qt::blue)); lpItems.at(2)->setBackground(QBrush(Qt::blue)); + lpItems.at(3)->setBackground(QBrush(Qt::blue)); } else if(bHasInit) { lpItems.at(0)->setBackground(QBrush(Qt::lightGray)); lpItems.at(1)->setBackground(QBrush(Qt::lightGray)); lpItems.at(2)->setBackground(QBrush(Qt::lightGray)); + lpItems.at(3)->setBackground(QBrush(Qt::lightGray)); } else { lpItems.at(0)->setBackground(QBrush(Qt::green)); lpItems.at(1)->setBackground(QBrush(Qt::green)); lpItems.at(2)->setBackground(QBrush(Qt::green)); + lpItems.at(3)->setBackground(QBrush(Qt::green)); } if(lpSerie->download().length()) @@ -821,6 +829,7 @@ void cMainWindow::setSeriesStyle(QListlpItems) lpItems.at(0)->setToolTip(szOpen); lpItems.at(1)->setToolTip(szOpen); lpItems.at(2)->setToolTip(szOpen); + lpItems.at(3)->setToolTip(szOpen); } void cMainWindow::setMovieStyle(QStandardItem* /*lpItem*/) @@ -844,10 +853,10 @@ void cMainWindow::displaySeries() qint32 iSeries = 0; qint32 iEpisodes = 0; - m_lpSeriesListModel->setColumnCount(iMax-iMin+2); + m_lpSeriesListModel->setColumnCount(iMax-iMin+3); QStringList header; - header << "Nr" << "Serie" << "Year"; + header << tr("Nr") << tr("Serie") << tr("Year") << tr("Res"); for(int z = iMin;z <= iMax;z++) header.append(QString("Season %1").arg(z)); @@ -878,12 +887,15 @@ void cMainWindow::displaySeries() lpItems.at(2)->setText(lpSerie->firstAired().toString("yyyy")); lpItems.at(2)->setTextAlignment(Qt::AlignRight); + lpItems.at(3)->setText(lpSerie->resolution()); + lpItems.at(3)->setTextAlignment(Qt::AlignRight); + QList seasonList = lpSerie->seasonList(); for(int season = 0;season < seasonList.count();season++) { cSeason* lpSeason = seasonList.at(season); if(lpSeason->seasonNumber() || bDisplaySeason0) - lpItems.at(lpSeason->seasonNumber()+3-iMin)->setData(QVariant::fromValue(lpSeason), Qt::UserRole); + lpItems.at(lpSeason->seasonNumber()+4-iMin)->setData(QVariant::fromValue(lpSeason), Qt::UserRole); } m_lpSeriesListModel->appendRow(lpItems); @@ -899,13 +911,13 @@ void cMainWindow::displaySeries() } } - for(int z = 3;z < m_lpSeriesListModel->columnCount();z++) + for(int z = 4;z < m_lpSeriesListModel->columnCount();z++) { ui->m_lpSeriesList1->setColumnWidth(z, 0); ui->m_lpSeriesList2->resizeColumnToContents(z); } - for(int z = 2;z >= 0;z--) + for(int z = 3;z >= 0;z--) ui->m_lpSeriesList1->resizeColumnToContents(z); if(selected.isValid()) @@ -916,12 +928,13 @@ void cMainWindow::displaySeries() m_szOldSelected = ""; - for(int z = 3;z < m_lpSeriesListModel->columnCount();z++) + for(int z = 4;z < m_lpSeriesListModel->columnCount();z++) ui->m_lpSeriesList1->setColumnHidden(z, true); ui->m_lpSeriesList2->setColumnHidden(0, true); ui->m_lpSeriesList2->setColumnHidden(1, true); ui->m_lpSeriesList2->setColumnHidden(2, true); + ui->m_lpSeriesList2->setColumnHidden(3, true); ui->m_lpSeriesCount->setText(QString("%1").arg(iSeries)); ui->m_lpEpisodesCount->setText(QString("%1").arg(iEpisodes)); @@ -960,7 +973,14 @@ void cMainWindow::displayMovies() } } - QStandardItem* lpItem = new QStandardItem(QString("%1 (%2)  
%3").arg(lpMovie->movieTitle()).arg(lpMovie->releaseDate().year()).arg(lpMovie->tagline())); + QString szText; + + if(lpMovie->resolution().isEmpty()) + szText = QString("%1 (%2)  
%3").arg(lpMovie->movieTitle()).arg(lpMovie->releaseDate().year()).arg(lpMovie->tagline()); + else + szText = QString("%1 (%2) [%4]  
%3").arg(lpMovie->movieTitle()).arg(lpMovie->releaseDate().year()).arg(lpMovie->tagline()).arg(lpMovie->resolution()); + + QStandardItem* lpItem = new QStandardItem(szText); lpItem->setData(QVariant::fromValue(lpMovie), Qt::UserRole); if(lpRoot) @@ -1733,9 +1753,9 @@ void cMainWindow::onActionMovieDelete() void cMainWindow::onActionEdit() { - QModelIndex index = ui->m_lpSeriesList1->selectionModel()->selectedRows().at(0); - - cSerie* lpSerie = m_lpSeriesListModel->itemFromIndex(index)->data(Qt::UserRole).value(); + QModelIndex index = ui->m_lpSeriesList1->selectionModel()->selectedRows().at(0); + QStandardItem* lpRes = m_lpSeriesListModel->item(index.row(), 3); + cSerie* lpSerie = m_lpSeriesListModel->itemFromIndex(index)->data(Qt::UserRole).value(); if(!lpSerie) return; @@ -1754,6 +1774,8 @@ void cMainWindow::onActionEdit() lpSerie->del(m_db); lpSerie->save(m_db); + lpRes->setText(lpSerie->resolution()); + QList lpItems; QStandardItem* lpItem; int iColumn = 0; @@ -1795,6 +1817,16 @@ void cMainWindow::onActionMovieEdit() */ QStandardItem* lpItem = m_lpMoviesListModel->itemFromIndex(ui->m_lpMoviesList->selectionModel()->selectedRows().at(0)); + + QString szText; + + if(lpMovie->resolution().isEmpty()) + szText = QString("%1 (%2)  
%3").arg(lpMovie->movieTitle()).arg(lpMovie->releaseDate().year()).arg(lpMovie->tagline()); + else + szText = QString("%1 (%2) [%4]  
%3").arg(lpMovie->movieTitle()).arg(lpMovie->releaseDate().year()).arg(lpMovie->tagline()).arg(lpMovie->resolution()); + + lpItem->setText(szText); + setMovieStyle(lpItem); emit m_lpMoviesListModel->layoutChanged(); diff --git a/cseasondelegate.cpp b/cseasondelegate.cpp index b40d5c5..eb871af 100644 --- a/cseasondelegate.cpp +++ b/cseasondelegate.cpp @@ -25,7 +25,7 @@ void cSeasonDelegate::paint(QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index) const { - if(index.column() > 2) + if(index.column() > 3) { cSeason* lpSeason = nullptr; @@ -84,11 +84,11 @@ void cSeasonDelegate::paint(QPainter *painter, const QStyleOptionViewItem &optio QSize cSeasonDelegate::sizeHint(const QStyleOptionViewItem &option, const QModelIndex &index) const { - if(index.column() > 2) + if(index.column() > 3) { qint32 iTotal = -1; qint32 z; - cSeason* lpSeason = 0; + cSeason* lpSeason = nullptr; if(index.data(Qt::UserRole).canConvert()) lpSeason = qvariant_cast(index.data(Qt::UserRole));