tilde~
Puredata Qt-based GUI
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
ApplicationController.h
Go to the documentation of this file.
1 // (c) 2017 Alex Nadzharov
2 // License: GPL3
3 
4 #ifndef APPLICATIONCONTROLLER
5 #define APPLICATIONCONTROLLER
6 
7 //#include "pdServer.hpp"
8 
11 
12 #include "recentfiles.h"
13 
14 #include <QAction>
15 
16 #ifdef WITH_PYTHON
17 #include "python/PythonQtScriptingConsole.h"
18 #include "scriptrunner.h"
19 #else
20 namespace tilde {
21 class PythonQtScriptingConsole;
22 }
23 #endif
24 
25 #include <QApplication>
26 
27 using namespace xpd;
28 
29 using namespace std;
30 
31 namespace tilde {
32 
33 class PdWindow;
34 class PatchWindow;
35 class UIObject;
36 class ServerWorker;
37 //class PdWindowConsoleObserver;
38 class RecentFiles;
39 class FilePaths;
40 
44 class ApplicationController : public QObject {
45  Q_OBJECT
46 
47 private:
48  PdLocalServer* _localServer;
49 
50  QThread* _serverThread;
51 
52  PdWindow* _pdWindow;
53  PythonQtScriptingConsole* _pythonConsole;
54 
55  PdWindowConsoleObserverPtr _consoleObserver;
56 
57  int _newFilenameCounter;
58 
59  RecentFiles* _recentFiles;
60  QMenu* _recentMenu;
61 
62  FilePaths* _filePaths;
63 
64  void loadAllLibraries();
65 
66  static ProcessPtr _theServerInstance;
67 
68 #ifdef WITH_PYTHON
69  ScriptRunner* _scriptRunner;
70 #endif
71 
72 public:
74 
75  ProcessPtr mainServerInstance();
76 
77  Observer* controllerObserver();
78 
79  //ServerWorker* serverWorker() { return _serverWorker; };
80 
81  QString newFileName()
82  {
83  return QString("Untitled-" + QString::number(_newFilenameCounter++));
84  }
85 
86  void createRecentMenu();
87 
88  QMenu* recentMenu() { return _recentMenu; }
89 
90  FilePaths* filePaths() { return _filePaths; }
91 
92  static void post(QString text);
93 
94 #ifdef WITH_PYTHON
95  ScriptRunner* scriptRunner()
96  {
97  return _scriptRunner;
98  }
99 #endif
100 
101 signals:
102  void getLocalServer(ProcessPtr* ret);
103 
104 public slots:
105  void newPatchWindowController();
106  void openFileDialog();
107 
108  void pdWindow();
109  void pythonConsole();
110 
111  void preferencesWindow();
112  void audioSettingsWindow();
113 
114  void dspOn();
115  void dspOff();
116 
117  void openFile();
118 
119  void newScript();
120 
121  ObjectId slotCreateObject(CanvasPtr canvas, string name);
122 };
123 }
124 
125 #endif // CM_PDLINK_H
Pd console window.
Definition: PdWindow.h:26
QString newFileName()
Definition: ApplicationController.h:81
The Application Controller class.
Definition: ApplicationController.h:44
Definition: recentfiles.h:8
QMenu * recentMenu()
Definition: ApplicationController.h:88
minimal class to run python scripts (from menu)
Definition: scriptrunner.h:7
EXTERN void post(const char *fmt,...)
shared_ptr< PdWindowConsoleObserver > PdWindowConsoleObserverPtr
Definition: pdWindowConsoleObserver.h:34
Definition: filepaths.h:17
FilePaths * filePaths()
Definition: ApplicationController.h:90