source: projects/punch-card-project/trunk/punch-card-editor/src/app/mainwindow.h @ 67

Last change on this file since 67 was 67, checked in by sven, 11 years ago

Irgendwelche alten Aenderungen vom 11.03.2011 von Sven7, der geschrottet wird

File size: 3.4 KB
Line 
1#ifndef PUNCH_CARD_EDITOR_MAINWINDOW_H
2#define PUNCH_CARD_EDITOR_MAINWINDOW_H
3
4#include <QMainWindow>
5#include <QAction>
6#include <QUndoView>
7#include <QMenu>
8#include <QMenuBar>
9#include <QStatusBar>
10#include <QToolBar>
11#include <QPointer>
12#include <QFile>
13
14namespace QPunchCard {
15namespace App {
16        class MainWindow;
17};
18};
19
20#include "qpunchcard/card.h"
21#include "qpunchcard/deck.h"
22#include "deckviewer/navigatordock.h"
23#include "deckviewer/cardeditor.h"
24#include "text/editordock.h"
25#include "driver/driver.h"
26
27namespace QPunchCard {
28namespace App {
29
30class MainWindow : public QMainWindow {
31        Q_OBJECT
32        DeckIndex current_index;
33
34public:
35        // gerade offenes *Dokument*
36        QPointer< Deck > deck;
37
38        QPointer<Navigator::Dock> navigator;
39        CardEditor *graphical_editor; // setCentralWidget takes ownership
40        QList< QPointer<QPunchCard::Text::EditorDock> > text_editors; // eigentlich nur fuer exportText()
41        QList< QPointer<QPunchCard::Device::Dock> > device_docks;
42
43        MainWindow();
44
45        bool hasFileOpened() const { return deck; }
46        QPointer< Deck > getDeck() const { return deck; }
47        DeckIndex getCurrentIndex() const { return current_index; }
48
49        /// speichert die Datei wenn noetig, auf Benutzeranfrage
50        /// @returns ob weitergemacht werden darf (wenn nicht, will Benutzer
51        /// an seiner Datei weiterarbeiten)
52        bool maybeSave();
53
54        // Low-Level-Funktionen ohne GUI-Interaktion
55        void loadDeck(const QString& filename);
56        void closeDeck();
57
58
59public slots:
60        void newFile();
61        void openFile();
62        /// Speichert Datei. Wenn kein Dateiname, ruft saveFileAs auf.
63        /// @returns True bei erfolgreichem Speichern, sonst false.
64        bool saveFile();
65        /// Oeffnet Speichern unter-Dialog
66        /// @returns true, wenn erfolgreich gespeichert
67        bool saveFileAs();
68        void exportText();
69        //void exportPicture();
70        void closeFile();
71        void help();
72        void quit();
73        void about();
74        void newTextEditor();
75
76        void newCard();
77        void moveCardForwards();
78        void moveCardBackwards();
79
80        // durchreichen an alle Kindobjekte
81        void nextCard();
82        void prevCard();
83        void setCard(DeckIndex i);
84
85signals:
86        void cardSelected(DeckIndex i);
87
88        // broadcasting from deck
89        void contentsChanged(DeckIndex lower_index, DeckIndex upper_index);
90
91        void fileOpened(bool opened);
92
93private slots:
94        void window_update_on_file_state(bool opened);
95        void actions_update_on_file_state(bool opened);
96
97private:
98        void createDevices();
99        void createGraphicalEditor();
100        void createActions();
101        void createMenus();
102        void createDynamicMenus();
103        void createToolBars();
104        void createDynamicToolBars();
105        void createStatusBar();
106        void createDockWindows();
107
108        void notifyFileOpened();
109
110        // top level menus
111        QMenu* file_menu;
112        QMenu* edit_menu;
113        QMenu* view_menu;
114        QMenu* devices_menu;
115        QMenu* help_menu;
116
117        // sub menus
118        QMenu* toolbars_view_menu;
119        QMenu* docks_view_menu;
120
121        QToolBar* navi_bar;
122        QToolBar* main_bar;
123
124        QPointer<QUndoView> undo_view;
125
126        // FILE Actions
127        QAction
128                * new_file_action,
129                * open_file_action,
130                * save_file_action,
131                * save_file_as_action,
132                * export_text_action,
133                * export_picture_action,
134                * close_action,
135                * help_action,
136                * about_action;
137
138        // EDIT Actions
139        QAction
140                * undo_action,
141                * redo_action,
142                * undo_view_action;
143
144
145        QAction* new_text_editor_action;
146
147        // Naviactions
148        QAction* next_card_action;
149        QAction* prev_card_action;
150        QAction* new_card_action;
151        QAction* move_forwards_action;
152        QAction* move_backwards_action;
153
154protected:
155        void closeEvent(QCloseEvent* event);
156};
157
158}; // namespace App
159}; // namespace QPunchCard
160
161#endif // PUNCH_CARD_EDITOR_MAINWINDOW_H
Note: See TracBrowser for help on using the repository browser.
© 2008 - 2013 technikum29 • Sven Köppel • Some rights reserved
Powered by Trac
Expect where otherwise noted, content on this site is licensed under a Creative Commons 3.0 License