]> SALOME platform Git repositories - modules/shaper.git/commitdiff
Salome HOME
Updated GUI according to GUI specification V3.
authorvsv <vitaly.smetannikov@opencascade.com>
Thu, 13 Mar 2014 10:09:12 +0000 (14:09 +0400)
committervsv <vitaly.smetannikov@opencascade.com>
Thu, 13 Mar 2014 10:09:12 +0000 (14:09 +0400)
36 files changed:
CMakeLists.txt
src/GeomModule/GeomModule.cpp
src/GeomModule/GeomModule_icons.qrc
src/GeomModule/icons/axis.png [new file with mode: 0644]
src/GeomModule/icons/box.png [deleted file]
src/GeomModule/icons/common.png [new file with mode: 0644]
src/GeomModule/icons/cut.png [new file with mode: 0644]
src/GeomModule/icons/cylinder.png [deleted file]
src/GeomModule/icons/disk.png [deleted file]
src/GeomModule/icons/duplicate.png [new file with mode: 0644]
src/GeomModule/icons/extrusion.png [new file with mode: 0644]
src/GeomModule/icons/fusion.png [new file with mode: 0644]
src/GeomModule/icons/import.png [new file with mode: 0644]
src/GeomModule/icons/plane.png [new file with mode: 0644]
src/GeomModule/icons/point.png [new file with mode: 0644]
src/GeomModule/icons/remove.png [new file with mode: 0644]
src/GeomModule/icons/revol.png [new file with mode: 0644]
src/GeomModule/icons/torus.png [deleted file]
src/XGUI/XGUI_Command.cpp
src/XGUI/XGUI_Command.h
src/XGUI/XGUI_Interfaces.h
src/XGUI/XGUI_MainMenu.cpp
src/XGUI/XGUI_MainMenu.h
src/XGUI/XGUI_MainWindow.cpp
src/XGUI/XGUI_MenuGroupPanel.cpp
src/XGUI/XGUI_MenuGroupPanel.h
src/XGUI/XGUI_Workbench.cpp
src/XGUI/XGUI_Workbench.h
src/XGUI/XGUI_Workshop.cpp
src/XGUI/XGUI_Workshop.h
src/XGUI/XGUI_msg_en.ts
src/XGUI/XGUI_pictures.qrc
src/XGUI/pictures/copy.png [deleted file]
src/XGUI/pictures/cut.png [deleted file]
src/XGUI/pictures/paste.png [deleted file]
src/XGUI/pictures/rebuild.png [new file with mode: 0644]

index 4ffaeb0c88dd92e235b307433b0f5527b1013ea6..d58767ec6b9ee5ed5b2eff728a795b83fbafc25c 100644 (file)
@@ -10,4 +10,4 @@ INCLUDE(FindQt5)
 #ADD_SUBDIRECTORY (src/ModelAPI)
 #ADD_SUBDIRECTORY (src/Model)
 ADD_SUBDIRECTORY (src/XGUI)
-#ADD_SUBDIRECTORY (src/GeomModule)
+ADD_SUBDIRECTORY (src/GeomModule)
index 37ec7e5b2361162ebdbbc94a43638a6a283a388d..5bac1033695d82076e4d01072982f094c46d5236 100644 (file)
@@ -25,12 +25,27 @@ GeomModule::~GeomModule()
 
 void GeomModule::createFeatures()
 {
-    int aPageId = myWorkshop->addWorkbench("Primitives");
-    int aGroupId = myWorkshop->addGroup(aPageId);
-    int aCommand = myWorkshop->addFeature(aPageId, aGroupId, "Box", "Create Box", QIcon(":icons/box.png"), QKeySequence());
-    aCommand = myWorkshop->addFeature(aPageId, aGroupId, "Cylinder", "Create Cylinder", QIcon(":icons/cylinder.png"), QKeySequence());
-    aCommand = myWorkshop->addFeature(aPageId, aGroupId, "Disk", "Create Disk", QIcon(":icons/disk.png"), QKeySequence());
-    aCommand = myWorkshop->addFeature(aPageId, aGroupId, "Torus", "Create Torus", QIcon(":icons/torus.png"), QKeySequence());
-
-    aPageId = myWorkshop->addWorkbench("Operations");
+    IWorkbench* aPage = myWorkshop->addWorkbench("Primitives");
+    IMenuGroup* aGroup = aPage->addGroup();
+
+    IFeatureMenu* aCommand = aGroup->addFeature("new_part", "Part", "Creates a new part", QIcon(":pictures/part_ico.png"));
+    aCommand = aGroup->addFeature("new_point", "Point", "Create a new point", QIcon(":icons/point.png"));
+    aCommand = aGroup->addFeature("new_axis", "Axis", "Create a new axis", QIcon(":icons/axis.png"), QKeySequence());
+    aCommand = aGroup->addFeature("new_plane", "Plane", "Create a new plane", QIcon(":icons/plane.png"), QKeySequence());
+
+    //aGroup = aPage->addGroup();
+    aCommand = aGroup->addFeature("duplicate", "Duplicate", "Duplicate selected object", QIcon(":icons/duplicate.png"));
+    aCommand = aGroup->addFeature("remove", "Remove", "Remove selected object", QIcon(":icons/remove.png"));
+
+    aPage = myWorkshop->addWorkbench("Features");
+    aGroup = aPage->addGroup();
+
+    aCommand = aGroup->addFeature("extrusion", "Extrusion", "Make extrusion", QIcon(":icons/extrusion.png"));
+    aCommand = aGroup->addFeature("cut", "Cut", "Make cut", QIcon(":icons/cut.png"));
+    aCommand = aGroup->addFeature("fusion", "Fusion", "Make fusion", QIcon(":icons/fusion.png"));
+    aCommand = aGroup->addFeature("revolution", "Revolution", "Make revolution", QIcon(":icons/revol.png"));
+    aCommand = aGroup->addFeature("common", "Common", "Make common", QIcon(":icons/common.png"));
+
+    //aGroup = aPage->addGroup();
+    aCommand = aGroup->addFeature("import", "Import", "Make import", QIcon(":icons/import.png"));
 }
\ No newline at end of file
index 3f6a8a3617e5aa614a0a38f1780646d4bd3593c3..571e1cd6fb9279b16fbe1d05082d65c3e37a55c2 100644 (file)
@@ -1,8 +1,15 @@
  <!DOCTYPE RCC><RCC version="1.0">
  <qresource>
-     <file>icons/box.png</file>
-     <file>icons/cylinder.png</file>
-     <file>icons/disk.png</file>
-     <file>icons/torus.png</file>
+     <file>icons/point.png</file>
+     <file>icons/plane.png</file>
+     <file>icons/axis.png</file>
+     <file>icons/duplicate.png</file>
+     <file>icons/remove.png</file>
+     <file>icons/extrusion.png</file>
+     <file>icons/cut.png</file>
+     <file>icons/fusion.png</file>
+     <file>icons/revol.png</file>
+     <file>icons/common.png</file>
+     <file>icons/import.png</file>
  </qresource>
  </RCC>
diff --git a/src/GeomModule/icons/axis.png b/src/GeomModule/icons/axis.png
new file mode 100644 (file)
index 0000000..5f5bfff
Binary files /dev/null and b/src/GeomModule/icons/axis.png differ
diff --git a/src/GeomModule/icons/box.png b/src/GeomModule/icons/box.png
deleted file mode 100644 (file)
index 3047d92..0000000
Binary files a/src/GeomModule/icons/box.png and /dev/null differ
diff --git a/src/GeomModule/icons/common.png b/src/GeomModule/icons/common.png
new file mode 100644 (file)
index 0000000..7deab35
Binary files /dev/null and b/src/GeomModule/icons/common.png differ
diff --git a/src/GeomModule/icons/cut.png b/src/GeomModule/icons/cut.png
new file mode 100644 (file)
index 0000000..0d43adb
Binary files /dev/null and b/src/GeomModule/icons/cut.png differ
diff --git a/src/GeomModule/icons/cylinder.png b/src/GeomModule/icons/cylinder.png
deleted file mode 100644 (file)
index a00136d..0000000
Binary files a/src/GeomModule/icons/cylinder.png and /dev/null differ
diff --git a/src/GeomModule/icons/disk.png b/src/GeomModule/icons/disk.png
deleted file mode 100644 (file)
index 8aad056..0000000
Binary files a/src/GeomModule/icons/disk.png and /dev/null differ
diff --git a/src/GeomModule/icons/duplicate.png b/src/GeomModule/icons/duplicate.png
new file mode 100644 (file)
index 0000000..1a5de9b
Binary files /dev/null and b/src/GeomModule/icons/duplicate.png differ
diff --git a/src/GeomModule/icons/extrusion.png b/src/GeomModule/icons/extrusion.png
new file mode 100644 (file)
index 0000000..12bbe45
Binary files /dev/null and b/src/GeomModule/icons/extrusion.png differ
diff --git a/src/GeomModule/icons/fusion.png b/src/GeomModule/icons/fusion.png
new file mode 100644 (file)
index 0000000..7fca3fe
Binary files /dev/null and b/src/GeomModule/icons/fusion.png differ
diff --git a/src/GeomModule/icons/import.png b/src/GeomModule/icons/import.png
new file mode 100644 (file)
index 0000000..2a6ba81
Binary files /dev/null and b/src/GeomModule/icons/import.png differ
diff --git a/src/GeomModule/icons/plane.png b/src/GeomModule/icons/plane.png
new file mode 100644 (file)
index 0000000..3075a34
Binary files /dev/null and b/src/GeomModule/icons/plane.png differ
diff --git a/src/GeomModule/icons/point.png b/src/GeomModule/icons/point.png
new file mode 100644 (file)
index 0000000..de84d96
Binary files /dev/null and b/src/GeomModule/icons/point.png differ
diff --git a/src/GeomModule/icons/remove.png b/src/GeomModule/icons/remove.png
new file mode 100644 (file)
index 0000000..6c64527
Binary files /dev/null and b/src/GeomModule/icons/remove.png differ
diff --git a/src/GeomModule/icons/revol.png b/src/GeomModule/icons/revol.png
new file mode 100644 (file)
index 0000000..3400b62
Binary files /dev/null and b/src/GeomModule/icons/revol.png differ
diff --git a/src/GeomModule/icons/torus.png b/src/GeomModule/icons/torus.png
deleted file mode 100644 (file)
index af76fc0..0000000
Binary files a/src/GeomModule/icons/torus.png and /dev/null differ
index 4c4249c6ff905e3d430a753bd468e7445c0e1471..3ba1689a3b5168c44bb828a7f22de419154429ee 100644 (file)
@@ -2,13 +2,13 @@
 
 #include <QPushButton>
 
-XGUI_Command::XGUI_Command(QObject * parent) :
-    QWidgetAction(parent)
+XGUI_Command::XGUI_Command(const QString& theId, QObject * parent) :
+    QWidgetAction(parent), myId(theId)
 {
 }
 
-XGUI_Command::XGUI_Command(const QIcon& icon, const QString& text, QObject* parent):
-    QWidgetAction(parent)
+XGUI_Command::XGUI_Command(const QString& theId, const QIcon& icon, const QString& text, QObject* parent):
+    QWidgetAction(parent), myId(theId)
 {
     setIcon(icon);
     setText(text);
@@ -39,4 +39,24 @@ QWidget* XGUI_Command::createWidget(QWidget* theParent)
         return aBtn;
     }
     return QWidgetAction::createWidget(theParent);
+}
+
+bool XGUI_Command::enabled() const
+{
+    return isEnabled();
+}
+
+void XGUI_Command::enable()
+{
+    setEnabled(true);
+}
+
+void XGUI_Command::disable()
+{
+    setEnabled(false);
+}
+
+void XGUI_Command::connectTo(const QObject* theResiver, const char* theSlot)
+{
+    connect(this, SIGNAL(triggered()), theResiver, theSlot);
 }
\ No newline at end of file
index 8f1caf154ac41a4790b07bb487840fb8c7fb2efa..e3759a4aa922644f588a1d1c61d465f7fcd99137 100644 (file)
@@ -1,22 +1,34 @@
 #ifndef XGUI_Command_H
 #define XGUI_Command_H
 
+#include "XGUI_Interfaces.h"
+
 #include <QWidgetAction>
 
 #define MIN_BUTTON_HEIGHT 18
 #define MIN_BUTTON_WIDTH 40
 
 
-class XGUI_Command : public QWidgetAction
+class XGUI_Command : public QWidgetAction, public IFeatureMenu
 {
     Q_OBJECT
 public:
-    XGUI_Command(QObject * parent);
-    XGUI_Command(const QIcon& icon, const QString& text, QObject* parent);
+    XGUI_Command(const QString& theId, QObject * parent);
+    XGUI_Command(const QString& theId, const QIcon& icon, const QString& text, QObject* parent);
     ~XGUI_Command();
 
+    virtual bool enabled() const;
+    virtual void enable();
+    virtual void disable();
+    virtual QString getId() const { return myId; }
+
+    virtual void connectTo(const QObject* theResiver, const char* theSlot);
+
 protected:
     virtual QWidget* createWidget(QWidget* theParent);
+
+private:
+    QString myId;
 };
 
 #endif
\ No newline at end of file
index 12725017c0b9f9e6b050f6a327f4171347270d27..d54bba43bbe3879d18797962c711f111048193fa 100644 (file)
@@ -6,17 +6,40 @@
 #include <QIcon>
 #include <QKeySequence>
 
-class IWorkshop
+
+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 int addWorkbench(const QString& theName) = 0;
+    virtual IMenuGroup* addGroup() = 0;
+};
 
-    virtual int addGroup(int thePageId) = 0;
 
-    virtual int addFeature(int thePageId, int theGroupId, 
-                           const QString& theTitle, const QString& theTip, 
-                           const QIcon& theIcon, 
-                           const QKeySequence& theKeys = QKeySequence()) = 0;
+class IWorkshop
+{
+public:
+    virtual IWorkbench* addWorkbench(const QString& theName) = 0;
 };
 
 
index 0be7579aaa9626ae08df1addc1215d4f6e5ec935..0a4903bcea28b92a50b13f46b89b46bbf9bd604c 100644 (file)
@@ -18,7 +18,7 @@ XGUI_MainMenu::~XGUI_MainMenu(void)
 {
 }
 
-int XGUI_MainMenu::addWorkbench(QString theTitle)
+IWorkbench* XGUI_MainMenu::addWorkbench(QString theTitle)
 {
     QDockWidget* aDoc = new QDockWidget(myDesktop);
     aDoc->setFeatures(QDockWidget::DockWidgetVerticalTitleBar);
@@ -37,19 +37,13 @@ int XGUI_MainMenu::addWorkbench(QString theTitle)
 
 
     myMenuTabs.append(aDoc);
-    return myMenuTabs.length() - 1;
+    return aPage;
 }
 
 
-int XGUI_MainMenu::addGroup(int thePageId)
+IMenuGroup* XGUI_MainMenu::addGroup(int thePageId)
 {
     XGUI_Workbench* aPage = dynamic_cast<XGUI_Workbench*>(myMenuTabs[thePageId]->widget());
     return aPage->addGroup();
 }
 
-void XGUI_MainMenu::addCommand(int thePageId, int theGroupId, XGUI_Command* theCommand)
-{
-    XGUI_Workbench* aPage = dynamic_cast<XGUI_Workbench*>(myMenuTabs[thePageId]->widget());
-    aPage->addCommand(theGroupId, theCommand);
-}
-
index 3521be3c09584ab8b9b81f09f2e971c53380ab3e..ef4dc0511dcda16b15ede7435f39470f62503ff0 100644 (file)
@@ -1,6 +1,8 @@
 #ifndef XGUI_MainMenu_H
 #define XGUI_MainMenu_H
 
+#include "XGUI_Interfaces.h"
+
 #include <QObject>
 #include <QList>
 
@@ -19,11 +21,9 @@ public:
     XGUI_MainMenu(XGUI_MainWindow *parent);
     virtual ~XGUI_MainMenu();
 
-    int addWorkbench(QString theTitle);
-
-    int addGroup(int thePageId);
+    IWorkbench* addWorkbench(QString theTitle);
 
-    void addCommand(int thePageId, int theGroupId, XGUI_Command* theCommand);
+    IMenuGroup* addGroup(int thePageId);
 
 private:
     XGUI_MainWindow* myDesktop;
index 729f1869bcc76703835c51436da5703481cb1a41..f5c82a4bc76f1c38652cdc1a73e306d736ebea8d 100644 (file)
@@ -17,6 +17,7 @@
 #include <QFormLayout>
 #include <QDoubleSpinBox>
 #include <QPushButton>
+#include <QScrollArea>
 
 XGUI_MainWindow::XGUI_MainWindow(QWidget* parent) :
     QMainWindow(parent), myObjectBrowser(0)
@@ -36,12 +37,12 @@ XGUI_MainWindow::XGUI_MainWindow(QWidget* parent) :
 
     aDoc = new QDockWidget(this);
     aDoc->setFeatures(QDockWidget::AllDockWidgetFeatures | QDockWidget::DockWidgetVerticalTitleBar);
-    aDoc->setMinimumHeight(20);
+    aDoc->setMinimumHeight(0);
     aDoc->setWindowTitle("Console");
     QTextEdit* aTextEdt = new QTextEdit(aDoc);
     aTextEdt->setText(">>>");
-    aTextEdt->setMinimumHeight(20);
     aDoc->setWidget(aTextEdt);
+    aTextEdt->setMinimumHeight(0);
     addDockWidget(Qt::BottomDockWidgetArea, aDoc);
 
     QMdiArea* aMdiArea = new QMdiArea(this);
@@ -57,7 +58,6 @@ XGUI_MainWindow::XGUI_MainWindow(QWidget* parent) :
 QWidget* XGUI_MainWindow::getSubWindow()
 {
     QMdiSubWindow* aSub = new QMdiSubWindow(this);
-    aSub->setGeometry(0,0, 600, 400);
     QLabel* aLbl = new QLabel(aSub);
     aLbl->setFrameStyle(QFrame::Sunken);
     aLbl->setFrameShape(QFrame::Panel);
index b88960f7b769d6fc7868fb8001e5b0f1ec9ff21f..0753625d5c476f1615c896e5173f30f2fc389206 100644 (file)
@@ -20,7 +20,8 @@ XGUI_MenuGroupPanel::XGUI_MenuGroupPanel(QWidget *parent) :
 
 void XGUI_MenuGroupPanel::addCommand(XGUI_Command* theAction)
 {
-    addWidget(theAction->requestWidget(this));
+    myActions[theAction] = theAction->requestWidget(this);
+    addWidget(myActions[theAction]);
 }
 
 void XGUI_MenuGroupPanel::placeWidget(QWidget* theWgt)
@@ -36,14 +37,13 @@ void XGUI_MenuGroupPanel::placeWidget(QWidget* theWgt)
 void XGUI_MenuGroupPanel::addWidget(QWidget* theWgt)
 {
     placeWidget(theWgt);
-    myWidgets.append(theWgt);
 }
 
 
 void XGUI_MenuGroupPanel::resizeEvent(QResizeEvent* theEvent)
 {
     QWidget::resizeEvent(theEvent);
-    if (myWidgets.size() == 0)
+    if (myActions.size() == 0)
         return;
 
     int aH = theEvent->size().height();
@@ -52,10 +52,24 @@ void XGUI_MenuGroupPanel::resizeEvent(QResizeEvent* theEvent)
         return;
 
     myMaxRow = aMaxRow;
-    QListIterator<QWidget*> aIt(myWidgets);
+    QListIterator<QWidget*> aIt(myActions.values());
     myNewRow = 0;
     myNewCol = 0;
     while (aIt.hasNext()) {
        placeWidget(aIt.next());
     }
 }
+
+IFeatureMenu* XGUI_MenuGroupPanel::addFeature(const QString& theId, const QString& theTitle, 
+                                              const QString& theTip, 
+                                              const QIcon& theIcon, 
+                                              const QKeySequence& theKeys)
+{
+    XGUI_Command* aCommand = new XGUI_Command(theId, theIcon, theTitle, this);
+    aCommand->setToolTip(theTip);
+    if (!theKeys.isEmpty())
+        aCommand->setShortcut(theKeys);
+
+    addCommand(aCommand);
+    return aCommand;
+}
index 7fe95cff5edfb8dfc05defb1ccf1a9aeb5114e12..cda62888c6104459074158d7255f42b3deac481b 100644 (file)
@@ -2,19 +2,25 @@
 #ifndef XGUI_MenuGroupPanel_H
 #define XGUI_MenuGroupPanel_H
 
+#include "XGUI_Interfaces.h"
+
 #include <QWidget>
-#include <QList>
+#include <QMap>
 
 class QGridLayout;
 class XGUI_Command;
 
-class XGUI_MenuGroupPanel : public QWidget
+class XGUI_MenuGroupPanel : public QWidget, public IMenuGroup
 {
     Q_OBJECT
 public:
     explicit XGUI_MenuGroupPanel(QWidget *parent = 0);
 
-    void addCommand(XGUI_Command* theAction);
+    virtual IFeatureMenu* addFeature(const QString& theId, 
+                                     const QString& theTitle, 
+                                     const QString& theTip, 
+                                     const QIcon& theIcon, 
+                                     const QKeySequence& theKeys = QKeySequence());
 
 protected:
     virtual void resizeEvent(QResizeEvent *theEvent);
@@ -22,8 +28,9 @@ protected:
 private:
     void addWidget(QWidget* theWgt);
     void placeWidget(QWidget* theWgt);
+    void addCommand(XGUI_Command* theAction);
 
-    QList<QWidget*> myWidgets;
+    QMap<XGUI_Command*, QWidget*> myActions;
     QGridLayout* myLayout;
     int myNewRow;
     int myNewCol;
index 3cecc44b9cb091fa5187392bdf9fda7dd502620e..f73c693fc8ceb045c1dec92c3213e5ebc3b63ead 100644 (file)
@@ -43,7 +43,6 @@ XGUI_Workbench::XGUI_Workbench(QWidget *theParent) :
 
     myLeftButton = new QPushButton("<", this);
     myLeftButton->setMaximumWidth(14);
-    //myLeftButton->setEnabled(false);
     myLeftButton->setVisible(false);
     connect(myLeftButton,SIGNAL(clicked()), this, SLOT(onLeftScroll()));
     aMainLayout->addWidget(myLeftButton);
@@ -70,7 +69,7 @@ XGUI_Workbench::XGUI_Workbench(QWidget *theParent) :
 
 }
 
-int XGUI_Workbench::addGroup()
+IMenuGroup* XGUI_Workbench::addGroup()
 {
     if (!myLayout->isEmpty()) {
         int aNb = myLayout->count();
@@ -82,7 +81,7 @@ int XGUI_Workbench::addGroup()
     addSeparator();
     myLayout->addStretch();
     myGroups.append(aGroup);
-    return myGroups.size() - 1;
+    return aGroup;
 }
 
 void XGUI_Workbench::addSeparator()
@@ -93,13 +92,6 @@ void XGUI_Workbench::addSeparator()
     myLayout->addWidget(aLine);
 }
 
-void XGUI_Workbench::addCommand(int theGroupId, XGUI_Command* theCommand)
-{
-    XGUI_MenuGroupPanel* aGroup = myGroups.at(theGroupId);
-    aGroup->addCommand(theCommand);
-}
-
-
 void XGUI_Workbench::resizeEvent(QResizeEvent* theEvent)
 {
     QWidget::resizeEvent(theEvent);
index d7916351a706cdec9a5687e5b38f6d79e294eae3..506845adbddbe84bf0016eafe8f98c89bb8803e3 100644 (file)
@@ -2,6 +2,8 @@
 #ifndef XGUI_Workbench_H
 #define XGUI_Workbench_H
 
+#include "XGUI_Interfaces.h"
+
 #include <QWidget>
 #include <QScrollArea>
 #include <QList>
@@ -13,15 +15,13 @@ class CommandsArea;
 class XGUI_Command;
 
 
-class XGUI_Workbench : public QWidget
+class XGUI_Workbench : public QWidget, public IWorkbench
 {
     Q_OBJECT
 public:
     XGUI_Workbench(QWidget* theParent);
 
-    int addGroup();
-
-    void addCommand(int theGroupId, XGUI_Command* theCommand);
+    virtual IMenuGroup* addGroup();
 
 private slots:
     void onLeftScroll();
index 810e0344bc6b142ab5291c0556332c6f361afd20..191e960a0c87daa56c4964a1bba81bd5c6b3938b 100644 (file)
@@ -37,110 +37,57 @@ void XGUI_Workshop::startApplication()
 //******************************************************
 void XGUI_Workshop::initMenu()
 {
-    int aPageId = addWorkbench(tr("HOME_MENU_TITLE"));
+    IWorkbench* aPage = addWorkbench(tr("HOME_MENU_TITLE"));
 
     // File commands group
-    int aGroupId = addGroup(aPageId);
+    IMenuGroup* aGroup = aPage->addGroup();
 
-    XGUI_Command* aCommand;
+    IFeatureMenu* aCommand;
 
-    //aCommand = createMenuCommand(aPageId, aGroupId, NEW_CMD, tr("NEW_MENU"), tr("NEW_MENU_TIP"),
-    //                             QIcon(":pictures/new.png"), QKeySequence::New);
-    //connect(aCommand, SIGNAL(triggered()), this, SLOT(onNew()));
+    aCommand = aGroup->addFeature("NEW_CMD", tr("NEW_MENU"), tr("NEW_MENU_TIP"),
+                                  QIcon(":pictures/new.png"), QKeySequence::New);
+    aCommand->connectTo(this, SLOT(onNew()));
 
-    //aCommand = createMenuCommand(aPageId, aGroupId, OPEN_CMD, tr("OPEN_MENU"), tr("OPEN_MENU_TIP"),
-    //                             QIcon(":pictures/open.png"), QKeySequence::Open);
-    //connect(aCommand, SIGNAL(triggered()), this, SLOT(onOpen()));
+    aCommand = aGroup->addFeature("OPEN_CMD", tr("OPEN_MENU"), tr("OPEN_MENU_TIP"),
+                                  QIcon(":pictures/open.png"), QKeySequence::Open);
+    aCommand->connectTo(this, SLOT(onOpen()));
 
-    aCommand = createMenuCommand(aPageId, aGroupId, SAVE_CMD, tr("SAVE_MENU"), tr("SAVE_MENU_TIP"),
-                                 QIcon(":pictures/save.png"), QKeySequence::Save);
-    connect(aCommand, SIGNAL(triggered()), this, SLOT(onSave()));
-    aCommand->setEnabled(false);
+    aCommand = aGroup->addFeature("SAVE_CMD", tr("SAVE_MENU"), tr("SAVE_MENU_TIP"),
+                                  QIcon(":pictures/save.png"), QKeySequence::Save);
+    aCommand->connectTo(this, SLOT(onSave()));
+    aCommand->disable();
 
-    aCommand = createMenuCommand(aPageId, aGroupId, SAVEAS_CMD, tr("SAVEAS_MENU"), tr("SAVEAS_MENU_TIP"),
-                                 QIcon(":pictures/save.png"));
-    connect(aCommand, SIGNAL(triggered()), this, SLOT(onSaveAs()));
-    aCommand->setEnabled(false);
 
+    aCommand = aGroup->addFeature("SAVEAS_CMD", tr("SAVEAS_MENU"), tr("SAVEAS_MENU_TIP"),
+                                  QIcon(":pictures/save.png"));
+    aCommand->connectTo(this, SLOT(onSaveAs()));
+    aCommand->disable();
 
     // Edit commands group
-    //aGroupId = addGroup(aPageId);
+    //aGroup = aPage->addGroup();
 
-    aCommand = createMenuCommand(aPageId, aGroupId, UNDO_CMD, tr("UNDO_MENU"), tr("UNDO_MENU_TIP"),
-                                 QIcon(":pictures/undo.png"), QKeySequence::Undo);
+    aCommand = aGroup->addFeature("UNDO_CMD", tr("UNDO_MENU"), tr("UNDO_MENU_TIP"),
+                                  QIcon(":pictures/undo.png"), QKeySequence::Undo);
 
-    aCommand = createMenuCommand(aPageId, aGroupId, REDO_CMD, tr("REDO_MENU"), tr("REDO_MENU_TIP"),
+    aCommand = aGroup->addFeature("REDO_CMD", tr("REDO_MENU"), tr("REDO_MENU_TIP"),
                                  QIcon(":pictures/redo.png"), QKeySequence::Redo);
 
-    //aCommand = createMenuCommand(aPageId, aGroupId, CUT_CMD, tr("CUT_MENU"), tr("CUT_MENU_TIP"),
-    //                             QIcon(":pictures/cut.png"), QKeySequence::Cut);
+    aCommand = aGroup->addFeature("REBUILD_CMD", tr("REBUILD_MENU"), tr("REBUILD_MENU_TIP"),
+                                 QIcon(":pictures/rebuild.png"));
 
-    //aCommand = createMenuCommand(aPageId, aGroupId, COPY_CMD, tr("COPY_MENU"), tr("COPY_MENU_TIP"),
-    //                             QIcon(":pictures/copy.png"), QKeySequence::Copy);
-
-    //aCommand = createMenuCommand(aPageId, aGroupId, PASTE_CMD, tr("PASTE_MENU"), tr("PASTE_MENU_TIP"),
-    //                             QIcon(":pictures/paste.png"), QKeySequence::Paste);
-
-    aCommand = createMenuCommand(aPageId, aGroupId, EXIT_CMD, tr("EXIT_MENU"), tr("EXIT_MENU_TIP"),
-                                 QIcon(":pictures/close.png"), QKeySequence::Close);
-    connect(aCommand, SIGNAL(triggered()), this, SLOT(onExit()));
-
-    // Tests
-    //aPageId = addWorkbench("Primitives");
-    //aGroupId = addGroup(aPageId);
-    //
-    //aCommand = createMenuCommand(aPageId, aGroupId, LAST_CMD, "Box", "Create Box", QIcon(":pictures/box.png"));
-    //aCommand = createMenuCommand(aPageId, aGroupId, LAST_CMD, "Cylinder", "Create Cylinder", QIcon(":pictures/cylinder.png"));
-    //aCommand = createMenuCommand(aPageId, aGroupId, LAST_CMD, "Disk", "Create Disk", QIcon(":pictures/disk.png"));
-    //aCommand = createMenuCommand(aPageId, aGroupId, LAST_CMD, "Torus", "Create Torus", QIcon(":pictures/torus.png"));
-
-    //aPageId = addWorkbench("Operations");
+    aCommand = aGroup->addFeature("EXIT_CMD", tr("EXIT_MENU"), tr("EXIT_MENU_TIP"),
+                                  QIcon(":pictures/close.png"), QKeySequence::Close);
+    aCommand->connectTo(this, SLOT(onExit()));
 
 }
 
 //******************************************************
-XGUI_Command* XGUI_Workshop::createMenuCommand(int thePageId, int theGroupId, XCommandId theCmdId, 
-                                               const QString& theTitle, const QString& theTip, 
-                                               const QIcon& theIcon, const QKeySequence& theKeys)
-{
-    XGUI_Command* aCommand = new XGUI_Command(theIcon, theTitle, this);
-    aCommand->setToolTip(theTip);
-    if (!theKeys.isEmpty())
-        aCommand->setShortcut(theKeys);
-    addCommand(theCmdId, thePageId, theGroupId, aCommand);
-    return aCommand;
-}
-
-//******************************************************
-int XGUI_Workshop::addWorkbench(const QString& theName)
+IWorkbench* XGUI_Workshop::addWorkbench(const QString& theName)
 {
     XGUI_MainMenu* aMenuBar = myMainWindow->menuObject();
     return aMenuBar->addWorkbench(theName);
 }
 
-//******************************************************
-int XGUI_Workshop::addGroup(int thePageId)
-{
-    XGUI_MainMenu* aMenuBar = myMainWindow->menuObject();
-    return aMenuBar->addGroup(thePageId);
-}
-
-//******************************************************
-void XGUI_Workshop::addCommand(XCommandId theCommandId, int thePageId, int theGroupId, XGUI_Command* theCommand)
-{
-    XGUI_MainMenu* aMenuBar = myMainWindow->menuObject();
-    aMenuBar->addCommand(thePageId, theGroupId, theCommand);
-    myCommands[theCommandId] = theCommand;
-}
-
-//******************************************************
-XGUI_Command* XGUI_Workshop::command(XCommandId theId) const
-{
-    if (myCommands.contains(theId))
-        return myCommands[theId];
-    return 0;
-}
-
 //******************************************************
 void XGUI_Workshop::onExit()
 {
@@ -242,11 +189,3 @@ bool XGUI_Workshop::activateModule()
     return true;
 }
 
-//******************************************************
-int XGUI_Workshop::addFeature(int thePageId, int theGroupId, 
-                           const QString& theTitle, const QString& theTip, 
-                           const QIcon& theIcon, 
-                           const QKeySequence& theKeys)
-{
-    return (int) createMenuCommand(thePageId, theGroupId, LAST_CMD, theTitle, theTip, theIcon, theKeys);
-}
index cfeb70092b332d850e2a3d293001bcad3441ae3c..c941f42d010269ac594d7954a3bbc19af6ba7623 100644 (file)
@@ -13,40 +13,19 @@ class XGUI_MainWindow;
 class XGUI_Command;
 class XGUI_Module;
 
-class XGUI_Workshop: public QObject, IWorkshop
+class XGUI_Workshop: public QObject, public IWorkshop
 {
        Q_OBJECT
 public:
-    enum XCommandId {
-        NEW_CMD,
-        OPEN_CMD,
-        SAVE_CMD,
-        SAVEAS_CMD,
-        EXIT_CMD,
-        UNDO_CMD,
-        REDO_CMD,
-        COPY_CMD,
-        CUT_CMD,
-        PASTE_CMD,
-        LAST_CMD
-    };
 
        XGUI_Workshop();
        virtual ~XGUI_Workshop();
 
     void startApplication();
 
-    XGUI_Command* command(XCommandId theId) const;
-
     XGUI_MainWindow* mainWindow() const { return myMainWindow; }
 
-    virtual int addWorkbench(const QString& theName);
-    virtual int addGroup(int thePageId);
-    virtual int addFeature(int thePageId, int theGroupId, 
-                           const QString& theTitle, const QString& theTip, 
-                           const QIcon& theIcon, 
-                           const QKeySequence& theKeys = QKeySequence());
-
+    virtual IWorkbench* addWorkbench(const QString& theName);
 
 public slots:
     void onNew();
@@ -61,13 +40,6 @@ private:
     IModule* loadModule(const QString& theModule);
     bool activateModule();
 
-    void addCommand(XCommandId theCommandId, int thePageId, int theGroupId, XGUI_Command* theCommand);
-    XGUI_Command* createMenuCommand(int thePageId, int theGroupId, XCommandId theCmdId, 
-                                    const QString& theTitle, const QString& theTip, 
-                                    const QIcon& theIcon = QIcon(), const QKeySequence& theKeys = QKeySequence());
-
-    QMap<int, XGUI_Command*> myCommands;
-
     XGUI_MainWindow* myMainWindow;
 };
 
index 94a8cc9a9603d409791d8e27c137f0aabc70ac9f..4f72790d63ab7cb11d1050b08c8aa3a04a9f6efd 100644 (file)
         <source>PASTE_MENU_TIP</source>
         <translation>Paste copied object</translation>
     </message>
+    <message>
+        <source>REBUILD_MENU</source>
+        <translation>Rebuild</translation>
+    </message>
+    <message>
+        <source>REBUILD_MENU_TIP</source>
+        <translation>Rebuild data objects</translation>
+    </message>
 </context>
 <context>
     <name>XGUI_MainWindow</name>
index ee262ff3f8beb71e3bd5febe337026ba1a8d22e0..ddcb76b47ffc911e55a85e7d0b99775afb908073 100644 (file)
@@ -4,11 +4,9 @@
      <file>pictures/open.png</file>
      <file>pictures/save.png</file>
      <file>pictures/close.png</file>
-     <file>pictures/copy.png</file>
-     <file>pictures/cut.png</file>
-     <file>pictures/paste.png</file>
      <file>pictures/redo.png</file>
      <file>pictures/undo.png</file>
+     <file>pictures/rebuild.png</file>
      <!--For test purposes-->
 
      <file>pictures/ViewPort.png</file>
diff --git a/src/XGUI/pictures/copy.png b/src/XGUI/pictures/copy.png
deleted file mode 100644 (file)
index 0c90599..0000000
Binary files a/src/XGUI/pictures/copy.png and /dev/null differ
diff --git a/src/XGUI/pictures/cut.png b/src/XGUI/pictures/cut.png
deleted file mode 100644 (file)
index 5f022d0..0000000
Binary files a/src/XGUI/pictures/cut.png and /dev/null differ
diff --git a/src/XGUI/pictures/paste.png b/src/XGUI/pictures/paste.png
deleted file mode 100644 (file)
index 12e3ce9..0000000
Binary files a/src/XGUI/pictures/paste.png and /dev/null differ
diff --git a/src/XGUI/pictures/rebuild.png b/src/XGUI/pictures/rebuild.png
new file mode 100644 (file)
index 0000000..8d4bb27
Binary files /dev/null and b/src/XGUI/pictures/rebuild.png differ