From: Sergey Belash Date: Thu, 20 Mar 2014 08:46:49 +0000 (+0400) Subject: Re-factoring: interfaces removed from "XGUI", "GeomModule" renamed to "PartSet" X-Git-Tag: V_0.1~53 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=5bd491bf7444d3859f91ed88142e6186d8881f6e;p=modules%2Fshaper.git Re-factoring: interfaces removed from "XGUI", "GeomModule" renamed to "PartSet" --- diff --git a/CMakeLists.txt b/CMakeLists.txt index 248e6f91a..bc48f8c8c 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -11,5 +11,5 @@ ADD_SUBDIRECTORY (src/Event) ADD_SUBDIRECTORY (src/Config) #ADD_SUBDIRECTORY (src/ModelAPI) #ADD_SUBDIRECTORY (src/Model) -ADD_SUBDIRECTORY (src/GeomModule) +ADD_SUBDIRECTORY (src/PartSet) ADD_SUBDIRECTORY (src/XGUI) diff --git a/src/GeomModule/CMakeLists.txt b/src/GeomModule/CMakeLists.txt deleted file mode 100644 index 540798c8d..000000000 --- a/src/GeomModule/CMakeLists.txt +++ /dev/null @@ -1,50 +0,0 @@ -CMAKE_MINIMUM_REQUIRED(VERSION 2.8.11) - -INCLUDE(Common) - -SET(PROJECT_HEADERS - GeomModule_Defs.h - GeomModule.h -) - -SET(PROJECT_SOURCES - GeomModule.cpp -) - -SET(PROJECT_RESOURCES - GeomModule_icons.qrc -) - -SET(TEXT_RESOURCES - GeomModule_msg_en.ts -) - -SET(PROJECT_LIBRARIES - Config - ${Qt5Widgets_LIBRARIES} -) - -QT5_ADD_RESOURCES(PROJECT_COMPILED_RESOURCES ${PROJECT_RESOURCES}) -QT5_ADD_TRANSLATION(QM_RESOURCES ${TEXT_RESOURCES}) - -SOURCE_GROUP ("Generated Files" FILES ${PROJECT_COMPILED_RESOURCES} ${QM_RESOURCES}) -SOURCE_GROUP ("Resource Files" FILES ${TEXT_RESOURCES} ${PROJECT_RESOURCES}) - -ADD_LIBRARY(GeomModule SHARED - ${PROJECT_SOURCES} - ${PROJECT_HEADERS} - ${PROJECT_COMPILED_RESOURCES} - ${TEXT_RESOURCES} - ${QM_RESOURCES} -) - -ADD_DEPENDENCIES(GeomModule XGUI) - -INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/src/XGUI) -INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/src/Config) -INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/src/Event) - -# The Qt5Widgets_LIBRARIES variable also includes QtGui and QtCore -TARGET_LINK_LIBRARIES(GeomModule ${PROJECT_LIBRARIES}) - -INSTALL(TARGETS GeomModule DESTINATION bin) diff --git a/src/GeomModule/GeomModule.cpp b/src/GeomModule/GeomModule.cpp deleted file mode 100644 index f3bc0fd16..000000000 --- a/src/GeomModule/GeomModule.cpp +++ /dev/null @@ -1,33 +0,0 @@ -#include "GeomModule.h" - -#include - -#include -#include -#include -#include - -/*!Create and return new instance of XGUI_Module*/ -extern "C" GM_EXPORT IModule* createModule(IWorkshop* theWshop) -{ - return new GeomModule(theWshop); -} - - -GeomModule::GeomModule(IWorkshop* theWshop) -{ - myWorkshop = theWshop; -} - - -GeomModule::~GeomModule() -{ -} - - -void GeomModule::createFeatures() -{ - Config_XMLReader* aReader = - new Config_XMLReader("plugin-PartSet.xml"); - aReader->readAll(); -} diff --git a/src/GeomModule/GeomModule.h b/src/GeomModule/GeomModule.h deleted file mode 100644 index e190a2305..000000000 --- a/src/GeomModule/GeomModule.h +++ /dev/null @@ -1,25 +0,0 @@ - -#ifndef GeomModule_H -#define GeomModule_H - -#include "GeomModule_Defs.h" - -#include - -class Config_XMLReader; - -class GM_EXPORT GeomModule : public IModule -{ -public: - GeomModule(IWorkshop* theWshop); - virtual ~GeomModule(); - - virtual void createFeatures(); - -private: - QString myMenuXML; - - IWorkshop* myWorkshop; -}; - -#endif diff --git a/src/GeomModule/GeomModule_Defs.h b/src/GeomModule/GeomModule_Defs.h deleted file mode 100644 index faa697282..000000000 --- a/src/GeomModule/GeomModule_Defs.h +++ /dev/null @@ -1,16 +0,0 @@ -#ifndef GeomModule_Defs_H -#define GeomModule_Defs_H - - -#if defined WIN32 -# if defined GeomModule_EXPORTS -# define GM_EXPORT __declspec( dllexport ) -# else -# define GM_EXPORT __declspec( dllimport ) -# endif -#else -# define GM_EXPORT -#endif - - -#endif \ No newline at end of file diff --git a/src/GeomModule/GeomModule_icons.qrc b/src/GeomModule/GeomModule_icons.qrc deleted file mode 100644 index 571e1cd6f..000000000 --- a/src/GeomModule/GeomModule_icons.qrc +++ /dev/null @@ -1,15 +0,0 @@ - - - icons/point.png - icons/plane.png - icons/axis.png - icons/duplicate.png - icons/remove.png - icons/extrusion.png - icons/cut.png - icons/fusion.png - icons/revol.png - icons/common.png - icons/import.png - - diff --git a/src/GeomModule/GeomModule_msg_en.ts b/src/GeomModule/GeomModule_msg_en.ts deleted file mode 100644 index 4270bb8a8..000000000 --- a/src/GeomModule/GeomModule_msg_en.ts +++ /dev/null @@ -1,18 +0,0 @@ - - - - - @default - - - XGUI_Workshop - - HOME_MENU_TITLE - Home - - - NEW_MENU - New - - - diff --git a/src/GeomModule/icons/axis.png b/src/GeomModule/icons/axis.png deleted file mode 100644 index 5f5bfffd8..000000000 Binary files a/src/GeomModule/icons/axis.png and /dev/null differ diff --git a/src/GeomModule/icons/common.png b/src/GeomModule/icons/common.png deleted file mode 100644 index 7deab358a..000000000 Binary files a/src/GeomModule/icons/common.png and /dev/null differ diff --git a/src/GeomModule/icons/cut.png b/src/GeomModule/icons/cut.png deleted file mode 100644 index 0d43adb8b..000000000 Binary files a/src/GeomModule/icons/cut.png and /dev/null differ diff --git a/src/GeomModule/icons/duplicate.png b/src/GeomModule/icons/duplicate.png deleted file mode 100644 index 1a5de9b5f..000000000 Binary files a/src/GeomModule/icons/duplicate.png and /dev/null differ diff --git a/src/GeomModule/icons/extrusion.png b/src/GeomModule/icons/extrusion.png deleted file mode 100644 index 12bbe4530..000000000 Binary files a/src/GeomModule/icons/extrusion.png and /dev/null differ diff --git a/src/GeomModule/icons/fusion.png b/src/GeomModule/icons/fusion.png deleted file mode 100644 index 7fca3fe67..000000000 Binary files a/src/GeomModule/icons/fusion.png and /dev/null differ diff --git a/src/GeomModule/icons/import.png b/src/GeomModule/icons/import.png deleted file mode 100644 index 2a6ba81ec..000000000 Binary files a/src/GeomModule/icons/import.png and /dev/null differ diff --git a/src/GeomModule/icons/plane.png b/src/GeomModule/icons/plane.png deleted file mode 100644 index 3075a34aa..000000000 Binary files a/src/GeomModule/icons/plane.png and /dev/null differ diff --git a/src/GeomModule/icons/point.png b/src/GeomModule/icons/point.png deleted file mode 100644 index de84d9652..000000000 Binary files a/src/GeomModule/icons/point.png and /dev/null differ diff --git a/src/GeomModule/icons/remove.png b/src/GeomModule/icons/remove.png deleted file mode 100644 index 6c6452718..000000000 Binary files a/src/GeomModule/icons/remove.png and /dev/null differ diff --git a/src/GeomModule/icons/revol.png b/src/GeomModule/icons/revol.png deleted file mode 100644 index 3400b6200..000000000 Binary files a/src/GeomModule/icons/revol.png and /dev/null differ diff --git a/src/PartSet/CMakeLists.txt b/src/PartSet/CMakeLists.txt new file mode 100644 index 000000000..b8c89c47c --- /dev/null +++ b/src/PartSet/CMakeLists.txt @@ -0,0 +1,49 @@ +CMAKE_MINIMUM_REQUIRED(VERSION 2.8.11) + +INCLUDE(Common) + +SET(PROJECT_HEADERS + PartSet.h + PartSet_Module.h +) + +SET(PROJECT_SOURCES + PartSet_Module.cpp +) + +SET(PROJECT_RESOURCES + PartSet_icons.qrc +) + +SET(TEXT_RESOURCES + PartSet_msg_en.ts +) + +SET(PROJECT_LIBRARIES + Config + ${Qt5Widgets_LIBRARIES} +) + +QT5_ADD_RESOURCES(PROJECT_COMPILED_RESOURCES ${PROJECT_RESOURCES}) +QT5_ADD_TRANSLATION(QM_RESOURCES ${TEXT_RESOURCES}) + +SOURCE_GROUP ("Generated Files" FILES ${PROJECT_COMPILED_RESOURCES} ${QM_RESOURCES}) +SOURCE_GROUP ("Resource Files" FILES ${TEXT_RESOURCES} ${PROJECT_RESOURCES}) + +INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/src/XGUI) +INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/src/Config) +INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/src/Event) + +ADD_DEFINITIONS(-DPARTSET_EXPORTS) +ADD_LIBRARY(PartSet SHARED + ${PROJECT_SOURCES} + ${PROJECT_HEADERS} + ${PROJECT_COMPILED_RESOURCES} + ${TEXT_RESOURCES} + ${QM_RESOURCES} +) + +# The Qt5Widgets_LIBRARIES variable also includes QtGui and QtCore +TARGET_LINK_LIBRARIES(PartSet ${PROJECT_LIBRARIES}) + +INSTALL(TARGETS PartSet DESTINATION bin) diff --git a/src/PartSet/PartSet.h b/src/PartSet/PartSet.h new file mode 100644 index 000000000..6579536fe --- /dev/null +++ b/src/PartSet/PartSet.h @@ -0,0 +1,18 @@ +#ifndef PARTSET_H +#define PARTSET_H + +#if defined PARTSET_EXPORTS +#if defined WIN32 +#define PARTSET_EXPORT __declspec( dllexport ) +#else +#define PARTSET_EXPORT +#endif +#else +#if defined WIN32 +#define PARTSET_EXPORT __declspec( dllimport ) +#else +#define PARTSET_EXPORT +#endif +#endif + +#endif //PARTSET_H diff --git a/src/PartSet/PartSet_Module.cpp b/src/PartSet/PartSet_Module.cpp new file mode 100644 index 000000000..2121a26a6 --- /dev/null +++ b/src/PartSet/PartSet_Module.cpp @@ -0,0 +1,33 @@ +#include "PartSet_Module.h" + +#include + +#include +#include +#include +#include + +/*!Create and return new instance of XGUI_Module*/ +extern "C" PARTSET_EXPORT XGUI_Module* createModule(XGUI_Workshop* theWshop) +{ + return new PartSet_Module(theWshop); +} + + +PartSet_Module::PartSet_Module(XGUI_Workshop* theWshop) +{ + myWorkshop = theWshop; +} + + +PartSet_Module::~PartSet_Module() +{ +} + + +void PartSet_Module::createFeatures() +{ + Config_XMLReader* aReader = + new Config_XMLReader("plugin-PartSet.xml"); + aReader->readAll(); +} diff --git a/src/PartSet/PartSet_Module.h b/src/PartSet/PartSet_Module.h new file mode 100644 index 000000000..b9f6ee913 --- /dev/null +++ b/src/PartSet/PartSet_Module.h @@ -0,0 +1,25 @@ + +#ifndef PartSet_Module_H +#define PartSet_Module_H + +#include "PartSet.h" + +#include + +class Config_XMLReader; + +class PARTSET_EXPORT PartSet_Module : public XGUI_Module +{ +public: + PartSet_Module(XGUI_Workshop* theWshop); + virtual ~PartSet_Module(); + + virtual void createFeatures(); + +private: + QString myMenuXML; + + XGUI_Workshop* myWorkshop; +}; + +#endif diff --git a/src/PartSet/PartSet_icons.qrc b/src/PartSet/PartSet_icons.qrc new file mode 100644 index 000000000..571e1cd6f --- /dev/null +++ b/src/PartSet/PartSet_icons.qrc @@ -0,0 +1,15 @@ + + + icons/point.png + icons/plane.png + icons/axis.png + icons/duplicate.png + icons/remove.png + icons/extrusion.png + icons/cut.png + icons/fusion.png + icons/revol.png + icons/common.png + icons/import.png + + diff --git a/src/PartSet/PartSet_msg_en.ts b/src/PartSet/PartSet_msg_en.ts new file mode 100644 index 000000000..4270bb8a8 --- /dev/null +++ b/src/PartSet/PartSet_msg_en.ts @@ -0,0 +1,18 @@ + + + + + @default + + + XGUI_Workshop + + HOME_MENU_TITLE + Home + + + NEW_MENU + New + + + diff --git a/src/PartSet/icons/axis.png b/src/PartSet/icons/axis.png new file mode 100644 index 000000000..5f5bfffd8 Binary files /dev/null and b/src/PartSet/icons/axis.png differ diff --git a/src/PartSet/icons/common.png b/src/PartSet/icons/common.png new file mode 100644 index 000000000..7deab358a Binary files /dev/null and b/src/PartSet/icons/common.png differ diff --git a/src/PartSet/icons/cut.png b/src/PartSet/icons/cut.png new file mode 100644 index 000000000..0d43adb8b Binary files /dev/null and b/src/PartSet/icons/cut.png differ diff --git a/src/PartSet/icons/duplicate.png b/src/PartSet/icons/duplicate.png new file mode 100644 index 000000000..1a5de9b5f Binary files /dev/null and b/src/PartSet/icons/duplicate.png differ diff --git a/src/PartSet/icons/extrusion.png b/src/PartSet/icons/extrusion.png new file mode 100644 index 000000000..12bbe4530 Binary files /dev/null and b/src/PartSet/icons/extrusion.png differ diff --git a/src/PartSet/icons/fusion.png b/src/PartSet/icons/fusion.png new file mode 100644 index 000000000..7fca3fe67 Binary files /dev/null and b/src/PartSet/icons/fusion.png differ diff --git a/src/PartSet/icons/import.png b/src/PartSet/icons/import.png new file mode 100644 index 000000000..2a6ba81ec Binary files /dev/null and b/src/PartSet/icons/import.png differ diff --git a/src/PartSet/icons/plane.png b/src/PartSet/icons/plane.png new file mode 100644 index 000000000..3075a34aa Binary files /dev/null and b/src/PartSet/icons/plane.png differ diff --git a/src/PartSet/icons/point.png b/src/PartSet/icons/point.png new file mode 100644 index 000000000..de84d9652 Binary files /dev/null and b/src/PartSet/icons/point.png differ diff --git a/src/PartSet/icons/remove.png b/src/PartSet/icons/remove.png new file mode 100644 index 000000000..6c6452718 Binary files /dev/null and b/src/PartSet/icons/remove.png differ diff --git a/src/PartSet/icons/revol.png b/src/PartSet/icons/revol.png new file mode 100644 index 000000000..3400b6200 Binary files /dev/null and b/src/PartSet/icons/revol.png differ diff --git a/src/XGUI/XGUI_Command.h b/src/XGUI/XGUI_Command.h index e3759a4aa..180395501 100644 --- a/src/XGUI/XGUI_Command.h +++ b/src/XGUI/XGUI_Command.h @@ -1,15 +1,13 @@ #ifndef XGUI_Command_H #define XGUI_Command_H -#include "XGUI_Interfaces.h" - #include #define MIN_BUTTON_HEIGHT 18 #define MIN_BUTTON_WIDTH 40 -class XGUI_Command : public QWidgetAction, public IFeatureMenu +class XGUI_Command : public QWidgetAction { Q_OBJECT public: @@ -31,4 +29,4 @@ private: QString myId; }; -#endif \ No newline at end of file +#endif diff --git a/src/XGUI/XGUI_Interfaces.h b/src/XGUI/XGUI_Interfaces.h deleted file mode 100644 index 24b53dcd5..000000000 --- a/src/XGUI/XGUI_Interfaces.h +++ /dev/null @@ -1,63 +0,0 @@ - -#ifndef XGUI_Interfaces_H -#define XGUI_Interfaces_H - -#include -#include -#include - - -class IFeatureMenu -{ -public: - virtual bool enabled() const = 0; - virtual void enable() = 0; - virtual void disable() = 0; - virtual QString getId() const = 0; - virtual void connectTo(const QObject* theResiver, const char* theSlot) = 0; -}; - - -class IMenuGroup -{ -public: - virtual IFeatureMenu* addFeature(const QString& theId, - const QString& theTitle, - const QString& theTip, - const QIcon& theIcon, - const QKeySequence& theKeys = QKeySequence()) = 0; -}; - - -class IWorkbench -{ -public: - virtual IMenuGroup* addGroup(const QString& theName = "") = 0; - virtual IMenuGroup* findGroup(const QString& theName) = 0; -}; - - -class IWorkshop -{ -public: - virtual IWorkbench* addWorkbench(const QString& theName) = 0; -}; - - -class IModule -{ -public: - virtual void createFeatures() = 0; -}; - - -//! This function must return a new module instance. -extern "C" -{ - typedef IModule* (*CREATE_FUNC)(IWorkshop*); -} - -#define CREATE_MODULE "createModule" - - -#endif diff --git a/src/XGUI/XGUI_MainMenu.cpp b/src/XGUI/XGUI_MainMenu.cpp index a19731dea..f1926acf0 100644 --- a/src/XGUI/XGUI_MainMenu.cpp +++ b/src/XGUI/XGUI_MainMenu.cpp @@ -18,7 +18,7 @@ XGUI_MainMenu::~XGUI_MainMenu(void) { } -IWorkbench* XGUI_MainMenu::addWorkbench(const QString& theTitle) +XGUI_Workbench* XGUI_MainMenu::addWorkbench(const QString& theTitle) { QDockWidget* aDoc = new QDockWidget(myDesktop); QString workbenchObjName = theTitle + "_Workbench"; @@ -44,17 +44,17 @@ IWorkbench* XGUI_MainMenu::addWorkbench(const QString& theTitle) /* * Searches for already created workbench with given name. */ -IWorkbench* XGUI_MainMenu::findWorkbench(const QString& theObjName) +XGUI_Workbench* XGUI_MainMenu::findWorkbench(const QString& theObjName) { QDockWidget* aDoc = myDesktop->findChild(theObjName); if(aDoc) { - return dynamic_cast(aDoc->widget()); + return dynamic_cast(aDoc->widget()); } return NULL; } -IMenuGroup* XGUI_MainMenu::addGroup(int thePageId) +XGUI_MenuGroupPanel* XGUI_MainMenu::addGroup(int thePageId) { XGUI_Workbench* aPage = dynamic_cast(myMenuTabs[thePageId]->widget()); return aPage->addGroup(); diff --git a/src/XGUI/XGUI_MainMenu.h b/src/XGUI/XGUI_MainMenu.h index 3addcdb6f..ca45fe030 100644 --- a/src/XGUI/XGUI_MainMenu.h +++ b/src/XGUI/XGUI_MainMenu.h @@ -1,19 +1,21 @@ #ifndef XGUI_MainMenu_H #define XGUI_MainMenu_H -#include "XGUI_Interfaces.h" - #include #include +class XGUI_Command; +class XGUI_MainWindow; +class XGUI_Workbench; +class XGUI_MenuGroupPanel; + class QTabWidget; class QLabel; class QAction; -class XGUI_Command; -class XGUI_MainWindow; class QDockWidget; + class XGUI_MainMenu : public QObject { Q_OBJECT @@ -21,10 +23,10 @@ public: XGUI_MainMenu(XGUI_MainWindow *parent); virtual ~XGUI_MainMenu(); - IWorkbench* addWorkbench(const QString& theTitle); - IWorkbench* findWorkbench(const QString& theObjName); + XGUI_Workbench* addWorkbench(const QString& theTitle); + XGUI_Workbench* findWorkbench(const QString& theObjName); - IMenuGroup* addGroup(int thePageId); + XGUI_MenuGroupPanel* addGroup(int thePageId); private: XGUI_MainWindow* myDesktop; diff --git a/src/XGUI/XGUI_MenuGroupPanel.cpp b/src/XGUI/XGUI_MenuGroupPanel.cpp index 0753625d5..3173f97aa 100644 --- a/src/XGUI/XGUI_MenuGroupPanel.cpp +++ b/src/XGUI/XGUI_MenuGroupPanel.cpp @@ -60,7 +60,7 @@ void XGUI_MenuGroupPanel::resizeEvent(QResizeEvent* theEvent) } } -IFeatureMenu* XGUI_MenuGroupPanel::addFeature(const QString& theId, const QString& theTitle, +XGUI_Command* XGUI_MenuGroupPanel::addFeature(const QString& theId, const QString& theTitle, const QString& theTip, const QIcon& theIcon, const QKeySequence& theKeys) diff --git a/src/XGUI/XGUI_MenuGroupPanel.h b/src/XGUI/XGUI_MenuGroupPanel.h index cda62888c..9c72384d1 100644 --- a/src/XGUI/XGUI_MenuGroupPanel.h +++ b/src/XGUI/XGUI_MenuGroupPanel.h @@ -2,25 +2,23 @@ #ifndef XGUI_MenuGroupPanel_H #define XGUI_MenuGroupPanel_H -#include "XGUI_Interfaces.h" - #include #include -class QGridLayout; class XGUI_Command; +class QGridLayout; -class XGUI_MenuGroupPanel : public QWidget, public IMenuGroup +class XGUI_MenuGroupPanel : public QWidget { Q_OBJECT public: explicit XGUI_MenuGroupPanel(QWidget *parent = 0); - virtual IFeatureMenu* addFeature(const QString& theId, - const QString& theTitle, - const QString& theTip, - const QIcon& theIcon, - const QKeySequence& theKeys = QKeySequence()); + XGUI_Command* addFeature(const QString& theId, + const QString& theTitle, + const QString& theTip, + const QIcon& theIcon, + const QKeySequence& theKeys = QKeySequence()); protected: virtual void resizeEvent(QResizeEvent *theEvent); @@ -37,4 +35,4 @@ private: int myMaxRow; }; -#endif \ No newline at end of file +#endif diff --git a/src/XGUI/XGUI_Module.h b/src/XGUI/XGUI_Module.h new file mode 100644 index 000000000..e27066743 --- /dev/null +++ b/src/XGUI/XGUI_Module.h @@ -0,0 +1,26 @@ + +#ifndef XGUI_Module_H +#define XGUI_Module_H + +#include +#include +#include + +#include + +class XGUI_Module +{ +public: + virtual void createFeatures() = 0; +}; + +//! This function must return a new module instance. +extern "C" +{ + typedef XGUI_Module* (*CREATE_FUNC)(XGUI_Workshop*); +} + +#define CREATE_MODULE "createModule" + + +#endif //XGUI_Module diff --git a/src/XGUI/XGUI_Workbench.cpp b/src/XGUI/XGUI_Workbench.cpp index ac930f076..4661f5791 100644 --- a/src/XGUI/XGUI_Workbench.cpp +++ b/src/XGUI/XGUI_Workbench.cpp @@ -73,7 +73,7 @@ XGUI_Workbench::XGUI_Workbench(QWidget *theParent) : * Creates a new group in the workbench with given name. * If no name provided it would be defined as {workbench_name}_Group_N. */ -IMenuGroup* XGUI_Workbench::addGroup(const QString& theName) +XGUI_MenuGroupPanel* XGUI_Workbench::addGroup(const QString& theName) { QString aGroupName = theName; //Generate a group name. @@ -99,7 +99,7 @@ IMenuGroup* XGUI_Workbench::addGroup(const QString& theName) /* * Searches for already created group with given name. */ -IMenuGroup* XGUI_Workbench::findGroup(const QString& theName) +XGUI_MenuGroupPanel* XGUI_Workbench::findGroup(const QString& theName) { QString aGroupName = theName; XGUI_MenuGroupPanel* aPanel; diff --git a/src/XGUI/XGUI_Workbench.h b/src/XGUI/XGUI_Workbench.h index e44b60b87..26d7d6918 100644 --- a/src/XGUI/XGUI_Workbench.h +++ b/src/XGUI/XGUI_Workbench.h @@ -2,27 +2,27 @@ #ifndef XGUI_Workbench_H #define XGUI_Workbench_H -#include "XGUI_Interfaces.h" - #include #include #include -class QHBoxLayout; +class XGUI_Command; class XGUI_MenuGroupPanel; -class QPushButton; class CommandsArea; -class XGUI_Command; + +class QHBoxLayout; +class QPushButton; + -class XGUI_Workbench : public QWidget, public IWorkbench +class XGUI_Workbench : public QWidget { Q_OBJECT public: XGUI_Workbench(QWidget* theParent); - virtual IMenuGroup* addGroup(const QString& theName = ""); - virtual IMenuGroup* findGroup(const QString& theName); + XGUI_MenuGroupPanel* addGroup(const QString& theName = ""); + XGUI_MenuGroupPanel* findGroup(const QString& theName); private slots: void onLeftScroll(); diff --git a/src/XGUI/XGUI_Workshop.cpp b/src/XGUI/XGUI_Workshop.cpp index b7cd63a16..7b857b5af 100644 --- a/src/XGUI/XGUI_Workshop.cpp +++ b/src/XGUI/XGUI_Workshop.cpp @@ -1,8 +1,11 @@ -#include "XGUI_Workshop.h" -#include "XGUI_MainWindow.h" -#include "XGUI_MainMenu.h" +#include "XGUI_Module.h" #include "XGUI_Command.h" +#include "XGUI_MainMenu.h" +#include "XGUI_MainWindow.h" +#include "XGUI_MenuGroupPanel.h" #include "XGUI_Tools.h" +#include "XGUI_Workbench.h" +#include "XGUI_Workshop.h" #include #include @@ -13,10 +16,6 @@ #ifdef _DEBUG #include #endif - - -#include - #ifdef WIN32 #include #else @@ -50,12 +49,12 @@ void XGUI_Workshop::startApplication() //****************************************************** void XGUI_Workshop::initMenu() { - IWorkbench* aPage = addWorkbench(tr("GEN_MENU_TITLE")); + XGUI_Workbench* aPage = addWorkbench(tr("GEN_MENU_TITLE")); // File commands group - IMenuGroup* aGroup = aPage->addGroup(); + XGUI_MenuGroupPanel* aGroup = aPage->addGroup(); - IFeatureMenu* aCommand; + XGUI_Command* aCommand; aCommand = aGroup->addFeature("SAVE_CMD", tr("SAVE_MENU"), tr("SAVE_MENU_TIP"), QIcon(":pictures/save.png"), QKeySequence::Save); @@ -92,7 +91,7 @@ void XGUI_Workshop::initMenu() } //****************************************************** -IWorkbench* XGUI_Workshop::addWorkbench(const QString& theName) +XGUI_Workbench* XGUI_Workshop::addWorkbench(const QString& theName) { XGUI_MainMenu* aMenuBar = myMainWindow->menuObject(); return aMenuBar->addWorkbench(theName); @@ -109,15 +108,18 @@ void XGUI_Workshop::ProcessEvent(const Event_Message* theMessage) } #ifdef _DEBUG qDebug() << "XGUI_Workshop::ProcessEvent: " - << "Got message, but it's not a Config_FeatureMessage"; + << "Catch message, but it can not be processed."; #endif } +/* + * + */ void XGUI_Workshop::addFeature(const Config_FeatureMessage* theMessage) { XGUI_MainMenu* aMenuBar = myMainWindow->menuObject(); - IWorkbench* aPage = aMenuBar->findWorkbench(tr( "GEN_MENU_TITLE" ) + "_Workbench"); + XGUI_Workbench* aPage = aMenuBar->findWorkbench(tr( "GEN_MENU_TITLE" ) + "_Workbench"); if(!aPage) { #ifdef _DEBUG qDebug() << "XGUI_Workshop::ProcessEvent: " @@ -126,13 +128,12 @@ void XGUI_Workshop::addFeature(const Config_FeatureMessage* theMessage) aPage = addWorkbench(tr( "GEN_MENU_TITLE" )); } QString aGroupName = QString::fromStdString(theMessage->m_group); - IMenuGroup* aGroup = aPage->findGroup(aGroupName); + QString aFeatureId = QString::fromStdString(theMessage->m_id); + XGUI_MenuGroupPanel* aGroup = aPage->findGroup(aGroupName); if(!aGroup) { aGroup = aPage->addGroup(aGroupName); } - IFeatureMenu* aCommand; - aCommand = aGroup->addFeature( - QString::fromStdString(theMessage->m_id), + XGUI_Command* aCommand = aGroup->addFeature(aFeatureId, QString::fromStdString(theMessage->m_text), QString::fromStdString(theMessage->m_tooltip), QIcon(theMessage->m_icon.c_str()) @@ -170,7 +171,7 @@ void XGUI_Workshop::onSaveAs() } //****************************************************** -IModule* XGUI_Workshop::loadModule(const QString& theModule) +XGUI_Module* XGUI_Workshop::loadModule(const QString& theModule) { QString libName = library( theModule ); if ( libName.isEmpty() ) @@ -219,7 +220,7 @@ IModule* XGUI_Workshop::loadModule(const QString& theModule) } #endif - IModule* aModule = crtInst ? crtInst(this) : 0; + XGUI_Module* aModule = crtInst ? crtInst(this) : 0; if ( !err.isEmpty() ) { if ( mainWindow() && mainWindow()->isVisible() ) @@ -234,7 +235,7 @@ IModule* XGUI_Workshop::loadModule(const QString& theModule) bool XGUI_Workshop::activateModule() { // Test of modules loading - IModule* aModule = loadModule("GeomModule"); + XGUI_Module* aModule = loadModule("PartSet"); if (!aModule) return false; aModule->createFeatures(); diff --git a/src/XGUI/XGUI_Workshop.h b/src/XGUI/XGUI_Workshop.h index b0471732f..e6aa99707 100644 --- a/src/XGUI/XGUI_Workshop.h +++ b/src/XGUI/XGUI_Workshop.h @@ -2,8 +2,6 @@ #ifndef XGUI_WORKSHOP_H #define XGUI_WORKSHOP_H -#include "XGUI_Interfaces.h" - #include #include @@ -15,10 +13,11 @@ class XGUI_MainWindow; class XGUI_Command; class XGUI_Module; +class XGUI_Workbench; class Config_FeatureMessage; -class XGUI_Workshop: public QObject, public Event_Listener, public IWorkshop +class XGUI_Workshop: public QObject, public Event_Listener { Q_OBJECT public: @@ -30,7 +29,7 @@ public: XGUI_MainWindow* mainWindow() const { return myMainWindow; } - virtual IWorkbench* addWorkbench(const QString& theName); + XGUI_Workbench* addWorkbench(const QString& theName); virtual void ProcessEvent(const Event_Message* theMessage); @@ -48,7 +47,7 @@ protected: private: void initMenu(); - IModule* loadModule(const QString& theModule); + XGUI_Module* loadModule(const QString& theModule); bool activateModule(); XGUI_MainWindow* myMainWindow;