00001 #ifndef VSTUDIO_H 00002 #define VSTUDIO_H 00003 00004 /****************************************************************************\ 00005 * REQUIRED HEADERS * 00006 \****************************************************************************/ 00007 00008 //UICLASS 00009 #include "ui_vstudio.h" 00010 //QT 00011 #include <QtGui/QMainWindow> 00012 //OWN 00013 #include "Definitions.h" 00014 #include "Memory/mmgr.h" 00015 #include "Memory/TSmartPointer.h" 00016 #include "CConsole.h" 00017 #include "Volume.h" 00018 #include "CVolumeStatistics.h" 00019 00020 /****************************************************************************\ 00021 * DEFINITIONS * 00022 \****************************************************************************/ 00023 00024 class QSplashScreen; 00025 class CSettings; 00026 class VStudioRenderer; 00027 class CShaderEditor; 00028 class CProperties; 00029 00030 #define CREATE_SUCCESS 1 00031 #define CREATE_WARNING 2 00032 #define CREATE_ERROR 3 00033 00034 typedef byte CreateResult; 00035 typedef std::map<byte,std::string> CreateMessages; 00036 typedef std::map<byte,std::string>::iterator CreateMessagesIt; 00037 00038 /****************************************************************************\ 00039 * CLASS * 00040 \****************************************************************************/ 00041 class VStudio : public QMainWindow 00042 { 00043 Q_OBJECT 00044 00045 /**************************************************************************\ 00046 * PUBLIC CLASS FUNCTIONS * 00047 \**************************************************************************/ 00048 public: 00049 00050 VStudio(QWidget *parent = 0, Qt::WFlags flags = 0); 00051 ~VStudio(){Destroy();} 00052 00053 virtual CreateResult Create(); 00054 virtual CreateMessages * const GetCreateMessages(){return &mCreateMessages;} 00055 00056 virtual CConsole & GetConsole(){return *pConsole;} 00057 virtual VStudioRenderer & GetRenderer(){return *pRenderer;} 00058 virtual CShaderEditor & GetShaderEditor(){return *pShaderEditor;} 00059 virtual TSmartPointer<CVolume> GetVolume(){return pSceneVolume;} 00060 virtual TSmartPointer<CGLProgram> GetProgram(){return pSceneProgram;} 00061 00062 void VStudio::closeEvent(QCloseEvent *event); 00063 void VStudio::showEvent(QShowEvent *event); 00064 void VStudio::changeEvent(QEvent *event); 00065 00066 void SaveImage(QImage & img); 00067 00068 bool RenderMIP(bool tf); 00069 00070 public slots: 00071 00072 void LogStatusChange(int,bool tf); 00073 void MaximizeRenderer(); 00074 00075 /**************************************************************************\ 00076 * PROTECTED CLASS FUNCTIONS * 00077 \**************************************************************************/ 00078 protected: 00079 00080 /**************************************************************************\ 00081 * PRIVATE CLASS FUNCTIONS * 00082 \**************************************************************************/ 00083 private: 00084 00085 void insertCreateMessage(CreateResult cr,std::string msg){mCreateMessages.insert(std::make_pair(cr,msg));} 00086 00087 bool SetupUI(); 00088 bool CheckOpenGL(); 00089 bool SetupConnections(); 00090 00091 void LoadVolume(QString fileName); 00092 void SaveScene(QString fileName); 00093 void OpenScene(QString fileName); 00094 void AddRecent(QString fileName); 00095 bool AskSave(); 00096 void ResetScene(); 00097 void SaveApp(); 00098 00099 virtual void Destroy(); 00100 00101 private slots: 00102 00103 void on_actionOpen_Recent_triggered(); 00104 void on_actionOpen_triggered(); 00105 void on_actionSave_As_triggered(); 00106 void on_actionSave_triggered(); 00107 void on_actionApply_Fragment_Shader_triggered(); 00108 void on_actionApply_Vertex_Shader_triggered(); 00109 void on_actionExport_triggered(); 00110 void on_actionVolume_triggered(); 00111 void on_actionConsole_triggered(); 00112 void on_actionExit_triggered(); 00113 00114 /**************************************************************************\ 00115 * PRIVATE CLASS MEMBERS * 00116 \**************************************************************************/ 00117 private: 00118 00119 Ui::VStudioMainWin ui; 00120 00121 CreateMessages mCreateMessages; 00122 00123 QQueue<QAction *> recentActions; 00124 QString currentSceneFileName; 00125 bool askedforSave; 00126 00127 QSplashScreen *pSplash; 00128 00129 CSettings *pVStudioSettings; 00130 CConsole *pConsole; 00131 VStudioRenderer *pRenderer; 00132 CShaderEditor *pShaderEditor; 00133 CProperties *pProperties; 00134 00135 TSmartPointer<CVolume> pSceneVolume; 00136 TSmartPointer<CVolumeStatistics> pSceneVolumeStatistics; 00137 TSmartPointer<CGLProgram> pSceneProgram; 00138 TSmartPointer<CGLProgram> pMipProgram; 00139 }; 00140 00141 #endif // VSTUDIO_H