Skip to content
Snippets Groups Projects
Commit 8b155e0e authored by Pospelov, Gennady's avatar Pospelov, Gennady
Browse files

Code cleanup in ModelTuningWidget

parent d4850a65
No related branches found
No related tags found
No related merge requests found
......@@ -141,7 +141,7 @@ void JobQueueData::runJob(JobItem *jobItem)
jobItem->setStatus(Constants::STATUS_FAILED);
jobItem->setProgress(100);
QString message("JobQueueData::runJob() -> Error. Attempt to create sample/instrument object from user description "
"has failed with following error message.\n");
"has failed with following error message.\n\n");
message += QString(ex.what());
jobItem->setComments(message);
emit focusRequest(identifier);
......
......@@ -31,8 +31,6 @@
#include <QCommandLinkButton>
#include <QDebug>
#include <QMessageBox>
#include "qtcolorbutton.h"
#include "doubletabwidget.h"
ModelTuningWidget::ModelTuningWidget(JobQueueData *jobQueueData, QWidget *parent)
......@@ -54,7 +52,17 @@ ModelTuningWidget::ModelTuningWidget(JobQueueData *jobQueueData, QWidget *parent
connect(m_sliderSettingsWidget, SIGNAL(lockzChanged(bool)), this, SLOT(onLockZValueChanged(bool)));
m_treeView = new QTreeView();
m_treeView->setStyleSheet("QTreeView::branch {background: palette(base);}QTreeView::branch:has-siblings:!adjoins-item {border-image: url(:/images/treeview-vline.png) 0;}QTreeView::branch:has-siblings:adjoins-item {border-image: url(:/images/treeview-branch-more.png) 0;}QTreeView::branch:!has-children:!has-siblings:adjoins-item {border-image: url(:/images/treeview-branch-end.png) 0;}QTreeView::branch:has-children:!has-siblings:closed,QTreeView::branch:closed:has-children:has-siblings {border-image: none;image: url(:/images/treeview-branch-closed.png);}QTreeView::branch:open:has-children:!has-siblings,QTreeView::branch:open:has-children:has-siblings {border-image: none;image: url(:/images/treeview-branch-open.png);}");
m_treeView->setStyleSheet(
"QTreeView::branch {background: palette(base);}QTreeView::branch:has-siblings:!adjoins-item "
"{border-image: url(:/images/treeview-vline.png) 0;}QTreeView::branch:has-siblings:"
"adjoins-item {border-image: url(:/images/treeview-branch-more.png) 0;}QTreeView::branch:"
"!has-children:!has-siblings:adjoins-item {border-image: "
"url(:/images/treeview-branch-end.png) 0;}QTreeView::branch:has-children:!has-siblings:closed"
",QTreeView::branch:closed:has-children:has-siblings {border-image: none;image: "
"url(:/images/treeview-branch-closed.png);}QTreeView::branch:open:has-children:!has-siblings,"
"QTreeView::branch:open:has-children:has-siblings {border-image: none;image: "
"url(:/images/treeview-branch-open.png);}");
m_treeView->setItemDelegate(m_delegate);
connect(m_delegate, SIGNAL(currentLinkChanged(ItemLink)), this, SLOT(onCurrentLinkChanged(ItemLink)));
......@@ -130,7 +138,6 @@ void ModelTuningWidget::onCurrentLinkChanged(ItemLink link)
if(link.getItem()) {
qDebug() << "ModelTuningWidget::onCurrentLinkChanged() -> Starting to tune model" << link.getItem()->modelType() << link.getPropertyName() ;
link.updateItem();
m_jobQueueData->runJob(m_currentJobItem->getIdentifier());
}
}
......@@ -163,9 +170,11 @@ void ModelTuningWidget::updateParameterModel()
if(!m_currentJobItem) return;
if(!m_currentJobItem->getSampleModel() || !m_currentJobItem->getInstrumentModel())
throw GUIHelpers::Error("ModelTuningWidget::updateParameterModel() -> Error. JobItem doesn't have sample or instrument model.");
throw GUIHelpers::Error("ModelTuningWidget::updateParameterModel() -> Error."
"JobItem doesn't have sample or instrument model.");
m_parameterModel = ParameterModelBuilder::createParameterModel(m_currentJobItem->getSampleModel(), m_currentJobItem->getInstrumentModel());
m_parameterModel = ParameterModelBuilder::createParameterModel(
m_currentJobItem->getSampleModel(), m_currentJobItem->getInstrumentModel());
m_treeView->setModel(m_parameterModel);
m_treeView->setColumnWidth(0, 170);
m_treeView->expandAll();
......@@ -183,7 +192,6 @@ void ModelTuningWidget::backupModels()
if(!m_instrumentModelBackup)
m_instrumentModelBackup = m_currentJobItem->getInstrumentModel()->createCopy();
}
void ModelTuningWidget::restoreModelsOfCurrentJobItem()
......@@ -191,13 +199,14 @@ void ModelTuningWidget::restoreModelsOfCurrentJobItem()
if(m_currentJobItem->isRunning())
return;
qDebug() << "ModelTuningWidget::restoreModelsOfCurrentJobItem()";
// qDebug() << "ModelTuningWidget::restoreModelsOfCurrentJobItem()";
Q_ASSERT(m_sampleModelBackup);
Q_ASSERT(m_instrumentModelBackup);
Q_ASSERT(m_currentJobItem);
qDebug() << "ModelTuningWidget::restoreModelsOfCurrentJobItem() current" << m_currentJobItem->getSampleModel() << m_currentJobItem->getInstrumentModel()
<< " backup" << m_sampleModelBackup << m_instrumentModelBackup;
// qDebug() << "ModelTuningWidget::restoreModelsOfCurrentJobItem() current"
// << m_currentJobItem->getSampleModel() << m_currentJobItem->getInstrumentModel()
// << " backup" << m_sampleModelBackup << m_instrumentModelBackup;
m_currentJobItem->setSampleModel(m_sampleModelBackup->createCopy());
m_currentJobItem->setInstrumentModel(m_instrumentModelBackup->createCopy());
......@@ -210,11 +219,10 @@ void ModelTuningWidget::onInfoLinkButtonClicked()
{
if(m_currentJobItem && !m_currentJobItem->getComments().isEmpty()) {
QString message;
message.append("Simulation has failed with current parameters.\n\n");
message.append("Current parameter values cause simulation failure.\n\n");
message.append(m_currentJobItem->getComments());
QMessageBox::warning(this, tr("Simulation failed"), message);
}
}
......
......@@ -65,7 +65,4 @@ private:
QCommandLinkButton *m_infoLinkButton;
};
#endif
......@@ -136,7 +136,7 @@ MainWindow::MainWindow(QWidget *parent)
//m_tabWidget->insertTab(FitViewTab, m_fitView, QIcon(":/images/main_simulation.png"), "Fit");
//m_tabWidget->insertTab(FIT_VIEW, new TestView(this), QIcon(":/images/main_simulation.png"), "Test");
m_tabWidget->setCurrentIndex(INSTRUMENT);
m_tabWidget->setCurrentIndex(WELCOME);
m_progressBar = new Manhattan::ProgressBar(this);
m_tabWidget->addBottomCornerWidget(m_progressBar);
......@@ -153,7 +153,7 @@ MainWindow::MainWindow(QWidget *parent)
m_projectManager->createNewProject();
testGUIObjectBuilder();
// testGUIObjectBuilder();
}
MainWindow::~MainWindow()
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment