From: sbh Date: Fri, 4 Apr 2014 08:36:14 +0000 (+0400) Subject: Merge branch 'master' of newgeom:newgeom.git X-Git-Tag: V_0.1~39 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=401394b2e312e5c4ecd6a410b90eb2c159a675bf;hp=196e9b5ccfef56a00ce7764708469685613616c9;p=modules%2Fshaper.git Merge branch 'master' of newgeom:newgeom.git Conflicts: src/XGUI/CMakeLists.txt src/XGUI/XGUI_MainWindow.cpp src/XGUI/XGUI_MainWindow.h --- diff --git a/src/Model/CMakeLists.txt b/src/Model/CMakeLists.txt index c6dfa0f7e..eca79ac1a 100644 --- a/src/Model/CMakeLists.txt +++ b/src/Model/CMakeLists.txt @@ -34,3 +34,5 @@ INCLUDE_DIRECTORIES( ../Config ${CAS_INCLUDE_DIRS} ) + +INSTALL(TARGETS Model DESTINATION bin) diff --git a/src/Model/Model_Document.cxx b/src/Model/Model_Document.cxx index 8a3f0bf45..3aea0ff6e 100644 --- a/src/Model/Model_Document.cxx +++ b/src/Model/Model_Document.cxx @@ -191,6 +191,14 @@ shared_ptr Model_Document::featuresIterator(const string theG return shared_ptr(new Model_Iterator(aThis, groupLabel(theGroup))); } +shared_ptr Model_Document::feature(const string& theGroupID, const int theIndex) +{ + // TODO: optimize this method + shared_ptr anIter = featuresIterator(theGroupID); + for(int a = 0; a != theIndex; anIter->next()) a++; + return anIter->current(); +} + Model_Document::Model_Document(const std::string theID) : myID(theID), myDoc(new TDocStd_Document("BinOcaf")) // binary OCAF format { diff --git a/src/Model/Model_Document.h b/src/Model/Model_Document.h index bc7d6db74..d96aa15dd 100644 --- a/src/Model/Model_Document.h +++ b/src/Model/Model_Document.h @@ -78,6 +78,10 @@ public: MODEL_EXPORT virtual const std::string& id() const {return myID;} + //! Returns the feature in the group by the index (started from zero) + MODEL_EXPORT virtual std::shared_ptr + feature(const std::string& theGroupID, const int theIndex); + protected: //! Returns (creates if needed) the group label diff --git a/src/ModelAPI/CMakeLists.txt b/src/ModelAPI/CMakeLists.txt index 017acf05d..c9afbc7ab 100644 --- a/src/ModelAPI/CMakeLists.txt +++ b/src/ModelAPI/CMakeLists.txt @@ -52,6 +52,7 @@ IF(WIN32) ENDIF(WIN32) INSTALL(TARGETS _ModelAPI DESTINATION swig) +INSTALL(TARGETS ModelAPI DESTINATION bin) #INSTALL(TARGETS ${SWIG_SCRIPTS} DESTINATION swig) diff --git a/src/ModelAPI/ModelAPI_Document.h b/src/ModelAPI/ModelAPI_Document.h index 90a6a9184..e40e9f5b5 100644 --- a/src/ModelAPI/ModelAPI_Document.h +++ b/src/ModelAPI/ModelAPI_Document.h @@ -78,8 +78,13 @@ public: MODELAPI_EXPORT virtual std::shared_ptr featuresIterator( const std::string theGroup) = 0; + ///! Returns the id of hte document MODELAPI_EXPORT virtual const std::string& id() const = 0; + //! Returns the feature in the group by the index (started from zero) + MODELAPI_EXPORT virtual std::shared_ptr + feature(const std::string& theGroupID, const int theIndex) = 0; + protected: /// Only for SWIG wrapping it is here MODELAPI_EXPORT ModelAPI_Document() diff --git a/src/PyConsole/PyConsole_Console.h b/src/PyConsole/PyConsole_Console.h index 0f2a9be5a..b2ece1f92 100644 --- a/src/PyConsole/PyConsole_Console.h +++ b/src/PyConsole/PyConsole_Console.h @@ -13,7 +13,8 @@ class PyConsole_Editor; class PyConsole_EnhInterp; class QMenu; -class PYCONSOLE_EXPORT PyConsole_Console : public QWidget//, public SUIT_PopupClient +//PYCONSOLE_EXPORT +class PyConsole_Console : public QWidget//, public SUIT_PopupClient { Q_OBJECT @@ -76,7 +77,8 @@ protected: * Similar to PyConsole_Console except that an enhanced interpreter and enhanced editor * are encapsulated. */ -class PYCONSOLE_EXPORT PyConsole_EnhConsole: public PyConsole_Console +//PYCONSOLE_EXPORT +class PyConsole_EnhConsole: public PyConsole_Console { Q_OBJECT diff --git a/src/PyConsole/PyConsole_Editor.h b/src/PyConsole/PyConsole_Editor.h index f3324dc25..8c17a5bc7 100644 --- a/src/PyConsole/PyConsole_Editor.h +++ b/src/PyConsole/PyConsole_Editor.h @@ -10,7 +10,8 @@ class PyConsole_Interp; class PyInterp_Request; class QEventLoop; -class PYCONSOLE_EXPORT PyConsole_Editor : public QTextEdit +//PYCONSOLE_EXPORT +class PyConsole_Editor : public QTextEdit { Q_OBJECT; diff --git a/src/PyConsole/PyConsole_EnhEditor.h b/src/PyConsole/PyConsole_EnhEditor.h index 03b5e19a1..defa59060 100644 --- a/src/PyConsole/PyConsole_EnhEditor.h +++ b/src/PyConsole/PyConsole_EnhEditor.h @@ -14,7 +14,8 @@ class PyConsole_EnhInterp; /** * Enhanced Python editor handling tab completion. */ -class PYCONSOLE_EXPORT PyConsole_EnhEditor: public PyConsole_Editor +//PYCONSOLE_EXPORT +class PyConsole_EnhEditor: public PyConsole_Editor { Q_OBJECT; diff --git a/src/PyConsole/PyConsole_EnhInterp.h b/src/PyConsole/PyConsole_EnhInterp.h index 1af977cc0..b01f68973 100644 --- a/src/PyConsole/PyConsole_EnhInterp.h +++ b/src/PyConsole/PyConsole_EnhInterp.h @@ -15,7 +15,8 @@ * Enhanced Python interpreter used for auto-completion. * This extends PyConsole_Interp with an API wrapping the Python dir() command nicely. */ -class PYCONSOLE_EXPORT PyConsole_EnhInterp: public PyConsole_Interp +//PYCONSOLE_EXPORT +class PyConsole_EnhInterp: public PyConsole_Interp { public: PyConsole_EnhInterp() diff --git a/src/PyConsole/PyConsole_Interp.h b/src/PyConsole/PyConsole_Interp.h index d65c9e620..5dfa7f78c 100644 --- a/src/PyConsole/PyConsole_Interp.h +++ b/src/PyConsole/PyConsole_Interp.h @@ -6,7 +6,8 @@ #include /// !!! WARNING !!! THIS INCLUDE MUST BE VERY FIRST !!! -class PYCONSOLE_EXPORT PyConsole_Interp : public PyInterp_Interp +//PYCONSOLE_EXPORT +class PyConsole_Interp : public PyInterp_Interp { public: PyConsole_Interp(); diff --git a/src/PyEvent/PyEvent_Event.h b/src/PyEvent/PyEvent_Event.h index ed1ea7b74..76340b94b 100644 --- a/src/PyEvent/PyEvent_Event.h +++ b/src/PyEvent/PyEvent_Event.h @@ -9,7 +9,8 @@ //! SALOME custom event type #define PyEvent_EVENT QEvent::Type( QEvent::User + 10000 ) -class PYEVENT_EXPORT PyEvent_CustomEvent : public QEvent +// PYEVENT_EXPORT +class PyEvent_CustomEvent : public QEvent { public: PyEvent_CustomEvent( int type ); @@ -24,7 +25,8 @@ private: class QSemaphore; -class PYEVENT_EXPORT PyEvent_Event +//PYEVENT_EXPORT +class PyEvent_Event { public: PyEvent_Event(); diff --git a/src/PyEvent/PyEvent_EventFilter.h b/src/PyEvent/PyEvent_EventFilter.h index 23132de7e..d115a2802 100644 --- a/src/PyEvent/PyEvent_EventFilter.h +++ b/src/PyEvent/PyEvent_EventFilter.h @@ -17,7 +17,8 @@ class PyEvent_Event; This event filter can be installed by any application that intends to use PyEvent_Event mechanism asynchronously. This class replaced SalomeApp_EventFilter. */ -class PYEVENT_EXPORT PyEvent_EventFilter: public QObject +//PYEVENT_EXPORT +class PyEvent_EventFilter: public QObject { public: static void Init(); diff --git a/src/PyInterp/PyInterp_Dispatcher.h b/src/PyInterp/PyInterp_Dispatcher.h index fa98d30b0..cb5da2e8a 100644 --- a/src/PyInterp/PyInterp_Dispatcher.h +++ b/src/PyInterp/PyInterp_Dispatcher.h @@ -14,7 +14,8 @@ class QObject; class PyInterp_Watcher; -class PYINTERP_EXPORT PyInterp_Dispatcher : protected QThread +//PYINTERP_EXPORT +class PyInterp_Dispatcher : protected QThread { PyInterp_Dispatcher(); // private constructor diff --git a/src/PyInterp/PyInterp_Event.h b/src/PyInterp/PyInterp_Event.h index 01bab92c1..b08c34246 100644 --- a/src/PyInterp/PyInterp_Event.h +++ b/src/PyInterp/PyInterp_Event.h @@ -27,7 +27,8 @@ protected: * Events thrown by the interpreter having executed a command and indicating * the return status. */ -class PYINTERP_EXPORT PyInterp_Event : public QEvent +//PYINTERP_EXPORT +class PyInterp_Event : public QEvent { PyInterp_Event(); PyInterp_Event( const PyInterp_Event& ); diff --git a/src/PyInterp/PyInterp_Interp.h b/src/PyInterp/PyInterp_Interp.h index d92bc4fc9..b93c6475a 100644 --- a/src/PyInterp/PyInterp_Interp.h +++ b/src/PyInterp/PyInterp_Interp.h @@ -7,7 +7,8 @@ #include #include -class PYINTERP_EXPORT PyLockWrapper +//PYINTERP_EXPORT +class PyLockWrapper { PyThreadState* myThreadState; PyThreadState* mySaveThreadState; @@ -19,7 +20,8 @@ public: typedef void PyOutChanged(void* data,char * c); -class PYINTERP_EXPORT PyInterp_Interp +//PYINTERP_EXPORT +class PyInterp_Interp { public: static int _argc; @@ -62,7 +64,8 @@ protected: virtual bool initContext() = 0; }; -class PYINTERP_EXPORT PyObjWrapper +//PYINTERP_EXPORT +class PyObjWrapper { PyObject* myObject; public: diff --git a/src/PyInterp/PyInterp_Request.h b/src/PyInterp/PyInterp_Request.h index 9cc3a68ac..b96cd1dc2 100644 --- a/src/PyInterp/PyInterp_Request.h +++ b/src/PyInterp/PyInterp_Request.h @@ -15,7 +15,8 @@ class PyInterp_Dispatcher; class PyInterp_ExecuteEvent; class PyConsole_Editor; -class PYINTERP_EXPORT PyInterp_Request +// PYINTERP_EXPORT +class PyInterp_Request { friend class PyInterp_Dispatcher; friend class PyInterp_ExecuteEvent; @@ -61,7 +62,8 @@ private: QObject* myListener; }; -class PYINTERP_EXPORT PyInterp_LockRequest : public PyInterp_Request +//PYINTERP_EXPORT +class PyInterp_LockRequest : public PyInterp_Request { public: diff --git a/src/PyInterp/PyInterp_Watcher.h b/src/PyInterp/PyInterp_Watcher.h index 91126b7e9..3f110c1e2 100644 --- a/src/PyInterp/PyInterp_Watcher.h +++ b/src/PyInterp/PyInterp_Watcher.h @@ -9,7 +9,8 @@ #include // Private class that keeps track of destructions of request listeners -class PYINTERP_EXPORT PyInterp_Watcher : public QObject +//PYINTERP_EXPORT +class PyInterp_Watcher : public QObject { Q_OBJECT diff --git a/src/XGUI/CMakeLists.txt b/src/XGUI/CMakeLists.txt index 38deae122..713f9b905 100644 --- a/src/XGUI/CMakeLists.txt +++ b/src/XGUI/CMakeLists.txt @@ -19,6 +19,9 @@ SET(PROJECT_HEADERS XGUI_Constants.h XGUI_ViewBackground.h XGUI_WidgetFactory.h + XGUI_DocumentDataModel.h + XGUI_DataModel.h + XGUI_ObjectsBrowser.h ) SET(PROJECT_AUTOMOC @@ -40,15 +43,18 @@ SET(PROJECT_SOURCES XGUI_RubberBand.cpp XGUI_ViewBackground.cpp XGUI_WidgetFactory.cpp + XGUI_DocumentDataModel.cpp + XGUI_DataModel.cpp + XGUI_ObjectsBrowser.cpp ) SET(PROJECT_RESOURCES XGUI_pictures.qrc ) -SET(TEXT_RESOURCES - XGUI_msg_en.ts -) +#SET(TEXT_RESOURCES +# XGUI_msg_en.ts +#) SET(PROJECT_LIBRARIES opengl32 @@ -60,12 +66,14 @@ SET(PROJECT_LIBRARIES PyConsole PyInterp PyEvent + ModelAPI ) QT5_ADD_RESOURCES(PROJECT_COMPILED_RESOURCES ${PROJECT_RESOURCES}) -QT5_ADD_TRANSLATION(QM_RESOURCES ${TEXT_RESOURCES}) +#QT5_ADD_TRANSLATION(QM_RESOURCES ${TEXT_RESOURCES}) -SOURCE_GROUP ("Generated Files" FILES ${PROJECT_AUTOMOC} ${PROJECT_COMPILED_RESOURCES} ${QM_RESOURCES}) +#SOURCE_GROUP ("Generated Files" FILES ${PROJECT_AUTOMOC} ${PROJECT_COMPILED_RESOURCES} ${QM_RESOURCES}) +SOURCE_GROUP ("Generated Files" FILES ${PROJECT_AUTOMOC} ${PROJECT_COMPILED_RESOURCES}) SOURCE_GROUP ("Resource Files" FILES ${TEXT_RESOURCES} ${PROJECT_RESOURCES}) ADD_DEFINITIONS(${CAS_DEFINITIONS} ) @@ -74,6 +82,7 @@ INCLUDE_DIRECTORIES (${PROJECT_SOURCE_DIR}/src/Event ${PROJECT_SOURCE_DIR}/src/Config ${PROJECT_SOURCE_DIR}/src/PyInterp ${PROJECT_SOURCE_DIR}/src/PyConsole + ${PROJECT_SOURCE_DIR}/src/ModelAPI ${CAS_INCLUDE_DIRS}) LINK_DIRECTORIES($ENV{PYTHON_LIB_DIR}) @@ -83,11 +92,12 @@ ADD_EXECUTABLE(XGUI WIN32 ${PROJECT_HEADERS} ${PROJECT_COMPILED_RESOURCES} ${TEXT_RESOURCES} - ${QM_RESOURCES} ) +ADD_DEPENDENCIES(XGUI ModelAPI) + # The Qt5Widgets_LIBRARIES variable also includes QtGui and QtCore TARGET_LINK_LIBRARIES(XGUI ${PROJECT_LIBRARIES}) INSTALL(TARGETS XGUI DESTINATION bin) -INSTALL(FILES ${QM_RESOURCES} DESTINATION bin) +#INSTALL(FILES ${QM_RESOURCES} DESTINATION bin) diff --git a/src/XGUI/XGUI_DataModel.cpp b/src/XGUI/XGUI_DataModel.cpp new file mode 100644 index 000000000..7dc78aa87 --- /dev/null +++ b/src/XGUI/XGUI_DataModel.cpp @@ -0,0 +1,12 @@ +#include "XGUI_DataModel.h" + + +XGUI_DataModel::XGUI_DataModel(QObject* theParent) + : QAbstractItemModel(theParent) +{ +} + + +XGUI_DataModel::~XGUI_DataModel() +{ +} diff --git a/src/XGUI/XGUI_DataModel.h b/src/XGUI/XGUI_DataModel.h new file mode 100644 index 000000000..106a7f0cc --- /dev/null +++ b/src/XGUI/XGUI_DataModel.h @@ -0,0 +1,15 @@ + +#ifndef XGUI_DataModel_H +#define XGUI_DataModel_H + +#include + +class XGUI_DataModel : public QAbstractItemModel +{ + Q_OBJECT +public: + XGUI_DataModel(QObject* theParent); + virtual ~XGUI_DataModel(); +}; + +#endif \ No newline at end of file diff --git a/src/XGUI/XGUI_DocumentDataModel.cpp b/src/XGUI/XGUI_DocumentDataModel.cpp new file mode 100644 index 000000000..f65545188 --- /dev/null +++ b/src/XGUI/XGUI_DocumentDataModel.cpp @@ -0,0 +1,102 @@ +#include "XGUI_DocumentDataModel.h" + +#include +#include +#include + + + + +XGUI_DocumentDataModel::XGUI_DocumentDataModel(QObject* theParent) + : QAbstractItemModel(theParent), + myParamsFolder(0), + myConstructFolder(0) +{ + //std::shared_ptr myRoot = aMgr->createFeature("Point"); + std::shared_ptr aMgr = ModelAPI_PluginManager::get(); + myDocument = aMgr->currentDocument(); +} + + +XGUI_DocumentDataModel::~XGUI_DocumentDataModel() +{ +} + + +QVariant XGUI_DocumentDataModel::data(const QModelIndex& theIndex, int theRole) const +{ + switch (theRole) { + case Qt::DisplayRole: + // return a name + if (theIndex.internalId() == quintptr(&myParamsFolder)) + return "Parameters"; + else if (theIndex.internalId() == quintptr(&myConstructFolder)) + return "Constructions"; + else if (theIndex.internalId() == 0) { + return "Part"; + } + break; + case Qt::DecorationRole: + // return an Icon + break; + case Qt::ToolTipRole: + // return Tooltip + break; + } + return QVariant(); +} + + +QVariant XGUI_DocumentDataModel::headerData(int section, Qt::Orientation orientation, int role) const +{ + return QVariant(); +} + +int XGUI_DocumentDataModel::rowCount(const QModelIndex &parent) const +{ + std::shared_ptr aIt = myDocument->featuresIterator(PARTS_GROUP); + return aIt->numIterationsLeft() + 2; +} + +int XGUI_DocumentDataModel::columnCount(const QModelIndex &parent) const +{ + return 1; +} + +QModelIndex XGUI_DocumentDataModel::index(int theRow, int theColumn, const QModelIndex& theParent) const +{ + switch (theRow) { + case 0: + return createIndex(theRow, theColumn, (quintptr) &myParamsFolder); + case 1: + return createIndex(theRow, theColumn, (quintptr) &myConstructFolder); + default: + { + std::shared_ptr aIt = myDocument->featuresIterator(PARTS_GROUP); + if (aIt->numIterationsLeft() <= (theRow - 1)) { + return createIndex(theRow, theColumn, (quintptr) 0); + } + } + } + return QModelIndex(); +} + + +QModelIndex XGUI_DocumentDataModel::parent(const QModelIndex &index) const +{ + return QModelIndex(); +} + +bool XGUI_DocumentDataModel::hasChildren(const QModelIndex& theParent) const +{ + if (!theParent.isValid()) + return true; + + if (theParent.internalId() == quintptr(&myParamsFolder)) + return myDocument->featuresIterator(PARAMETERS_GROUP)->more(); + if (theParent.internalId() == quintptr(&myConstructFolder)) + return myDocument->featuresIterator(CONSTRUCTIONS_GROUP)->more(); + if (theParent.internalId() == 0) + return false; + return false; +} \ No newline at end of file diff --git a/src/XGUI/XGUI_DocumentDataModel.h b/src/XGUI/XGUI_DocumentDataModel.h new file mode 100644 index 000000000..e6f8a787e --- /dev/null +++ b/src/XGUI/XGUI_DocumentDataModel.h @@ -0,0 +1,39 @@ + +#ifndef XGUI_DocumentDataModel_H +#define XGUI_DocumentDataModel_H + +#include + +class ModelAPI_Document; + +class XGUI_DocumentDataModel : public QAbstractItemModel +{ + Q_OBJECT +public: + XGUI_DocumentDataModel(QObject* theParent); + virtual ~XGUI_DocumentDataModel(); + + + virtual QVariant data(const QModelIndex& theIndex, int theRole) const; + virtual QVariant headerData(int section, Qt::Orientation orientation, + int role = Qt::DisplayRole) const; + + virtual int rowCount(const QModelIndex &parent = QModelIndex()) const; + virtual int columnCount(const QModelIndex &parent = QModelIndex()) const; + + virtual QModelIndex index(int theRow, int theColumn, + const QModelIndex &parent = QModelIndex()) const; + + virtual QModelIndex parent(const QModelIndex &index) const; + + virtual bool hasChildren(const QModelIndex& theParent = QModelIndex()) const; + +private: + //std::shared_ptr myRoot; + short myParamsFolder; + short myConstructFolder; + + std::shared_ptr myDocument; +}; + +#endif \ No newline at end of file diff --git a/src/XGUI/XGUI_MainMenu.cpp b/src/XGUI/XGUI_MainMenu.cpp index bb7bbd582..efce9ab2c 100644 --- a/src/XGUI/XGUI_MainMenu.cpp +++ b/src/XGUI/XGUI_MainMenu.cpp @@ -11,7 +11,7 @@ XGUI_MainMenu::XGUI_MainMenu(XGUI_MainWindow *parent) : QObject(parent), myDesktop(parent) { parent->setTabPosition(Qt::TopDockWidgetArea, QTabWidget::North); - myGeneralPage = addWorkbench(tr("GEN_MENU_TITLE")); + myGeneralPage = addWorkbench(tr("General")); } XGUI_MainMenu::~XGUI_MainMenu(void) diff --git a/src/XGUI/XGUI_MainWindow.cpp b/src/XGUI/XGUI_MainWindow.cpp index 40a0d26cf..c89e0fc0a 100644 --- a/src/XGUI/XGUI_MainWindow.cpp +++ b/src/XGUI/XGUI_MainWindow.cpp @@ -2,6 +2,7 @@ #include "XGUI_MainMenu.h" #include "XGUI_ViewWindow.h" #include "XGUI_Viewer.h" +#include "XGUI_ObjectsBrowser.h" #include #include @@ -29,7 +30,7 @@ XGUI_MainWindow::XGUI_MainWindow(QWidget* parent) myObjectBrowser(0), myPythonConsole(0) { - setWindowTitle(tr("WINDOW_TITLE")); + setWindowTitle(tr("New Geom")); myMenuBar = new XGUI_MainMenu(this); QMdiArea* aMdiArea = new QMdiArea(this); @@ -145,62 +146,11 @@ QDockWidget* XGUI_MainWindow::createObjectBrowser() { QDockWidget* aObjDock = new QDockWidget(this); aObjDock->setAllowedAreas(Qt::LeftDockWidgetArea | Qt::RightDockWidgetArea); - aObjDock->setWindowTitle(tr("OBJECT_BROWSER_TITLE")); - myObjectBrowser = new QTreeWidget(aObjDock); - myObjectBrowser->setColumnCount(1); - myObjectBrowser->setHeaderHidden(true); + aObjDock->setWindowTitle(tr("Object browser")); + myObjectBrowser = new XGUI_ObjectsBrowser(aObjDock); + //myObjectBrowser->setColumnCount(1); + //myObjectBrowser->setHeaderHidden(true); aObjDock->setWidget(myObjectBrowser); // fillObjectBrowser(); return aObjDock; } - -//****************************************************** - -// TEST FUNCTIONS - -//****************************************************** -void XGUI_MainWindow::fillObjectBrowser() -{ - QStringList aNames; - aNames << "Parameters" << "Constructions"; - aNames << "Part 1" << "Part 2" << "Part 3"; - aNames << "Properties"; - - QStringList aIcons; - aIcons << ":pictures/params_folder.png"; - aIcons << ":pictures/constr_folder.png"; - aIcons << ":pictures/part_ico.png"; - aIcons << ":pictures/part_ico.png"; - aIcons << ":pictures/part_ico.png"; - aIcons << ":pictures/properties.png"; - - QList aItems; - foreach(QString aName, aNames) - { - QTreeWidgetItem* aItem = new QTreeWidgetItem(myObjectBrowser); - aItem->setText(0, aName); - aItems.append(aItem); - } - for(int i = 0; i < aItems.length(); i++) { - aItems[i]->setIcon(0, QIcon(aIcons[i])); - } - myObjectBrowser->addTopLevelItems(aItems); - - for(int i = 2; i < 5; i++) { - QTreeWidgetItem* aItem = new QTreeWidgetItem(aItems[i]); - aItem->setText(0, "Parameters"); - aItem->setIcon(0, QIcon(":pictures/params_folder.png")); - - aItem = new QTreeWidgetItem(aItems[i]); - aItem->setText(0, "Construction"); - aItem->setIcon(0, QIcon(":pictures/constr_folder.png")); - - aItem = new QTreeWidgetItem(aItems[i]); - aItem->setText(0, "Bodies"); - aItem->setIcon(0, QIcon(":pictures/part_ico.png")); - - aItem = new QTreeWidgetItem(aItems[i]); - aItem->setText(0, "Features"); - aItem->setIcon(0, QIcon(":pictures/features.png")); - } -} diff --git a/src/XGUI/XGUI_MainWindow.h b/src/XGUI/XGUI_MainWindow.h index 0806b5863..e12614a73 100644 --- a/src/XGUI/XGUI_MainWindow.h +++ b/src/XGUI/XGUI_MainWindow.h @@ -5,7 +5,7 @@ class XGUI_MainMenu; class XGUI_Viewer; -class QTreeWidget; +class XGUI_ObjectsBrowser; class QMdiArea; class PyConsole_EnhConsole; @@ -22,7 +22,7 @@ public: return myMenuBar; } - QTreeWidget* objectBrowser() const + XGUI_ObjectsBrowser* objectBrowser() const { return myObjectBrowser; } @@ -44,11 +44,9 @@ private: void createDockWidgets(); QDockWidget* createObjectBrowser(); QDockWidget* createPropertyPanel(); - //!! For test purposes only - void fillObjectBrowser(); XGUI_MainMenu* myMenuBar; - QTreeWidget* myObjectBrowser; + XGUI_ObjectsBrowser* myObjectBrowser; XGUI_Viewer* myViewer; diff --git a/src/XGUI/XGUI_ObjectsBrowser.cpp b/src/XGUI/XGUI_ObjectsBrowser.cpp new file mode 100644 index 000000000..926929063 --- /dev/null +++ b/src/XGUI/XGUI_ObjectsBrowser.cpp @@ -0,0 +1,17 @@ +#include "XGUI_ObjectsBrowser.h" +#include "XGUI_DocumentDataModel.h" + + +XGUI_ObjectsBrowser::XGUI_ObjectsBrowser(QWidget* theParent) + : QTreeView(theParent) +{ + setHeaderHidden(true); + myDocModel = new XGUI_DocumentDataModel(this); + setModel(myDocModel); +} + + +XGUI_ObjectsBrowser::~XGUI_ObjectsBrowser() +{ +} + diff --git a/src/XGUI/XGUI_ObjectsBrowser.h b/src/XGUI/XGUI_ObjectsBrowser.h new file mode 100644 index 000000000..75d12e5b6 --- /dev/null +++ b/src/XGUI/XGUI_ObjectsBrowser.h @@ -0,0 +1,23 @@ + +#ifndef XGUI_ObjectsBrowser_H +#define XGUI_ObjectsBrowser_H + +#include + +class XGUI_DocumentDataModel; + +class XGUI_ObjectsBrowser : public QTreeView +{ + Q_OBJECT +public: + XGUI_ObjectsBrowser(QWidget* theParent); + virtual ~XGUI_ObjectsBrowser(); + + XGUI_DocumentDataModel* dataModel() const { return myDocModel; } + +private: + + XGUI_DocumentDataModel* myDocModel; +}; + +#endif \ No newline at end of file diff --git a/src/XGUI/XGUI_ViewWindow.cpp b/src/XGUI/XGUI_ViewWindow.cpp index c536c7c41..ef9e5403f 100644 --- a/src/XGUI/XGUI_ViewWindow.cpp +++ b/src/XGUI/XGUI_ViewWindow.cpp @@ -167,63 +167,63 @@ XGUI_ViewWindow::XGUI_ViewWindow(XGUI_Viewer* theViewer, V3d_TypeOfView theType) QAction* aBtn; // Dump view - aBtn = new QAction(QIcon(":pictures/occ_view_camera_dump.png"), tr("DUMP_VIEW"), myViewBar); + aBtn = new QAction(QIcon(":pictures/occ_view_camera_dump.png"), tr("Dump view"), myViewBar); connect(aBtn, SIGNAL(triggered()), SLOT(dumpView())); myViewBar->addAction(aBtn); // Fit all - aBtn = new QAction(QIcon(":pictures/occ_view_fitall.png"), tr("FIT_ALL"), myViewBar); + aBtn = new QAction(QIcon(":pictures/occ_view_fitall.png"), tr("Fit all"), myViewBar); connect(aBtn, SIGNAL(triggered()), SLOT(fitAll())); myViewBar->addAction(aBtn); // Fit area - aBtn = new QAction(QIcon(":pictures/occ_view_fitarea.png"), tr("FIT_AREA"), myViewBar); + aBtn = new QAction(QIcon(":pictures/occ_view_fitarea.png"), tr("Fit area"), myViewBar); connect(aBtn, SIGNAL(triggered()), SLOT(activateWindowFit())); myViewBar->addAction(aBtn); // Zoom - aBtn = new QAction(QIcon(":pictures/occ_view_zoom.png"), tr("ZOOM_VIEW"), myViewBar); + aBtn = new QAction(QIcon(":pictures/occ_view_zoom.png"), tr("Zoom"), myViewBar); connect(aBtn, SIGNAL(triggered()), SLOT(activateZoom())); myViewBar->addAction(aBtn); // Pan - aBtn = new QAction(QIcon(":pictures/occ_view_pan.png"), tr("PAN_VIEW"), myViewBar); + aBtn = new QAction(QIcon(":pictures/occ_view_pan.png"), tr("Panning"), myViewBar); connect(aBtn, SIGNAL(triggered()), SLOT(activatePanning())); myViewBar->addAction(aBtn); // Global Panning - aBtn = new QAction(QIcon(":pictures/occ_view_glpan.png"), tr("GLOB_PAN_VIEW"), myViewBar); + aBtn = new QAction(QIcon(":pictures/occ_view_glpan.png"), tr("Global panning"), myViewBar); connect(aBtn, SIGNAL(triggered()), SLOT(activateGlobalPanning())); myViewBar->addAction(aBtn); // Rotation - aBtn = new QAction(QIcon(":pictures/occ_view_rotate.png"), tr("ROTATE_VIEW"), myViewBar); + aBtn = new QAction(QIcon(":pictures/occ_view_rotate.png"), tr("Rotate"), myViewBar); connect(aBtn, SIGNAL(triggered()), SLOT(activateRotation())); myViewBar->addAction(aBtn); // Reset - aBtn = new QAction(QIcon(":pictures/occ_view_reset.png"), tr("RESET_VIEW"), myViewBar); + aBtn = new QAction(QIcon(":pictures/occ_view_reset.png"), tr("Reset"), myViewBar); connect(aBtn, SIGNAL(triggered()), SLOT(reset())); myViewBar->addAction(aBtn); // Front view - aBtn = new QAction(QIcon(":pictures/occ_view_front.png"), tr("FRONT_VIEW"), myViewBar); + aBtn = new QAction(QIcon(":pictures/occ_view_front.png"), tr("Front"), myViewBar); connect(aBtn, SIGNAL(triggered()), SLOT(frontView())); myViewBar->addAction(aBtn); // Back view - aBtn = new QAction(QIcon(":pictures/occ_view_back.png"), tr("BACK_VIEW"), myViewBar); + aBtn = new QAction(QIcon(":pictures/occ_view_back.png"), tr("Back"), myViewBar); connect(aBtn, SIGNAL(triggered()), SLOT(backView())); myViewBar->addAction(aBtn); // Top view - aBtn = new QAction(QIcon(":pictures/occ_view_top.png"), tr("TOP_VIEW"), myViewBar); + aBtn = new QAction(QIcon(":pictures/occ_view_top.png"), tr("Top"), myViewBar); connect(aBtn, SIGNAL(triggered()), SLOT(topView())); myViewBar->addAction(aBtn); // Bottom view - aBtn = new QAction(QIcon(":pictures/occ_view_bottom.png"), tr("BOTTOM_VIEW"), myViewBar); + aBtn = new QAction(QIcon(":pictures/occ_view_bottom.png"), tr("Bottom"), myViewBar); connect(aBtn, SIGNAL(triggered()), SLOT(bottomView())); myViewBar->addAction(aBtn); // Left view - aBtn = new QAction(QIcon(":pictures/occ_view_left.png"), tr("LEFT_VIEW"), myViewBar); + aBtn = new QAction(QIcon(":pictures/occ_view_left.png"), tr("Left"), myViewBar); connect(aBtn, SIGNAL(triggered()), SLOT(leftView())); myViewBar->addAction(aBtn); // Right view - aBtn = new QAction(QIcon(":pictures/occ_view_right.png"), tr("RIGHT_VIEW"), myViewBar); + aBtn = new QAction(QIcon(":pictures/occ_view_right.png"), tr("Right"), myViewBar); connect(aBtn, SIGNAL(triggered()), SLOT(rightView())); myViewBar->addAction(aBtn); // Clone view - aBtn = new QAction(QIcon(":pictures/occ_view_clone.png"), tr("CLONE_VIEW"), myViewBar); + aBtn = new QAction(QIcon(":pictures/occ_view_clone.png"), tr("Clone"), myViewBar); connect(aBtn, SIGNAL(triggered()), SLOT(cloneView())); myViewBar->addAction(aBtn); @@ -946,7 +946,7 @@ void XGUI_ViewWindow::cloneView() void XGUI_ViewWindow::dumpView() { - QString aFilter(tr("OCC_IMAGE_FILES")); + QString aFilter(tr("Images Files (*.bmp *.png *.jpg *.jpeg *.eps *.ps)")); QString aSelectedFilter; QString aFileName = QFileDialog::getSaveFileName(this, "Save picture", QString(), aFilter, &aSelectedFilter); if (!aFileName.isNull()) { diff --git a/src/XGUI/XGUI_Viewer.cpp b/src/XGUI/XGUI_Viewer.cpp index 881b91f87..6bec77168 100644 --- a/src/XGUI/XGUI_Viewer.cpp +++ b/src/XGUI/XGUI_Viewer.cpp @@ -61,17 +61,17 @@ Handle(V3d_Viewer) CreateViewer(const Standard_ExtString name, const Standard_CS */ QString XGUI_Viewer::backgroundData(QStringList& gradList, QIntList& idList, QIntList& txtList) { - gradList << tr("GT_HORIZONTALGRADIENT") << tr("GT_VERTICALGRADIENT") - << tr("GT_FIRSTDIAGONALGRADIENT") << tr("GT_SECONDDIAGONALGRADIENT") - << tr("GT_FIRSTCORNERGRADIENT") << tr("GT_SECONDCORNERGRADIENT") - << tr("GT_THIRDCORNERGRADIENT") << tr("GT_FORTHCORNERGRADIENT"); + gradList << tr("Horizontal gradient") << tr("Vertical gradient") + << tr("First diagonal gradient") << tr("Second diagonal gradient") + << tr("First corner gradient") << tr("Second corner gradient") + << tr("Third corner gradient") << tr("Fourth corner gradient"); idList << XGUI::HorizontalGradient << XGUI::VerticalGradient << XGUI::Diagonal1Gradient << XGUI::Diagonal2Gradient << XGUI::Corner1Gradient << XGUI::Corner2Gradient << XGUI::Corner3Gradient << XGUI::Corner4Gradient; #ifdef OCC_ENABLE_TEXTURED_BACKGROUND txtList << XGUI::CenterTexture << XGUI::TileTexture << XGUI::StretchTexture; #endif - return tr("BG_IMAGE_FILES"); + return tr("Image files (*.bmp *.gif *.pix *.xwd *.rgb *.rs)"); } XGUI_Viewer::XGUI_Viewer(XGUI_MainWindow* theParent, bool DisplayTrihedron) diff --git a/src/XGUI/XGUI_Workshop.cpp b/src/XGUI/XGUI_Workshop.cpp index 55e16fcf8..ecf852496 100644 --- a/src/XGUI/XGUI_Workshop.cpp +++ b/src/XGUI/XGUI_Workshop.cpp @@ -68,34 +68,34 @@ void XGUI_Workshop::initMenu() XGUI_Command* aCommand; - aCommand = aGroup->addFeature("SAVE_CMD", tr("SAVE_MENU"), tr("SAVE_MENU_TIP"), + aCommand = aGroup->addFeature("SAVE_CMD", tr("Save..."), tr("Save the document"), QIcon(":pictures/save.png"), QKeySequence::Save); aCommand->connectTo(this, SLOT(onSave())); //aCommand->disable(); - aCommand = aGroup->addFeature("UNDO_CMD", tr("UNDO_MENU"), tr("UNDO_MENU_TIP"), + aCommand = aGroup->addFeature("UNDO_CMD", tr("Undo"), tr("Undo last command"), QIcon(":pictures/undo.png"), QKeySequence::Undo); - aCommand = aGroup->addFeature("REDO_CMD", tr("REDO_MENU"), tr("REDO_MENU_TIP"), + aCommand = aGroup->addFeature("REDO_CMD", tr("Redo"), tr("Redo last command"), QIcon(":pictures/redo.png"), QKeySequence::Redo); - aCommand = aGroup->addFeature("REBUILD_CMD", tr("REBUILD_MENU"), tr("REBUILD_MENU_TIP"), + aCommand = aGroup->addFeature("REBUILD_CMD", tr("Rebuild"), tr("Rebuild data objects"), QIcon(":pictures/rebuild.png")); - aCommand = aGroup->addFeature("SAVEAS_CMD", tr("SAVEAS_MENU"), tr("SAVEAS_MENU_TIP"), + aCommand = aGroup->addFeature("SAVEAS_CMD", tr("Save as..."), tr("Save the document into a file"), QIcon(":pictures/save.png")); aCommand->connectTo(this, SLOT(onSaveAs())); //aCommand->disable(); - aCommand = aGroup->addFeature("OPEN_CMD", tr("OPEN_MENU"), tr("OPEN_MENU_TIP"), + aCommand = aGroup->addFeature("OPEN_CMD", tr("Open..."), tr("Open a new document"), QIcon(":pictures/open.png"), QKeySequence::Open); aCommand->connectTo(this, SLOT(onOpen())); - aCommand = aGroup->addFeature("NEW_CMD", tr("NEW_MENU"), tr("NEW_MENU_TIP"), + aCommand = aGroup->addFeature("NEW_CMD", tr("New"), tr("Create a new document"), QIcon(":pictures/new.png"), QKeySequence::New); aCommand->connectTo(this, SLOT(onNew())); - aCommand = aGroup->addFeature("EXIT_CMD", tr("EXIT_MENU"), tr("EXIT_MENU_TIP"), + aCommand = aGroup->addFeature("EXIT_CMD", tr("Exit"), tr("Exit application"), QIcon(":pictures/close.png"), QKeySequence::Close); aCommand->connectTo(this, SLOT(onExit())); diff --git a/src/XGUI/XGUI_msg_en.ts b/src/XGUI/XGUI_msg_en.ts deleted file mode 100644 index afe0ddcae..000000000 --- a/src/XGUI/XGUI_msg_en.ts +++ /dev/null @@ -1,226 +0,0 @@ - - - - - @default - - - XGUI_Workshop - - NEW_MENU - New - - - NEW_MENU_TIP - Create new document - - - OPEN_MENU - Open... - - - OPEN_MENU_TIP - Open document - - - SAVE_MENU - Save - - - SAVE_MENU_TIP - Save document - - - SAVEAS_MENU - Save As... - - - SAVEAS_MENU_TIP - Save document in another file - - - EXIT_MENU - Exit - - - EXIT_MENU_TIP - Exit from application - - - UNDO_MENU - Undo - - - UNDO_MENU_TIP - Undo last command - - - REDO_MENU - Redo - - - REDO_MENU_TIP - Redo last command - - - CUT_MENU - Cut - - - CUT_MENU_TIP - Cut selected object - - - COPY_MENU - Copy - - - COPY_MENU_TIP - Copy selected object - - - PASTE_MENU - Paste - - - PASTE_MENU_TIP - Paste copied object - - - REBUILD_MENU - Rebuild - - - REBUILD_MENU_TIP - Rebuild data objects - - - - XGUI_MainWindow - - WINDOW_TITLE - New GEOM - - - OBJECT_BROWSER_TITLE - Object Browser - - - - XGUI_MainMenu - - MENU_TITLE - Menu - - - GEN_MENU_TITLE - General - - - - XGUI_Viewer - - GT_HORIZONTALGRADIENT - Horizontal gradient - - - GT_VERTICALGRADIENT - Vertical gradient - - - GT_FIRSTDIAGONALGRADIENT - First diagonal gradient - - - GT_SECONDDIAGONALGRADIENT - Second diagonal gradient - - - GT_FIRSTCORNERGRADIENT - First corner gradient - - - GT_SECONDCORNERGRADIENT - Second corner gradient - - - GT_THIRDCORNERGRADIENT - Third corner gradient - - - GT_FORTHCORNERGRADIENT - Fourth corner gradient - - - BG_IMAGE_FILES - Image files (*.bmp *.gif *.pix *.xwd *.rgb *.rs) - - - - XGUI_ViewWindow - - OCC_IMAGE_FILES - Images Files (*.bmp *.png *.jpg *.jpeg *.eps *.ps) - - - DUMP_VIEW - Dump view - - - FIT_ALL - Fit all - - - FIT_AREA - Fit area - - - CLONE_VIEW - Clone view - - - ZOOM_VIEW - Zoom - - - PAN_VIEW - Panning - - - GLOB_PAN_VIEW - Global panning - - - ROTATE_VIEW - Rotate - - - FRONT_VIEW - Front - - - BACK_VIEW - Back - - - TOP_VIEW - Top - - - BOTTOM_VIEW - Bottom - - - LEFT_VIEW - Left - - - RIGHT_VIEW - Right - - - RESET_VIEW - Reset - - -