Commit 638583bc authored by Nick Draper's avatar Nick Draper
Browse files

clang format and release notes

parent 575681c2
......@@ -38,7 +38,8 @@ public:
void stopObservingManager();
virtual void progressHandle(const IAlgorithm *alg, double p,
const std::string &msg, const double estimatedTime,
const std::string &msg,
const double estimatedTime,
const int progressPrecision);
virtual void startingHandle(IAlgorithm_sptr alg);
virtual void startHandle(const IAlgorithm *alg);
......
......@@ -166,7 +166,7 @@ void AlgorithmObserver::errorHandle(const IAlgorithm *alg,
void AlgorithmObserver::_progressHandle(
const Poco::AutoPtr<Algorithm::ProgressNotification> &pNf) {
this->progressHandle(pNf->algorithm(), pNf->progress, pNf->message,
pNf->estimatedTime, pNf->progressPrecision);
pNf->estimatedTime, pNf->progressPrecision);
}
/** Poco notification handler for Algorithm::StartedNotification.
......
......@@ -68,7 +68,7 @@ void Pause::exec() {
if (seconds > duration)
break;
// Report progress for non-infinite runs
this->progress(seconds / duration,"",duration - seconds);
this->progress(seconds / duration, "", duration - seconds);
}
}
}
......
......@@ -14,8 +14,7 @@ AlgorithmObserverAdapter::AlgorithmObserverAdapter(PyObject *self)
: API::AlgorithmObserver(), m_self(self) {}
void AlgorithmObserverAdapter::progressHandle(const API::IAlgorithm *alg,
double p,
const std::string &msg,
double p, const std::string &msg,
const double estimatedTime,
const int progressPrecision) {
UNUSED_ARG(alg)
......
......@@ -42,6 +42,7 @@ Improvements
- Surface plots no longer spill over the axes when their limits are reduced.
- The instrument view now ignores non-finite (infinity and NaN) values and should now display workspaces containing those values.
- The gray and plasma colormaps have been added to the instrument view.
- Slow running algorithms will now display an estimated time to completion in their progress bars.
- The x-axis tick labels on colorfill plots are now horizontal.
Bugfixes
......
......@@ -41,16 +41,16 @@ public:
void algorithmEnded(Mantid::API::AlgorithmID);
/// Signals to the presenters that there has been progress in one of the
/// algorithms
void updateProgressBar(Mantid::API::AlgorithmID, double,
const std::string &, const double estimatedTime,
void updateProgressBar(Mantid::API::AlgorithmID, double, const std::string &,
const double estimatedTime,
const int progressPrecision);
/// Sets the parameter progress bar to show the progress and message
void setProgressBar(QProgressBar *, const double, const QString &,
const double, const int);
virtual void algorithmStartedSlot(Mantid::API::AlgorithmID) = 0;
virtual void updateProgressBarSlot(Mantid::API::AlgorithmID, const double, const QString,
const double,
virtual void updateProgressBarSlot(Mantid::API::AlgorithmID, const double,
const QString, const double,
const int) = 0;
virtual void algorithmEndedSlot(Mantid::API::AlgorithmID) = 0;
......
......@@ -48,8 +48,8 @@ public:
/// Enable or disable the processing of updates to the algorithm progress
void blockUpdates(bool block = true);
/// Update the progress bar
void updateProgress(const double progress,
const QString &message, const double estimatedTime,
void updateProgress(const double progress, const QString &message,
const double estimatedTime,
const int progressPrecision) override;
public slots:
......
......@@ -77,8 +77,8 @@ void AlgorithmProgressDialogPresenter::updateProgressBarSlot(
return;
}
}
setProgressBar(m_progressBars.at(alg).second, progress, message, estimatedTime,
progressPrecision);
setProgressBar(m_progressBars.at(alg).second, progress, message,
estimatedTime, progressPrecision);
}
/// This slot is triggered whenever an algorithms ends. If the algorithm is not
......
......@@ -64,7 +64,8 @@ void AlgorithmProgressModel::progressHandle(const Mantid::API::IAlgorithm *alg,
const double estimatedTime,
const int progressPrecision) {
m_mainWindowPresenter->updateProgressBar(alg->getAlgorithmID(), progress,
message, estimatedTime, progressPrecision);
message, estimatedTime,
progressPrecision);
if (m_dialogPresenter) {
m_dialogPresenter->updateProgressBar(alg->getAlgorithmID(), progress,
message, estimatedTime,
......
......@@ -47,10 +47,9 @@ void AlgorithmProgressPresenterBase::algorithmEnded(
/// already have been copied into the GUI thread, so it is safe to receive it by
/// @param estimatedTime :: estimated time to completion in seconds
/// @param progressPrecision :: number of digits after the decimal
void AlgorithmProgressPresenterBase::setProgressBar(QProgressBar *progressBar,
const double progress,
const QString &message, const double estimatedTime,
const int progressPrecision) {
void AlgorithmProgressPresenterBase::setProgressBar(
QProgressBar *progressBar, const double progress, const QString &message,
const double estimatedTime, const int progressPrecision) {
progressBar->setValue(static_cast<int>(progress * 100));
// Make the progress string
std::ostringstream mess;
......@@ -77,7 +76,6 @@ void AlgorithmProgressPresenterBase::setProgressBar(QProgressBar *progressBar,
}
QString formatStr = QString::fromStdString(mess.str());
progressBar->setFormat(formatStr);
}
/// This function is called whenever an algorithm reports progress. It emits a
/// signal triggering the slot inside the GUI thread. It is safe to call this
......@@ -86,11 +84,10 @@ void AlgorithmProgressPresenterBase::setProgressBar(QProgressBar *progressBar,
/// @param progress The progress that the algorithm has reported
/// @param msg The message that the algorithm has sent
void AlgorithmProgressPresenterBase::updateProgressBar(
Mantid::API::AlgorithmID alg, double progress,
const std::string &msg, const double estimatedTime,
const int progressPrecision) {
emit updateProgressBarSignal(alg, progress, QString::fromStdString(msg),
estimatedTime, progressPrecision);
Mantid::API::AlgorithmID alg, double progress, const std::string &msg,
const double estimatedTime, const int progressPrecision) {
emit updateProgressBarSignal(alg, progress, QString::fromStdString(msg),
estimatedTime, progressPrecision);
}
} // namespace MantidWidgets
} // namespace MantidQt
\ No newline at end of file
......@@ -55,11 +55,12 @@ void AlgorithmProgressWidget::showDetailsDialog() {
}
}
void AlgorithmProgressWidget::updateProgress(const double progress, const QString &message, const double estimatedTime,
const int progressPrecision) {
m_presenter->setProgressBar(m_progressBar, progress,
message, estimatedTime,
progressPrecision);
void AlgorithmProgressWidget::updateProgress(const double progress,
const QString &message,
const double estimatedTime,
const int progressPrecision) {
m_presenter->setProgressBar(m_progressBar, progress, message, estimatedTime,
progressPrecision);
}
void AlgorithmProgressWidget::blockUpdates(bool block) {
......
......@@ -60,7 +60,7 @@ public:
EXPECT_CALL(*mainProgressBar.get(), algorithmStarted()).Times(1);
for (const auto prog : {0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 1.0}) {
EXPECT_CALL(*mainProgressBar.get(),
updateProgress(DoubleEq(prog), emptyQString, 0.0, 0));
updateProgress(DoubleEq(prog), emptyQString, 0.0, 0));
}
EXPECT_CALL(*mainProgressBar.get(), algorithmEnded()).Times(1);
// End of assertions for the main progress bar
......
......@@ -103,7 +103,8 @@ public:
int testInt = 123;
void *algorithmIDpretender = &testInt;
EXPECT_CALL(*mockView.get(), algorithmStarted()).Times(1);
EXPECT_CALL(*mockView.get(), updateProgress(3.0, QString(""),0.,0)).Times(1);
EXPECT_CALL(*mockView.get(), updateProgress(3.0,
QString(""),0.,0)).Times(1);
auto pres = mockView->m_presenter.get();
pres->algorithmStartedSlot(algorithmIDpretender);
......@@ -117,7 +118,8 @@ public:
int testInt2 = 666;
void *secondAlgorithmID = &testInt2;
EXPECT_CALL(*mockView.get(), algorithmStarted()).Times(1);
EXPECT_CALL(*mockView.get(), updateProgress(3.0, QString(""),0.,0)).Times(0);
EXPECT_CALL(*mockView.get(), updateProgress(3.0,
QString(""),0.,0)).Times(0);
auto pres = mockView->m_presenter.get();
pres->algorithmStartedSlot(algorithmIDpretender);
......
......@@ -31,7 +31,8 @@ public:
MOCK_METHOD0(algorithmStarted, void());
MOCK_METHOD0(algorithmEnded, void());
MOCK_METHOD4(updateProgress, void(const double, const QString &, const double, const int));
MOCK_METHOD4(updateProgress,
void(const double, const QString &, const double, const int));
MOCK_METHOD0(showDetailsDialog, void());
std::shared_ptr<AlgorithmProgressPresenter> m_presenter;
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment