Aquila  2.0 prealpha
Cognitive Robotics Architecture
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
gui.h
Go to the documentation of this file.
1 //##############################################################################################################################################################################################################//
2 //Aquila - An Open-Source GPU-Accelerated Toolkit for Cognitive and Neuro-Robotics Research //
3 // //
4 //Copyright (c) <2012>, <Martin Peniak - www.martinpeniak.com> //
5 //All rights reserved. //
6 // //
7 //Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: //
8 // //
9 // - Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. //
10 // - Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. //
11 // //
12 //THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR //
13 //A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT //
14 //LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR //
15 //TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. //
16 // //
17 //The views and conclusions contained in the software and documentation are those of the authors and should not be interpreted //
18 //as representing official policies,either expressed or implied, of the FreeBSD Project. //
19 //##############################################################################################################################################################################################################//
20 
21 #ifndef GUI_H
22 #define GUI_H
23 
24 #include "mainWindow.h"
25 #include "ui_mainWindow.h"
26 
27 class Interface;
28 class Settings;
29 
31 class GUI : public QWidget
32 {
33  Q_OBJECT
34 
35 public:
36  GUI(MainWindow *pMainWindow, QString binaryName, QString moduleTitle, QString serverName, int instanceID, int tabID=-1);
37  ~GUI();
38 
39  QString binary;
40  QString title;
41  QString server;
42 
43  int instance;
44 
45 private:
46  QProcess *module;
47 
48  bool startModule(QString binaryName, QString serverName, int instanceID);
49  bool timeoutConnectTo(QString binaryName, QString portName, int instanceID);
50 
51 protected:
55 
56  QSignalMapper *deviceSignalMapper;
57  QMenu *fileMenu;
58  QMenu *editMenu;
59  QMenu *helpMenu;
60  QMenu *deviceSubMenu;
61  QMenu *moduleMenu;
62  QAction *startAction;
63  QAction *stopAction;
64  QAction *settingsAct;
66  QAction *abortAct;
67  QAction *quitAct;
68  QAction *aboutAct[2];
69  QString tag;
70 
71 #ifdef NTDDI_WIN7
72  int win7ProgressBarId;
73 #endif
74 
75  int progress;
76  int status;
77  bool selected;
78  bool running;
79  bool remoteMode;
82 
83  void createStartAction(QMenu* menu, QString actionName, QString statusTip, QString shortcut);
84  void createStopAction(QMenu* menu, QString actionName, QString statusTip, QString shortcut);
85 
86 private slots:
87  void initialise(MainWindow *pMainWindow, QString binaryName, QString moduleTitle, QString serverName, int instanceID, int tabID);
88  void remove(int tabID);
89  void duplicate(int tabID);
90  void closeModule();
91 
92 public slots:
93  void setGpu(int deviceID);
94  void setGpuList(QStringList gpuList);
95 
96 protected slots:
97  virtual void about();
98  virtual void show();
99  virtual void checkFocus(int tabID);
100  virtual void statusChanged(int newStatus);
101  virtual void createMenu();
102  virtual void createFileMenu();
103  virtual void createEditMenu();
104  virtual void createHelpMenu();
105  virtual void createModuleMenu();
106  virtual void createDeviceSubmenu();
107  virtual void updateGUI();
108  virtual void updateProgressBarClients();
109  virtual void updateProgressBar(int currentProgress);
110 
111 signals:
112  void tabSelected();
113  void tabDeselected();
114  void stateReceived(int newState);
115  void abortRequested();
116 };
117 
118 #endif//GUI_H