forked from mehtabmahir/easy-whisper-ui
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathfilequeue.h
More file actions
34 lines (25 loc) · 834 Bytes
/
filequeue.h
File metadata and controls
34 lines (25 loc) · 834 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
#ifndef FILEQUEUE_H
#define FILEQUEUE_H
#pragma once
#include <QQueue>
#include <QStringList>
#include <functional>
class FileQueue {
public:
FileQueue();
// Set this to your processing lambda, e.g. [this](const QString &file){ processAudioFile(file); }
void setProcessor(std::function<void(const QString&)> processor);
// Enqueue files and start processing if idle
void enqueueFilesAndStart(const QStringList &files);
// Called when one file is finished to trigger the next
void startNext();
// Check if currently processing
bool isProcessing() const { return processing; }
bool isEmpty() const { return queue.isEmpty(); }
void clear();
private:
QQueue<QString> queue;
bool processing = false;
std::function<void(const QString&)> processFunc;
};
#endif // FILEQUEUE_H