1 | #ifndef EDITORWINDOW_H |
---|
2 | #define EDITORWINDOW_H |
---|
3 | |
---|
4 | /** |
---|
5 | * foo? |
---|
6 | * |
---|
7 | **/ |
---|
8 | #include <QMainWindow> |
---|
9 | #include <QAction> |
---|
10 | #include <QMenu> |
---|
11 | #include <QMenuBar> |
---|
12 | #include <QStatusBar> |
---|
13 | #include <QToolBar> |
---|
14 | #include <QPointer> |
---|
15 | #include <QFile> |
---|
16 | |
---|
17 | class EditorWindow; |
---|
18 | |
---|
19 | #include "qpunchcard/card.h" |
---|
20 | #include "navigator.h" |
---|
21 | #include "cardeditor.h" |
---|
22 | #include "decktexteditor.h" |
---|
23 | |
---|
24 | class EditorWindow : public QMainWindow { |
---|
25 | Q_OBJECT |
---|
26 | int current_card; |
---|
27 | |
---|
28 | public: |
---|
29 | // gerade offenes *Dokument* |
---|
30 | QPointer< QPunchCard::Deck > deck; |
---|
31 | //QPointer< QFile > file; |
---|
32 | QFile file; |
---|
33 | |
---|
34 | QPointer<Navigator> navigator; |
---|
35 | QPointer<CardEditor> graphical_editor; |
---|
36 | QList< QPointer<TextEditorDock> > text_editors; // eigentlich nur fuer exportText() |
---|
37 | |
---|
38 | EditorWindow(); |
---|
39 | |
---|
40 | bool hasFileOpened() const { return deck; } |
---|
41 | int getCurrentCard() const { return current_card; } |
---|
42 | |
---|
43 | /// speichert die Datei wenn noetig, auf Benutzeranfrage |
---|
44 | /// @returns ob weitergemacht werden darf (wenn nicht, will Benutzer |
---|
45 | /// an seiner Datei weiterarbeiten) |
---|
46 | bool maybeSave(); |
---|
47 | |
---|
48 | // Low-Level-Funktionen ohne GUI-Interaktion |
---|
49 | void loadDeck(const QString& filename); |
---|
50 | void closeDeck(); |
---|
51 | |
---|
52 | |
---|
53 | public slots: |
---|
54 | void newFile(); |
---|
55 | void newWindow(); |
---|
56 | void openFile(); |
---|
57 | /// Speichert Datei. Wenn kein Dateiname, ruft saveFileAs auf. |
---|
58 | /// @returns True bei erfolgreichem Speichern, sonst false. |
---|
59 | bool saveFile(); |
---|
60 | /// Oeffnet Speichern unter-Dialog |
---|
61 | /// @returns true, wenn erfolgreich gespeichert |
---|
62 | bool saveFileAs(); |
---|
63 | void exportText(); |
---|
64 | void exportPicture(); |
---|
65 | void closeFile(); |
---|
66 | void help(); |
---|
67 | void quit(); |
---|
68 | void about(); |
---|
69 | void newTextEditor(); |
---|
70 | |
---|
71 | // durchreichen an alle Kindobjekte |
---|
72 | void nextCard(); |
---|
73 | void prevCard(); |
---|
74 | void setCard(int i); |
---|
75 | |
---|
76 | signals: |
---|
77 | void cardSelected(int i); |
---|
78 | |
---|
79 | void fileOpened(bool opened); |
---|
80 | |
---|
81 | private slots: |
---|
82 | void window_update_on_file_state(bool opened); |
---|
83 | |
---|
84 | private: |
---|
85 | void createActions(); |
---|
86 | void createMenus(); |
---|
87 | void createToolBars(); |
---|
88 | void createStatusBar(); |
---|
89 | void createDockWindows(); |
---|
90 | |
---|
91 | QMenu* file_menu; |
---|
92 | QMenu* edit_menu; |
---|
93 | QMenu* view_menu; |
---|
94 | QMenu* devices_menu; |
---|
95 | QMenu* help_menu; |
---|
96 | |
---|
97 | QToolBar* navi_bar; |
---|
98 | |
---|
99 | // Hauptactions |
---|
100 | QAction* new_file_action; |
---|
101 | QAction* new_window_action; |
---|
102 | QAction* open_file_action; |
---|
103 | QAction* save_file_action; |
---|
104 | QAction* save_file_as_action; |
---|
105 | QAction* export_text_action; |
---|
106 | QAction* export_picture_action; |
---|
107 | QAction* close_file_action; |
---|
108 | QAction* quit_action; |
---|
109 | QAction* help_action; |
---|
110 | QAction* about_action; |
---|
111 | |
---|
112 | // Editactions |
---|
113 | QAction* undo_action; |
---|
114 | QAction* redo_action; |
---|
115 | |
---|
116 | QAction* new_text_editor_action; |
---|
117 | |
---|
118 | protected: |
---|
119 | void closeEvent(QCloseEvent* event); |
---|
120 | }; |
---|
121 | |
---|
122 | #endif // EDITORWINDOW_H |
---|