annotate edmain.h @ 391:28a74940f2b6

More work on the editor.
author Matti Hamalainen <ccr@tnsp.org>
date Fri, 19 Oct 2012 04:30:24 +0300
parents e5220ff48bc8
children 5137db55f00b
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
376
40e33ad0d153 Work towards a working editor .. some day.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
1 #ifndef EDMAIN_H
40e33ad0d153 Work towards a working editor .. some day.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
2 #define EDMAIN_H
40e33ad0d153 Work towards a working editor .. some day.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
3
40e33ad0d153 Work towards a working editor .. some day.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
4 // Program name etc
40e33ad0d153 Work towards a working editor .. some day.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
5 #define PROGRAM_NAME "DMPE Editor"
40e33ad0d153 Work towards a working editor .. some day.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
6 #define PROGRAM_VERSION "0.1"
40e33ad0d153 Work towards a working editor .. some day.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
7
40e33ad0d153 Work towards a working editor .. some day.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
8 // Defaults
40e33ad0d153 Work towards a working editor .. some day.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
9 #define DOC_DEF_FILENAME "Untitled"
381
71c830840691 More work.
Matti Hamalainen <ccr@tnsp.org>
parents: 379
diff changeset
10 #define DOC_UNDO_MAX 15
71c830840691 More work.
Matti Hamalainen <ccr@tnsp.org>
parents: 379
diff changeset
11
71c830840691 More work.
Matti Hamalainen <ccr@tnsp.org>
parents: 379
diff changeset
12 enum
71c830840691 More work.
Matti Hamalainen <ccr@tnsp.org>
parents: 379
diff changeset
13 {
71c830840691 More work.
Matti Hamalainen <ccr@tnsp.org>
parents: 379
diff changeset
14 CTRL_REWIND,
71c830840691 More work.
Matti Hamalainen <ccr@tnsp.org>
parents: 379
diff changeset
15 CTRL_PLAY_START,
71c830840691 More work.
Matti Hamalainen <ccr@tnsp.org>
parents: 379
diff changeset
16 CTRL_PLAY_CURRENT,
71c830840691 More work.
Matti Hamalainen <ccr@tnsp.org>
parents: 379
diff changeset
17 CTRL_PAUSE
71c830840691 More work.
Matti Hamalainen <ccr@tnsp.org>
parents: 379
diff changeset
18 };
71c830840691 More work.
Matti Hamalainen <ccr@tnsp.org>
parents: 379
diff changeset
19
71c830840691 More work.
Matti Hamalainen <ccr@tnsp.org>
parents: 379
diff changeset
20 #define CTRL_ICON_SIZE 32
376
40e33ad0d153 Work towards a working editor .. some day.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
21
379
05e85401480a Rename eddemoobj to edtlobj, etc.
Matti Hamalainen <ccr@tnsp.org>
parents: 378
diff changeset
22 #include "edtlobj.h"
384
e5220ff48bc8 Slowly working on the editor.
Matti Hamalainen <ccr@tnsp.org>
parents: 381
diff changeset
23 #include "edview.h"
e5220ff48bc8 Slowly working on the editor.
Matti Hamalainen <ccr@tnsp.org>
parents: 381
diff changeset
24 #include "edwaveform.h"
376
40e33ad0d153 Work towards a working editor .. some day.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
25 #include <QDebug>
40e33ad0d153 Work towards a working editor .. some day.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
26 #include <QFile>
40e33ad0d153 Work towards a working editor .. some day.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
27 #include <QApplication>
40e33ad0d153 Work towards a working editor .. some day.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
28 #include <QMainWindow>
40e33ad0d153 Work towards a working editor .. some day.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
29 #include <QTableView>
40e33ad0d153 Work towards a working editor .. some day.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
30 #include <QAction>
40e33ad0d153 Work towards a working editor .. some day.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
31 #include <QActionGroup>
40e33ad0d153 Work towards a working editor .. some day.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
32 #include <QSlider>
40e33ad0d153 Work towards a working editor .. some day.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
33 #include <QMessageBox>
40e33ad0d153 Work towards a working editor .. some day.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
34 #include <QCheckBox>
384
e5220ff48bc8 Slowly working on the editor.
Matti Hamalainen <ccr@tnsp.org>
parents: 381
diff changeset
35 #include <QScrollBar>
376
40e33ad0d153 Work towards a working editor .. some day.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
36
40e33ad0d153 Work towards a working editor .. some day.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
37 class DemoEditor : public QMainWindow
40e33ad0d153 Work towards a working editor .. some day.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
38 {
40e33ad0d153 Work towards a working editor .. some day.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
39 Q_OBJECT
40e33ad0d153 Work towards a working editor .. some day.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
40
40e33ad0d153 Work towards a working editor .. some day.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
41 public:
40e33ad0d153 Work towards a working editor .. some day.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
42 DemoEditor();
40e33ad0d153 Work towards a working editor .. some day.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
43 ~DemoEditor();
40e33ad0d153 Work towards a working editor .. some day.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
44
40e33ad0d153 Work towards a working editor .. some day.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
45 void settingsRestore();
40e33ad0d153 Work towards a working editor .. some day.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
46 void settingsSave();
40e33ad0d153 Work towards a working editor .. some day.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
47
40e33ad0d153 Work towards a working editor .. some day.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
48
40e33ad0d153 Work towards a working editor .. some day.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
49 private slots:
40e33ad0d153 Work towards a working editor .. some day.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
50 void actionFileNew();
40e33ad0d153 Work towards a working editor .. some day.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
51 void actionFileOpen();
40e33ad0d153 Work towards a working editor .. some day.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
52 void actionFileSave();
40e33ad0d153 Work towards a working editor .. some day.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
53 void actionFileSaveAs();
40e33ad0d153 Work towards a working editor .. some day.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
54
40e33ad0d153 Work towards a working editor .. some day.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
55 void actionAboutBox();
40e33ad0d153 Work towards a working editor .. some day.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
56
40e33ad0d153 Work towards a working editor .. some day.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
57 //void actionCut();
40e33ad0d153 Work towards a working editor .. some day.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
58 //void actionCopy();
40e33ad0d153 Work towards a working editor .. some day.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
59 //void actionPaste();
40e33ad0d153 Work towards a working editor .. some day.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
60 //void actionDelete();
40e33ad0d153 Work towards a working editor .. some day.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
61
40e33ad0d153 Work towards a working editor .. some day.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
62 void performUndo();
40e33ad0d153 Work towards a working editor .. some day.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
63 void performRedo();
40e33ad0d153 Work towards a working editor .. some day.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
64
381
71c830840691 More work.
Matti Hamalainen <ccr@tnsp.org>
parents: 379
diff changeset
65 void actionControlChanged(QAction *);
391
28a74940f2b6 More work on the editor.
Matti Hamalainen <ccr@tnsp.org>
parents: 384
diff changeset
66 void actionTimelineScrollChanged(int);
28a74940f2b6 More work on the editor.
Matti Hamalainen <ccr@tnsp.org>
parents: 384
diff changeset
67 void actionOffsetChanged(float);
28a74940f2b6 More work on the editor.
Matti Hamalainen <ccr@tnsp.org>
parents: 384
diff changeset
68 void actionTimeChanged(float);
381
71c830840691 More work.
Matti Hamalainen <ccr@tnsp.org>
parents: 379
diff changeset
69
376
40e33ad0d153 Work towards a working editor .. some day.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
70 private:
381
71c830840691 More work.
Matti Hamalainen <ccr@tnsp.org>
parents: 379
diff changeset
71 QTableView *effectTable;
376
40e33ad0d153 Work towards a working editor .. some day.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
72 QAction *menuActUndo, *menuActRedo, *menuActOpen, *menuActSave, *menuActSaveAs;
40e33ad0d153 Work towards a working editor .. some day.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
73 // QAction *menuActCut, *menuActCopy, *menuActPaste, *menuActDelete;
381
71c830840691 More work.
Matti Hamalainen <ccr@tnsp.org>
parents: 379
diff changeset
74 QActionGroup *actGroupControls;
384
e5220ff48bc8 Slowly working on the editor.
Matti Hamalainen <ccr@tnsp.org>
parents: 381
diff changeset
75 QScrollBar *timelineScrollBar;
391
28a74940f2b6 More work on the editor.
Matti Hamalainen <ccr@tnsp.org>
parents: 384
diff changeset
76 WaveTrackView *timelineAudioTrack;
28a74940f2b6 More work on the editor.
Matti Hamalainen <ccr@tnsp.org>
parents: 384
diff changeset
77 GLDemoView *demoView;
384
e5220ff48bc8 Slowly working on the editor.
Matti Hamalainen <ccr@tnsp.org>
parents: 381
diff changeset
78
e5220ff48bc8 Slowly working on the editor.
Matti Hamalainen <ccr@tnsp.org>
parents: 381
diff changeset
79
376
40e33ad0d153 Work towards a working editor .. some day.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
80
40e33ad0d153 Work towards a working editor .. some day.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
81 QAction * createToolButton(QActionGroup *group, QString name, QIcon icon, QString statustip, QVariant data);
40e33ad0d153 Work towards a working editor .. some day.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
82 QAction * createMenuAction(QString name, const QKeySequence &shortcut, QString tooltip);
40e33ad0d153 Work towards a working editor .. some day.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
83 QAction * createMenuGroupAction(QMenu *, QActionGroup *, QString name, const QKeySequence &shortcut, QString tooltip, QVariant data);
40e33ad0d153 Work towards a working editor .. some day.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
84 void setActionGroupChecked(QActionGroup *group, QVariant data);
40e33ad0d153 Work towards a working editor .. some day.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
85
40e33ad0d153 Work towards a working editor .. some day.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
86
378
feaeec4c6c55 Cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 376
diff changeset
87 void showFileErrorDialog(QString operation, int code);
376
40e33ad0d153 Work towards a working editor .. some day.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
88 QMessageBox::StandardButton showDocumentModifiedDialog();
40e33ad0d153 Work towards a working editor .. some day.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
89 void statusMsg(QString message);
40e33ad0d153 Work towards a working editor .. some day.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
90 void closeEvent(QCloseEvent *event);
40e33ad0d153 Work towards a working editor .. some day.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
91 void createMainGUI();
40e33ad0d153 Work towards a working editor .. some day.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
92 void updateMenuStates();
384
e5220ff48bc8 Slowly working on the editor.
Matti Hamalainen <ccr@tnsp.org>
parents: 381
diff changeset
93 void updateTimelineView();
376
40e33ad0d153 Work towards a working editor .. some day.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
94
378
feaeec4c6c55 Cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 376
diff changeset
95 int initEffectsAndResources();
feaeec4c6c55 Cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 376
diff changeset
96 void shutdownEffectsAndResources();
376
40e33ad0d153 Work towards a working editor .. some day.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
97 int reopenResources();
40e33ad0d153 Work towards a working editor .. some day.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
98 int loadResources();
40e33ad0d153 Work towards a working editor .. some day.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
99 bool initializeVideo();
391
28a74940f2b6 More work on the editor.
Matti Hamalainen <ccr@tnsp.org>
parents: 384
diff changeset
100
28a74940f2b6 More work on the editor.
Matti Hamalainen <ccr@tnsp.org>
parents: 384
diff changeset
101 int getAudioTrackDuration();
28a74940f2b6 More work on the editor.
Matti Hamalainen <ccr@tnsp.org>
parents: 384
diff changeset
102 int getTimelineDuration();
376
40e33ad0d153 Work towards a working editor .. some day.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
103
40e33ad0d153 Work towards a working editor .. some day.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
104 void createNewFile();
40e33ad0d153 Work towards a working editor .. some day.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
105 void readFromFile(QString filename);
40e33ad0d153 Work towards a working editor .. some day.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
106 void saveToFile(QString filename);
40e33ad0d153 Work towards a working editor .. some day.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
107
40e33ad0d153 Work towards a working editor .. some day.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
108
381
71c830840691 More work.
Matti Hamalainen <ccr@tnsp.org>
parents: 379
diff changeset
109 bool changed, initSDL;
391
28a74940f2b6 More work on the editor.
Matti Hamalainen <ccr@tnsp.org>
parents: 384
diff changeset
110 float currViewScale;
28a74940f2b6 More work on the editor.
Matti Hamalainen <ccr@tnsp.org>
parents: 384
diff changeset
111 int currViewOffset;
28a74940f2b6 More work on the editor.
Matti Hamalainen <ccr@tnsp.org>
parents: 384
diff changeset
112 int currFrameTime;
28a74940f2b6 More work on the editor.
Matti Hamalainen <ccr@tnsp.org>
parents: 384
diff changeset
113
381
71c830840691 More work.
Matti Hamalainen <ccr@tnsp.org>
parents: 379
diff changeset
114 TimelineObject *tl;
71c830840691 More work.
Matti Hamalainen <ccr@tnsp.org>
parents: 379
diff changeset
115 DMEngineData engine;
71c830840691 More work.
Matti Hamalainen <ccr@tnsp.org>
parents: 379
diff changeset
116
378
feaeec4c6c55 Cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 376
diff changeset
117 QList<TimelineObject *> undoHistory;
376
40e33ad0d153 Work towards a working editor .. some day.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
118 int undoHistoryPos, undoHistoryMax;
40e33ad0d153 Work towards a working editor .. some day.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
119
40e33ad0d153 Work towards a working editor .. some day.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
120 void historyReset();
40e33ad0d153 Work towards a working editor .. some day.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
121 void historyPush(QString description);
40e33ad0d153 Work towards a working editor .. some day.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
122 void historyTop();
40e33ad0d153 Work towards a working editor .. some day.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
123 void historyPop();
40e33ad0d153 Work towards a working editor .. some day.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
124 };
40e33ad0d153 Work towards a working editor .. some day.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
125
40e33ad0d153 Work towards a working editor .. some day.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
126
40e33ad0d153 Work towards a working editor .. some day.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
127 #endif // EDMAIN_H