Short Description: Essential optimizations for the Accounting View Qt Port Bug Number: n/a Release notes (y/n): no For Release Nums: 6.1 Essential optimizations for the Accounting View Qt Port: (1) Centralize the Supply and Transfer Item endpoint update mechanism to use only a single QTimer instead of one QTimer for every Account Item. Loading a model having about 670 Accounts (The URGWOM Planning regression test) caused a Windows XP system to essentially freeze up. [Qt 4.6.3]. (2) Maintain fast-access collections (QMaps) for QGraphicsItems for SimObjs, Links, Supplies and Transfers. We had been searching the QGraphicsScene using the items() method for specific instances of these items. This caused VERY SLOW LOADING of the large model mentioned above. With these, plus some other minor enhancements (e.g. limiting certain processing during a model load) the URGWOM Planning regression test now loads basically as quickly as it does in the 6.0.1 release. ------------------ AccountGfxItem.hpp AccountGfxItem.cpp ------------------ Removed AccountGfxItem's QTimer for updating Supply (and Transfer) Item end-points. This is now done centrally, by WorkspaceGfxScene. (Too many simultaneously running QTimers was apparently a problem on Windows, e.g. when loading a model with about 670 Accounts). Removed: QTimer* _updateSuppliesTimer; void updateSupplies (bool calledFromTimeout=false); void updateSuppliesTimeout(); Added: void instantiateMissingSupplyItems(); ------------------- RwGraphicsScene.hpp RwGraphicsView.cpp ------------------- Notification to RwGraphicsScene subclasses, via a virtual method, of the completion of notifications to the scene and its QGrahicsItems of mouse move events having at least one button pressed. // Notification that a mouse move event has been delivered to the // scene and all of its QGraphicsItems. virtual void RwGraphicsScene::sceneMouseButtonMoveDone (QMouseEvent*) {} This virtual method is called from RwGraphicsView::mouseMoveEvent() after calling the base class method (from which the event is delivered to the Qt4 Graphics View system). This is used in WorkspaceGfxScene to "release" (process) all queued requests for end-point updates for Supplies and Transfers. Those requests would otherwise be processed anyway when a QTimer times out. --------------------- WorkspaceGfxScene.hpp WorkspaceGfxScene.cpp SimulationGfxScene.cpp LinkGfxItem.cpp SupplyGfxItem.cpp TransferGfxItem.cpp --------------------- (1) Maintenance of references to SimObj, Link, Supply and Transfer QGraphicsItems. This provided a significant performance enhancement, as an alternative to searching the QGraphicsScene::items() list. QMap _simObjItemMap; QMap _linkItemMap; QMap _supplyItemMap; QMap _transferItemMap; ... and related methods. void simObjGfxItem_destroyed (QObject*); // private slot void linkItemDeleted (Link*, LinkGfxItem*); void supplyItemDeleted (Supply*, SupplyGfxItem*); void transferItemDeleted (Supply*, TransferGfxItem*); (2) Centralized maintenance of Supply and Transfer Item end-point update requests. Requests are accumulated in WorkspaceGfxScene variables and "released" based on a timeout OR when all other Graphics View processing for a Mouse-Move event is completed. bool _needingEndUpdates_AllSupplies; bool _needingEndUpdates_AllTransfers; QSet _needingEndUpdates_supplySet; QSet _needingEndUpdates_transferSet; QTimer* _updateSupplyEndsTimer; // for transfers too // These methods schedule an update with schedUpdateSupplyEnds(). void setSuppliesNeedEndUpdates (const QList&); void setTransfersNeedEndUpdates (const QList&); void schedUpdateSupplyEnds(); void forceUpdateSupplyEnds(); void cancelUpdateSupplyEnds(); void updateSupplyEnds (bool calledFromTimeout=false); void updateAllSupplyEndPoints(); void updateSupplyEndsTimeout(); // Qt slot // virtual fom RwGraphicsScene virtual void sceneMouseButtonMoveDone (QMouseEvent*); (3) Prevent unnecessary Supply-related processing during a model load and the subsequent "MODEL_LOADED" processing. bool _wsSceneProcessingModelLoaded; bool wsSceneProcessingModelLoaded() const { return _wsSceneProcessingModelLoaded; } ------------------ AcctRowGfxItem.cpp SimObjGfxItem.hpp SimObjGfxItem.cpp ------------------ Various optimizations.