Changeset b375e7 for src/UIElements


Ignore:
Timestamp:
Feb 12, 2016, 11:15:03 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:
4ab5dc
Parents:
db842b
git-author:
Frederik Heber <heber@…> (10/15/15 09:08:37)
git-committer:
Frederik Heber <heber@…> (02/12/16 23:15:03)
Message:

QtFavoriteActions uses ObservedValue for checking last queued action's name.

Location:
src/UIElements
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • src/UIElements/Qt4/QtUIFactory.cpp

    rdb842b rb375e7  
    165165        executePythonScript(scriptfile_line, scriptname);
    166166        do {
    167           testlauncher_sleep(boost::posix_time::seconds(.1));
     167          app->processEvents();
     168          testlauncher_sleep(boost::posix_time::seconds(.5));
    168169        } while (!MoleCuilder::ActionQueue::getInstance().isIdle());
    169170      }
     
    177178
    178179    std::cout << "TESTLAUNCHER: Sleeping after script" << std::endl;
    179     testlauncher_sleep(boost::posix_time::seconds(1.5));
     180    testlauncher_sleep(boost::posix_time::seconds(1.));
    180181
    181182  } while ((scriptiter != _scripts.end()) && (!testlauncher_Interrupted));
  • src/UIElements/Views/Qt4/QtToolBar.hpp

    rdb842b rb375e7  
    2424#include <string>
    2525
     26#include "CodePatterns/ObservedValue.hpp"
     27#include "CodePatterns/Observer/Observable.hpp"
    2628#include "CodePatterns/Observer/Observer.hpp"
    2729
     
    99101        ) const;
    100102
     103    void resetQueuedAction();
     104    std::string updateQueuedAction() const;
     105
    101106  private:
     107    //!> cached value of ActionQueue's last action name
     108    ObservedValue<std::string> LastActionCalled;
     109
     110    //!> all channels that signal a queued action
     111    static const Observable::channels_t ActionQueuedChannels;
     112
    102113    //!> typedef for the action counts
    103114    typedef std::map<std::string, unsigned int> ActionCounts_t;
  • src/UIElements/Views/Qt4/QtToolBar_QtFavoriteActions.cpp

    rdb842b rb375e7  
    5555using namespace MoleCuilder;
    5656
     57const Observable::channels_t
     58QtToolBar::QtFavoriteActions::ActionQueuedChannels(1, ActionQueue::ActionQueued);
     59
    5760QtToolBar::QtFavoriteActions::QtFavoriteActions() :
    5861  Observer("QtFavoriteActions"),
     62  LastActionCalled(
     63      ActionQueue::getPointer(),
     64      boost::bind(&QtToolBar::QtFavoriteActions::updateQueuedAction, boost::cref(this)),
     65      "QtFavoriteActions_QueuedAction",
     66      std::string(""),
     67      ActionQueuedChannels),
    5968  ActionQueue_observing(false)
    6069{
     
    8594}
    8695
     96std::string QtToolBar::QtFavoriteActions::updateQueuedAction() const
     97{
     98  const Action *lastcalledaction =
     99      ActionQueue::getInstance().lastChanged<Action>();
     100  if (lastcalledaction != NULL)
     101    return lastcalledaction->getName();
     102  else
     103    return std::string("");
     104}
     105
     106void QtToolBar::QtFavoriteActions::resetQueuedAction()
     107{
     108  const std::string name = LastActionCalled.get();
     109  if (!name.empty())
     110    ++ActionCounts[name];
     111}
     112
    87113QtToolBar::QtFavoriteActions::~QtFavoriteActions()
    88114{
     
    115141{
    116142  if (dynamic_cast<ActionQueue *>(publisher) != NULL) {
    117     // increment count for this action
    118     const Action *lastcalledaction =
    119         dynamic_cast<ActionQueue *>(publisher)->lastChanged<Action>();
    120     ++ActionCounts[lastcalledaction->getName()];
     143    resetQueuedAction();
    121144  } else {
    122145    ASSERT(0, "QtFavoriteActions::update() - cannot get here, we are only subscribed to ActionQueue.");
Note: See TracChangeset for help on using the changeset viewer.