2
* This file is part of the KDE Baloo Project
3
* Copyright (C) 2012 Vishesh Handa <me@vhanda.in>
5
* This library is free software; you can redistribute it and/or
6
* modify it under the terms of the GNU Lesser General Public
7
* License as published by the Free Software Foundation; either
8
* version 2.1 of the License, or (at your option) version 3, or any
9
* later version accepted by the membership of KDE e.V. (or its
10
* successor approved by the membership of KDE e.V.), which shall
11
* act as a proxy defined in Section 6 of version 3 of the license.
13
* This library is distributed in the hope that it will be useful,
14
* but WITHOUT ANY WARRANTY; without even the implied warranty of
15
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16
* Lesser General Public License for more details.
18
* You should have received a copy of the GNU Lesser General Public
19
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
24
#ifndef FILEINDEXER_INDEXINGQUEUE_H
25
#define FILEINDEXER_INDEXINGQUEUE_H
27
#include <QtCore/QObject>
28
#include <QtCore/QQueue>
29
#include <QtCore/QDirIterator>
35
* An abstract class representing the queue. All indexing queues
36
* should be derived from this queue.
39
class IndexingQueue : public QObject
43
explicit IndexingQueue(QObject* parent = 0);
45
virtual bool isEmpty() = 0;
48
* fill the queue if there is available data, return true if something
49
* is enqueued. Should be used in combinition with isEmpty()
51
* Default implementation will do nothing.
53
virtual void fillQueue();
56
* Sets a artificial delay between each call to processNextIteration.
57
* This can be used to slow down the indexing, in order to conserve
60
void setDelay(int msec);
63
bool isSuspended() const;
71
* This signal will be emitted when the queue starts
74
void startedIndexing();
77
* The signal be emitted once the queue is empty
79
void finishedIndexing();
83
* Process the next iteration in your queue. Once you are done
84
* processing the file call finishIndexingFile so that the queue
85
* can continue processing and call this function when it is
86
* ready for the next iteration.
88
* \sa finishIndexingFile
90
virtual void processNextIteration() = 0;
91
virtual void doSuspend();
92
virtual void doResume();
96
* Call this function when you have finished processing the
97
* iteration from processNextIteration.
99
* \sa processNextIteration
101
void finishIteration();
103
void callForNextIteration();
111
bool m_shouldEmitStartSignal;
118
#endif // FILEINDEXER_INDEXINGQUEUE_H