Ignore:
Timestamp:
Sep 14, 2014, 4:22:48 PM (10 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:
7f1b51
Parents:
29b52b
git-author:
Frederik Heber <heber@…> (09/12/14 08:00:59)
git-committer:
Frederik Heber <heber@…> (09/14/14 16:22:48)
Message:

Added QtFavoriteActions to QtToolBar to spawn placeholder icons of most favorite Actions.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/UIElements/Views/Qt4/QtToolBar.hpp

    r29b52b r8859b5  
    2020#include "Menu/Qt4/QtMenuPipe.hpp"
    2121
     22#include <map>
     23#include <set>
     24#include <string>
     25
     26#include "CodePatterns/Observer/Observer.hpp"
     27
    2228
    2329class QtToolBar : public QToolBar
     
    2834  virtual ~QtToolBar();
    2935
     36  /** Adds an action named \a token to the toolbar.
     37   *
     38   * @param token token of Action
     39   * @param description description to appear as tooltip
     40   * @param icon_name name of icon
     41   */
     42  void addActionItem(const std::string &token, const std::string &description, const std::string &icon_name);
     43
     44  /** Function to add a set of favorite actions.
     45   *
     46   * @param _max maximum number of actions to add
     47   */
     48  void addFavoriteActionItems(const unsigned int _max);
     49
     50  //!> typedef for a set of action tokens
     51  typedef std::set<std::string> present_actions_t;
     52
     53  /** Getter for current set of present action on this toolbar.
     54   *
     55   * @return set of action tokens
     56   */
     57  const present_actions_t & getPresentActions() const
     58  { return present_actions; }
     59
    3060private:
    3161  std::list<QtMenuPipe*> plumbing;
    3262
    33   void addActionItem(const std::string &token, const std::string &description, const std::string &icon_name);
     63  /** This class knows about all Actions being called and stores their frequency.
     64   *
     65   * This is used to know about the topmost used Actions and creating placeholder
     66   * toolbar icons for these on program launch.
     67   *
     68   */
     69  class QtFavoriteActions : public Observer
     70  {
     71  public:
     72    QtFavoriteActions();
     73    ~QtFavoriteActions();
    3474
     75    void addToolBarActions(
     76        QtToolBar &_toolbar,
     77        const unsigned int _max) const;
     78
     79    void update(Observable *publisher);
     80    void subjectKilled(Observable *publisher);
     81    void recieveNotification(Observable *publisher, Notification_ptr notification);
     82
     83    QIcon getIcon(
     84        const std::string &_token,
     85        const std::string &_icon_name
     86        ) const;
     87
     88  private:
     89    QIcon createIconPlaceholder(
     90        const std::string &_token
     91        ) const;
     92
     93  private:
     94    //!> typedef for the action counts
     95    typedef std::map<std::string, unsigned int> ActionCounts_t;
     96    //!> map counts how often each action has been called
     97    ActionCounts_t ActionCounts;
     98    //!> sign in to ActionQueue?
     99    bool ActionQueue_observing;
     100  };
     101
     102  //!> instance dealing with favorite action icons
     103  QtFavoriteActions FavActions;
     104
     105  //!> set of already present action icons
     106  present_actions_t present_actions;
    35107};
    36108
Note: See TracChangeset for help on using the changeset viewer.