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>
27 #include "dceditscriptfolder.h"
34 class DCCellScriptsEditorPageWidget : public QWidget
39 DCCellCode *d_cellCodeOrg;
40 DCCodeEditor *d_customScriptEditor;
41 DCCodeEditor *d_cellCodeScriptEditor;
43 QSplitter *d_splitter;
46 DCEditScriptFolder d_customScriptFolder;
47 DCEditScriptFolder d_cellCodeScriptFolder;
49 QPushButton *d_customScriptEditExternalButton;
50 QPushButton *d_cellCodeScriptEditExternalButton;
51 bool d_customScriptExternalMode;
52 bool d_cellCodeScriptExternalMode;
53 QList<QProcess*> d_processes;
55 bool loadCustomScript(bool forceReload = false);
56 bool loadCellCodeScript(bool forceReload = false);
58 void updateModifiedStatus();
59 bool openExternalEditor(const QString& path);
62 DCCellScriptsEditorPageWidget(DCCell *targetCell, QWidget *parent = 0);
63 virtual ~DCCellScriptsEditorPageWidget();
65 bool getIsModified() const;
66 bool getIsCustomScriptModifiedByExternalEditor() const;
67 bool getIsCellCodeModifiedByExternalEditor() const;
68 qint64 getCustomScriptLoadedTime() const;
69 qint64 getCellCodeScriptLoadedTime() const;
70 bool getIsCustomScriptExternalMode() const { return d_customScriptExternalMode; }
71 bool getIsCellCodeScriptExternalMode() const { return d_cellCodeScriptExternalMode; }
73 void setReadOnly(bool readOnly);
74 QSet<DCVCPage*> saveScriptsToFile(bool saveModifiedOnly);
75 bool saveCustomScriptOnlyToFile(bool saveModifiedOnly);
76 bool saveCellCodeScriptOnlyToFile(bool saveModifiedOnly);
78 void focusCustomScript();
79 void focusCellCodeScript();
81 void reloadCustomScript();
82 void reloadCellCodeScript();
85 void editingCellDestroyed(DCCell *cell);
86 void cellScriptsModifiedStatusChanged(QWidget *self, bool modified);
87 void cellScriptsSaved(QWidget *self);
88 void customScriptModifiedByExternalEditor(QWidget *self, qint64 notifiedTime);
89 void cellCodeScriptModifiedByExternalEditor(QWidget *self, qint64 notifiedTime);
92 void assignedCellCodeChanged();
94 void editorCustomScriptChanged();
95 void editorCellCodeScriptChanged();
96 void folderCustomScriptChanged();
97 void folderCellCodeScriptChanged();
98 void folderCustomScriptModifiedStatusChanged(bool modified);
99 void folderCellCodeScriptModifiedStatusChanged(bool modified);
100 void folderCustomScriptFileModifiedByExternalEditor(qint64 notifiedTime);
101 void folderCellCodeScriptFileModifiedByExternalEditor(qint64 notifiedTime);
103 void useExternalEditorForCustomScriptPressed();
104 void useExternalEditorForCellCodeScriptPressed();
107 #endif // DCCELLCODEEDITORPAGEWIDGET_H