OSDN Git Service

[denncoCreator] cell code scripts editor modification. Set editor readonly when a...
[dennco/denncoCreator.git] / Source / mainwindow.h
1 //  Copyright (c) 2012 Dennco Project
2 //
3 // This program is free software: you can redistribute it and/or modify
4 // it under the terms of the GNU General Public License as published by
5 // the Free Software Foundation, either version 3 of the License, or
6 // (at your option) any later version.
7 //
8 // This program is distributed in the hope that it will be useful,
9 // but WITHOUT ANY WARRANTY; without even the implied warranty of
10 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
11 // GNU General Public License for more details.
12 //
13 // You should have received a copy of the GNU General Public License
14 // along with this program.  If not, see <http://www.gnu.org/licenses/>.
15
16 //
17 //  Created by tkawata on Sep-30, 2012.
18 //
19 #ifndef MAINWINDOW_H
20 #define MAINWINDOW_H
21
22 #include <QMainWindow>
23 #include <QProcess>
24 #include <QSharedMemory>
25
26 namespace Ui {
27 class MainWindow;
28 }
29
30 class DCCreator;
31 class DCGLVisualizerWidget;
32 class DCTreeViewWidget;
33
34 class MainWindow : public QMainWindow
35 {
36     Q_OBJECT
37
38 public:
39     explicit MainWindow(QWidget *parent = 0);
40     ~MainWindow();
41
42     static QByteArray readSettingsForCellScriptsEditorGeometory();
43     static void writeSettingsForCellScriptsEditorGeometory(const QByteArray &value);
44
45 protected:
46     void closeEvent(QCloseEvent *event);
47
48 private slots:
49     void newFile();
50     void open();
51     void openRecent1();
52     void openRecent2();
53     void openRecent3();
54     void openRecent4();
55     void openRecent5();
56     bool save();
57     bool save(bool showMessage);
58     bool saveAs();
59     void about();
60     void documentWasModified();
61     void playContent();
62
63 private:
64     void createActions();
65     void createMenus();
66     void createOpenRecentMenu();
67     void createToolBars();
68     void createStatusBar();
69     void readSettings();
70     void writeSettings();
71     bool maybeSave();
72     bool openRecent(int idx);
73     void loadContent(const QString &contentDirectory);
74     void setCurrentContent(const QString &contentDirectory);
75     QString strippedName(const QString &fullFileName);
76
77     QString curContent;
78
79     QMenu *fileMenu;
80     QMenu *openRecentMenu;
81     QMenu *editMenu;
82     QMenu *helpMenu;
83     QToolBar *fileToolBar;
84     QToolBar *editToolBar;
85     QToolBar *playToolBar;
86     QAction *newAct;
87     QAction *openAct;
88     QAction *saveAct;
89     QAction *saveAsAct;
90     QAction *exitAct;
91     QAction *cutAct;
92     QAction *copyAct;
93     QAction *playAct;
94     QAction *pasteAct;
95     QAction *aboutAct;
96     QList<QAction*> openRecentActs;
97
98     Ui::MainWindow *ui;
99
100     DCCreator                   *d_creator;
101     DCGLVisualizerWidget        *d_visualizerWidget;
102     DCTreeViewWidget            *d_treeViewWidget;
103     QProcess                    d_player;
104     QString                     d_IPCServerName;
105     QStringList                 d_contentOpenHistory;
106 };
107
108 #endif // MAINWINDOW_H