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