@@ -51,10 +51,8 @@
|
||||
#include "evaluationtool.h"
|
||||
#include "ui_evaluationtool.h"
|
||||
|
||||
|
||||
using namespace std;
|
||||
|
||||
|
||||
EvaluationTool::EvaluationTool(QWidget *parent) :
|
||||
QWidget(parent),
|
||||
ui(new Ui::EvaluationTool), resourcesRelPath("/../../dram/resources/scripts""")
|
||||
@@ -63,6 +61,8 @@ EvaluationTool::EvaluationTool(QWidget *parent) :
|
||||
traceFilesModel = new QStandardItemModel(this);
|
||||
ui->listView->setModel(traceFilesModel);
|
||||
QObject::connect(ui->traceTestTreeWidget,SIGNAL(setMessage(QString)),this,SLOT(setTestMessage(QString)));
|
||||
selectMetrics = new SelectMetrics(this);
|
||||
QObject::connect(selectMetrics, SIGNAL(getSelectedMetrics()), this, SLOT(getSelectedMetrics()));
|
||||
}
|
||||
|
||||
EvaluationTool::~EvaluationTool()
|
||||
@@ -84,6 +84,7 @@ void EvaluationTool::showAndRunTests(QList<QString> paths)
|
||||
fillFileList(paths);
|
||||
show();
|
||||
ui->toolBox->setCurrentIndex(0);
|
||||
selectMetrics->setMetrics(getMetrics());
|
||||
runTests();
|
||||
}
|
||||
|
||||
@@ -93,15 +94,12 @@ void EvaluationTool::showAndEvaluateMetrics(QList<QString> paths)
|
||||
fillFileList(paths);
|
||||
show();
|
||||
ui->toolBox->setCurrentIndex(1);
|
||||
selectMetrics = new SelectMetrics(getMetrics(), this);
|
||||
QObject::connect(selectMetrics, SIGNAL(getSelectedMetrics()), this, SLOT(getSelectedMetrics()));
|
||||
selectMetrics->setMetrics(getMetrics());
|
||||
cout<<"done"<<endl;
|
||||
}
|
||||
|
||||
vector<string> EvaluationTool::getMetrics()
|
||||
{
|
||||
ui->traceMetricTreeWidget->clear();
|
||||
|
||||
vector<string> metrics;
|
||||
for(int row = 0; row < traceFilesModel->rowCount(); ++row)
|
||||
{
|
||||
@@ -110,7 +108,6 @@ vector<string> EvaluationTool::getMetrics()
|
||||
if(result.size() > metrics.size())
|
||||
metrics = result;
|
||||
}
|
||||
|
||||
return metrics;
|
||||
}
|
||||
|
||||
@@ -209,11 +206,9 @@ EvaluationTool::TraceFileItem::TraceFileItem(const QString &path)
|
||||
setEditable(false);
|
||||
}
|
||||
|
||||
|
||||
|
||||
void EvaluationTool::on_btn_exportCSV_clicked()
|
||||
{
|
||||
if(calculatedMetrics.size()>0)
|
||||
if(calculatedMetrics.size() > 0)
|
||||
{
|
||||
QString filename = QFileDialog::getSaveFileName(this, "Export to CSV", "", "Comma separated Values(*.csv)");
|
||||
if(filename != "")
|
||||
@@ -229,7 +224,6 @@ void EvaluationTool::on_btn_exportCSV_clicked()
|
||||
file.close();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void EvaluationTool::on_btn_genPlots_clicked()
|
||||
|
||||
@@ -38,36 +38,20 @@
|
||||
#include "ui_selectmetrics.h"
|
||||
#include<QMessageBox>
|
||||
|
||||
SelectMetrics::SelectMetrics(std::vector<std::string> metrics, QWidget *parent) :
|
||||
SelectMetrics::SelectMetrics(QWidget *parent) :
|
||||
QDialog(parent),
|
||||
ui(new Ui::SelectMetrics)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
|
||||
QVBoxLayout* layout = new QVBoxLayout();
|
||||
|
||||
for(std::string metric : metrics)
|
||||
{
|
||||
QCheckBox * checkBox = new QCheckBox();
|
||||
checkBox->setObjectName (QString::fromStdString(metric));
|
||||
checkBox->setCheckable (true);
|
||||
checkBox->setChecked (true);
|
||||
|
||||
checkBox->setGeometry (10, 25, 100, 17);
|
||||
checkBox->setText (QString::fromStdString(metric));
|
||||
this->metrics.push_back(checkBox);
|
||||
layout->addWidget(checkBox, Qt::AlignLeft);
|
||||
|
||||
}
|
||||
layout = new QVBoxLayout();
|
||||
|
||||
ui->scrollAreaWidgetContents->setLayout(layout);
|
||||
|
||||
ui->scrollArea->setHorizontalScrollBarPolicy(Qt::ScrollBarAsNeeded);
|
||||
ui->scrollArea->setVerticalScrollBarPolicy(Qt::ScrollBarAsNeeded);
|
||||
|
||||
}
|
||||
|
||||
|
||||
void SelectMetrics::on_okButton_clicked()
|
||||
{
|
||||
if(isThereAnyMetricSelected())
|
||||
@@ -108,6 +92,32 @@ bool SelectMetrics::isThereAnyMetricSelected()
|
||||
return false;
|
||||
}
|
||||
|
||||
void SelectMetrics::setMetrics(std::vector<std::string> metrics)
|
||||
{
|
||||
if(this->metrics.size() != metrics.size())
|
||||
{
|
||||
for(QCheckBox* checkBox : this->metrics)
|
||||
{
|
||||
layout->removeWidget(checkBox);
|
||||
}
|
||||
|
||||
this->metrics.clear();
|
||||
|
||||
for(std::string metric : metrics)
|
||||
{
|
||||
QCheckBox * checkBox = new QCheckBox();
|
||||
checkBox->setObjectName (QString::fromStdString(metric));
|
||||
checkBox->setCheckable (true);
|
||||
checkBox->setChecked (true);
|
||||
|
||||
checkBox->setGeometry (10, 25, 100, 17);
|
||||
checkBox->setText (QString::fromStdString(metric));
|
||||
this->metrics.push_back(checkBox);
|
||||
layout->addWidget(checkBox, Qt::AlignLeft);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
SelectMetrics::~SelectMetrics()
|
||||
{
|
||||
delete ui;
|
||||
|
||||
@@ -52,11 +52,13 @@ class SelectMetrics : public QDialog
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit SelectMetrics(std::vector<std::string> metrics, QWidget *parent = 0);
|
||||
explicit SelectMetrics(QWidget *parent = 0);
|
||||
~SelectMetrics();
|
||||
|
||||
std::vector<QCheckBox*> metrics;
|
||||
|
||||
void setMetrics(std::vector<std::string> metrics);
|
||||
|
||||
|
||||
Q_SIGNALS:
|
||||
void getSelectedMetrics();
|
||||
@@ -69,6 +71,7 @@ private Q_SLOTS:
|
||||
|
||||
private:
|
||||
Ui::SelectMetrics *ui;
|
||||
QVBoxLayout* layout;
|
||||
bool isThereAnyMetricSelected();
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user