0029580: Regression: invalid result of BOP Fuse
[occt.git] / samples / qt / Tutorial / src / ApplicationTut.cxx
CommitLineData
7fd59977 1#include "ApplicationTut.h"
2#include "DocumentTut.h"
3
4#include <QFileDialog>
5#include <QStatusBar>
861a7b03 6#include <QMdiSubWindow>
7fd59977 7
8ApplicationTut::ApplicationTut()
9 : ApplicationCommonWindow( )
10{
11 createMakeBottleOperation();
12}
13
14ApplicationTut::~ApplicationTut()
15{
16}
17
18void ApplicationTut::createMakeBottleOperation(){
19 QPixmap MakeBottleIcon;
20 QString dir = getTutResourceDir() + QString( "/" );
21 MakeBottleIcon = QPixmap( dir+QObject::tr( "ICON_MAKE_BOTTLE" ) );
22
23 QAction * MakeBottleAction = new QAction( MakeBottleIcon, QObject::tr("TBR_MAKEBOT"), this );
24 MakeBottleAction->setToolTip( QObject::tr( "TBR_MAKEBOT" ) );
25 MakeBottleAction->setStatusTip( QObject::tr("TBR_MAKEBOT") );
26 MakeBottleAction->setShortcut( QObject::tr( "CTRL+M" ) );
3cb77da4 27 connect( MakeBottleAction, SIGNAL( triggered() ) , this, SLOT( onMakeBottleAction() ) );
7fd59977 28
29 myMakeBottleBar = addToolBar( tr( "Make Bottle" ) );
30 insertToolBar( getCasCadeBar(), myMakeBottleBar );
31 myMakeBottleBar->addAction( MakeBottleAction );
32 myMakeBottleBar->hide();
33}
34
35void ApplicationTut::updateFileActions()
36{
861a7b03 37 if ( getWorkspace()->subWindowList().isEmpty() )
7fd59977 38 {
39 if ( !isDocument() )
40 {
41 myMakeBottleBar->show();
42 }
43 else
44 {
45 myMakeBottleBar->hide();
46 }
47 }
48 ApplicationCommonWindow::updateFileActions();
49}
50
51void ApplicationTut::onMakeBottleAction()
52{
861a7b03 53 QMdiArea* ws = ApplicationCommonWindow::getWorkspace();
54 DocumentTut* doc = (DocumentTut*)( qobject_cast<MDIWindow*>( ws->activeSubWindow()->widget() )->getDocument() );
7fd59977 55 statusBar()->showMessage( QObject::tr("INF_MAKE_BOTTLE"), 5000 );
56 doc->onMakeBottle();
57 statusBar()->showMessage(QObject::tr("INF_DONE"));
58}
59
60QString ApplicationTut::getTutResourceDir()
61{
861a7b03 62 static QString resDir (qgetenv ("CSF_TutorialResourcesDefaults").constData());
63 return resDir;
7fd59977 64}
65