-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathagview.h
122 lines (90 loc) · 3.44 KB
/
agview.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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
#ifndef AGVIEW_H
#define AGVIEW_H
#include "aderperviewmain.h"
#include "aderperviewvideo.h"
#include "agmediafilerectitem.h"
//#include "agcliprectangleitem.h"
//#include "agcliprectitem.h"
#include <QDateTime>
#include <QFileInfo>
#include <QGraphicsView>
#include <QMediaPlayer>
class AGMediaFileRectItem;
typedef struct {
QString action;
QString mediaType;
QGraphicsItem *item;
QString property;
QString oldValue;
QString newValue;
// bool changed;
} UndoStruct;
class AGView: public QGraphicsView
{
Q_OBJECT
QGraphicsScene *scene;
bool panEnabled = false;
double panStartX;
double panStartY;
bool noFileOrClipDescendants(QGraphicsItem *parentItem);
void reParent(QGraphicsItem *parentItem, QString prefix = "");
qreal mediaFileScaleFactor;
qreal clipScaleFactor;
qreal mediaHeight = 300 * 9.0 / 16.0;
void filterItem(QGraphicsItem *item);
void assignCreateDates();
public:
AGView(QWidget *parent = nullptr);
~AGView();
void onSearchTextChanged(QString text);
void clearAll();
void setThemeColors(QColor color);
void setMediaScaleAndArrange(qreal mediaFileScaleFactor);
QMediaPlayer *dialogMediaPlayer = nullptr;
bool playInDialog;
void setPlayInDialog(bool checked);
void setClipScaleAndArrange(qreal mediaFileScaleFactor);
void setZoom(int value);
QString searchText = "";
bool filtering = false;
void setOrderBy(QString orderBy);
void stopAndDeletePlayers(QFileInfo fileInfo = QFileInfo());
QDialog *playerDialog = nullptr;
QVideoWidget *dialogVideoWidget = nullptr;
QString orderBy = "Name";
QRectF arrangeItems(QGraphicsItem *parentItem = nullptr, QString caller = "");
QGraphicsItem *rootItem = nullptr;
bool isLoading = false;
void processAction(QString action);
void undoOrRedo(QString undoOrRedo);
void saveModels();
void saveModel(AGMediaFileRectItem *mediaItem);
void updateChangedColors(bool debugOn);
QList<UndoStruct> undoList;
int undoIndex = -1;
int undoSavePoint = -1;
public slots:
void onSetView();
// void onClipItemChanged(AGClipRectItem *clipItem);
// void onClipMouseReleased(AGClipRectItem *clipItem);
void onItemRightClicked(QPoint pos);
void onHoverPositionChanged(QGraphicsRectItem *rectItem, int progress);
void onPlayerDialogFinished(int result);
void onFileChanged(QFileInfo fileInfo);
void onAddItem(bool changed, QString parentName, QString mediaType, QFileInfo fileInfo = QFileInfo(), int duration = 0, int clipIn = 0, int clipOut = 0, QString tag = "");
void onDeleteItem(bool changed, QString mediaType, QFileInfo fileInfo, int clipIn = -1, QString tagName = "");
void onAddUndo(bool changed, QString action, QString mediaType, QGraphicsItem *item, QString property = "", QString oldValue = "", QString newValue = "");
void onArrangeItems();
protected:
void keyPressEvent(QKeyEvent *event);
private slots:
void wheelEvent(QWheelEvent *event);
void mousePressEvent(QMouseEvent *event);
void mouseReleaseEvent(QMouseEvent *event);
void mouseMoveEvent(QMouseEvent *event);
void onSelectionChanged();
signals:
void fileWatch(QString folderFileName, bool on, bool triggerFileChanged = false);
void showInStatusBar(QString message, int timeout);
};
#endif // AGVIEW_H