3 #include <sys/socket.h> 38 Progress::Progress() {
43 percent = group[
"ProgressBarPercent"];
44 QString temp = (QString) group[
"ProgressBar"];
45 printPercent = temp.toUpper() ==
"ON";
48 if((percent != 1) && (percent != 2) &&
49 (percent != 5) && (percent != 10)) {
50 string m =
"Invalid preference for [ProgressBarPercent] in ";
51 m +=
"group [UserInterface] must be 1, 2, 5, or 10";
60 p_percentIncrement = percent;
61 p_printPercent = printPercent;
66 Progress::~Progress() {
77 void Progress::SetText(
const QString &text) {
88 QString Progress::Text()
const {
101 void Progress::SetMaximumSteps(
const int steps) {
103 string m =
"Value for [steps] must be greater than ";
104 m +=
"or equal to zero in [Progress::SetMaximumSteps]";
107 p_maximumSteps = steps;
109 p_currentPercent = 0;
121 void Progress::CheckStatus() {
124 if(p_currentStep > p_maximumSteps) {
125 string m =
"Step exceeds maximumSteps in [Progress::CheckStatus]";
129 if(p_currentStep == 0) {
130 if(Isis::iApp != NULL) {
136 if(p_printPercent && p_autoDisplay) {
137 cout << p_text << endl;
143 while(100.0 * p_currentStep / p_maximumSteps >= p_currentPercent) {
144 if(Isis::iApp != NULL) {
150 if(p_printPercent && p_autoDisplay) {
151 if(p_currentPercent < 100) {
152 cout << p_currentPercent <<
"% Processed\r" << flush;
155 cout << p_currentPercent <<
"% Processed" << endl;
159 p_currentPercent += p_percentIncrement;
162 if(p_autoDisplay && Isis::iApp != NULL) {
177 void Progress::DisableAutomaticDisplay() {
178 p_autoDisplay =
false;
188 int Progress::MaximumSteps()
const {
189 return p_maximumSteps;
201 int Progress::CurrentStep()
const {
202 return p_currentStep;
215 void Progress::AddSteps(
const int steps) {
217 string m =
"Value for [steps] must not be zero in [Progress::AddSteps]";
221 p_maximumSteps += steps;
223 if(p_currentStep > p_maximumSteps) {
224 string m =
"Step exceeds maximumSteps in [Progress::AddSteps]";
228 if(p_maximumSteps <= 0) {
229 string m =
"Maximum steps must be greater than zero in [Progress::AddSteps]";
PvlGroupIterator findGroup(const QString &name, PvlGroupIterator beg, PvlGroupIterator end)
Find a group with the specified name, within these indexes.
Namespace for the standard library.
Contains multiple PvlContainers.
#define _FILEINFO_
Macro for the filename and line number.
void ProcessGuiEvents()
Processes the gui events.
Namespace for ISIS/Bullet specific routines.
void UpdateProgress(const QString &text, bool print)
Updates the progress bar in the gui.