Rev | Line | |
---|
[4] | 1 | #include <qapplication.h> |
---|
| 2 | #include "ProjectionModel.h" |
---|
| 3 | #include "RSync.h" |
---|
| 4 | #include "GUIControler.h" |
---|
| 5 | #include <stdlib.h> |
---|
| 6 | #include <GL/glut.h> |
---|
| 7 | |
---|
| 8 | using namespace projection; |
---|
| 9 | |
---|
| 10 | #if defined(UNIX) |
---|
| 11 | #define stricmp strcasecmp |
---|
| 12 | #endif // UNIX |
---|
| 13 | |
---|
| 14 | int main(int argc, char** argv) |
---|
| 15 | { |
---|
| 16 | glutInit (&argc, argv); |
---|
| 17 | |
---|
| 18 | QApplication app(argc,argv); |
---|
| 19 | |
---|
| 20 | //app.setStyle("windows"); |
---|
| 21 | //app.setStyle("plastique"); |
---|
| 22 | |
---|
| 23 | ProjectionModel model; |
---|
| 24 | |
---|
| 25 | bool bServer = true; |
---|
| 26 | QString address = model.getRSync()->getHostName(); |
---|
| 27 | int portNo = DEFAULT_PORT_NO; |
---|
| 28 | QString fileName; |
---|
| 29 | for (int i=1; i<argc; ++i) |
---|
| 30 | { |
---|
| 31 | if (_stricmp(argv[i], "-c") == 0 || _stricmp(argv[i], "-client") == 0) |
---|
| 32 | bServer = false; |
---|
| 33 | else if (_stricmp(argv[i], "-address") == 0 && i+1 < argc) |
---|
| 34 | address = argv[i+1]; |
---|
| 35 | else if ((_stricmp(argv[i], "-port") == 0 || _stricmp(argv[i], "-portno") == 0) && i+1 < argc) |
---|
| 36 | { |
---|
| 37 | portNo = atoi(argv[i+1]); |
---|
| 38 | i++; // <== Don't parse Portnumber again. |
---|
| 39 | } |
---|
| 40 | else |
---|
| 41 | fileName = argv[i]; |
---|
| 42 | } |
---|
| 43 | |
---|
| 44 | if (bServer) |
---|
| 45 | { |
---|
| 46 | model.initServer(portNo); |
---|
| 47 | if (!fileName.isEmpty()) |
---|
| 48 | model.getGUI()->loadFile(fileName); |
---|
| 49 | } |
---|
| 50 | else |
---|
| 51 | model.initClient(address, portNo); |
---|
| 52 | |
---|
| 53 | return app.exec(); |
---|
| 54 | } |
---|
Note: See
TracBrowser
for help on using the repository browser.