From 5bd491bf7444d3859f91ed88142e6186d8881f6e Mon Sep 17 00:00:00 2001 From: Sergey Belash Date: Thu, 20 Mar 2014 12:46:49 +0400 Subject: [PATCH] Re-factoring: interfaces removed from "XGUI", "GeomModule" renamed to "PartSet" --- CMakeLists.txt | 2 +- src/GeomModule/GeomModule.h | 25 ------- src/GeomModule/GeomModule_Defs.h | 16 ----- src/{GeomModule => PartSet}/CMakeLists.txt | 27 ++++---- src/PartSet/PartSet.h | 18 +++++ .../PartSet_Module.cpp} | 12 ++-- src/PartSet/PartSet_Module.h | 25 +++++++ .../PartSet_icons.qrc} | 0 .../PartSet_msg_en.ts} | 0 src/{GeomModule => PartSet}/icons/axis.png | Bin src/{GeomModule => PartSet}/icons/common.png | Bin src/{GeomModule => PartSet}/icons/cut.png | Bin .../icons/duplicate.png | Bin .../icons/extrusion.png | Bin src/{GeomModule => PartSet}/icons/fusion.png | Bin src/{GeomModule => PartSet}/icons/import.png | Bin src/{GeomModule => PartSet}/icons/plane.png | Bin src/{GeomModule => PartSet}/icons/point.png | Bin src/{GeomModule => PartSet}/icons/remove.png | Bin src/{GeomModule => PartSet}/icons/revol.png | Bin src/XGUI/XGUI_Command.h | 6 +- src/XGUI/XGUI_Interfaces.h | 63 ------------------ src/XGUI/XGUI_MainMenu.cpp | 8 +-- src/XGUI/XGUI_MainMenu.h | 16 +++-- src/XGUI/XGUI_MenuGroupPanel.cpp | 2 +- src/XGUI/XGUI_MenuGroupPanel.h | 18 +++-- src/XGUI/XGUI_Module.h | 26 ++++++++ src/XGUI/XGUI_Workbench.cpp | 4 +- src/XGUI/XGUI_Workbench.h | 16 ++--- src/XGUI/XGUI_Workshop.cpp | 41 ++++++------ src/XGUI/XGUI_Workshop.h | 9 ++- 31 files changed, 148 insertions(+), 186 deletions(-) delete mode 100644 src/GeomModule/GeomModule.h delete mode 100644 src/GeomModule/GeomModule_Defs.h rename src/{GeomModule => PartSet}/CMakeLists.txt (76%) create mode 100644 src/PartSet/PartSet.h rename src/{GeomModule/GeomModule.cpp => PartSet/PartSet_Module.cpp} (53%) create mode 100644 src/PartSet/PartSet_Module.h rename src/{GeomModule/GeomModule_icons.qrc => PartSet/PartSet_icons.qrc} (100%) rename src/{GeomModule/GeomModule_msg_en.ts => PartSet/PartSet_msg_en.ts} (100%) rename src/{GeomModule => PartSet}/icons/axis.png (100%) rename src/{GeomModule => PartSet}/icons/common.png (100%) rename src/{GeomModule => PartSet}/icons/cut.png (100%) rename src/{GeomModule => PartSet}/icons/duplicate.png (100%) rename src/{GeomModule => PartSet}/icons/extrusion.png (100%) rename src/{GeomModule => PartSet}/icons/fusion.png (100%) rename src/{GeomModule => PartSet}/icons/import.png (100%) rename src/{GeomModule => PartSet}/icons/plane.png (100%) rename src/{GeomModule => PartSet}/icons/point.png (100%) rename src/{GeomModule => PartSet}/icons/remove.png (100%) rename src/{GeomModule => PartSet}/icons/revol.png (100%) delete mode 100644 src/XGUI/XGUI_Interfaces.h create mode 100644 src/XGUI/XGUI_Module.h 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/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/CMakeLists.txt b/src/PartSet/CMakeLists.txt similarity index 76% rename from src/GeomModule/CMakeLists.txt rename to src/PartSet/CMakeLists.txt index 540798c8d..b8c89c47c 100644 --- a/src/GeomModule/CMakeLists.txt +++ b/src/PartSet/CMakeLists.txt @@ -3,20 +3,20 @@ CMAKE_MINIMUM_REQUIRED(VERSION 2.8.11) INCLUDE(Common) SET(PROJECT_HEADERS - GeomModule_Defs.h - GeomModule.h + PartSet.h + PartSet_Module.h ) SET(PROJECT_SOURCES - GeomModule.cpp + PartSet_Module.cpp ) SET(PROJECT_RESOURCES - GeomModule_icons.qrc + PartSet_icons.qrc ) SET(TEXT_RESOURCES - GeomModule_msg_en.ts + PartSet_msg_en.ts ) SET(PROJECT_LIBRARIES @@ -30,7 +30,12 @@ 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 +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} @@ -38,13 +43,7 @@ ADD_LIBRARY(GeomModule SHARED ${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}) +TARGET_LINK_LIBRARIES(PartSet ${PROJECT_LIBRARIES}) -INSTALL(TARGETS GeomModule DESTINATION bin) +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/GeomModule/GeomModule.cpp b/src/PartSet/PartSet_Module.cpp similarity index 53% rename from src/GeomModule/GeomModule.cpp rename to src/PartSet/PartSet_Module.cpp index f3bc0fd16..2121a26a6 100644 --- a/src/GeomModule/GeomModule.cpp +++ b/src/PartSet/PartSet_Module.cpp @@ -1,4 +1,4 @@ -#include "GeomModule.h" +#include "PartSet_Module.h" #include @@ -8,24 +8,24 @@ #include /*!Create and return new instance of XGUI_Module*/ -extern "C" GM_EXPORT IModule* createModule(IWorkshop* theWshop) +extern "C" PARTSET_EXPORT XGUI_Module* createModule(XGUI_Workshop* theWshop) { - return new GeomModule(theWshop); + return new PartSet_Module(theWshop); } -GeomModule::GeomModule(IWorkshop* theWshop) +PartSet_Module::PartSet_Module(XGUI_Workshop* theWshop) { myWorkshop = theWshop; } -GeomModule::~GeomModule() +PartSet_Module::~PartSet_Module() { } -void GeomModule::createFeatures() +void PartSet_Module::createFeatures() { Config_XMLReader* aReader = new Config_XMLReader("plugin-PartSet.xml"); 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/GeomModule/GeomModule_icons.qrc b/src/PartSet/PartSet_icons.qrc similarity index 100% rename from src/GeomModule/GeomModule_icons.qrc rename to src/PartSet/PartSet_icons.qrc diff --git a/src/GeomModule/GeomModule_msg_en.ts b/src/PartSet/PartSet_msg_en.ts similarity index 100% rename from src/GeomModule/GeomModule_msg_en.ts rename to src/PartSet/PartSet_msg_en.ts diff --git a/src/GeomModule/icons/axis.png b/src/PartSet/icons/axis.png similarity index 100% rename from src/GeomModule/icons/axis.png rename to src/PartSet/icons/axis.png diff --git a/src/GeomModule/icons/common.png b/src/PartSet/icons/common.png similarity index 100% rename from src/GeomModule/icons/common.png rename to src/PartSet/icons/common.png diff --git a/src/GeomModule/icons/cut.png b/src/PartSet/icons/cut.png similarity index 100% rename from src/GeomModule/icons/cut.png rename to src/PartSet/icons/cut.png diff --git a/src/GeomModule/icons/duplicate.png b/src/PartSet/icons/duplicate.png similarity index 100% rename from src/GeomModule/icons/duplicate.png rename to src/PartSet/icons/duplicate.png diff --git a/src/GeomModule/icons/extrusion.png b/src/PartSet/icons/extrusion.png similarity index 100% rename from src/GeomModule/icons/extrusion.png rename to src/PartSet/icons/extrusion.png diff --git a/src/GeomModule/icons/fusion.png b/src/PartSet/icons/fusion.png similarity index 100% rename from src/GeomModule/icons/fusion.png rename to src/PartSet/icons/fusion.png diff --git a/src/GeomModule/icons/import.png b/src/PartSet/icons/import.png similarity index 100% rename from src/GeomModule/icons/import.png rename to src/PartSet/icons/import.png diff --git a/src/GeomModule/icons/plane.png b/src/PartSet/icons/plane.png similarity index 100% rename from src/GeomModule/icons/plane.png rename to src/PartSet/icons/plane.png diff --git a/src/GeomModule/icons/point.png b/src/PartSet/icons/point.png similarity index 100% rename from src/GeomModule/icons/point.png rename to src/PartSet/icons/point.png diff --git a/src/GeomModule/icons/remove.png b/src/PartSet/icons/remove.png similarity index 100% rename from src/GeomModule/icons/remove.png rename to src/PartSet/icons/remove.png diff --git a/src/GeomModule/icons/revol.png b/src/PartSet/icons/revol.png similarity index 100% rename from src/GeomModule/icons/revol.png rename to src/PartSet/icons/revol.png 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; -- 2.39.2