NepomukDaemons
indexscheduler.h
Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019 #ifndef _NEPOMUK_STRIGI_INDEX_SCHEDULER_H_
00020 #define _NEPOMUK_STRIGI_INDEX_SCHEDULER_H_
00021
00022 #include <QtCore/QThread>
00023 #include <QtCore/QMutex>
00024 #include <QtCore/QWaitCondition>
00025 #include <QtCore/QSet>
00026
00027
00028 namespace Strigi {
00029 class StreamAnalyzer;
00030 class IndexManager;
00031 }
00032
00033 class StoppableConfiguration;
00034 class QFileInfo;
00035 class QUrl;
00036 class QDateTime;
00037 class QByteArray;
00038
00039
00040 namespace Nepomuk {
00048 class IndexScheduler : public QThread
00049 {
00050 Q_OBJECT
00051
00052 public:
00053 IndexScheduler( Strigi::IndexManager* manager, QObject* parent );
00054 ~IndexScheduler();
00055
00056 bool isSuspended() const;
00057 bool isIndexing() const;
00058
00063 QString currentFolder() const;
00064
00065 public Q_SLOTS:
00066 void suspend();
00067 void resume();
00068 void stop();
00069
00070 void setSuspended( bool );
00071
00079 void updateDir( const QString& path );
00080
00084 void updateAll();
00085
00094 void analyzeResource( const QUrl& uri, const QDateTime& modificationTime, QDataStream& data );
00095
00096 Q_SIGNALS:
00097 void indexingStarted();
00098 void indexingStopped();
00099 void indexingFolder( const QString& );
00100
00101 private Q_SLOTS:
00102 void readConfig();
00103
00104 private:
00105 void run();
00106
00107 bool waitForContinue();
00108 bool updateDir( const QString& dir, Strigi::StreamAnalyzer* analyzer, bool recursive );
00109 void analyzeFile( const QFileInfo& file, Strigi::StreamAnalyzer* analyzer );
00110
00111
00112
00113 void setIndexingStarted( bool started );
00114
00115 bool m_suspended;
00116 bool m_stopped;
00117 bool m_indexing;
00118
00119 QMutex m_resumeStopMutex;
00120 QWaitCondition m_resumeStopWc;
00121
00122 StoppableConfiguration* m_analyzerConfig;
00123 Strigi::IndexManager* m_indexManager;
00124
00125
00126 QSet<QPair<QString, int> > m_dirsToUpdate;
00127
00128 QMutex m_dirsToUpdateMutex;
00129 QWaitCondition m_dirsToUpdateWc;
00130
00131 QString m_currentFolder;
00132 };
00133 }
00134
00135 #endif