OSDN Git Service

[denncoCreator] fixed a crash bug.
[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 class DCCellCodeScriptTreeViewWidget;
34
35 class MainWindow : public QMainWindow
36 {
37     Q_OBJECT
38
39 public:
40     explicit MainWindow(QWidget *parent = 0);
41     ~MainWindow();
42
43     static QByteArray readSettingsForCellScriptsEditorGeometory();
44     static void writeSettingsForCellScriptsEditorGeometory(const QByteArray &value);
45     static QString readSettingsForExternalScriptEditorPath();
46     static QString readSettingsForExternalScriptEditorParameters();
47     static void writeSettingsForExternalScriptEditorPath(const QString& arg);
48     static void writeSettingsForExternalScriptEditorParameters(const QString& arg);
49     static bool openExternalEditorFor(const QString& path);
50
51 protected:
52     void closeEvent(QCloseEvent *event);
53
54 private slots:
55     void newFile();
56     void open();
57     void openRecent1();
58     void openRecent2();
59     void openRecent3();
60     void openRecent4();
61     void openRecent5();
62     bool save();
63     bool save(bool showMessage);
64     bool saveAs();
65     void doExternalEditorSetting();
66     void about();
67     void documentWasModified();
68     void playContent();
69     void manageCellCode();
70
71 private:
72     void createActions();
73     void createMenus();
74     void createOpenRecentMenu();
75     void createToolBars();
76     void createStatusBar();
77     void readSettings();
78     void writeSettings();
79     bool maybeSave();
80     bool openRecent(int idx);
81     void loadContent(const QString &contentDirectory);
82     void setCurrentContent(const QString &contentDirectory);
83     QString strippedName(const QString &fullFileName);
84
85     QString curContent;
86
87     QMenu *fileMenu;
88     QMenu *openRecentMenu;
89     QMenu *editMenu;
90     QMenu *helpMenu;
91     QMenu *settingMenu;
92     QToolBar *fileToolBar;
93     QToolBar *editToolBar;
94     QToolBar *playToolBar;
95     QAction *newAct;
96     QAction *openAct;
97     QAction *saveAct;
98     QAction *saveAsAct;
99     QAction *exitAct;
100     QAction *manageCellCodeAct;
101     QAction *cutAct;
102     QAction *copyAct;
103     QAction *playAct;
104     QAction *pasteAct;
105     QAction *externalEditorSettingAct;
106     QAction *aboutAct;
107     QList<QAction*> openRecentActs;
108
109     Ui::MainWindow *ui;
110
111     DCCreator                       *d_creator;
112     DCGLVisualizerWidget            *d_visualizerWidget;
113     DCTreeViewWidget                *d_treeViewWidget;
114     DCCellCodeScriptTreeViewWidget  *d_cellCodeScriptTreeViewWidget;
115     QProcess                        d_player;
116     QString                         d_IPCServerName;
117     QStringList                     d_contentOpenHistory;
118 };
119
120 #endif // MAINWINDOW_H