From 8b9ba1856b5adea7608a1aa4bbd14e15da35f98e Mon Sep 17 00:00:00 2001 From: birkeh Date: Tue, 21 Feb 2017 16:35:54 +0100 Subject: [PATCH] changed tooltip for first columns --- cmainwindow.cpp | 48 +++++++++++++++++++++++++++++++++++++++++++----- cmainwindow.h | 2 ++ cmainwindow.ui | 3 +++ 3 files changed, 48 insertions(+), 5 deletions(-) diff --git a/cmainwindow.cpp b/cmainwindow.cpp index c41f725..ea04253 100644 --- a/cmainwindow.cpp +++ b/cmainwindow.cpp @@ -249,12 +249,12 @@ void cMainWindow::displaySeries() QIcon icon(":/128279.png"); QTreeWidgetItem* lpSelected = 0; - for(int z = 0;z < m_serieList.count();z++) + for(int serie = 0;serie < m_serieList.count();serie++) { - cSerie* lpSerie = m_serieList.at(z); + cSerie* lpSerie = m_serieList.at(serie); QTreeWidgetItem* lp0 = new QTreeWidgetItem(ui->m_lpSeriesList); - lp0->setText(0, QString("%1").arg(z+1)); + lp0->setText(0, QString("%1").arg(serie+1)); lp0->setTextAlignment(0, Qt::AlignRight); lp0->setData(0, Qt::UserRole, QVariant::fromValue(lpSerie)); @@ -266,14 +266,16 @@ void cMainWindow::displaySeries() bool bHasProg = false; bool bHasDone = false; + QString szOpen; + QList seasonList = lpSerie->seasonList(); - for(int z = 0;z < seasonList.count();z++) + for(int season = 0;season < seasonList.count();season++) { QString szInit = ""; QString szProg = ""; QString szDone = ""; - cSeason* lpSeason = seasonList.at(z); + cSeason* lpSeason = seasonList.at(season); lp0->setData(lpSeason->number()+3-iMin, Qt::UserRole, QVariant::fromValue(lpSeason)); for(int y = 0;y < lpSeason->episodeList().count();y++) @@ -317,6 +319,17 @@ void cMainWindow::displaySeries() else szTooltip.append("open: " + szInit + "\n"); + if(lpSeason->number()) + { + if(szOpen.length()) + szOpen += "\n"; + + if(szInit.isEmpty()) + szOpen += QString("Season %1: none").arg(lpSeason->number(), 2, 10, QChar('0')); + else + szOpen += QString("Season %1: %2").arg(lpSeason->number(), 2, 10, QChar('0')).arg(szInit); + } + if(szProg.isEmpty()) szTooltip.append("in progress: none\n"); else @@ -384,7 +397,12 @@ void cMainWindow::displaySeries() lpSelected = lp0; } } + + lp0->setToolTip(0, szOpen); + lp0->setToolTip(1, szOpen); + lp0->setToolTip(2, szOpen); } + for(int z = 0;z < ui->m_lpSeriesList->columnCount();z++) ui->m_lpSeriesList->resizeColumnToContents(z); @@ -788,3 +806,23 @@ void cMainWindow::picturesDone() delete m_lpMessageDialog; m_lpMessageDialog = 0; } + +void cMainWindow::on_m_lpSeriesList_pressed(const QModelIndex &index) +{ + switch(QGuiApplication::mouseButtons()) + { + case Qt::MiddleButton: + if(ui->m_lpSeriesList->selectedItems().count() == 1) + { + cSerie* lpSerie = ui->m_lpSeriesList->selectedItems().at(0)->data(0, Qt::UserRole).value(); + if(lpSerie) + { + if(!lpSerie->download().isEmpty()) + onActionGotoDownload(); + } + } + break; + default: + break; + } +} diff --git a/cmainwindow.h b/cmainwindow.h index 8e2fac8..59cf699 100644 --- a/cmainwindow.h +++ b/cmainwindow.h @@ -46,6 +46,8 @@ private slots: void picturesMessage(const QString& szMessage, const qint32 &iProgress); void picturesAppendMessage(const QString& szMessage); void picturesDone(); + void on_m_lpSeriesList_pressed(const QModelIndex &index); + private: Ui::cMainWindow* ui; cSerieList m_serieList; diff --git a/cmainwindow.ui b/cmainwindow.ui index c39b4e5..fd0ede4 100644 --- a/cmainwindow.ui +++ b/cmainwindow.ui @@ -20,6 +20,9 @@ Qt::CustomContextMenu + + QAbstractItemView::NoEditTriggers + true