-
Notifications
You must be signed in to change notification settings - Fork 0
/
subcontroller.h
46 lines (36 loc) · 1.16 KB
/
subcontroller.h
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
35
36
37
38
39
40
41
42
43
44
45
46
#ifndef SUBCONTROLLER_H
#define SUBCONTROLLER_H
#include <QObject>
#include <QFile>
#include "subdata.h"
#include <vector>
class MainWindow;
struct SubPauseInfo {
bool pauseEnabled = false;
int smallPauseStart = 0;
int smallPauseEnd = 0;
int bigPauseStart = 0;
SubPauseInfo(bool _pauseEnabled, int _smallPauseStart, int _smallPauseEnd, int _bigPauseStart)
: pauseEnabled(_pauseEnabled)
, smallPauseStart(_smallPauseStart)
, smallPauseEnd(_smallPauseEnd)
, bigPauseStart(_bigPauseStart)
{}
};
// Will handle parsing part and storing part
class CSubController: public QObject
{
public:
void SetMainWindow(MainWindow* mainWindow);
const std::vector<CSubData>& GetSubData() const;
public slots:
void ExtractDataFromFile(const QString& filename, SubPauseInfo pauseInfo);
private:
void ExtractDataFromSRT(QFile& inputFile, SubPauseInfo pauseInfo);
void ExtractDataFromASS(QFile& inputFile, SubPauseInfo pauseInfo);
bool AddToSameCharacter(SubPauseInfo pauseInfo, QTime startTime, QTime endTime, const QString& text);
private:
std::vector<CSubData> _subData;
MainWindow* _mainWindow;
};
#endif // SUBCONTROLLER_H