Skip to content

Commit

Permalink
Refs #10223 Add a progress bar to the Refl UI
Browse files Browse the repository at this point in the history
  • Loading branch information
Harry Jeffery committed Sep 11, 2014
1 parent 862b3b5 commit ee069df
Show file tree
Hide file tree
Showing 5 changed files with 38 additions and 10 deletions.
Expand Up @@ -57,6 +57,10 @@ namespace MantidQt
virtual void giveUserWarning(std::string prompt, std::string title);
virtual void giveUserCritical(std::string prompt, std::string title);

//Set the status of the progress bar
virtual void setProgressRange(int min, int max);
virtual void setProgress(int progress);

//Accessor methods
virtual std::vector<size_t> getSelectedRowIndexes() const;

Expand Down
Expand Up @@ -49,6 +49,10 @@ namespace MantidQt
virtual void giveUserWarning(std::string prompt, std::string title) = 0;
virtual void giveUserCritical(std::string prompt, std::string title) = 0;

//Set the status of the progress bar
virtual void setProgressRange(int min, int max) = 0;
virtual void setProgress(int progress) = 0;

//Accessor methods
virtual std::vector<size_t> getSelectedRowIndexes() const = 0;

Expand Down
Expand Up @@ -329,17 +329,11 @@
</widget>
</item>
<item>
<spacer name="spacerRowButtons">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
<widget class="QProgressBar" name="progressBar">
<property name="value">
<number>24</number>
</property>
</spacer>
</widget>
</item>
<item>
<widget class="QPushButton" name="buttonProcess">
Expand Down
23 changes: 23 additions & 0 deletions Code/Mantid/MantidQt/CustomInterfaces/src/QtReflMainView.cpp
Expand Up @@ -42,6 +42,10 @@ namespace MantidQt
ui.splitterTables->setStretchFactor(0, 0);
ui.splitterTables->setStretchFactor(1, 1);

//Zero out the progress bar
ui.progressBar->setRange(0, 100);
ui.progressBar->setValue(0);

connect(ui.workspaceSelector,SIGNAL(activated(QString)),this,SLOT(setModel(QString)));
connect(ui.buttonSave, SIGNAL(clicked()),this, SLOT(saveButton()));
connect(ui.buttonSaveAs, SIGNAL(clicked()),this, SLOT(saveAsButton()));
Expand Down Expand Up @@ -184,6 +188,25 @@ namespace MantidQt
return "";
}

/**
Set the range of the progress bar
@param min : The minimum value of the bar
@param max : The maxmimum value of the bar
*/
void QtReflMainView::setProgressRange(int min, int max)
{
ui.progressBar->setRange(min, max);
}

/**
Set the status of the progress bar
@param progress : The current value of the bar
*/
void QtReflMainView::setProgress(int progress)
{
ui.progressBar->setValue(progress);
}

/**
Get the indices of the highlighted rows
@returns a vector of unsigned ints contianing the highlighted row numbers
Expand Down
Expand Up @@ -67,11 +67,14 @@ namespace MantidQt
}
}

m_view->setProgressRange(0, (int)rows.size());
int progress = 0;
for(auto it = rows.begin(); it != rows.end(); ++it)
{
try
{
processRow(*it);
m_view->setProgress(++progress);
}
catch(std::exception& ex)
{
Expand Down

0 comments on commit ee069df

Please sign in to comment.