first beta
This commit is contained in:
+2
-2
@@ -624,12 +624,12 @@ void cMainWindow::displayMovies()
|
||||
lpRoot = 0;
|
||||
else
|
||||
{
|
||||
lpRoot = new QStandardItem(QString("<font color='white'><b>%1</b></font>").arg(szOldCollection));
|
||||
lpRoot = new QStandardItem(QString("<b>%1</b>").arg(szOldCollection));
|
||||
m_lpMoviesListModel->appendRow(lpRoot);
|
||||
}
|
||||
}
|
||||
|
||||
QStandardItem* lpItem = new QStandardItem(QString("<font color='white'><b>%1</b> (%2) <br><i>%3</i></font>").arg(lpMovie->movieTitle()).arg(lpMovie->releaseDate().year()).arg(lpMovie->tagline()));
|
||||
QStandardItem* lpItem = new QStandardItem(QString("<b>%1</b> (%2) <br><i>%3</i>").arg(lpMovie->movieTitle()).arg(lpMovie->releaseDate().year()).arg(lpMovie->tagline()));
|
||||
lpItem->setData(QVariant::fromValue(lpMovie), Qt::UserRole);
|
||||
|
||||
if(lpRoot)
|
||||
|
||||
+17
-6
@@ -110,9 +110,20 @@ void cMovie::setGenres(const QString& szGenres)
|
||||
m_szGenres = szGenres.split(",");
|
||||
}
|
||||
|
||||
QStringList cleanList(const QStringList& list)
|
||||
{
|
||||
QStringList list1;
|
||||
|
||||
for(int x = 0;x < list.count();x++)
|
||||
{
|
||||
if(!list.at(x).isEmpty())
|
||||
list1.append(list.at(x));
|
||||
}
|
||||
return(list1);
|
||||
}
|
||||
void cMovie::setGenres(const QStringList& szGenres)
|
||||
{
|
||||
m_szGenres = szGenres;
|
||||
m_szGenres = cleanList(szGenres);
|
||||
}
|
||||
|
||||
QStringList cMovie::genres()
|
||||
@@ -187,7 +198,7 @@ void cMovie::setProductionCompanies(const QString& szProductionCompanies)
|
||||
|
||||
void cMovie::setProductionCompanies(const QStringList& szProductionCompanies)
|
||||
{
|
||||
m_szProductionCompanies = szProductionCompanies;
|
||||
m_szProductionCompanies = cleanList(szProductionCompanies);
|
||||
}
|
||||
|
||||
QStringList cMovie::productionCompanies()
|
||||
@@ -202,7 +213,7 @@ void cMovie::setProductionCountries(const QString& szProductionCountries)
|
||||
|
||||
void cMovie::setProductionCountries(const QStringList& szProductionCountries)
|
||||
{
|
||||
m_szProductionCountries = szProductionCountries;
|
||||
m_szProductionCountries = cleanList(szProductionCountries);
|
||||
}
|
||||
|
||||
QStringList cMovie::productionCountries()
|
||||
@@ -237,7 +248,7 @@ void cMovie::setSpokenLanguages(const QString& szSpokenLanguages)
|
||||
|
||||
void cMovie::setSpokenLanguages(const QStringList& szSpokenLanguages)
|
||||
{
|
||||
m_szSpokenLanguages = szSpokenLanguages;
|
||||
m_szSpokenLanguages = cleanList(szSpokenLanguages);
|
||||
}
|
||||
|
||||
QStringList cMovie::spokenLanguages()
|
||||
@@ -297,7 +308,7 @@ qint32 cMovie::voteCount()
|
||||
|
||||
void cMovie::setCast(const QStringList &szCast)
|
||||
{
|
||||
m_szCast = szCast;
|
||||
m_szCast = cleanList(szCast);
|
||||
}
|
||||
|
||||
QStringList cMovie::cast()
|
||||
@@ -307,7 +318,7 @@ QStringList cMovie::cast()
|
||||
|
||||
void cMovie::setCrew(const QStringList &szCrew)
|
||||
{
|
||||
m_szCrew = szCrew;
|
||||
m_szCrew = cleanList(szCrew);
|
||||
}
|
||||
|
||||
QStringList cMovie::crew()
|
||||
|
||||
@@ -34,6 +34,7 @@ void cMovieEdit::setMovie(cMovie *lpMovie)
|
||||
break;
|
||||
case cMovie::StateProgress:
|
||||
ui->m_lpProgress->setChecked(true);
|
||||
break;
|
||||
case cMovie::StateDone:
|
||||
ui->m_lpDone->setChecked(true);
|
||||
break;
|
||||
@@ -57,12 +58,14 @@ void cMovieEdit::setMovie(cMovie *lpMovie)
|
||||
lpItem->setText(1, str.at(1));
|
||||
ui->m_lpDetailsActors->addTopLevelItem(lpItem);
|
||||
}
|
||||
ui->m_lpDetailsActors->resizeColumnToContents(0);
|
||||
for(int x = 0;x < m_lpMovie->genres().count();x++)
|
||||
{
|
||||
lpItem = new QTreeWidgetItem(ui->m_lpDetailsGenre);
|
||||
lpItem->setText(0, m_lpMovie->genres().at(x));
|
||||
ui->m_lpDetailsGenre->addTopLevelItem(lpItem);
|
||||
}
|
||||
ui->m_lpDetailsGenre->resizeColumnToContents(0);
|
||||
}
|
||||
|
||||
void cMovieEdit::on_m_lpInit_clicked()
|
||||
|
||||
+16
-1
@@ -40,7 +40,22 @@ void cMovieSearch::on_m_lpSearchButton_clicked()
|
||||
lpDialog->show();
|
||||
|
||||
cTheMovieDBV3 theMovieDBV3;
|
||||
QList<cMovie*> movieList = theMovieDBV3.search(ui->m_lpSearch->text(), -1, "de");
|
||||
QString szSearchText = ui->m_lpSearch->text();
|
||||
qint16 iYear = -1;
|
||||
|
||||
if(szSearchText.contains("(") && szSearchText.contains(")"))
|
||||
{
|
||||
QString tmp = szSearchText.mid(szSearchText.indexOf("(")+1);
|
||||
if(tmp.contains(")"))
|
||||
{
|
||||
tmp = tmp.left(tmp.indexOf(")"));
|
||||
iYear = tmp.toInt();
|
||||
|
||||
szSearchText = szSearchText.left(szSearchText.indexOf("(")-1);
|
||||
}
|
||||
}
|
||||
|
||||
QList<cMovie*> movieList = theMovieDBV3.search(szSearchText, iYear, "de");
|
||||
|
||||
ui->m_lpResults->clear();
|
||||
|
||||
|
||||
+58
-33
@@ -9,7 +9,7 @@
|
||||
#include <QStandardItemModel>
|
||||
|
||||
|
||||
#define STATE_INIT Qt::gray
|
||||
#define STATE_INIT Qt::lightGray
|
||||
#define STATE_PROGRESS Qt::blue
|
||||
#define STATE_DONE Qt::green
|
||||
#define STATE_UNKNOWN Qt::black
|
||||
@@ -18,27 +18,14 @@ void cMovieViewItemDelegate::paint(QPainter* painter, const QStyleOptionViewItem
|
||||
{
|
||||
cMovie* lpMovie = qvariant_cast<cMovie*>(index.data(Qt::UserRole));
|
||||
QBrush oldBrush;
|
||||
cMovie::State state;
|
||||
QPen oldPen;
|
||||
|
||||
QStyleOptionViewItem options = option;
|
||||
initStyleOption(&options, index);
|
||||
|
||||
painter->save();
|
||||
|
||||
QTextDocument doc;
|
||||
doc.setHtml(options.text);
|
||||
|
||||
options.text = "";
|
||||
options.widget->style()->drawControl(QStyle::CE_ItemViewItem, &options, painter);
|
||||
|
||||
// shift text right to make icon visible
|
||||
QSize iconSize = options.icon.actualSize(options.rect.size());
|
||||
painter->translate(options.rect.left()+iconSize.width(), options.rect.top());
|
||||
QRect clip(0, 0, options.rect.width()+iconSize.width(), options.rect.height());
|
||||
|
||||
//doc.drawContents(painter, clip);
|
||||
|
||||
painter->setClipRect(clip);
|
||||
|
||||
if(!lpMovie)
|
||||
{
|
||||
int statusInit = 0;
|
||||
@@ -75,45 +62,83 @@ void cMovieViewItemDelegate::paint(QPainter* painter, const QStyleOptionViewItem
|
||||
}
|
||||
}
|
||||
if(statusProg)
|
||||
painter->setBrush(STATE_PROGRESS);
|
||||
state = cMovie::StateProgress;
|
||||
else if(statusInit)
|
||||
painter->setBrush(STATE_INIT);
|
||||
state = cMovie::StateInit;
|
||||
else
|
||||
painter->setBrush(STATE_DONE);
|
||||
state = cMovie::StateDone;
|
||||
}
|
||||
else
|
||||
{
|
||||
oldBrush = painter->brush();
|
||||
state = lpMovie->state();
|
||||
|
||||
switch(lpMovie->state())
|
||||
QTextDocument doc;
|
||||
|
||||
if(option.state & QStyle::State_Selected)
|
||||
doc.setHtml(QString("<font color='red'>%1</font>").arg(options.text));
|
||||
else
|
||||
{
|
||||
switch(state)
|
||||
{
|
||||
case cMovie::StateInit:
|
||||
painter->setBrush(STATE_INIT);
|
||||
doc.setHtml(QString("<font color='black'>%1</font>").arg(options.text));
|
||||
break;
|
||||
case cMovie::StateProgress:
|
||||
painter->setBrush(STATE_PROGRESS);
|
||||
doc.setHtml(QString("<font color='white'>%1</font>").arg(options.text));
|
||||
break;
|
||||
case cMovie::StateDone:
|
||||
painter->setBrush(STATE_DONE);
|
||||
doc.setHtml(QString("<font color='black'>%1</font>").arg(options.text));
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
QRect back = clip;
|
||||
|
||||
back.setLeft(back.left()+2);
|
||||
back.setRight(back.right()-2);
|
||||
back.setTop(back.top()+4);
|
||||
back.setBottom(back.bottom()-4);
|
||||
options.text = "";
|
||||
options.widget->style()->drawControl(QStyle::CE_ItemViewItem, &options, painter);
|
||||
|
||||
// shift text right to make icon visible
|
||||
QSize iconSize = options.icon.actualSize(options.rect.size());
|
||||
painter->translate(options.rect.left()+iconSize.width(), options.rect.top());
|
||||
QRect clip(0, 0, options.rect.width()+iconSize.width(), options.rect.height());
|
||||
|
||||
painter->setClipRect(clip);
|
||||
|
||||
oldBrush = painter->brush();
|
||||
oldPen = painter->pen();
|
||||
|
||||
switch(state)
|
||||
{
|
||||
case cMovie::StateInit:
|
||||
painter->setBrush(STATE_INIT);
|
||||
if(!(option.state & QStyle::State_Selected))
|
||||
painter->setPen(STATE_INIT);
|
||||
break;
|
||||
case cMovie::StateProgress:
|
||||
painter->setBrush(STATE_PROGRESS);
|
||||
if(!(option.state & QStyle::State_Selected))
|
||||
painter->setPen(STATE_PROGRESS);
|
||||
break;
|
||||
case cMovie::StateDone:
|
||||
painter->setBrush(STATE_DONE);
|
||||
if(!(option.state & QStyle::State_Selected))
|
||||
painter->setPen(STATE_DONE);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
QRect back = clip;
|
||||
back.setLeft(back.left()+1);
|
||||
back.setRight(back.right()-1);
|
||||
back.setTop(back.top()+1);
|
||||
back.setBottom(back.bottom()-1);
|
||||
|
||||
painter->drawRect(back);
|
||||
painter->setBrush(oldBrush);
|
||||
painter->setPen(oldPen);
|
||||
|
||||
QAbstractTextDocumentLayout::PaintContext ctx;
|
||||
// set text color to red for selected item
|
||||
if (option.state & QStyle::State_Selected)
|
||||
ctx.palette.setColor(QPalette::Text, QColor("red"));
|
||||
|
||||
ctx.clip = clip;
|
||||
doc.documentLayout()->draw(painter, ctx);
|
||||
|
||||
|
||||
@@ -66,6 +66,9 @@ QList<cMovie*> cTheMovieDBV3::search(const QString& szMovie, const qint16& year,
|
||||
break;
|
||||
|
||||
page++;
|
||||
if(page > 20)
|
||||
break;
|
||||
|
||||
delete reply;
|
||||
}
|
||||
else
|
||||
|
||||
Reference in New Issue
Block a user