VR-Forces 4.5 Class Documentation
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
scriptEditor.h
Go to the documentation of this file.
1 /******************************************************************************
2 ** Copyright (c) 2013 MAK Technologies, Inc.
3 ** All rights reserved.
4 ******************************************************************************/
5 
8 
10 
11 #pragma once
12 
13 #include <vrvUtil/signalslib.h>
17 #include <vlutil/vlFilename.h>
18 
19 #include <QObject>
20 #include <QDateTime>
21 #include <QtCore/QProcess>
22 
23 namespace makVrv
24 {
25  class DtDe;
26 }
27 
28 class DtSimMessage;
29 class QProcess;
31 
32 namespace makVrf
33 {
38  {
39  Q_OBJECT
40 
41  public:
44 
46  virtual ~DtScriptEditor();
47 
49  static DtScriptEditor& instance(makVrv::DtDe& de);
50  static void registerInstance(makVrv::DtDe&, DtScriptEditor*);
51 
53  virtual void edit(const std::string&, int scriptType, const std::string& commentBlock = "");
54 
57  virtual void editNew(const std::string& id, int sType, const std::string& script, const std::string& scriptEngine,
58  const std::string& commentBlock = "");
59 
61  virtual void view(const std::string&);
62 
64  virtual void closeEditorFor(const std::string&);
65 
67  virtual bool alreadyEditing(const std::string& id) const;
68 
71  virtual void editExternalScript(const std::string& filename);
72 
74  boost::signal<void (const std::string&, const std::string&)> signal_scriptModified;
75 
76  boost::signal<void (const std::string&)> signal_editingComplete;
77 
78  protected:
80  virtual void receivedScript(DtSimMessage*);
81 
83  virtual void slot_aboutToClearScriptedTasks();
84  virtual void slot_scriptedTaskAboutToBeRemoved(std::string scriptId);
85 
87  virtual void editScript(const std::string& id, int sType, const std::string& script,
88  const std::string& scriptEngine = "lua", bool readOnly = false,
89  bool localOnly = false, bool scriptIsFilename = false,
90  const std::string& commentBlock = "");
91 
93  virtual void tick();
94 
97  virtual void checkNeedsUpdate(const std::string& filename);
98 
100  virtual void scriptBeingRemoved();
101 
103  virtual void slot_scriptedTaskAdded(std::string);
104 
106  virtual void editingComplete(QProcess*);
107 
111  virtual bool checkForScriptErrors(const DtScriptedTaskMetaData&) const;
112 
114  virtual std::string cleanUpError(const std::string&) const;
115 
116  protected slots:
117  virtual void editingComplete(int, QProcess::ExitStatus);
118  virtual void startupError(QProcess::ProcessError);
119 
120  protected:
122 
124  {
125  std::string scriptid;
126  bool viewOnly;
127  bool localOnly;
129  std::string commentBlock;
131  };
132 
133  std::map<DtU32, PendingRequest> myPendingRequests;
134 
135  struct FileInfo
136  {
137  QProcess* editingProcess;
138  QDateTime lastModified;
139  std::string scriptId;
140  bool readOnly;
141  bool localOnly;
144  std::string scriptEditor;
145  int retries;
147  };
148 
149  typedef std::map<std::string, FileInfo> FileInfoMap;
151 
153 
154  DtFilename myTempDirectory;
155  };
156 }

Document ID: Generated on Thu Mar 23 18:54:12 EDT 2017 from SVN revision 174804
Copyright © 2005-2017 VT MÄK. All Rights Reserved (www.mak.com)