Fix sequence for recently changed items.

This commit is contained in:
Klaas Freitag 2013-08-19 13:06:30 +02:00
parent 1a7c89326b
commit c3b82e6818
3 changed files with 14 additions and 11 deletions

View file

@ -552,9 +552,9 @@ void Application::rebuildRecentMenus()
_recentActionsMenu->addAction(tr("No items synced recently"));
} else {
QListIterator<Progress::Info> i(progressInfoList);
i.toBack();
while(i.hasPrevious()) {
Progress::Info info = i.previous();
while(i.hasNext()) {
Progress::Info info = i.next();
QString kindStr = Progress::asResultString(info.kind);
QString timeStr = info.timestamp.toString("hh:mm");

View file

@ -121,7 +121,7 @@ ProgressDispatcher* ProgressDispatcher::instance() {
ProgressDispatcher::ProgressDispatcher(QObject *parent) :
QObject(parent),
_problemQueueSize(50)
_QueueSize(50)
{
}
@ -163,9 +163,9 @@ void ProgressDispatcher::setProgressInfo(const QString& folder, const Progress::
err.error_code = newProgress.current_file_bytes;
err.timestamp = QDateTime::currentDateTime();
_recentProblems.enqueue( err );
if( _recentProblems.size() > _problemQueueSize ) {
_recentProblems.dequeue();
_recentProblems.prepend( err );
if( _recentProblems.size() > _QueueSize ) {
_recentProblems.removeLast();
}
emit progressSyncProblem( folder, err );
} else {
@ -180,7 +180,10 @@ void ProgressDispatcher::setProgressInfo(const QString& folder, const Progress::
if( newProgress.kind == Progress::EndDownload ||
newProgress.kind == Progress::EndUpload ||
newProgress.kind == Progress::EndDelete ) {
_recentChanges.enqueue(newProgress);
_recentChanges.prepend(newProgress);
if( _recentChanges.size() > _QueueSize ) {
_recentChanges.removeLast();
}
}
// store the last real action to help clients that start during
// the Context-phase of an upload or download.

View file

@ -111,9 +111,9 @@ protected:
private:
ProgressDispatcher(QObject* parent = 0);
const int _problemQueueSize;
QQueue<Progress::Info> _recentChanges;
QQueue<Progress::SyncProblem> _recentProblems;
const int _QueueSize;
QList<Progress::Info> _recentChanges;
QList<Progress::SyncProblem> _recentProblems;
QHash<QString, Progress::Kind> _currentAction;
static ProgressDispatcher* _instance;