2 #include <HYDROGUI_Module.h>
3 #include <HYDROGUI_Operations.h>
4 #include <CAM_Application.h>
5 #include <SUIT_ResourceMgr.h>
6 #include <SUIT_Desktop.h>
9 QAction* HYDROGUI_Module::CreateAction( const int theId, const QString& theSuffix, const QString& theImg,
10 const int theKey, const bool isToggle, const QString& theSlot )
12 QString aSlot = theSlot;
14 aSlot = SLOT( onOperation() );
15 SUIT_ResourceMgr* aMgr = application()->resourceMgr();
16 std::string anImg = theImg.toStdString();
17 QPixmap aPixmap = theImg.isEmpty() ? QPixmap() : aMgr->loadPixmap( "HYDROGUI", tr( anImg.c_str() ) );
18 std::string aMenu = ( "MEN_" + theSuffix ).toStdString();
19 std::string aDesktop = ( "DSK_" + theSuffix ).toStdString();
20 std::string aToolbar = ( "STB_" + theSuffix ).toStdString();
21 std::string aSlotStr = aSlot.toStdString();
22 return LightApp_Module::createAction( theId, tr( aMenu.c_str() ), aPixmap,
23 tr( aDesktop.c_str() ), tr( aToolbar.c_str() ),
24 theKey, application()->desktop(), isToggle, this, aSlotStr.c_str() );
27 void HYDROGUI_Module::CreateActions()
29 CreateAction( ImportImageId, "IMPORT_IMAGE", "", Qt::CTRL + Qt::Key_I );
32 void HYDROGUI_Module::CreateMenus()
34 int aFileId = createMenu( tr( "MEN_DESK_FILE" ), -1, -1, 0 );
36 createMenu( separator(), aFileId, -1, 1, -1 );
37 createMenu( ImportImageId, aFileId, -1, -1 );
40 void HYDROGUI_Module::CreatePopups()
44 void HYDROGUI_Module::CreateToolbars()
48 void HYDROGUI_Module::onOperation()
50 const QAction* anAction = dynamic_cast<const QAction*>( sender() );
51 int anId = actionId( anAction );
53 startOperation( anId );
56 LightApp_Operation* HYDROGUI_Module::createOperation( const int theId ) const
58 LightApp_Operation* anOp = 0;
59 HYDROGUI_Module* aModule = const_cast<HYDROGUI_Module*>( this );
68 anOp = LightApp_Module::createOperation( theId );