-// Copyright (C) 2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2014-2021 CEA/DEN, EDF R&D, OPEN CASCADE
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
#include <SalomeApp_Application.h>
// QT includes
-#include <QWidgetAction>
#include <QPushButton>
#include <QSpinBox>
#include <QCheckBox>
-#include <QThread>
-#include <QMutex>
+
+#include "DependencyTree.h"
class DependencyTree_Object;
class DependencyTree_Arrow;
class DependencyTree_View;
-class DependencyTree_QThread : public QThread
-{
- Q_OBJECT
-
-public:
-
- DependencyTree_QThread( DependencyTree_View* );
- void sleepDraw();
- void cancel();
-
- DependencyTree_View* getView() { return myView; };
-
-protected:
- void run();
-
-private:
- DependencyTree_View* myView;
-};
-
typedef std::map<std::string,DependencyTree_Object*> EntryObjectMap;
typedef std::map<std::pair<DependencyTree_Object*,DependencyTree_Object*>,DependencyTree_Arrow*> ArrowsInfo;
-class DependencyTree_View: public GraphicsView_ViewPort
+class DEPENDENCYTREE_EXPORT DependencyTree_View: public GraphicsView_ViewPort
{
Q_OBJECT
DependencyTree_View( QWidget* = 0 );
~DependencyTree_View();
- void init( GraphicsView_ViewFrame* );
- void updateModel( bool = true, bool = true );
- void drawTree();
-
- QString getViewName() const;
-
- virtual void customEvent ( QEvent* );
- void mouseMoveEvent(QMouseEvent *event);
+ void init( GraphicsView_ViewFrame* );
+ void updateModel( bool = true, bool = true );
- DependencyTree_Object* getObjectByEntry( QString );
+ void mouseMoveEvent(QMouseEvent* event);
+ void wheelEvent( QWheelEvent* event );
- void setHierarchyType( const int );
- void setNodesMovable( const bool );
- void setPrefBackgroundColor( const QColor& );
- void setNodeColor( const QColor& );
- void setMainNodeColor( const QColor& );
- void setSelectNodeColor( const QColor& );
- void setArrowColor( const QColor& );
- void setHighlightArrowColor( const QColor& );
- void setSelectArrowColor( const QColor& );
+ QString getViewName() const;
- void setIsCompute( bool );
- bool getIsCompute();
-
- bool updateObjectName( const std::string &theEntry );
-
- QMutex myMutex;
+ DependencyTree_Object* getObjectByEntry( const std::string& );
public slots:
- void onUpdateModel();
- void onRebuildModel();
+
+ void onRebuildModel();
protected:
- void closeEvent( QCloseEvent* );
+
+ void resizeEvent( QResizeEvent *event );
private slots:
- void updateView();
- void onMoveNodes( bool );
- void onHierarchyType();
- void onCancel();
-signals:
+ void onUpdateModel();
+ void onMoveNodes( bool );
+ void onHierarchyType();
+ void onPreferenceChanged( const QString&, const QString& );
+ void onRenameObject( const QString& theEntry );
private:
- void addNode( const std::string& );
- void addArrow( DependencyTree_Object*, DependencyTree_Object* );
- void addNewItem( QGraphicsItem* );
-
- void parseTree();
- void parseTreeWard(const GEOMUtils::LevelsList);
- void parseTreeWardArrow(const GEOMUtils::LevelsList);
-
- void drawWard( const GEOMUtils::LevelsList&, std::map< std::string, int >&,
- std::map< int, std::vector< std::string > >&, int, const int );
- void drawWardArrows( GEOMUtils::LevelsList );
-
- void getNewTreeModel( bool = true, bool = true );
- void clearView( bool );
-
- int checkMaxLevelsNumber();
- void calcTotalCost();
- double getComputeProgress();
+ void parseTree();
+ void parseTreeWard( const GEOMUtils::LevelsList& );
+ void parseTreeWardArrow( const GEOMUtils::LevelsList& );
- void changeWidgetState( bool );
+ void addNode( const std::string& );
+ void addArrow( DependencyTree_Object*, DependencyTree_Object* );
- GEOMUtils::TreeModel myTreeModel;
+ void drawTree();
+ void drawWard( const GEOMUtils::LevelsList&, std::map< std::string, int >&,
+ std::map< int, std::vector< std::string > >&, int, const int );
+ void drawWardArrows( const GEOMUtils::LevelsList& );
- EntryObjectMap myTreeMap;
- ArrowsInfo myArrows;
+ void updateView();
+ void clearView( bool );
- int myLevelsNumber;
- int myMaxDownwardLevelsNumber;
- int myMaxUpwardLevelsNumber;
+ void fitWindow();
- QCheckBox* myNodesMovable;
- QSpinBox* myHierarchyDepth;
- QCheckBox* myDisplayAscendants;
- QCheckBox* myDisplayDescendants;
- QWidgetAction* cancelAction;
- QWidgetAction* progressAction;
- QPushButton* updateButton;
+ int checkMaxLevelsNumber();
- int myTimer;
+ void getNewTreeModel( bool = true, bool = true );
- bool myIsUpdate;
+ void setHierarchyType( const int );
+ void setNodesMovable( const bool );
+ void setPrefBackgroundColor( const QColor& );
+ void setNodeColor( const QColor& );
+ void setMainNodeColor( const QColor& );
+ void setUnpublishNodeColor( const QColor& );
+ void setSelectNodeColor( const QColor& );
+ void setArrowColor( const QColor& );
+ void setHighlightArrowColor( const QColor& );
+ void setSelectArrowColor( const QColor& );
- bool myIsCompute;
+ GEOMUtils::TreeModel myTreeModel;
- int myTotalCost;
- int myComputedCost;
+ EntryObjectMap myTreeMap;
+ ArrowsInfo myArrows;
- DependencyTree_QThread* qthread;
+ int myLevelsNumber;
+ int myMaxDownwardLevelsNumber;
+ int myMaxUpwardLevelsNumber;
- GEOM::string_array_var myMainEntries;
+ QCheckBox* myNodesMovable;
+ QSpinBox* myHierarchyDepth;
+ QCheckBox* myDisplayAscendants;
+ QCheckBox* myDisplayDescendants;
+ QPushButton* updateButton;
- SALOMEDS::Study_var myStudy;
- LightApp_SelectionMgr* mySelectionMgr;
+ LightApp_SelectionMgr* mySelectionMgr;
+ GEOM::string_array_var myMainEntries;
+ bool myIsUpdate;
};