1 // Copyright (c) 2012 Dennco Project
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.
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.
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/>.
17 // Created by tkawata on Nov-3, 2012.
19 #ifndef DCCELLCODEEDITORPAGEWIDGET_H
20 #define DCCELLCODEEDITORPAGEWIDGET_H
24 #include <QPushButton>
26 #include "dceditscriptfolder.h"
33 class DCCellScriptsEditorPageWidget : public QWidget
38 DCCellCode *d_cellCodeOrg;
39 DCCodeEditor *d_customScriptEditor;
40 DCCodeEditor *d_cellCodeScriptEditor;
42 QSplitter *d_splitter;
45 DCEditScriptFolder d_customScriptFolder;
46 DCEditScriptFolder d_cellCodeScriptFolder;
48 QPushButton *d_customScriptEditExternalButton;
49 QPushButton *d_cellCodeScriptEditExternalButton;
50 bool d_customScriptExternalMode;
51 bool d_cellCodeScriptExternalMode;
53 bool loadCustomScript(bool forceReload = false);
54 bool loadCellCodeScript(bool forceReload = false);
56 void updateModifiedStatus();
59 DCCellScriptsEditorPageWidget(DCCell *targetCell, QWidget *parent = 0);
60 virtual ~DCCellScriptsEditorPageWidget();
62 bool getIsModified() const;
63 bool getIsCustomScriptModifiedByExternalEditor() const;
64 bool getIsCellCodeModifiedByExternalEditor() const;
65 qint64 getCustomScriptLoadedTime() const;
66 qint64 getCellCodeScriptLoadedTime() const;
67 bool getIsCustomScriptExternalMode() const { return d_customScriptExternalMode; }
68 bool getIsCellCodeScriptExternalMode() const { return d_cellCodeScriptExternalMode; }
70 void setReadOnly(bool readOnly);
71 QSet<DCVCPage*> saveScriptsToFile(bool saveModifiedOnly);
72 bool saveCustomScriptOnlyToFile(bool saveModifiedOnly);
73 bool saveCellCodeScriptOnlyToFile(bool saveModifiedOnly);
75 void focusCustomScript();
76 void focusCellCodeScript();
78 void reloadCustomScript();
79 void reloadCellCodeScript();
82 void editingCellDestroyed(DCCell *cell);
83 void cellScriptsModifiedStatusChanged(QWidget *self, bool modified);
84 void cellScriptsSaved(QWidget *self);
85 void customScriptModifiedByExternalEditor(QWidget *self, qint64 notifiedTime);
86 void cellCodeScriptModifiedByExternalEditor(QWidget *self, qint64 notifiedTime);
89 void assignedCellCodeChanged();
91 void editorCustomScriptChanged();
92 void editorCellCodeScriptChanged();
93 void folderCustomScriptChanged();
94 void folderCellCodeScriptChanged();
95 void folderCustomScriptModifiedStatusChanged(bool modified);
96 void folderCellCodeScriptModifiedStatusChanged(bool modified);
97 void folderCustomScriptFileModifiedByExternalEditor(qint64 notifiedTime);
98 void folderCellCodeScriptFileModifiedByExternalEditor(qint64 notifiedTime);
100 void useExternalEditorForCustomScriptPressed();
101 void useExternalEditorForCellCodeScriptPressed();
104 #endif // DCCELLCODEEDITORPAGEWIDGET_H