diff --git a/src/Load.cpp b/src/Load.cpp index d1e6aba5..5a76cd1b 100644 --- a/src/Load.cpp +++ b/src/Load.cpp @@ -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); } }; @@ -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(); @@ -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(); +} diff --git a/src/Load.h b/src/Load.h index aa8b223f..4b32e0b5 100644 --- a/src/Load.h +++ b/src/Load.h @@ -64,8 +64,6 @@ class Load:public QObject static Load *ins; Load(QObject *parent=0); - void loadTop(); - void dequeue(); signals: void stateChanged(int state); @@ -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