/home/ann2.ext/paccaulf/projsem2/ContourActif/interface.cpp

Aller à la documentation de ce fichier.
00001 #include "interface.h"
00002 #include <qlayout.h>
00003 #include <qaction.h>
00004 #include <qmenubar.h>
00005 #include <q3popupmenu.h>
00006 #include <q3filedialog.h>
00007 #include <qmessagebox.h>
00008 //Added by qt3to4:
00009 #include <Q3HBoxLayout>
00010 #include <QFileDialog>
00011 
00012 //using namespace qglviewer;
00013 
00014 static const char* const image0_data[] = { 
00015 // "Save" icon
00016 "22 22 5 1",
00017 ". c None",
00018 "# c #000000",
00019 "a c #838100",
00020 "b c #c5c2c5",
00021 "c c #cdb6d5",
00022 "......................",
00023 ".####################.",
00024 ".#aa#bbbbbbbbbbbb#bb#.",
00025 ".#aa#bbbbbbbbbbbb#bb#.",
00026 ".#aa#bbbbbbbbbcbb####.",
00027 ".#aa#bbbccbbbbbbb#aa#.",
00028 ".#aa#bbbccbbbbbbb#aa#.",
00029 ".#aa#bbbbbbbbbbbb#aa#.",
00030 ".#aa#bbbbbbbbbbbb#aa#.",
00031 ".#aa#bbbbbbbbbbbb#aa#.",
00032 ".#aa#bbbbbbbbbbbb#aa#.",
00033 ".#aaa############aaa#.",
00034 ".#aaaaaaaaaaaaaaaaaa#.",
00035 ".#aaaaaaaaaaaaaaaaaa#.",
00036 ".#aaa#############aa#.",
00037 ".#aaa#########bbb#aa#.",
00038 ".#aaa#########bbb#aa#.",
00039 ".#aaa#########bbb#aa#.",
00040 ".#aaa#########bbb#aa#.",
00041 ".#aaa#########bbb#aa#.",
00042 "..##################..",
00043 "......................"};
00044 
00045 
00046 static const char* const image1_data[] = { 
00047 // "Open" icon
00048 "22 22 5 1",
00049 ". c None",
00050 "# c #000000",
00051 "c c #848200",
00052 "a c #ffff00",
00053 "b c #ffffff",
00054 "......................",
00055 "......................",
00056 "......................",
00057 "............####....#.",
00058 "...........#....##.##.",
00059 "..................###.",
00060 ".................####.",
00061 ".####...........#####.",
00062 "#abab##########.......",
00063 "#babababababab#.......",
00064 "#ababababababa#.......",
00065 "#babababababab#.......",
00066 "#ababab###############",
00067 "#babab##cccccccccccc##",
00068 "#abab##cccccccccccc##.",
00069 "#bab##cccccccccccc##..",
00070 "#ab##cccccccccccc##...",
00071 "#b##cccccccccccc##....",
00072 "###cccccccccccc##.....",
00073 "##cccccccccccc##......",
00074 "###############.......",
00075 "......................"};
00076 
00077 static const char* const image2_data[] = { 
00078 //"Undo" icon
00079 "22 22 3 1",
00080 ". c None",
00081 "# c #000084",
00082 "a c #848284",
00083 "......................",
00084 "......................",
00085 "......................",
00086 "......................",
00087 "......................",
00088 "...........######a....",
00089 "..#......##########...",
00090 "..##...####......##a..",
00091 "..###.###.........##..",
00092 "..######..........##..",
00093 "..#####...........##..",
00094 "..######..........##..",
00095 "..#######.........##..",
00096 "..########.......##a..",
00097 "...............a###...",
00098 "...............###....",
00099 "......................",
00100 "......................",
00101 "......................",
00102 "......................",
00103 "......................",
00104 "......................"};
00105 
00106 static const char* const image3_data[] = { 
00107 // "Redo" icon
00108 "22 22 3 1",
00109 ". c None",
00110 "a c #000084",
00111 "# c #848284",
00112 "......................",
00113 "......................",
00114 "......................",
00115 "......................",
00116 "......................",
00117 "....#aaaaaa...........",
00118 "...aaaaaaaaaa......a..",
00119 "..#aa......aaaa...aa..",
00120 "..aa.........aaa.aaa..",
00121 "..aa..........aaaaaa..",
00122 "..aa...........aaaaa..",
00123 "..aa..........aaaaaa..",
00124 "..aa.........aaaaaaa..",
00125 "..#aa.......aaaaaaaa..",
00126 "...aaa#...............",
00127 "....aaa...............",
00128 "......................",
00129 "......................",
00130 "......................",
00131 "......................",
00132 "......................",
00133 "......................"};
00134 
00135 static const char* const image4_data[] = { 
00136 // "Cut" icon
00137 "22 22 3 1",
00138 ". c None",
00139 "# c #000000",
00140 "a c #000082",
00141 "......................",
00142 ".......#.....#........",
00143 ".......#.....#........",
00144 ".......#.....#........",
00145 ".......#....##........",
00146 ".......##...#.........",
00147 "........#...#.........",
00148 "........##.##.........",
00149 ".........###..........",
00150 ".........###..........",
00151 "..........#...........",
00152 ".........a#a..........",
00153 "........aa.aaa........",
00154 ".......a.a.a..a.......",
00155 "......a..a.a...a......",
00156 ".....a...a.a....a.....",
00157 "....a....a.a....a.....",
00158 "....a....a..a...a.....",
00159 "....a....a..a..a......",
00160 "....a...a....aa.......",
00161 ".....aaa..............",
00162 "......................"};
00163 
00164 static const char* const image5_data[] = { 
00165 // "Copy" icon
00166 "22 22 6 1",
00167 ". c None",
00168 "# c #000000",
00169 "b c #000082",
00170 "c c #3c3cfd",
00171 "d c #8b8bfd",
00172 "a c #ffffff",
00173 "......................",
00174 "......................",
00175 "########..............",
00176 "#aaaaaa##.............",
00177 "#a####a#a#............",
00178 "#aaaaaa#aa#...........",
00179 "#a####a#bbbbbbbb......",
00180 "#aaaaaa#baaaaaabb.....",
00181 "#a#####aba####abcb....",
00182 "#aaaaaaabaaaaaabdcb...",
00183 "#a#####aba####abadcb..",
00184 "#aaaaaaabaaaaaabbbbbb.",
00185 "#a#####aba####aaaaaab.",
00186 "#aaaaaaabaaaaaaaaaaab.",
00187 "#a#####aba#########ab.",
00188 "#aaaaaaabaaaaaaaaaaab.",
00189 "########ba#########ab.",
00190 "........baaaaaaaaaaab.",
00191 "........ba#########ab.",
00192 "........baaaaaaaaaaab.",
00193 "........bbbbbbbbbbbbb.",
00194 "......................"};
00195 
00196 static const char* const image6_data[] = { 
00197 // "Paste" icon
00198 "22 22 8 1",
00199 ". c None",
00200 "# c #000000",
00201 "e c #000084",
00202 "c c #848200",
00203 "b c #848284",
00204 "d c #c6c3c6",
00205 "a c #ffff00",
00206 "f c #ffffff",
00207 "......................",
00208 ".......#####..........",
00209 "..######aaa######.....",
00210 ".######aaaaa######....",
00211 "##bcb##a###a##bcb##...",
00212 "#bcb#ddddddddd#bcb#...",
00213 "#cbc#ddddddddd#cbc#...",
00214 "#bcb###########bcb#...",
00215 "#cbcbcbcbcbcbcbcbc#...",
00216 "#bcbcbcbcbcbcbcbcb#...",
00217 "#cbcbcbceeeeeeeeee#...",
00218 "#bcbcbcbefffffffefe...",
00219 "#cbcbcbcefeeeeefeffe..",
00220 "#bcbcbcbefffffffefffe.",
00221 "#cbcbcbcefeeeeefeffffe",
00222 "#bcbcbcbefffffffeeeeee",
00223 "#cbcbcbcefeeeeeffffffe",
00224 "#bcbcbcbeffffffffffffe",
00225 "#cbcbcbcefeeeeeeeeeefe",
00226 ".#######effffffffffffe",
00227 "........eeeeeeeeeeeeee",
00228 "......................"};
00229 
00230 static const char* const image7_data[] = { 
00231 // "What is... ?" icon
00232 "22 22 106 2",
00233 "Qt c None",
00234 "#N c #212121",
00235 "#J c #292929",
00236 "#K c #393939",
00237 "#M c #424242",
00238 ".m c #5a5a5a",
00239 "#r c #5a736b",
00240 "#A c #5a9c84",
00241 "#B c #636363",
00242 ".N c #636b6b",
00243 "#G c #63736b",
00244 "#v c #63ad8c",
00245 "#H c #6b6b6b",
00246 ".c c #6b7373",
00247 "#D c #6b7b73",
00248 ".l c #6b7b7b",
00249 ".W c #6b847b",
00250 ".t c #6b8c7b",
00251 "#x c #6b9484",
00252 "#w c #6bad94",
00253 ".u c #737373",
00254 ".v c #737b73",
00255 ".g c #737b7b",
00256 ".D c #738c84",
00257 ".7 c #739484",
00258 "#d c #73948c",
00259 "#z c #73a59c",
00260 "#p c #73b594",
00261 "#o c #73bd9c",
00262 ".b c #7b7b7b",
00263 ".O c #7b8484",
00264 "#a c #7bad94",
00265 "#q c #7bad9c",
00266 "#i c #7bb59c",
00267 ".5 c #7bbd9c",
00268 "#b c #7bbda5",
00269 "#h c #7bc69c",
00270 "#y c #7bc6a5",
00271 ".8 c #848484",
00272 ".4 c #8484b5",
00273 ".h c #849c94",
00274 "#n c #84a5ad",
00275 ".V c #84ada5",
00276 "#E c #84b59c",
00277 "#F c #84b5a5",
00278 "#j c #84bda5",
00279 "#t c #84c6a5",
00280 "#l c #84cead",
00281 ".E c #8c8c8c",
00282 "#g c #8c8cbd",
00283 "## c #8c94b5",
00284 "#m c #8cadbd",
00285 "#c c #8cb5a5",
00286 ".L c #8cc6ad",
00287 ".T c #8ccead",
00288 "#f c #8cceb5",
00289 ".a c #949494",
00290 ".n c #94a59c",
00291 "#u c #94a5ce",
00292 ".k c #94bdad",
00293 ".M c #94c6ad",
00294 ".6 c #94c6b5",
00295 ".B c #94ceb5",
00296 ".1 c #94d6b5",
00297 ".C c #94d6bd",
00298 ".9 c #94debd",
00299 ".K c #9c94d6",
00300 ".d c #9c9c9c",
00301 ".w c #9cbdb5",
00302 "#. c #9cbdd6",
00303 "#s c #9ccebd",
00304 ".2 c #9ccece",
00305 ".0 c #9cdebd",
00306 ".S c #9ce7bd",
00307 ".Z c #9ce7c6",
00308 ".U c #a594de",
00309 "#L c #a5a5a5",
00310 ".A c #a5b5de",
00311 ".3 c #a5b5ef",
00312 ".I c #a5cece",
00313 "#k c #a5dec6",
00314 ".s c #a5e7c6",
00315 ".f c #adadad",
00316 ".J c #adadef",
00317 ".R c #adb5de",
00318 ".i c #adcec6",
00319 ".P c #add6c6",
00320 ".j c #addece",
00321 "#e c #ade7ce",
00322 ".# c #b5b5b5",
00323 ".H c #b5bdde",
00324 ".Q c #b5dede",
00325 ".r c #b5efd6",
00326 ".e c #bdbdbd",
00327 ".z c #bdc6f7",
00328 ".y c #bdd6ff",
00329 ".X c #bde7d6",
00330 ".q c #bdefde",
00331 ".Y c #bdf7de",
00332 "#I c #c6c6c6",
00333 ".x c #c6def7",
00334 ".p c #c6f7e7",
00335 "#C c #ced6ce",
00336 ".G c #cedeff",
00337 ".o c #ceffef",
00338 ".F c #d6fff7",
00339 "QtQtQtQtQtQtQtQtQtQtQtQtQtQtQtQtQtQtQtQtQtQt",
00340 "QtQtQtQtQtQtQtQtQtQtQtQtQtQtQtQtQtQtQtQtQtQt",
00341 "QtQtQt.#.a.b.c.c.b.d.eQtQtQtQtQtQtQtQtQtQtQt",
00342 "QtQt.f.g.h.i.j.j.k.l.b.#QtQtQtQtQtQtQtQtQtQt",
00343 "Qt.f.m.n.o.o.p.q.r.s.t.u.eQtQtQtQtQtQtQtQtQt",
00344 ".e.v.w.q.p.x.y.z.A.B.C.D.EQtQtQtQtQtQtQtQtQt",
00345 ".d.h.F.q.G.H.I.I.J.K.L.M.N.#QtQtQtQtQtQtQtQt",
00346 ".O.P.o.Q.R.B.S.T.A.U.V.B.W.dQtQtQtQtQtQtQtQt",
00347 ".g.X.Y.Z.Z.0.1.2.3.4.5.6.7.8QtQtQtQtQtQtQtQt",
00348 ".g.j.r.0.9.1#..3###a#b#c#d.8QtQtQtQtQtQtQtQt",
00349 ".v.P#e.1.1#f.A#g.5#h#i#j.W.EQtQtQtQtQtQtQtQt",
00350 ".E#c#k#f.L#l#m#n#o#p#p#q#r.fQtQtQtQtQtQtQtQt",
00351 ".f.g#s#t#t#b#u.4#v#w#w#x.u.eQtQtQtQtQtQtQtQt",
00352 "Qt.E.t#y#b.5#z#d#p#A#A#B.d#C.f.eQtQtQtQtQtQt",
00353 "Qt.e.b#D#E#F#j#i#a.7.m.dQt.f#B.m.fQtQtQtQtQt",
00354 "QtQt.e.E.N#D.W.W#G#H.fQtQt#I.b#J#K.E.eQtQtQt",
00355 "QtQtQtQt.#.d.E.a#L#IQtQtQtQtQt#L#M#J#H.fQtQt",
00356 "QtQtQtQtQtQtQtQtQtQtQtQtQtQtQtQt.e.u#N#K.aQt",
00357 "QtQtQtQtQtQtQtQtQtQtQtQtQtQtQtQtQtQt.d#K#N#H",
00358 "QtQtQtQtQtQtQtQtQtQtQtQtQtQtQtQtQtQtQt.##B.m",
00359 "QtQtQtQtQtQtQtQtQtQtQtQtQtQtQtQtQtQtQtQtQtQt",
00360 "QtQtQtQtQtQtQtQtQtQtQtQtQtQtQtQtQtQtQtQtQtQt"};
00361 
00362 static const char* const image8_data[] = { 
00363 // "Exit" icon
00364 "32 32 10 1",
00365 ". c None",
00366 "e c None",
00367 "f c None",
00368 "h c None",
00369 "b c #000000",
00370 "a c #000000",
00371 "# c #000000",
00372 "c c #737573",
00373 "d c #7b757b",
00374 "g c #7b797b",
00375 "................................",
00376 "................................",
00377 "................................",
00378 "...............###..............",
00379 "...............###.a............",
00380 "...........b...###..............",
00381 ".........#.....###.....#........",
00382 "........###....###....###.......",
00383 ".......#####...###...#####......",
00384 "......c####d...###...d####c.....",
00385 "......#####....###....#####.....",
00386 ".....#####..e..###....e#####....",
00387 ".....####......###......####....",
00388 "....c####......###......####c...",
00389 "....####.......###.......####...",
00390 "....####.......###.......####f..",
00391 "....####.......###.......####...",
00392 "....####.......###.......####...",
00393 "....####.......###.......####...",
00394 "....c####......###......####c...",
00395 ".....####...............####....",
00396 ".....#####.............#####.f..",
00397 "......#####...........#####.....",
00398 "......c#####.........#####c.....",
00399 ".......#######g...g#######......",
00400 ".......f#################..f....",
00401 ".........c#############d........",
00402 "...........###########..........",
00403 "..........h..d#####c....h.......",
00404 "................................",
00405 "..............h.....h...........",
00406 "................................"};
00407 
00408 /*
00409  *  Constructs a interface as a child of 'parent', with the
00410  *  name 'name' and widget flags set to 'f'.
00411  *
00412  */
00413 interface::interface( QWidget* parent, const char* name, Qt::WFlags fl )
00414     : Q3MainWindow( parent, name, fl ),
00415       image0( (const char **) image0_data ),
00416       image1( (const char **) image1_data ),
00417       image2( (const char **) image2_data ),
00418       image3( (const char **) image3_data ),
00419       image4( (const char **) image4_data ),
00420       image5( (const char **) image5_data ),
00421       image6( (const char **) image6_data ),
00422       image7( (const char **) image7_data ),
00423       image8( (const char **) image8_data )
00424 {
00425     viewer = new Viewer(this, "viewer");
00426     viewer->setGeometry( QRect( 10, 10, 600, 595 ) );
00427 
00428     (void)statusBar();
00429     if ( !name )
00430         setName( "Interface projets image" );
00431     setCentralWidget( new QWidget( this, "qt_central_widget" ) );
00432     Form1Layout = new Q3HBoxLayout( centralWidget(), 11, 6, "Form1Layout"); 
00433 
00434     viewer = new Viewer( centralWidget(), "viewer" );
00435     Form1Layout->addWidget( viewer );
00436 
00437     // actions
00438     fileOpenAction = new QAction( this, "fileOpenAction" );
00439     fileOpenAction->setIconSet( QIcon( image1 ) );
00440     fileSave_scene_asAction = new QAction( this, "fileSave_scene_asAction" );
00441     fileSave_scene_asAction->setIconSet( QIcon( image0 ) );
00442     fileExitAction = new QAction( this, "fileExitAction" );
00443     fileExitAction->setIconSet( QIcon( image8 ) );
00444     displayRepAction = new QAction( this, "displayRepAction" );
00445     displayEdgesAction = new QAction( this, "displayEdgesAction" );
00446     displaySmoothAction = new QAction( this, "displaySmoothAction" );
00447     displayInvertNormalsAction = new QAction( this, "displayInvertNormalsAction" );
00448     displayWorld_axisAction = new QAction( this, "displayWorld_axisAction" );
00449     displayXy_gridAction = new QAction( this, "displayXy_gridAction" );
00450     displayFull_screenAction = new QAction( this, "displayFull_screenAction" );
00451     displaySnapshotAction = new QAction( this, "displaySnapshotAction" );
00452     helpContentsAction = new QAction( this, "helpContentsAction" );
00453     helpAboutAction = new QAction( this, "helpAboutAction" );
00454     computeAction = new QAction( this, "computeAction" );
00455         switch2d3dAction = new QAction( this, "switch2d3dAction" );
00456     
00457     // menubar
00458     menubar = new QMenuBar( this, "menubar" );
00459 
00460     fileMenu = new Q3PopupMenu( this );
00461     fileOpenAction->addTo( fileMenu );
00462     fileSave_scene_asAction->addTo( fileMenu );
00463     fileMenu->insertSeparator();
00464     fileExitAction->addTo( fileMenu );
00465     menubar->insertItem( QString(""), fileMenu, 1 );
00466 
00467     displayMenu = new Q3PopupMenu( this );
00468     displayRepAction->addTo( displayMenu );
00469     displayEdgesAction->addTo( displayMenu );
00470     displaySmoothAction->addTo( displayMenu );
00471     displayInvertNormalsAction->addTo( displayMenu );
00472     displayMenu->insertSeparator();
00473     displayWorld_axisAction->addTo( displayMenu );
00474     displayXy_gridAction->addTo( displayMenu );
00475     displayMenu->insertSeparator();
00476     displayFull_screenAction->addTo( displayMenu );
00477     displaySnapshotAction->addTo( displayMenu );
00478     menubar->insertItem( QString(""), displayMenu, 2 );
00479 
00480     helpMenu = new Q3PopupMenu( this );
00481     helpContentsAction->addTo( helpMenu );
00482     helpAboutAction->addTo( helpMenu );
00483     menubar->insertItem( QString(""), helpMenu, 3 );
00484     
00485     computeMenu = new Q3PopupMenu( this );
00486     computeAction->addTo( computeMenu );
00487     switch2d3dAction->addTo( computeMenu );
00488     menubar->insertItem( QString(""), computeMenu, 4 );
00489 
00490     languageChange();
00491     resize( QSize(800, 600).expandedTo(minimumSizeHint()) );
00492 
00493 
00494     // signals and slots connections
00495     connect( fileOpenAction, SIGNAL( activated() ), this, SLOT( fileOpen() ) );
00496     connect( fileSave_scene_asAction, SIGNAL( activated() ), this, SLOT( fileSave() ) );
00497     connect( fileExitAction, SIGNAL( activated() ), this, SLOT( close() ) );
00498     connect( displayRepAction, SIGNAL( activated() ), this, SLOT( toggleDisplayRep() ) );
00499     connect( displayEdgesAction, SIGNAL( activated() ), this, SLOT( toggleDrawEdges() ) );
00500     connect( displaySmoothAction, SIGNAL( activated() ), this, SLOT( toggleSmoothShading() ) );
00501     connect( displayInvertNormalsAction, SIGNAL( activated() ), this, SLOT( toggleInvertNormals() ) );
00502     connect( displayWorld_axisAction, SIGNAL( activated() ), viewer, SLOT( toggleDrawAxis() ) );
00503     connect( displayXy_gridAction, SIGNAL( activated() ), viewer, SLOT( toggleDrawGrid() ) );
00504     connect( displayFull_screenAction, SIGNAL( activated() ), viewer, SLOT( toggleFullScreen() ) );
00505     connect( displaySnapshotAction, SIGNAL( activated() ), viewer, SLOT( saveSnapshot() ) );
00506     connect( helpContentsAction, SIGNAL( activated() ), viewer, SLOT( help() ) );
00507     connect( helpAboutAction, SIGNAL( activated() ), viewer, SLOT( aboutQGLViewer() ) );
00508     connect( computeAction, SIGNAL( activated() ), this, SLOT( computeDetection() ) );
00509     connect( switch2d3dAction, SIGNAL( activated() ), this, SLOT( switch2d3d() ) );
00510    
00511     strcpy(current_filename,"");
00512 
00513 }
00514 
00515 /*
00516  *  Sets the strings of the subwidgets using the current
00517  *  language.
00518  */
00519 void interface::languageChange()
00520 {
00521     setCaption( tr( "Interface projets image" ) );
00522     fileOpenAction->setText( tr( "Open" ) );
00523     fileOpenAction->setMenuText( tr( "Open..." ) );
00524     fileOpenAction->setAccel( QKeySequence( tr( "Ctrl+O" ) ) );
00525     fileSave_scene_asAction->setText( tr( "Save scene as" ) );
00526     fileSave_scene_asAction->setMenuText( tr( "Save scene as..." ) );
00527     fileSave_scene_asAction->setAccel( QKeySequence( tr( "Ctrl+S" ) ) );
00528     fileExitAction->setText( tr( "Exit" ) );
00529     fileExitAction->setMenuText( tr( "Exit" ) );
00530     fileExitAction->setAccel( QKeySequence( tr( "Esc" ) ) );
00531     displayRepAction->setText( tr( "Wireframe/points/surface" ) );
00532     displayRepAction->setMenuText( tr( "Wireframe/points/surface" ) );
00533     displayRepAction->setAccel( QKeySequence( tr( "R" ) ) );
00534     displayEdgesAction->setText( tr( "Edges" ) );
00535     displayEdgesAction->setMenuText( tr( "Edges" ) );
00536     displayEdgesAction->setAccel( QKeySequence( tr( "E" ) ) );
00537     displaySmoothAction->setText( tr( "Smooth shading" ) );
00538     displaySmoothAction->setMenuText( tr( "Smooth shading" ) );
00539     displaySmoothAction->setAccel( QKeySequence( tr( "X" ) ) );
00540     displayInvertNormalsAction->setText( tr( "Invert normals" ) );
00541     displayInvertNormalsAction->setMenuText( tr( "Invert Normals" ) );
00542     displayInvertNormalsAction->setAccel( QKeySequence( tr( "N" ) ) );
00543     displayWorld_axisAction->setText( tr( "World axis" ) );
00544     displayWorld_axisAction->setMenuText( tr( "World axis" ) );
00545     displayWorld_axisAction->setAccel( QKeySequence( tr( "A" ) ) );
00546     displayXy_gridAction->setText( tr( "XY grid" ) );
00547     displayXy_gridAction->setMenuText( tr( "XY grid" ) );
00548     displayXy_gridAction->setAccel( QKeySequence( tr( "G" ) ) );
00549     displayFull_screenAction->setText( tr( "Full screen" ) );
00550     displayFull_screenAction->setMenuText( tr( "Full screen" ) );
00551     displayFull_screenAction->setAccel( QKeySequence( tr( "Alt+Return" ) ) );
00552     displaySnapshotAction->setText( tr( "Snapshot" ) );
00553     displaySnapshotAction->setMenuText( tr( "Snapshot" ) );
00554     displaySnapshotAction->setAccel( QKeySequence( tr( "Return" ) ) );
00555     helpContentsAction->setText( tr( "Contents" ) );
00556     helpContentsAction->setMenuText( tr( "Contents..." ) );
00557     helpContentsAction->setAccel( QKeySequence( tr( "H" ) ) );
00558     helpAboutAction->setText( tr( "About" ) );
00559     helpAboutAction->setMenuText( tr( "About..." ) );
00560     computeAction->setText( tr( "Start Detection Process" ) );
00561     computeAction->setMenuText( tr( "Start Detection Process" ) );
00562     computeAction->setAccel( QKeySequence( tr( "Ctrl+C" ) ) );
00563     switch2d3dAction->setText( tr( "Switch Mesh/Local Region View" ) );
00564     switch2d3dAction->setMenuText( tr( "Switch Mesh/Local Region View" ) );
00565     switch2d3dAction->setAccel( QKeySequence( tr( "L" ) ) );
00566     
00567 //    if (menubar->findItem(1))
00568 //        menubar->findItem(1)->setText( tr( "File" ) );
00569 //    if (menubar->findItem(2))
00570 //        menubar->findItem(2)->setText( tr( "Display" ) );
00571 //    if (menubar->findItem(3))
00572 //        menubar->findItem(3)->setText( tr( "Help" ) );
00573 }
00574 
00575 void interface::fileOpen()
00576 {
00577     Q3FileDialog* fd = new Q3FileDialog( this, "file dialog", TRUE );
00578     const QString path= "/home/ann2.ext/paccaulf/projsem2/Data"; 
00579     // A COMPLETER : entrez ici le chemin d'accès
00580     // au répertoire où vous stockez vos données
00581 
00582     fd->setDir(path);
00583     fd->setMode( Q3FileDialog::ExistingFile);
00584     fd->setFilter( "Mesh (*.off)" );
00585 
00586     QString fileName;
00587     if ( fd->exec() == QDialog::Accepted )
00588         {
00589         fileName = fd->selectedFile();
00590         viewer->changeMesh((const char*) fileName);
00591         QFileInfo fi( fileName);
00592         }
00593     setCaption( tr( fileName ) );
00594   
00595     strcpy(current_filename,fileName);  
00596 };
00597 
00598 void interface::fileSave()
00599 {
00600         // Pop up the standard modal file browser dialog.
00601         QString filename = QFileDialog::getSaveFileName (
00602           this, // dialog's parent
00603           "Save file as...",
00604           "./", // pre-set working directory = current directory
00605           "Mesh (*.off)" 
00606         );
00607 
00608         // Bail if the user cancels or doesn't enter a file name.
00609         if (filename.isEmpty())
00610         {
00611                 return;
00612         }
00613         
00614         // Try to open the file for writing.    
00615         QFile outfile (filename);
00616         if (!outfile.open (QIODevice::WriteOnly))
00617         {
00618                 QMessageBox::information (this, "File open error",
00619                   "Could not open the file " + filename + " for writing."
00620                 );
00621                 return;
00622         }
00623 
00624         viewer->saveMesh(filename);
00625         strcpy(current_filename,filename);
00626         
00627 }
00628 
00629 void interface::toggleDrawEdges()
00630 {
00631         viewer->toggleDrawEdges();
00632 };
00633 
00634 void interface::toggleInvertNormals()
00635 {
00636         viewer->toggleInvertNormals();
00637 };
00638 
00639 void interface::toggleDisplayRep()
00640 {
00641         viewer->toggleDisplayRep();
00642 };
00643 
00644 void interface::toggleSmoothShading()
00645 {
00646         viewer->toggleSmoothShading();
00647 };
00648   
00649 void interface::computeDetection()
00650 {
00651         viewer->computeDetection();
00652 };
00653   
00654 void interface::switch2d3d()
00655 {
00656         viewer->switch2d3d();
00657 };
00658 
00659 

Généré le Thu Jun 15 18:48:51 2006 pour Projet Image 2006 - Vincent Vidal, Florent Paccault - par  doxygen 1.4.7