Added a progress bar to NeuroUI
This commit is contained in:
parent
6943fc0116
commit
2b84b8a054
@ -54,6 +54,8 @@ void NetLearner::run()
|
|||||||
}
|
}
|
||||||
|
|
||||||
myNet.backProp(targetValues);
|
myNet.backProp(targetValues);
|
||||||
|
|
||||||
|
emit progress((double)iteration / (double)numIterations);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (std::exception &ex)
|
catch (std::exception &ex)
|
||||||
|
@ -12,6 +12,7 @@ private:
|
|||||||
|
|
||||||
signals:
|
signals:
|
||||||
void logMessage(const QString &logMessage);
|
void logMessage(const QString &logMessage);
|
||||||
|
void progress(double progress);
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // NETLEARNER_H
|
#endif // NETLEARNER_H
|
||||||
|
@ -23,6 +23,7 @@ void NeuroUI::on_runButton_clicked()
|
|||||||
}
|
}
|
||||||
|
|
||||||
connect(m_netLearner.get(), &NetLearner::logMessage, this, &NeuroUI::logMessage);
|
connect(m_netLearner.get(), &NetLearner::logMessage, this, &NeuroUI::logMessage);
|
||||||
|
connect(m_netLearner.get(), &NetLearner::progress, this, &NeuroUI::progress);
|
||||||
|
|
||||||
connect(m_netLearner.get(), &NetLearner::started, this, &NeuroUI::netLearnerStarted);
|
connect(m_netLearner.get(), &NetLearner::started, this, &NeuroUI::netLearnerStarted);
|
||||||
connect(m_netLearner.get(), &NetLearner::finished, this, &NeuroUI::netLearnerFinished);
|
connect(m_netLearner.get(), &NetLearner::finished, this, &NeuroUI::netLearnerFinished);
|
||||||
@ -39,9 +40,19 @@ void NeuroUI::logMessage(const QString &logMessage)
|
|||||||
void NeuroUI::netLearnerStarted()
|
void NeuroUI::netLearnerStarted()
|
||||||
{
|
{
|
||||||
ui->runButton->setEnabled(false);
|
ui->runButton->setEnabled(false);
|
||||||
|
ui->progressBar->setValue(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
void NeuroUI::netLearnerFinished()
|
void NeuroUI::netLearnerFinished()
|
||||||
{
|
{
|
||||||
ui->runButton->setEnabled(true);
|
ui->runButton->setEnabled(true);
|
||||||
|
ui->progressBar->setValue(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
void NeuroUI::progress(double progress)
|
||||||
|
{
|
||||||
|
double range = ui->progressBar->maximum() - ui->progressBar->minimum();
|
||||||
|
int value = ui->progressBar->minimum() + (int)(progress * range);
|
||||||
|
|
||||||
|
ui->progressBar->setValue(value);
|
||||||
}
|
}
|
||||||
|
@ -27,6 +27,7 @@ private slots:
|
|||||||
void logMessage(const QString &logMessage);
|
void logMessage(const QString &logMessage);
|
||||||
void netLearnerStarted();
|
void netLearnerStarted();
|
||||||
void netLearnerFinished();
|
void netLearnerFinished();
|
||||||
|
void progress(double progress);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Ui::NeuroUI *ui;
|
Ui::NeuroUI *ui;
|
||||||
|
@ -22,6 +22,9 @@
|
|||||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||||
<item>
|
<item>
|
||||||
<widget class="QProgressBar" name="progressBar">
|
<widget class="QProgressBar" name="progressBar">
|
||||||
|
<property name="maximum">
|
||||||
|
<number>1000</number>
|
||||||
|
</property>
|
||||||
<property name="value">
|
<property name="value">
|
||||||
<number>0</number>
|
<number>0</number>
|
||||||
</property>
|
</property>
|
||||||
|
Reference in New Issue
Block a user