• Skip to content
  • Skip to link menu
KDE 4.2 API Reference
  • KDE API Reference
  • API Reference
  • Sitemap
  • Contact Us
 

NepomukDaemons

indexscheduler.h

Go to the documentation of this file.
00001 /* This file is part of the KDE Project
00002    Copyright (c) 2008 Sebastian Trueg <trueg@kde.org>
00003 
00004    This library is free software; you can redistribute it and/or
00005    modify it under the terms of the GNU Library General Public
00006    License version 2 as published by the Free Software Foundation.
00007 
00008    This library is distributed in the hope that it will be useful,
00009    but WITHOUT ANY WARRANTY; without even the implied warranty of
00010    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00011    Library General Public License for more details.
00012 
00013    You should have received a copy of the GNU Library General Public License
00014    along with this library; see the file COPYING.LIB.  If not, write to
00015    the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
00016    Boston, MA 02110-1301, USA.
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         // emits indexingStarted or indexingStopped based on parameter. Makes sure
00112         // no signal is emitted twice
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         // set of folders to update (+flags defined in the source file) - changed by updateDir
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

NepomukDaemons

Skip menu "NepomukDaemons"
  • Main Page
  • Namespace List
  • Class Hierarchy
  • Alphabetical List
  • Class List
  • File List
  • Namespace Members
  • Class Members
  • Related Pages

API Reference

Skip menu "API Reference"
  • KCMShell
  • KNotify
  • KStyles
  • Nepomuk Daemons
Generated for API Reference by doxygen 1.5.7
This website is maintained by Adriaan de Groot and Allen Winter.
KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal