- Timestamp:
- Sep 29, 2013, 11:40:48 AM (11 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:
- 8481f5
- Parents:
- c48ac12
- git-author:
- Frederik Heber <heber@…> (08/29/13 09:23:47)
- git-committer:
- Frederik Heber <heber@…> (09/29/13 11:40:48)
- Location:
- src/UIElements/Views/Qt4
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
src/UIElements/Views/Qt4/QtStatusBar.cpp
rc48ac12 r426c84 37 37 #include <QtGui/QLabel> 38 38 #include <QtGui/QBoxLayout> 39 #include <QtCore/QMetaType> 39 40 #include <QtGui/QProgressBar> 40 41 … … 55 56 atomCount(World::getInstance().numAtoms()), 56 57 moleculeCount(World::getInstance().numMolecules()), 57 parent(_parent) 58 parent(_parent), 59 activeProcess("") 58 60 { 59 61 World::getInstance().signOn(this); … … 63 65 addPermanentWidget(statusLabel); 64 66 redrawStatus(); 67 68 qRegisterMetaType<std::string>("std::string"); 69 connect( 70 this, SIGNAL(redrawProgressBar(const std::string, const unsigned int, const unsigned int, const bool)), 71 this, SLOT(updateProgressBar(const std::string, const unsigned int, const unsigned int, const bool))); 65 72 } 66 73 … … 79 86 else { 80 87 // we probably have some process 88 // as notify comes from ActionQueue's thread, we have to use signal/slots 89 // to inform ourselves but within the main() thread to be able to add 90 // the progressbar widget. 81 91 Process *proc; 82 92 if((proc=dynamic_cast<Process*>(subject))){ 83 redrawProcess(proc); 93 const bool StopStatus = proc->doesStop(); 94 emit redrawProgressBar(proc->getName(), proc->getMaxSteps(), proc->getCurrStep(), StopStatus); 84 95 } 85 96 } … … 101 112 } 102 113 103 void QtStatusBar::redrawProcess(Process *proc){ 114 void QtStatusBar::updateProgressBar( 115 const std::string name, 116 const unsigned int maxsteps, 117 const unsigned int currentstep, 118 const bool StopStatus) 119 { 104 120 progressIndicator *ind=0; 121 progressBars_t::iterator iter = progressBars.find(name); 105 122 // see what we have to do with the process 106 if(proc->doesStart()){ 107 ind = new progressIndicator(proc->getName()); 108 ind->bar->setMaximum(proc->getMaxSteps()); 109 progressBars.insert(pair<Process*,progressIndicator*>(proc,ind)); 123 if (iter == progressBars.end()) { 124 ind = new progressIndicator(name); 125 ind->bar->setMaximum(maxsteps); 126 progressBars.insert( std::make_pair(name,ind) ); 127 } else { 128 ind = iter->second; 110 129 } 111 else { 112 ind = progressBars[proc]; 130 if (activeProcess != name) { 131 addWidget(ind->container); 132 activeProcess = name; 113 133 } 114 if(activeProcess!=proc){ 115 addWidget(ind->container); 116 activeProcess = proc; 117 } 118 ind->bar->setValue(proc->getCurrStep()); 134 ind->bar->setValue(currentstep); 119 135 parent->repaint(); 120 if (proc->doesStop()){136 if ((iter != progressBars.end()) && StopStatus) { 121 137 removeWidget(ind->container); 122 activeProcess = 0;123 progressBars.erase( proc);138 activeProcess = std::string(""); 139 progressBars.erase(name); 124 140 delete ind; 125 141 } … … 128 144 129 145 130 QtStatusBar::progressIndicator::progressIndicator( std::stringname){146 QtStatusBar::progressIndicator::progressIndicator(const std::string &name){ 131 147 stringstream sstr; 132 148 sstr << "Busy (" << name << ")"; -
src/UIElements/Views/Qt4/QtStatusBar.hpp
rc48ac12 r426c84 35 35 36 36 struct progressIndicator{ 37 progressIndicator( std::string);37 progressIndicator(const std::string &name); 38 38 ~progressIndicator(); 39 39 QLabel *label; … … 49 49 void subjectKilled(Observable *subject); 50 50 51 private slots: 52 void updateProgressBar( 53 const std::string name, 54 const unsigned int maxsteps, 55 const unsigned int currentstep, 56 const bool StopStatus); 57 58 signals: 59 void redrawProgressBar( 60 const std::string name, 61 const unsigned int maxsteps, 62 const unsigned int currentstep, 63 const bool StopStatus); 64 51 65 private: 52 66 void redrawStatus(); 53 void redrawProcess(MoleCuilder::Process *proc);54 67 55 68 int atomCount; … … 58 71 QLabel *statusLabel; 59 72 QWidget *parent; 60 std::map<MoleCuilder::Process*,progressIndicator*> progressBars; 61 MoleCuilder::Process* activeProcess; 73 typedef std::map<std::string,progressIndicator*> progressBars_t; 74 progressBars_t progressBars; 75 std::string activeProcess; 62 76 }; 63 77
Note:
See TracChangeset
for help on using the changeset viewer.