- Timestamp:
- Feb 12, 2016, 11:15:39 PM (9 years ago)
- 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:
- deb5ee
- Parents:
- 1b6415a
- git-author:
- Frederik Heber <heber@…> (10/29/15 22:21:30)
- git-committer:
- Frederik Heber <heber@…> (02/12/16 23:15:39)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/UIElements/Views/Qt4/MoleculeList/QtMoleculeItem.hpp
r1b6415a rca1535 17 17 #include <QStandardItem> 18 18 19 #include "CodePatterns/Observer/Observer.hpp"20 21 19 #include <boost/function.hpp> 22 20 #include <boost/thread/recursive_mutex.hpp> … … 24 22 #include <string> 25 23 26 #include " molecule.hpp"24 #include "UIElements/Qt4/InstanceBoard/QtObservedMolecule.hpp" 27 25 28 26 /** This class describes the general interface for a specific item in a QtAbstractItemModel … … 37 35 * -# relaying updateState() call from QtMoleculeList to the specific internal_updateState() 38 36 */ 39 class QtMoleculeItem : public QStandardItem , public Observer37 class QtMoleculeItem : public QStandardItem 40 38 { 41 39 public: 42 //!> typedef for a list of notification channels required, to know when to update43 typedef Observable::channels_t channellist_t;44 45 40 //!> enum states whether an item's formula changed or not 46 41 enum MoveTypes { … … 58 53 const enum MoveTypes)> emitDirtyState_t; 59 54 60 //!> typedef for callback function to model to inform when our subjectKilled() was called61 typedef const boost::function<void (const moleculeId_t _id)> emitSubjectKilledState_t;62 63 55 QtMoleculeItem( 64 const moleculeId_t _molid, 65 const channellist_t &_channellist, 56 QtObservedMolecule::ptr &_ObservedMolecule, 66 57 const enum MoveTypes _movetype, 67 const emitDirtyState_t _emitDirtyState, 68 const emitSubjectKilledState_t _emitSubjectKilledState); 58 const emitDirtyState_t _emitDirtyState); 69 59 virtual ~QtMoleculeItem(); 70 60 … … 74 64 void updateState(); 75 65 76 /** Const getter to this item's molecule.77 *78 * \return const ref to \a mol79 */80 const molecule * const getMolecule() const;81 82 /** Getter for the id of the molecule this item is associated to83 *84 * \return id of molecule85 */86 moleculeId_t getMoleculeId() const87 { return molid; }88 89 66 /** Returns the type of this QtMoleculeItem, i.e. the column in QtMoleculeList. 90 67 * … … 93 70 virtual QtMoleculeItem::COLUMNTYPES getType() const = 0; 94 71 95 private: 96 void update(Observable *publisher); 97 void recieveNotification(Observable *publisher, Notification_ptr notification); 98 void subjectKilled(Observable *publisher); 72 /** Getter to the observed molecule in this item. 73 * 74 * \return const ref to ObservedMolecule for this item 75 */ 76 const QtObservedMolecule::ptr& getMolecule() const 77 { return ObservedMolecule; } 99 78 100 protected: 101 void signOnToMolecule(); 102 void signOffFromMolecule(); 79 /** Getter for the id of the observed molecule for this item. 80 * 81 * \return id of the observed molecule 82 */ 83 const moleculeId_t getMoleculeId() const 84 { return ObservedMolecule->getMolIndex(); } 103 85 104 86 protected: … … 108 90 virtual void internal_updateState() = 0; 109 91 110 //!> molecule we are signed on to111 const moleculeId_t molid;92 //!> ptr to ObservedMolecule we follow 93 const QtObservedMolecule::ptr ObservedMolecule; 112 94 113 95 private: 114 96 //!> move type for this specific item, set this when implementing 115 97 const enum MoveTypes movetype; 116 117 //!> ref to the specific static list of channels we are signed on to118 const channellist_t &channellist;119 120 //!> the Observable we are signed on, also indicates whether we are sign on (not NULL)121 const Observable * owner;122 98 123 99 //!> states that this item needs to be updated … … 126 102 //!> bound callback function to inform model about change 127 103 const emitDirtyState_t emitDirtyState; 128 129 //!> bound callback function to inform model about change130 const emitSubjectKilledState_t emitSubjectKilledState;131 132 //!> this protects the signing on and off133 mutable boost::recursive_mutex owner_mutex;134 104 }; 135 105
Note:
See TracChangeset
for help on using the changeset viewer.