OSDN Git Service

[denncoCreator] Implemented the functionality to check if editing script file is...
[dennco/denncoCreator.git] / Source / codeeditor / dccellscriptseditorpagewidget.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 Nov-3, 2012.
18 //
19 #ifndef DCCELLCODEEDITORPAGEWIDGET_H
20 #define DCCELLCODEEDITORPAGEWIDGET_H
21
22 #include <QWidget>
23 #include <QSplitter>
24
25 #include "dceditscriptfolder.h"
26
27 class DCCell;
28 class DCCellCode;
29 class DCCodeEditor;
30 class DCVCPage;
31
32 class DCCellScriptsEditorPageWidget : public QWidget
33 {
34     Q_OBJECT
35
36     DCCell          *d_cell;
37     DCCellCode      *d_cellCodeOrg;
38     DCCodeEditor    *d_customScriptEditor;
39     DCCodeEditor    *d_cellCodeScriptEditor;
40
41     QSplitter       *d_splitter;
42
43     bool                d_modified;
44     DCEditScriptFolder  d_customScriptFolder;
45     DCEditScriptFolder  d_cellCodeScriptFolder;
46
47     bool            loadCustomScript(bool forceReload = false);
48     bool            loadCellCodeScript(bool forceReload = false);
49     bool            loadScripts();
50     void            updateModifiedStatus();
51
52 public:
53     DCCellScriptsEditorPageWidget(DCCell *targetCell, QWidget *parent = 0);
54     virtual ~DCCellScriptsEditorPageWidget();
55
56     bool            getIsModified() const;
57     bool            getIsCustomScriptModifiedByExternalEditor() const;
58     bool            getIsCellCodeModifiedByExternalEditor() const;
59     qint64          getCustomScriptLoadedTime() const;
60     qint64          getCellCodeScriptLoadedTime() const;
61
62     void            setReadOnly(bool readOnly);
63     QSet<DCVCPage*> saveScriptsToFile(bool saveModifiedOnly);
64     bool            saveCustomScriptOnlyToFile(bool saveModifiedOnly);
65     bool            saveCellCodeScriptOnlyToFile(bool saveModifiedOnly);
66
67     void            focusCustomScript();
68     void            focusCellCodeScript();
69
70     void            reloadCustomScript();
71     void            reloadCellCodeScript();
72
73 signals:
74     void editingCellDestroyed(DCCell *cell);
75     void cellScriptsModifiedStatusChanged(QWidget *self, bool modified);
76     void cellScriptsSaved(QWidget *self);
77     void customScriptModifiedByExternalEditor(QWidget *self, qint64 notifiedTime);
78     void cellCodeScriptModifiedByExternalEditor(QWidget *self, qint64 notifiedTime);
79
80 private slots:
81     void assignedCellCodeChanged();
82     void cellDestroyed();
83     void editorCustomScriptChanged();
84     void editorCellCodeScriptChanged();
85     void folderCustomScriptChanged();
86     void folderCellCodeScriptChanged();
87     void folderCustomScriptModifiedStatusChanged(bool modified);
88     void folderCellCodeScriptModifiedStatusChanged(bool modified);
89     void folderCustomScriptFileModifiedByExternalEditor(qint64 notifiedTime);
90     void folderCellCodeScriptFileModifiedByExternalEditor(qint64 notifiedTime);
91 };
92
93 #endif // DCCELLCODEEDITORPAGEWIDGET_H