Skip to content

Commit

Permalink
fix iqiyi
Browse files Browse the repository at this point in the history
  • Loading branch information
AncientLysine committed Aug 4, 2014
1 parent 6fce0c7 commit e86cf03
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 18 deletions.
32 changes: 16 additions & 16 deletions src/Load.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -51,10 +51,10 @@ Load::Load(QObject *parent):
if(code==QNetworkReply::OperationCanceledError){
return;
}
dequeue();
loadTop();
QEvent e(QEvent::User);
if(!qApp->sendEvent(this,&e)){
dequeue();
loadTop();
emit stateChanged(code);
}
};
Expand Down Expand Up @@ -272,20 +272,6 @@ QStandardItemModel *Load::getModel()
return model;
}

void Load::loadTop()
{
if(!queue.isEmpty()&&queue.head()!=last){
last=queue.head();
manager->get(last);
}
}

void Load::dequeue()
{
queue.dequeue();
last=QNetworkRequest();
}

QString Load::getStr()
{
return queue.isEmpty()?QString():last.attribute(QNetworkRequest::User).toString();
Expand Down Expand Up @@ -382,3 +368,17 @@ void Load::getReply(QNetworkRequest request,QString code)
queue.head()=request;
}
}

void Load::loadTop()
{
if (!queue.isEmpty() && queue.head() != last){
last = queue.head();
manager->get(last);
}
}

void Load::dequeue()
{
queue.dequeue();
last = QNetworkRequest();
}
5 changes: 3 additions & 2 deletions src/Load.h
Original file line number Diff line number Diff line change
Expand Up @@ -64,8 +64,6 @@ class Load:public QObject
static Load *ins;

Load(QObject *parent=0);
void loadTop();
void dequeue();

signals:
void stateChanged(int state);
Expand All @@ -77,6 +75,9 @@ public slots:
void loadDanmaku(const QModelIndex &index=QModelIndex());
void getReply(QNetworkRequest request,QString code=QString());

private slots:
void loadTop();
void dequeue();
};

#endif // LOAD_H

0 comments on commit e86cf03

Please sign in to comment.