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

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

Punch Card Editor: Code reordering and class renaming, rewriting.
Now using the namespace QPunchCard everywhere.

Parted the whole application into 5 parts/directories:

  • app: The application core with MainWindow and main() function
  • qpunchcard: Everything directly binary card related (no interpretation): modeling, input/output, view. Most important classes are Card, Deck, FileFormat, Widget
  • text: Everything related to text interpretation of Cards/Card Decks. Having the abstract Codec classes and the Text::Editor, Text::EditorDock
  • deckviewer: Application components like binary card editing central widget (CardEditor) and Navigator (Model View Controller classes)
  • driver: Basis for the driver framework, must be written soon.

Deck now hides the complete Storage to implement frontend methods that
implement versioning (Undo framework). All code was cleaned up, but doesn't
compile right now (still quite some non heavy errors).

-- Sven @ workstation

File size: 3.1 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 <QMenu>
7#include <QMenuBar>
8#include <QStatusBar>
9#include <QToolBar>
10#include <QPointer>
11#include <QFile>
12
13namespace QPunchCard {
14namespace App {
15        class MainWindow;
16};
17};
18
19#include "qpunchcard/card.h"
20#include "qpunchcard/deck.h"
21#include "deckviewer/navigatordock.h"
22#include "deckviewer/cardeditor.h"
23#include "text/editordock.h"
24
25namespace QPunchCard {
26namespace App {
27
28class MainWindow : public QMainWindow {
29        Q_OBJECT
30        DeckIndex current_index;
31
32public:
33        // gerade offenes *Dokument*
34        QPointer< Deck > deck;
35        //QPointer< QFile > file;
36        QFile file;
37
38        QPointer<Navigator::Dock> navigator;
39        QPointer<CardEditor> graphical_editor;
40        QList< QPointer<Text::EditorDock> > text_editors; // eigentlich nur fuer exportText()
41
42        MainWindow();
43
44        bool hasFileOpened() const { return deck; }
45        QPointer< Deck > getDeck() const { return deck; }
46        DeckIndex getCurrentIndex() const { return current_index; }
47
48        /// speichert die Datei wenn noetig, auf Benutzeranfrage
49        /// @returns ob weitergemacht werden darf (wenn nicht, will Benutzer
50        /// an seiner Datei weiterarbeiten)
51        bool maybeSave();
52
53        // Low-Level-Funktionen ohne GUI-Interaktion
54        void loadDeck(const QString& filename);
55        void closeDeck();
56
57
58public slots:
59        void newFile();
60        void newWindow();
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
96private:
97        void createGraphicalEditor();
98        void createActions();
99        void createMenus();
100        void createToolBars();
101        void createStatusBar();
102        void createDockWindows();
103
104        void notifyFileOpened();
105
106        QMenu* file_menu;
107        QMenu* edit_menu;
108        QMenu* view_menu;
109        QMenu* devices_menu;
110        QMenu* help_menu;
111
112        QToolBar* navi_bar;
113
114        // Hauptactions
115        QAction* new_file_action;
116        QAction* new_window_action;
117        QAction* open_file_action;
118        QAction* save_file_action;
119        QAction* save_file_as_action;
120        QAction* export_text_action;
121        QAction* export_picture_action;
122        QAction* close_file_action;
123        QAction* quit_action;
124        QAction* help_action;
125        QAction* about_action;
126
127        // Editactions
128        QAction* undo_action;
129        QAction* redo_action;
130
131        QAction* new_text_editor_action;
132
133        // Naviactions
134        QAction* next_card_action;
135        QAction* prev_card_action;
136        QAction* new_card_action;
137        QAction* move_forwards_action;
138        QAction* move_backwards_action;
139
140protected:
141        void closeEvent(QCloseEvent* event);
142};
143
144}; // namespace App
145}; // namespace QPunchCard
146
147#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