OSDN Git Service

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