Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Share I/O worker thread instances between all DirModels.
  • Loading branch information
rburchell committed Feb 18, 2012
1 parent 14cc320 commit 29525ef
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
5 changes: 4 additions & 1 deletion dirmodel.cpp
Expand Up @@ -36,6 +36,9 @@
#include <QUrl>

#include "dirmodel.h"
#include "ioworkerthread.h"

Q_GLOBAL_STATIC(IOWorkerThread, ioWorkerThread);

class DirListWorker : public IORequest
{
Expand Down Expand Up @@ -190,7 +193,7 @@ void DirModel::setPath(const QString &pathName)
// TODO: we need to set a spinner active before we start getting results from DirListWorker
DirListWorker *dlw = new DirListWorker(pathName);
connect(dlw, SIGNAL(itemsAdded(QVector<QFileInfo>)), SLOT(onItemsAdded(QVector<QFileInfo>)));
mIOWorker.addRequest(dlw);
ioWorkerThread()->addRequest(dlw);

mCurrentDir = pathName;
emit pathChanged();
Expand Down
2 changes: 0 additions & 2 deletions dirmodel.h
Expand Up @@ -37,7 +37,6 @@
#include <QVector>

#include "iorequest.h"
#include "ioworkerthread.h"

class DirModel : public QAbstractListModel
{
Expand Down Expand Up @@ -95,7 +94,6 @@ public slots:
QString mCurrentDir;
QVector<QFileInfo> mDirectoryContents;
QHash<QByteArray, int> mRoleMapping;
IOWorkerThread mIOWorker;
};


Expand Down

0 comments on commit 29525ef

Please sign in to comment.