2 #include <HYDROGUI_Module.h>
3 #include <HYDROGUI_Operations.h>
4 #include <HYDROGUI_ImportImageOp.h>
5 #include <HYDROGUI_TwoImagesOp.h>
7 #include <CAM_Application.h>
8 #include <SUIT_ResourceMgr.h>
9 #include <SUIT_Desktop.h>
12 QAction* HYDROGUI_Module::CreateAction( const int theId, const QString& theSuffix, const QString& theImg,
13 const int theKey, const bool isToggle, const QString& theSlot )
15 QString aSlot = theSlot;
17 aSlot = SLOT( onOperation() );
18 SUIT_ResourceMgr* aMgr = application()->resourceMgr();
19 std::string anImg = theImg.toStdString();
20 QPixmap aPixmap = theImg.isEmpty() ? QPixmap() : aMgr->loadPixmap( "HYDROGUI", tr( anImg.c_str() ) );
21 std::string aMenu = ( "MEN_" + theSuffix ).toStdString();
22 std::string aDesktop = ( "DSK_" + theSuffix ).toStdString();
23 std::string aToolbar = ( "STB_" + theSuffix ).toStdString();
24 std::string aSlotStr = aSlot.toStdString();
25 return LightApp_Module::createAction( theId, tr( aMenu.c_str() ), aPixmap,
26 tr( aDesktop.c_str() ), tr( aToolbar.c_str() ),
27 theKey, application()->desktop(), isToggle, this, aSlotStr.c_str() );
30 void HYDROGUI_Module::CreateActions()
32 CreateAction( ImportImageId, "IMPORT_IMAGE", "", Qt::CTRL + Qt::Key_I );
35 void HYDROGUI_Module::CreateMenus()
37 int aFileId = createMenu( tr( "MEN_DESK_FILE" ), -1, -1, 0 );
39 createMenu( separator(), aFileId, -1, 1, -1 );
40 createMenu( ImportImageId, aFileId, -1, -1 );
43 void HYDROGUI_Module::CreatePopups()
47 void HYDROGUI_Module::CreateToolbars()
51 void HYDROGUI_Module::onOperation()
53 const QAction* anAction = dynamic_cast<const QAction*>( sender() );
54 int anId = actionId( anAction );
56 startOperation( anId );
59 LightApp_Operation* HYDROGUI_Module::createOperation( const int theId ) const
61 LightApp_Operation* anOp = 0;
62 HYDROGUI_Module* aModule = const_cast<HYDROGUI_Module*>( this );
66 anOp = new HYDROGUI_ImportImageOp( aModule );
69 anOp = new HYDROGUI_TwoImagesOp( aModule, tr( "FUSE_OP" ) );
72 anOp = new HYDROGUI_TwoImagesOp( aModule, tr( "CUT_OP" ) );
77 anOp = LightApp_Module::createOperation( theId );