Ignore:
Timestamp:
Apr 18, 2016, 10:33:41 PM (9 years ago)
Author:
Frederik Heber <heber@…>
Branches:
Action_Thermostats, Add_AtomRandomPerturbation, Add_FitFragmentPartialChargesAction, Add_RotateAroundBondAction, Add_SelectAtomByNameAction, Added_ParseSaveFragmentResults, AddingActions_SaveParseParticleParameters, Adding_Graph_to_ChangeBondActions, Adding_MD_integration_tests, Adding_ParticleName_to_Atom, Adding_StructOpt_integration_tests, AtomFragments, Automaking_mpqc_open, AutomationFragmentation_failures, Candidate_v1.5.4, Candidate_v1.6.0, Candidate_v1.6.1, ChangeBugEmailaddress, ChangingTestPorts, ChemicalSpaceEvaluator, CombiningParticlePotentialParsing, Combining_Subpackages, Debian_Package_split, Debian_package_split_molecuildergui_only, Disabling_MemDebug, Docu_Python_wait, EmpiricalPotential_contain_HomologyGraph, EmpiricalPotential_contain_HomologyGraph_documentation, Enable_parallel_make_install, Enhance_userguide, Enhanced_StructuralOptimization, Enhanced_StructuralOptimization_continued, Example_ManyWaysToTranslateAtom, Exclude_Hydrogens_annealWithBondGraph, FitPartialCharges_GlobalError, Fix_BoundInBox_CenterInBox_MoleculeActions, Fix_ChargeSampling_PBC, Fix_ChronosMutex, Fix_FitPartialCharges, Fix_FitPotential_needs_atomicnumbers, Fix_ForceAnnealing, Fix_IndependentFragmentGrids, Fix_ParseParticles, Fix_ParseParticles_split_forward_backward_Actions, Fix_PopActions, Fix_QtFragmentList_sorted_selection, Fix_Restrictedkeyset_FragmentMolecule, Fix_StatusMsg, Fix_StepWorldTime_single_argument, Fix_Verbose_Codepatterns, Fix_fitting_potentials, Fixes, ForceAnnealing_goodresults, ForceAnnealing_oldresults, ForceAnnealing_tocheck, ForceAnnealing_with_BondGraph, ForceAnnealing_with_BondGraph_continued, ForceAnnealing_with_BondGraph_continued_betteresults, ForceAnnealing_with_BondGraph_contraction-expansion, FragmentAction_writes_AtomFragments, FragmentMolecule_checks_bonddegrees, GeometryObjects, Gui_Fixes, Gui_displays_atomic_force_velocity, ImplicitCharges, IndependentFragmentGrids, IndependentFragmentGrids_IndividualZeroInstances, IndependentFragmentGrids_IntegrationTest, IndependentFragmentGrids_Sole_NN_Calculation, JobMarket_RobustOnKillsSegFaults, JobMarket_StableWorkerPool, JobMarket_unresolvable_hostname_fix, MoreRobust_FragmentAutomation, ODR_violation_mpqc_open, PartialCharges_OrthogonalSummation, PdbParser_setsAtomName, PythonUI_with_named_parameters, QtGui_reactivate_TimeChanged_changes, Recreated_GuiChecks, Rewrite_FitPartialCharges, RotateToPrincipalAxisSystem_UndoRedo, SaturateAtoms_findBestMatching, SaturateAtoms_singleDegree, StoppableMakroAction, Subpackage_CodePatterns, Subpackage_JobMarket, Subpackage_LinearAlgebra, Subpackage_levmar, Subpackage_mpqc_open, Subpackage_vmg, Switchable_LogView, ThirdParty_MPQC_rebuilt_buildsystem, TrajectoryDependenant_MaxOrder, TremoloParser_IncreasedPrecision, TremoloParser_MultipleTimesteps, TremoloParser_setsAtomName, Ubuntu_1604_changes, stable
Children:
ea2663
Parents:
24eb6b
git-author:
Frederik Heber <heber@…> (03/18/16 10:17:01)
git-committer:
Frederik Heber <heber@…> (04/18/16 22:33:41)
Message:

Removed all mutexes and updateDirtyStates() in QtMoleculeList, replaced by simpler slots.

  • thanks to events we don't need this humonguous system of lists, update timers, and mutexes. We simply need to take action whenever an event comes in.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/UIElements/Views/Qt4/MoleculeList/QtMoleculeList.hpp

    r24eb6b r5771e6  
    2626
    2727#include "UIElements/Views/Qt4/MoleculeList/QtMoleculeItem.hpp"
     28#include "UIElements/Views/Qt4/MoleculeList/QtObservedMoleculeObserver.hpp"
    2829#include "UIElements/Qt4/InstanceBoard/QtObservedMolecule.hpp"
    2930
     
    4748
    4849private slots:
     50  void formulaChanged(const QtObservedMolecule::ptr _mol);
     51  void nameChanged(const QtObservedMolecule::ptr _mol);
     52
    4953  void moleculeNameChanged(QStandardItem*);
    5054  void checkForVisibilityChange(QStandardItem*);
    51   void checkState();
    52 
    53   friend class QtMoleculeItem;
    54 
    55   std::string readdItem(QtMoleculeItem *_molitem);
    5655
    5756signals:
    58   void moleculeSelected(molecule*);
    59   void moleculeUnSelected(molecule*);
     57  void moleculeSelected(const QtObservedMolecule::ptr _mol);
     58  void moleculeUnSelected(const QtObservedMolecule::ptr _mol);
    6059  void moleculesVisibilityChanged(const moleculeId_t, bool);
    6160
    6261private:
    63 
    64   bool ChangingChildrensVisibility;
    6562
    6663private slots:
     
    7067
    7168private:
    72   mutable boost::recursive_mutex listAccessing_mutex;
    73   mutable boost::recursive_mutex refill_mutex;
    74   mutable boost::recursive_mutex map_mutex;
    75 
    76   //!> informs the view in regular intervals about updates
    77   QTimer *update_timer;
    78 
    79   //!> how often per second update is signalled to view
    80   static const unsigned int update_times_per_second;
    81 
    8269  friend class QtMoleculeListView;
    8370
     
    10794  void removeMoleculeItem(QtMoleculeItem * const _item);
    10895  int setOccurrence(QStandardItem * const _groupitem);
    109   bool areAnyItemsDirty();
    11096  void setVisibilityForMoleculeItem(QtMoleculeItem* _item);
    11197  void setVisibilityForGroupItem(QStandardItem* _item);
     98  void moveItem(QtMoleculeItem *_molitem, const std::string &_new_formula);
    11299
    113   void updateItemStates();
     100//  void updateItemStates();
    114101
    115102  //!> reference to InstanceBoard
     
    130117  MoleculeItemBiMap_t MoleculeItemBiMap;
    131118
    132   typedef std::map<moleculeId_t, unsigned int> KilledItemsPerMolecule_t;
    133   //!> takes note of how many items have already been killed for a specific row/molecule
    134   KilledItemsPerMolecule_t KilledItemsPerMolecule;
    135 
    136119  typedef std::set< moleculeId_t > list_of_molecules_t;
    137120  typedef std::set< std::pair<moleculeId_t, QtMoleculeItem::COLUMNTYPES> > list_of_molecule_items_t;
    138121  typedef std::set< std::pair<std::string, QtMoleculeItem::COLUMNTYPES> > list_of_group_items_t;
    139122
    140   //!> list of molecule items that need an update
    141   list_of_molecule_items_t dirtyMolItems;
    142   //!> list of molecule items that need an update of visibility
    143   list_of_molecules_t visibilityMolItems;
    144   //!> list of group items that need an update
    145   list_of_group_items_t dirtyGroupItems;
    146   //!> list of group items that need an update of visibility
    147   list_of_group_items_t visibilityGroupItems;
    148   //!> list of new molecules which need to be added
    149   std::vector<QtObservedMolecule::ptr> newMolecules;
    150   //!> list of molecules that have been removed
    151   std::vector<moleculeId_t> removedMolecules;
    152   //!> list of molecule items to molecule's whose formulas has changed and need to be moved
    153   list_of_molecules_t toBeMovedItems;
     123  //!> listens to all QtObservedMolecule and relays important events to us
     124  QtObservedMoleculeObserver observer;
    154125};
    155126
Note: See TracChangeset for help on using the changeset viewer.