00001
00002
00003
00004
00005
00006
00007
00008
00009
00010 #include "mainframe.h"
00011
00012 #include <qvariant.h>
00013 #include "myglwidget.h"
00014 #include <qgroupbox.h>
00015 #include <qpushbutton.h>
00016 #include <qbuttongroup.h>
00017 #include <qlayout.h>
00018 #include <qtooltip.h>
00019 #include <qwhatsthis.h>
00020 #include <qaction.h>
00021 #include <qmenubar.h>
00022 #include <qpopupmenu.h>
00023 #include <qtoolbar.h>
00024 #include <qimage.h>
00025 #include <qpixmap.h>
00026
00027 #include "MainFrame.ui.h"
00028
00029
00030
00031
00032
00033 MainFrame::MainFrame( QWidget* parent, const char* name, WFlags fl )
00034 : QMainWindow( parent, name, fl )
00035 {
00036 (void)statusBar();
00037 if ( !name )
00038 setName( "MainFrame" );
00039 setCentralWidget( new QWidget( this, "qt_central_widget" ) );
00040
00041 file = new QGroupBox( centralWidget(), "file" );
00042 file->setGeometry( QRect( 70, 0, 90, 80 ) );
00043
00044 OpenButton = new QPushButton( file, "OpenButton" );
00045 OpenButton->setGeometry( QRect( 10, 10, 70, 60 ) );
00046 OpenButton->setPixmap( QPixmap::fromMimeSource( "Open64.png" ) );
00047
00048 buttonGroup1 = new QButtonGroup( centralWidget(), "buttonGroup1" );
00049 buttonGroup1->setGeometry( QRect( 160, 0, 470, 80 ) );
00050 buttonGroup1->setExclusive( TRUE );
00051
00052 BoxButton = new QPushButton( buttonGroup1, "BoxButton" );
00053 BoxButton->setGeometry( QRect( 10, 30, 51, 31 ) );
00054 BoxButton->setToggleButton( TRUE );
00055
00056 WireButton = new QPushButton( buttonGroup1, "WireButton" );
00057 WireButton->setGeometry( QRect( 80, 30, 40, 30 ) );
00058 WireButton->setToggleButton( TRUE );
00059
00060 HiddenButton = new QPushButton( buttonGroup1, "HiddenButton" );
00061 HiddenButton->setGeometry( QRect( 130, 30, 60, 31 ) );
00062 HiddenButton->setToggleButton( TRUE );
00063
00064 FlatWireButton = new QPushButton( buttonGroup1, "FlatWireButton" );
00065 FlatWireButton->setGeometry( QRect( 260, 30, 61, 31 ) );
00066 FlatWireButton->setToggleButton( TRUE );
00067
00068 SmoothButton = new QPushButton( buttonGroup1, "SmoothButton" );
00069 SmoothButton->setGeometry( QRect( 330, 30, 50, 30 ) );
00070 SmoothButton->setToggleButton( TRUE );
00071
00072 SmallTetraButton = new QPushButton( buttonGroup1, "SmallTetraButton" );
00073 SmallTetraButton->setGeometry( QRect( 390, 30, 60, 30 ) );
00074 SmallTetraButton->setToggleButton( TRUE );
00075
00076 FlatButton = new QPushButton( buttonGroup1, "FlatButton" );
00077 FlatButton->setGeometry( QRect( 200, 30, 50, 30 ) );
00078 FlatButton->setToggleButton( TRUE );
00079 FlatButton->setOn( TRUE );
00080 FlatButton->setAutoDefault( FALSE );
00081 FlatButton->setDefault( FALSE );
00082
00083 myGLWidget = new MyGLWidget( centralWidget(), "myGLWidget" );
00084 myGLWidget->setGeometry( QRect( 70, 80, 790, 720 ) );
00085
00086 buttonGroup2 = new QButtonGroup( centralWidget(), "buttonGroup2" );
00087 buttonGroup2->setGeometry( QRect( 630, 0, 230, 80 ) );
00088 buttonGroup2->setExclusive( TRUE );
00089
00090 TrackButton = new QPushButton( buttonGroup2, "TrackButton" );
00091 TrackButton->setGeometry( QRect( 140, 20, 61, 31 ) );
00092 TrackButton->setToggleButton( TRUE );
00093 TrackButton->setOn( TRUE );
00094 TrackButton->setDefault( FALSE );
00095
00096 SectionButton = new QPushButton( buttonGroup2, "SectionButton" );
00097 SectionButton->setGeometry( QRect( 40, 20, 71, 31 ) );
00098 SectionButton->setToggleButton( TRUE );
00099
00100
00101 fileNewAction = new QAction( this, "fileNewAction" );
00102 fileNewAction->setIconSet( QIconSet( QPixmap::fromMimeSource( "" ) ) );
00103 fileOpenAction = new QAction( this, "fileOpenAction" );
00104 fileOpenAction->setToggleAction( FALSE );
00105 fileOpenAction->setOn( FALSE );
00106 fileOpenAction->setIconSet( QIconSet( QPixmap::fromMimeSource( "" ) ) );
00107 fileSaveAction = new QAction( this, "fileSaveAction" );
00108 fileSaveAction->setIconSet( QIconSet( QPixmap::fromMimeSource( "" ) ) );
00109 fileSaveAsAction = new QAction( this, "fileSaveAsAction" );
00110 filePrintAction = new QAction( this, "filePrintAction" );
00111 filePrintAction->setIconSet( QIconSet( QPixmap::fromMimeSource( "" ) ) );
00112 fileExitAction = new QAction( this, "fileExitAction" );
00113 helpContentsAction = new QAction( this, "helpContentsAction" );
00114 helpIndexAction = new QAction( this, "helpIndexAction" );
00115 helpAboutAction = new QAction( this, "helpAboutAction" );
00116 new_menunew_itemAction = new QAction( this, "new_menunew_itemAction" );
00117 infonew_itemAction = new QAction( this, "infonew_itemAction" );
00118 infoSimplexAction = new QAction( this, "infoSimplexAction" );
00119 infoSimplexAction->setToggleAction( TRUE );
00120 infoSimplexAction->setOn( TRUE );
00121 infoQualityAction = new QAction( this, "infoQualityAction" );
00122 infoQualityAction->setToggleAction( TRUE );
00123 infoPhysicsAction = new QAction( this, "infoPhysicsAction" );
00124 infoPhysicsAction->setToggleAction( TRUE );
00125
00126
00127
00128
00129
00130
00131 MenuBar = new QMenuBar( this, "MenuBar" );
00132
00133
00134 File = new QPopupMenu( this );
00135 fileNewAction->addTo( File );
00136 fileOpenAction->addTo( File );
00137 fileSaveAction->addTo( File );
00138 fileSaveAsAction->addTo( File );
00139 File->insertSeparator();
00140 filePrintAction->addTo( File );
00141 File->insertSeparator();
00142 fileExitAction->addTo( File );
00143 MenuBar->insertItem( QString(""), File, 1 );
00144
00145 Help = new QPopupMenu( this );
00146 helpContentsAction->addTo( Help );
00147 helpIndexAction->addTo( Help );
00148 Help->insertSeparator();
00149 helpAboutAction->addTo( Help );
00150 MenuBar->insertItem( QString(""), Help, 2 );
00151
00152 Info_2 = new QPopupMenu( this );
00153 new_menunew_itemAction->addTo( Info_2 );
00154 infoSimplexAction->addTo( Info_2 );
00155 infoQualityAction->addTo( Info_2 );
00156 infoPhysicsAction->addTo( Info_2 );
00157 MenuBar->insertItem( QString(""), Info_2, 3 );
00158
00159 languageChange();
00160 resize( QSize(908, 846).expandedTo(minimumSizeHint()) );
00161 clearWState( WState_Polished );
00162
00163
00164 connect( fileNewAction, SIGNAL( activated() ), this, SLOT( fileNew() ) );
00165 connect( fileOpenAction, SIGNAL( activated() ), this, SLOT( fileOpen() ) );
00166 connect( fileSaveAction, SIGNAL( activated() ), this, SLOT( fileSave() ) );
00167 connect( fileSaveAsAction, SIGNAL( activated() ), this, SLOT( fileSaveAs() ) );
00168 connect( helpAboutAction, SIGNAL( activated() ), this, SLOT( helpAbout() ) );
00169 connect( helpContentsAction, SIGNAL( activated() ), this, SLOT( helpContents() ) );
00170 connect( helpIndexAction, SIGNAL( activated() ), this, SLOT( helpIndex() ) );
00171 connect( BoxButton, SIGNAL( pressed() ), myGLWidget, SLOT( setBox() ) );
00172 connect( WireButton, SIGNAL( pressed() ), myGLWidget, SLOT( setWire() ) );
00173 connect( HiddenButton, SIGNAL( pressed() ), myGLWidget, SLOT( setHidden() ) );
00174 connect( FlatButton, SIGNAL( pressed() ), myGLWidget, SLOT( setFlat() ) );
00175 connect( FlatWireButton, SIGNAL( pressed() ), myGLWidget, SLOT( setFlatWire() ) );
00176 connect( SmoothButton, SIGNAL( pressed() ), myGLWidget, SLOT( setSmooth() ) );
00177 connect( SmallTetraButton, SIGNAL( pressed() ), myGLWidget, SLOT( setSmallTetra() ) );
00178 connect( OpenButton, SIGNAL( clicked() ), this, SLOT( fileOpen() ) );
00179 connect( SectionButton, SIGNAL( pressed() ), myGLWidget, SLOT( SectionMouseModality() ) );
00180 connect( TrackButton, SIGNAL( pressed() ), myGLWidget, SLOT( TrackMouseModality() ) );
00181 connect( infoPhysicsAction, SIGNAL( activated() ), myGLWidget, SLOT( SwitchTextPhysics() ) );
00182 connect( infoQualityAction, SIGNAL( activated() ), myGLWidget, SLOT( SwitchTextQuality() ) );
00183 connect( infoSimplexAction, SIGNAL( activated() ), myGLWidget, SLOT( SwitchTextSimplex() ) );
00184 }
00185
00186
00187
00188
00189 MainFrame::~MainFrame()
00190 {
00191
00192 }
00193
00194
00195
00196
00197
00198 void MainFrame::languageChange()
00199 {
00200 setCaption( tr( "TetraView" ) );
00201 file->setTitle( QString::null );
00202 OpenButton->setText( QString::null );
00203 buttonGroup1->setTitle( QString::null );
00204 BoxButton->setText( tr( "box" ) );
00205 WireButton->setText( tr( "Wire" ) );
00206 HiddenButton->setText( tr( "Hidden" ) );
00207 FlatWireButton->setText( tr( "FlatWire" ) );
00208 SmoothButton->setText( tr( "Smooth" ) );
00209 SmallTetraButton->setText( tr( "SmallTetra" ) );
00210 FlatButton->setText( tr( "Flat" ) );
00211 buttonGroup2->setTitle( QString::null );
00212 TrackButton->setText( tr( "Trackball" ) );
00213 SectionButton->setText( tr( "Section" ) );
00214 fileNewAction->setText( tr( "New" ) );
00215 fileNewAction->setMenuText( tr( "&New" ) );
00216 fileNewAction->setAccel( tr( "Ctrl+N" ) );
00217 fileOpenAction->setText( tr( "Open" ) );
00218 fileOpenAction->setMenuText( tr( "&Open..." ) );
00219 fileOpenAction->setAccel( tr( "Ctrl+O" ) );
00220 fileSaveAction->setText( tr( "Save" ) );
00221 fileSaveAction->setMenuText( tr( "&Save" ) );
00222 fileSaveAction->setAccel( tr( "Ctrl+S" ) );
00223 fileSaveAsAction->setText( tr( "Save As" ) );
00224 fileSaveAsAction->setMenuText( tr( "Save &As..." ) );
00225 fileSaveAsAction->setAccel( QString::null );
00226 filePrintAction->setText( tr( "Print" ) );
00227 filePrintAction->setMenuText( tr( "&Print..." ) );
00228 filePrintAction->setAccel( tr( "Ctrl+P" ) );
00229 fileExitAction->setText( tr( "Exit" ) );
00230 fileExitAction->setMenuText( tr( "E&xit" ) );
00231 fileExitAction->setAccel( QString::null );
00232 helpContentsAction->setText( tr( "Contents" ) );
00233 helpContentsAction->setMenuText( tr( "&Contents..." ) );
00234 helpContentsAction->setAccel( QString::null );
00235 helpIndexAction->setText( tr( "Index" ) );
00236 helpIndexAction->setMenuText( tr( "&Index..." ) );
00237 helpIndexAction->setAccel( QString::null );
00238 helpAboutAction->setText( tr( "About" ) );
00239 helpAboutAction->setMenuText( tr( "&About" ) );
00240 helpAboutAction->setAccel( QString::null );
00241 new_menunew_itemAction->setText( QString::null );
00242 new_menunew_itemAction->setMenuText( QString::null );
00243 infonew_itemAction->setText( tr( "new item" ) );
00244 infonew_itemAction->setMenuText( tr( "new item" ) );
00245 infoSimplexAction->setText( tr( "Simplex" ) );
00246 infoSimplexAction->setMenuText( tr( "Simplex" ) );
00247 infoQualityAction->setText( tr( "Quality" ) );
00248 infoQualityAction->setMenuText( tr( "Quality" ) );
00249 infoPhysicsAction->setText( tr( "Physics" ) );
00250 infoPhysicsAction->setMenuText( tr( "Physics" ) );
00251 if (MenuBar->findItem(1))
00252 MenuBar->findItem(1)->setText( tr( "&File" ) );
00253 if (MenuBar->findItem(2))
00254 MenuBar->findItem(2)->setText( tr( "&Help" ) );
00255 if (MenuBar->findItem(3))
00256 MenuBar->findItem(3)->setText( tr( "Info" ) );
00257 }
00258