Ignore:
Timestamp:
Feb 12, 2016, 11:15:39 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:
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)
Message:

All QtMoleculeItem now heed QtObservedMolecule and QtMoleculeList takes InstanceBoard.

File:
1 edited

Legend:

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

    r1b6415a rca1535  
    1717#include <QStandardItem>
    1818
    19 #include "CodePatterns/Observer/Observer.hpp"
    20 
    2119#include <boost/function.hpp>
    2220#include <boost/thread/recursive_mutex.hpp>
     
    2422#include <string>
    2523
    26 #include "molecule.hpp"
     24#include "UIElements/Qt4/InstanceBoard/QtObservedMolecule.hpp"
    2725
    2826/** This class describes the general interface for a specific item in a QtAbstractItemModel
     
    3735 * -# relaying updateState() call from QtMoleculeList to the specific internal_updateState()
    3836 */
    39 class QtMoleculeItem : public QStandardItem, public Observer
     37class QtMoleculeItem : public QStandardItem
    4038{
    4139public:
    42   //!> typedef for a list of notification channels required, to know when to update
    43   typedef Observable::channels_t channellist_t;
    44 
    4540  //!> enum states whether an item's formula changed or not
    4641  enum MoveTypes {
     
    5853      const enum MoveTypes)> emitDirtyState_t;
    5954
    60   //!> typedef for callback function to model to inform when our subjectKilled() was called
    61   typedef const boost::function<void (const moleculeId_t _id)> emitSubjectKilledState_t;
    62 
    6355  QtMoleculeItem(
    64       const moleculeId_t _molid,
    65       const channellist_t &_channellist,
     56      QtObservedMolecule::ptr &_ObservedMolecule,
    6657      const enum MoveTypes _movetype,
    67       const emitDirtyState_t _emitDirtyState,
    68       const emitSubjectKilledState_t _emitSubjectKilledState);
     58      const emitDirtyState_t _emitDirtyState);
    6959  virtual ~QtMoleculeItem();
    7060
     
    7464  void updateState();
    7565
    76   /** Const getter to this item's molecule.
    77    *
    78    * \return const ref to \a mol
    79    */
    80   const molecule * const getMolecule() const;
    81 
    82   /** Getter for the id of the molecule this item is associated to
    83    *
    84    * \return id of molecule
    85    */
    86   moleculeId_t getMoleculeId() const
    87   { return molid; }
    88 
    8966  /** Returns the type of this QtMoleculeItem, i.e. the column in QtMoleculeList.
    9067   *
     
    9370  virtual QtMoleculeItem::COLUMNTYPES getType() const = 0;
    9471
    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; }
    9978
    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(); }
    10385
    10486protected:
     
    10890  virtual void internal_updateState() = 0;
    10991
    110   //!> molecule we are signed on to
    111   const moleculeId_t molid;
     92  //!> ptr to ObservedMolecule we follow
     93  const QtObservedMolecule::ptr ObservedMolecule;
    11294
    11395private:
    11496  //!> move type for this specific item, set this when implementing
    11597  const enum MoveTypes movetype;
    116 
    117   //!> ref to the specific static list of channels we are signed on to
    118   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;
    12298
    12399  //!> states that this item needs to be updated
     
    126102  //!> bound callback function to inform model about change
    127103  const emitDirtyState_t emitDirtyState;
    128 
    129   //!> bound callback function to inform model about change
    130   const emitSubjectKilledState_t emitSubjectKilledState;
    131 
    132   //!> this protects the signing on and off
    133   mutable boost::recursive_mutex owner_mutex;
    134104};
    135105
Note: See TracChangeset for help on using the changeset viewer.