Baloo

pendingfilequeue.h
1/*
2 This file is part of the KDE Baloo project.
3 SPDX-FileCopyrightText: 2011 Sebastian Trueg <trueg@kde.org>
4 SPDX-FileCopyrightText: 2013-2014 Vishesh Handa <me@vhanda.in>
5
6 SPDX-License-Identifier: LGPL-2.1-only OR LGPL-3.0-only OR LicenseRef-KDE-Accepted-LGPL
7*/
8
9#ifndef PENDINGFILEQUEUE_H
10#define PENDINGFILEQUEUE_H
11
12#include "pendingfile.h"
13
14#include <QObject>
15#include <QString>
16#include <QHash>
17#include <QTimer>
18#include <QVector>
19
20namespace Baloo {
21
22class PendingFileQueueTest;
23
24/**
25 *
26 */
27class PendingFileQueue : public QObject
28{
30
31public:
32 explicit PendingFileQueue(QObject* parent = nullptr);
33 ~PendingFileQueue() override;
34
36 void indexNewFile(const QString& fileUrl);
37 void indexModifiedFile(const QString& fileUrl);
38 void indexXAttr(const QString& fileUrl);
39 void removeFileIndex(const QString& fileUrl);
40
41public Q_SLOTS:
42 void enqueue(const PendingFile& file);
43
44 /**
45 * The number of seconds the file should be tracked after it has
46 * been emitted. This defaults to 2 minutes
47 */
48 void setTrackingTime(int seconds);
49
50 /**
51 * Set the minimum amount of seconds a file should be kept in the queue
52 * on receiving successive modifications events.
53 */
54 void setMinimumTimeout(int seconds);
55 void setMaximumTimeout(int seconds);
56
57private Q_SLOTS:
58 void processCache(const QTime& currentTime);
59 void processPendingFiles(const QTime& currentTime);
60 void clearRecentlyEmitted(const QTime& currentTime);
61
62private:
64
65 QTimer m_cacheTimer;
66 QTimer m_clearRecentlyEmittedTimer;
67 QTimer m_pendingFilesTimer;
68
69 /**
70 * Holds the list of files that were recently emitted along with
71 * the time they were last emitted.
72 */
73 QHash<QString, QTime> m_recentlyEmitted;
74
75 /**
76 * The QTime contains the time when these file events should be processed.
77 */
78 QHash<QString, QTime> m_pendingFiles;
79
80 int m_minTimeout;
81 int m_maxTimeout;
82 int m_trackingTime;
83
84 friend class PendingFileQueueTest;
85};
86
87}
88
89#endif
Implements storage for docIds without any associated data Instantiated for:
Definition coding.cpp:11
Q_OBJECTQ_OBJECT
Q_SIGNALSQ_SIGNALS
Q_SLOTSQ_SLOTS
QObject * parent() const const
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Fri May 17 2024 11:51:50 by doxygen 1.10.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.