00001
00002
00003
00004
00005
00006
00007 #include <QtGui/QApplication>
00008 #include <QMessageBox>
00009
00010
00011 #include <stdio.h>
00012 #include <fcntl.h>
00013 #include <io.h>
00014 #include <iostream>
00015 #include <fstream>
00016
00017
00018 #include "Definitions.h"
00019 #include "Memory/mmgr.h"
00020
00021
00022 #include "QTUI/vstudio.h"
00023
00024
00025
00026
00027
00028 #define USE_CONSOLE 0
00029
00030
00031
00032
00033
00034 int main(int argc, char *argv[])
00035 {
00036
00037 if(USE_CONSOLE)
00038 {
00039
00040 bool tf = AllocConsole();
00041
00042
00043 int hConHandle;
00044 long lStdHandle;
00045
00046 lStdHandle = (long)GetStdHandle(STD_OUTPUT_HANDLE);
00047 hConHandle = _open_osfhandle(lStdHandle, _O_TEXT);
00048
00049 FILE *fp = _fdopen( hConHandle, "w" );
00050 *stdout = *fp;
00051 setvbuf( stdout, NULL, _IONBF, 0 );
00052 }
00053
00054
00055 QApplication::setApplicationName("VStudio");
00056 QApplication app(argc, argv);
00057
00058
00059 VStudio mainWgt;
00060
00061
00062 CreateResult result = mainWgt.Create();
00063
00064
00065 if(result == CREATE_SUCCESS)
00066 {
00067 mainWgt.showMaximized();
00068 }
00069 else
00070 {
00071 std::string msg = "";
00072 CreateMessages *msgs = mainWgt.GetCreateMessages();
00073 CreateMessagesIt it = msgs->begin();
00074
00075 switch(result){
00076
00077 case CREATE_WARNING:
00078 {
00079 msg = "The Following Warnings occured while setting up the Application:\n\n";
00080
00081 for( it = msgs->begin() ; it != msgs->end() ; it++ )
00082 {
00083 msg += "Warning: " + ((*it).second + "\n");
00084 }
00085
00086 if(QMessageBox::Abort == QMessageBox::warning(0,"VStudio",msg.c_str(),QMessageBox::Ok,QMessageBox::Abort))
00087 {
00088 app.quit();
00089 return 0;
00090 }
00091
00092 break;
00093 }
00094
00095 case CREATE_ERROR:
00096 {
00097 msg = "The following Errors occured, The Application cannot start:\n\n";
00098
00099 for( it = msgs->begin() ; it != msgs->end() ; it++ )
00100 {
00101 if((*it).first == CREATE_ERROR)
00102 {
00103 msg += "Error: " + ((*it).second + "\n");
00104 }
00105 }
00106
00107 QMessageBox::critical(0,"VStudio",msg.c_str());
00108 app.quit();
00109 return 0;
00110 }
00111 }
00112 }
00113
00114
00115 app.connect(&app, SIGNAL(lastWindowClosed()), &app, SLOT(quit()));
00116
00117
00118 return app.exec();
00119 }