Changed colors for first column
This commit is contained in:
@@ -262,12 +262,17 @@ void cMainWindow::displaySeries()
|
||||
lp0->setText(2, lpSerie->firstAired().toString("yyyy"));
|
||||
lp0->setTextAlignment(2, Qt::AlignRight);
|
||||
|
||||
bool bHasInit = false;
|
||||
bool bHasProg = false;
|
||||
bool bHasDone = false;
|
||||
|
||||
QList<cSeason*> seasonList = lpSerie->seasonList();
|
||||
for(int z = 0;z < seasonList.count();z++)
|
||||
{
|
||||
QString szInit = "";
|
||||
QString szProg = "";
|
||||
QString szDone = "";
|
||||
|
||||
cSeason* lpSeason = seasonList.at(z);
|
||||
lp0->setData(lpSeason->number()+3-iMin, Qt::UserRole, QVariant::fromValue(lpSeason));
|
||||
|
||||
@@ -279,6 +284,9 @@ void cMainWindow::displaySeries()
|
||||
szInit.append(QString("%1").arg(lpSeason->episodeList().at(y)->episodeNumber()));
|
||||
else
|
||||
szInit.append(QString(", %1").arg(lpSeason->episodeList().at(y)->episodeNumber()));
|
||||
|
||||
if(lpSeason->number())
|
||||
bHasInit = true;
|
||||
}
|
||||
else if(lpSeason->episodeList().at(y)->state() == cEpisode::StateProgress)
|
||||
{
|
||||
@@ -286,6 +294,9 @@ void cMainWindow::displaySeries()
|
||||
szProg.append(QString("%1").arg(lpSeason->episodeList().at(y)->episodeNumber()));
|
||||
else
|
||||
szProg.append(QString(", %1").arg(lpSeason->episodeList().at(y)->episodeNumber()));
|
||||
|
||||
if(lpSeason->number())
|
||||
bHasProg = true;
|
||||
}
|
||||
else if(lpSeason->episodeList().at(y)->state() == cEpisode::StateDone)
|
||||
{
|
||||
@@ -293,6 +304,9 @@ void cMainWindow::displaySeries()
|
||||
szDone.append(QString("%1").arg(lpSeason->episodeList().at(y)->episodeNumber()));
|
||||
else
|
||||
szDone.append(QString(", %1").arg(lpSeason->episodeList().at(y)->episodeNumber()));
|
||||
|
||||
if(lpSeason->number())
|
||||
bHasDone = true;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -336,6 +350,28 @@ void cMainWindow::displaySeries()
|
||||
lp0->setForeground(2, QBrush(Qt::red));
|
||||
}
|
||||
|
||||
if(bHasProg)
|
||||
{
|
||||
lp0->setForeground(0, QBrush(Qt::white));
|
||||
lp0->setForeground(1, QBrush(Qt::white));
|
||||
lp0->setForeground(2, QBrush(Qt::white));
|
||||
lp0->setBackground(0, QBrush(Qt::blue));
|
||||
lp0->setBackground(1, QBrush(Qt::blue));
|
||||
lp0->setBackground(2, QBrush(Qt::blue));
|
||||
}
|
||||
else if(bHasInit)
|
||||
{
|
||||
lp0->setBackground(0, QBrush(Qt::lightGray));
|
||||
lp0->setBackground(1, QBrush(Qt::lightGray));
|
||||
lp0->setBackground(2, QBrush(Qt::lightGray));
|
||||
}
|
||||
else
|
||||
{
|
||||
lp0->setBackground(0, QBrush(Qt::green));
|
||||
lp0->setBackground(1, QBrush(Qt::green));
|
||||
lp0->setBackground(2, QBrush(Qt::green));
|
||||
}
|
||||
|
||||
if(lpSerie->download().length())
|
||||
lp0->setIcon(0, icon);
|
||||
ui->m_lpSeriesList->insertTopLevelItem(0, lp0);
|
||||
|
||||
@@ -107,55 +107,3 @@ QSize cSeasonDelegate::sizeHint(const QStyleOptionViewItem &option, const QModel
|
||||
}
|
||||
return QStyledItemDelegate::sizeHint(option, index);
|
||||
}
|
||||
|
||||
/*
|
||||
QWidget *cSeasonDelegate::createEditor(QWidget *parent,
|
||||
const QStyleOptionViewItem &option,
|
||||
const QModelIndex &index) const
|
||||
|
||||
{
|
||||
if (index.data().canConvert<StarRating>()) {
|
||||
StarEditor *editor = new StarEditor(parent);
|
||||
connect(editor, SIGNAL(editingFinished()),
|
||||
this, SLOT(commitAndCloseEditor()));
|
||||
return editor;
|
||||
} else {
|
||||
return QStyledItemDelegate::createEditor(parent, option, index);
|
||||
}
|
||||
}
|
||||
*/
|
||||
/*
|
||||
void cSeasonDelegate::setEditorData(QWidget *editor,
|
||||
const QModelIndex &index) const
|
||||
{
|
||||
if (index.data().canConvert<StarRating>()) {
|
||||
StarRating starRating = qvariant_cast<StarRating>(index.data());
|
||||
StarEditor *starEditor = qobject_cast<StarEditor *>(editor);
|
||||
starEditor->setStarRating(starRating);
|
||||
} else {
|
||||
QStyledItemDelegate::setEditorData(editor, index);
|
||||
}
|
||||
}
|
||||
*/
|
||||
/*
|
||||
void cSeasonDelegate::setModelData(QWidget *editor, QAbstractItemModel *model, const QModelIndex &index) const
|
||||
{
|
||||
if (index.data().canConvert<StarRating>())
|
||||
{
|
||||
StarEditor *starEditor = qobject_cast<StarEditor *>(editor);
|
||||
model->setData(index, QVariant::fromValue(starEditor->starRating()));
|
||||
}
|
||||
else
|
||||
{
|
||||
QStyledItemDelegate::setModelData(editor, model, index);
|
||||
}
|
||||
}
|
||||
*/
|
||||
/*
|
||||
void cSeasonDelegate::commitAndCloseEditor()
|
||||
{
|
||||
StarEditor *editor = qobject_cast<StarEditor *>(sender());
|
||||
emit commitData(editor);
|
||||
emit closeEditor(editor);
|
||||
}
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user