source: projects/punch-card/punch-card-editor/src/app/mainwindow.h @ 53

Last change on this file since 53 was 53, checked in by sven, 10 years ago

Punch Card Editor, ongoing development

  • Extended new Deck interface, expanding the undo framework
  • Implemented editor changes via undo framework
  • revised the menu and toolbar actions and structure (now dynamic construction at deck load time), implemented undo viewer
  • Started implementation of device driver framework in menu
  • Embedded the Qextserialport library (http://qextserialport.sourceforge.net/)
  • Started the Documation M200 Client device driver (well, just created the directory structure and qmake project file infrastructure)
  • At the current state, the complete project compiles :-)

Statistics: About 3500 Lines of code (without libqextserialport)

-- sven @ workstation

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        //QPointer< QFile > file;
38        QFile file;
39
40        QPointer<Navigator::Dock> navigator;
41        QPointer<CardEditor> graphical_editor;
42        QList< QPointer<QPunchCard::Text::EditorDock> > text_editors; // eigentlich nur fuer exportText()
43        QList< QPointer<QPunchCard::Device::Dock> > device_docks;
44
45        MainWindow();
46
47        bool hasFileOpened() const { return deck; }
48        QPointer< Deck > getDeck() const { return deck; }
49        DeckIndex getCurrentIndex() const { return current_index; }
50
51        /// speichert die Datei wenn noetig, auf Benutzeranfrage
52        /// @returns ob weitergemacht werden darf (wenn nicht, will Benutzer
53        /// an seiner Datei weiterarbeiten)
54        bool maybeSave();
55
56        // Low-Level-Funktionen ohne GUI-Interaktion
57        void loadDeck(const QString& filename);
58        void closeDeck();
59
60
61public slots:
62        void newFile();
63        void openFile();
64        /// Speichert Datei. Wenn kein Dateiname, ruft saveFileAs auf.
65        /// @returns True bei erfolgreichem Speichern, sonst false.
66        bool saveFile();
67        /// Oeffnet Speichern unter-Dialog
68        /// @returns true, wenn erfolgreich gespeichert
69        bool saveFileAs();
70        void exportText();
71        void exportPicture();
72        void closeFile();
73        void help();
74        void quit();
75        void about();
76        void newTextEditor();
77
78        void newCard();
79        void moveCardForwards();
80        void moveCardBackwards();
81
82        // durchreichen an alle Kindobjekte
83        void nextCard();
84        void prevCard();
85        void setCard(DeckIndex i);
86
87signals:
88        void cardSelected(DeckIndex i);
89
90        // broadcasting from deck
91        void contentsChanged(DeckIndex lower_index, DeckIndex upper_index);
92
93        void fileOpened(bool opened);
94
95private slots:
96        void window_update_on_file_state(bool opened);
97        void actions_update_on_file_state(bool opened);
98
99private:
100        void createDevices();
101        void createGraphicalEditor();
102        void createActions();
103        void createMenus();
104        void createDynamicMenus();
105        void createToolBars();
106        void createDynamicToolBars();
107        void createStatusBar();
108        void createDockWindows();
109
110        void notifyFileOpened();
111
112        // top level menus
113        QMenu* file_menu;
114        QMenu* edit_menu;
115        QMenu* view_menu;
116        QMenu* devices_menu;
117        QMenu* help_menu;
118
119        // sub menus
120        QMenu* toolbars_view_menu;
121        QMenu* docks_view_menu;
122
123        QToolBar* navi_bar;
124        QToolBar* main_bar;
125
126        QUndoView* undo_view;
127
128        // FILE Actions
129        QAction
130                * new_file_action,
131                * open_file_action,
132                * save_file_action,
133                * save_file_as_action,
134                * export_text_action,
135                * export_picture_action,
136                * close_action,
137                * help_action,
138                * about_action;
139
140        // EDIT Actions
141        QAction
142                * undo_action,
143                * redo_action,
144                * undo_view_action;
145
146
147        QAction* new_text_editor_action;
148
149        // Naviactions
150        QAction* next_card_action;
151        QAction* prev_card_action;
152        QAction* new_card_action;
153        QAction* move_forwards_action;
154        QAction* move_backwards_action;
155
156protected:
157        void closeEvent(QCloseEvent* event);
158};
159
160}; // namespace App
161}; // namespace QPunchCard
162
163#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