diff --git a/GUI/coregui/Views/JobWidgets/JobListToolBar.cpp b/GUI/coregui/Views/JobWidgets/JobListToolBar.cpp index 8759e913ecc059128147ec254be9f1336d06dc04..ab017cc38d5281dd2d64580b11ce4c73f37eef87 100644 --- a/GUI/coregui/Views/JobWidgets/JobListToolBar.cpp +++ b/GUI/coregui/Views/JobWidgets/JobListToolBar.cpp @@ -18,7 +18,6 @@ #include <QToolButton> #include <QLabel> -//! main tool bar on top of SampleView window JobListToolBar::JobListToolBar(QWidget *parent) : QToolBar(parent) , m_runJobButton(0) diff --git a/GUI/coregui/Views/JobWidgets/JobListToolBar.h b/GUI/coregui/Views/JobWidgets/JobListToolBar.h index fcffd7b226c733952db55313294c1a21b40620e8..e0d80d435d3580b49057ef28912a3905300ee515 100644 --- a/GUI/coregui/Views/JobWidgets/JobListToolBar.h +++ b/GUI/coregui/Views/JobWidgets/JobListToolBar.h @@ -16,13 +16,11 @@ #ifndef JOBLISTTOOLBAR_H #define JOBLISTTOOLBAR_H - #include <QToolBar> #include "WinDllMacros.h" class QToolButton; - //! The JobListToolBar contains buttons (add, remove jobs) needed for JobListView class BA_CORE_API_ JobListToolBar : public QToolBar { @@ -40,6 +38,4 @@ private: QToolButton *m_removeJobButton; }; - #endif - diff --git a/GUI/coregui/Views/JobWidgets/JobListViewDelegate.cpp b/GUI/coregui/Views/JobWidgets/JobListViewDelegate.cpp index 882e7d9673666b184778309815961d5c7b19263a..425dc5d638e7f04b5a3d8545bd4e8e9e22793cee 100644 --- a/GUI/coregui/Views/JobWidgets/JobListViewDelegate.cpp +++ b/GUI/coregui/Views/JobWidgets/JobListViewDelegate.cpp @@ -26,8 +26,6 @@ #include <QStyleOptionProgressBarV2> #include "hostosinfo.h" - -// FIXME duplication JobListViewDelegate::JobListViewDelegate(QWidget *parent) : QItemDelegate(parent) { @@ -39,8 +37,6 @@ JobListViewDelegate::JobListViewDelegate(QWidget *parent) m_status_to_color[Constants::STATUS_FAILED] = QColor(255, 186, 12); } - - void JobListViewDelegate::paint(QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index ) const { @@ -59,25 +55,8 @@ void JobListViewDelegate::paint(QPainter *painter, const QStyleOptionViewItem &o QString text = item->itemName(); QRect textRect = getTextRect(option.rect); - //textRect.setHeight( 10); painter->drawText(textRect,text); -// QStyleOptionProgressBar progressBarOption; -// progressBarOption.state = QStyle::State_Enabled; -// progressBarOption.direction = QApplication::layoutDirection(); -// progressBarOption.rect = getProgressBarRect(option.rect); -// //progressBarOption.rect = option.rect; -// //progressBarOption.fontMetrics = QApplication::fontMetrics(); -// progressBarOption.minimum = 0; -// progressBarOption.maximum = 100; -// //progressBarOption.textAlignment = Qt::AlignCenter; -// progressBarOption.textVisible = false; - -// // Set the progress and text values of the style option. -// int progress = item->getProgress(); -// progressBarOption.progress = progress < 0 ? 0 : progress; -// QApplication::style()->drawControl(QStyle::CE_ProgressBar, &progressBarOption, painter); - drawCustomProjectBar(item, painter, option); if(item->isRunning()) { @@ -93,7 +72,6 @@ void JobListViewDelegate::paint(QPainter *painter, const QStyleOptionViewItem &o painter->restore(); } - bool JobListViewDelegate::editorEvent(QEvent *event, QAbstractItemModel *model, const QStyleOptionViewItem &option, @@ -107,7 +85,6 @@ bool JobListViewDelegate::editorEvent(QEvent *event, return true; } - const JobModel* jqmodel = static_cast<const JobModel*>(index.model()); Q_ASSERT(model); @@ -134,7 +111,6 @@ bool JobListViewDelegate::editorEvent(QEvent *event, return true; } - void JobListViewDelegate::drawCustomProjectBar(const JobItem *item, QPainter *painter, const QStyleOptionViewItem &option) const { int progress = item->getProgress(); @@ -160,7 +136,6 @@ void JobListViewDelegate::drawCustomProjectBar(const JobItem *item, QPainter *pa painter->restore(); } - //! returns rectangle for text QRect JobListViewDelegate::getTextRect(QRect optionRect) const { @@ -172,7 +147,6 @@ QRect JobListViewDelegate::getTextRect(QRect optionRect) const return result; } - //! returns rectangle for progress bar QRect JobListViewDelegate::getProgressBarRect(QRect optionRect) const { @@ -180,12 +154,6 @@ QRect JobListViewDelegate::getProgressBarRect(QRect optionRect) const int height = optionRect.height()*0.6; int x = optionRect.x() + optionRect.width()*0.5; int y = optionRect.y() + (optionRect.height() - height)/2.; -// if( Utils::HostOsInfo::isMacHost() ) { -// // for Mac the height of progress bar can't be made smaller -// y = optionRect.y(); -// height = optionRect.height()*0.5; -// } - QRect result(x,y,width,height); return result; } diff --git a/GUI/coregui/Views/JobWidgets/JobListViewDelegate.h b/GUI/coregui/Views/JobWidgets/JobListViewDelegate.h index 08d678c355319ec8197a3431920ee7533545bb54..cd11d9b2bf52b2d58195623489015223d1de0009 100644 --- a/GUI/coregui/Views/JobWidgets/JobListViewDelegate.h +++ b/GUI/coregui/Views/JobWidgets/JobListViewDelegate.h @@ -50,5 +50,4 @@ private: QMap<QString, QColor> m_status_to_color; }; - #endif diff --git a/GUI/coregui/Views/JobWidgets/JobListWidget.cpp b/GUI/coregui/Views/JobWidgets/JobListWidget.cpp index a5c20df637f0b4c06d87203e7b89bca08182b67e..0c6f832e8c5f86b09f99562345d74d0c6083ffaa 100644 --- a/GUI/coregui/Views/JobWidgets/JobListWidget.cpp +++ b/GUI/coregui/Views/JobWidgets/JobListWidget.cpp @@ -34,11 +34,7 @@ JobListWidget::JobListWidget(QWidget *parent) , m_runJobAction(0) , m_removeJobAction(0) , m_toolBar(new JobListToolBar) -// , m_submitButton(new QPushButton("Submit")) -// , m_runButton(new QPushButton("Run")) -// , m_saveButton(new QPushButton("Save")) { -// setMinimumSize(128, 128); setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding); m_listView->setDragEnabled(true); @@ -68,14 +64,9 @@ JobListWidget::JobListWidget(QWidget *parent) setLayout(mainLayout); -// connect(m_saveButton, SIGNAL(clicked()), this, SLOT(save())); -// connect(m_submitButton, SIGNAL(clicked()), this, SLOT(submit())); -// connect(m_runButton, SIGNAL(clicked()), this, SLOT(run())); - setupContextMenuActions(); } - void JobListWidget::setModel(JobModel *model) { Q_ASSERT(model); @@ -100,13 +91,10 @@ QItemSelectionModel *JobListWidget::getSelectionModel() return m_listView->selectionModel(); } - void JobListWidget::save() { Q_ASSERT(m_jobModel); - qDebug() << "JobListWidget::save() -> "; - m_jobModel->save("tmp2.xml"); - + m_jobModel->save("tmp.xml"); } void JobListWidget::runJob() @@ -118,7 +106,6 @@ void JobListWidget::runJob() } } - //! setup context menu for listView void JobListWidget::setupContextMenuActions() { @@ -129,7 +116,6 @@ void JobListWidget::setupContextMenuActions() connect(m_runJobAction, SIGNAL(triggered()), this, SLOT(runJob())); } - bool JobListWidget::jobItemCanBeRun(const QModelIndex &index) { if(!index.isValid()) return false; @@ -140,7 +126,6 @@ bool JobListWidget::jobItemCanBeRun(const QModelIndex &index) return true; } - //! remove job from the list void JobListWidget::removeJob() { @@ -151,11 +136,8 @@ void JobListWidget::removeJob() } } - void JobListWidget::makeJobItemSelected(const QModelIndex &index) { - qDebug() << "JobListWidget::makeJobItemSelected(const QModelIndex &index)" << index; - qDebug() << "m_listView->selectionModel()->selection()" << m_listView->selectionModel()->selectedIndexes(); QModelIndexList selected = m_listView->selectionModel()->selectedIndexes(); // already selected @@ -166,13 +148,9 @@ void JobListWidget::makeJobItemSelected(const QModelIndex &index) m_listView->selectionModel()->select(index, QItemSelectionModel::Select); } - void JobListWidget::showContextMenu(const QPoint &pnt) { - qDebug() << "JobListWidget::showContextMenu()"; - QMenu menu; - menu.addAction(m_runJobAction); menu.addAction(m_removeJobAction); @@ -193,5 +171,3 @@ void JobListWidget::showContextMenu(const QPoint &pnt) menu.exec(m_listView->mapToGlobal(pnt)); } - - diff --git a/GUI/coregui/Views/JobWidgets/JobListWidget.h b/GUI/coregui/Views/JobWidgets/JobListWidget.h index 6b731c3b889017ffde98beccb08b094b7a256190..a4823fbda2ce793b74c221ad7548c0610ed8647a 100644 --- a/GUI/coregui/Views/JobWidgets/JobListWidget.h +++ b/GUI/coregui/Views/JobWidgets/JobListWidget.h @@ -20,7 +20,6 @@ #include <QWidget> #include <QModelIndex> -//class JobQueueModel; class JobModel; class JobListViewDelegate; class QListView; diff --git a/GUI/coregui/Views/JobWidgets/JobOutputDataToolBar.h b/GUI/coregui/Views/JobWidgets/JobOutputDataToolBar.h index c5ff452329efb00f6808619fe08861fcc282b644..e3df70f4f79277f75a7ef9f99fbb9beb609c1b99 100644 --- a/GUI/coregui/Views/JobWidgets/JobOutputDataToolBar.h +++ b/GUI/coregui/Views/JobWidgets/JobOutputDataToolBar.h @@ -22,7 +22,6 @@ class QComboBox; class QToolButton; - //! Main tool bar of JobView widget. Belongs to JobOutputDataWidget. class BA_CORE_API_ JobOutputDataToolBar : public QToolBar { @@ -52,6 +51,4 @@ private: QToolButton *m_savePlotButton; }; - - #endif diff --git a/GUI/coregui/Views/JobWidgets/JobOutputDataWidget.cpp b/GUI/coregui/Views/JobWidgets/JobOutputDataWidget.cpp index c12b943be7fdf49d7b9eaff31c151ef44d13a769..644f3a6f99d81c283d7308c87e034eba19ddc5b5 100644 --- a/GUI/coregui/Views/JobWidgets/JobOutputDataWidget.cpp +++ b/GUI/coregui/Views/JobWidgets/JobOutputDataWidget.cpp @@ -29,7 +29,6 @@ #include <QDebug> #include "GUIHelpers.h" - JobOutputDataWidget::JobOutputDataWidget(JobModel *jobModel, ProjectManager *projectManager, QWidget *parent) : QWidget(parent) , m_jobModel(0) @@ -60,27 +59,6 @@ JobOutputDataWidget::JobOutputDataWidget(JobModel *jobModel, ProjectManager *pro } - -//void JobOutputDataWidget::setJobQueueModel(JobQueueModel *jobQueueModel) -//{ -// Q_ASSERT(jobQueueModel); -// if(jobQueueModel != m_jobQueueModel) { -// m_jobQueueModel = jobQueueModel; - -// connect(m_jobQueueModel, -// SIGNAL( selectionChanged(JobItem *) ), -// this, -// SLOT( itemClicked(JobItem *) ) -// ); - -// connect(m_jobQueueModel->getJobQueueData(), SIGNAL(jobIsFinished(QString)) -// , this, SLOT(onJobItemFinished(QString))); - -// connect(m_jobQueueModel, SIGNAL(aboutToDeleteJobItem(JobItem*)) -// , this, SLOT(onJobItemDelete(JobItem*))); -// } -//} - void JobOutputDataWidget::setJobModel(JobModel *jobModel) { Q_ASSERT(jobModel); @@ -103,9 +81,6 @@ void JobOutputDataWidget::setJobModel(JobModel *jobModel) SLOT( setItem(JobItem *) ) ); -// connect(m_jobModel->getJobQueueData(), SIGNAL(jobIsFinished(QString)) -// , this, SLOT(onJobItemFinished(QString))); - connect(m_jobModel, SIGNAL(aboutToDeleteJobItem(JobItem*)) , this, SLOT(onJobItemDelete(JobItem*))); } @@ -114,39 +89,30 @@ void JobOutputDataWidget::setJobModel(JobModel *jobModel) void JobOutputDataWidget::setItem(JobItem * item) { - qDebug() << "JobOutputDataWidget::setItem()" << item; + //qDebug() << "JobOutputDataWidget::setItem()" << item; if(!item) return; m_currentJobItem = item; -// OutputDataWidget *widget = m_jobItemToPlotWidget[item]; IntensityDataWidget *widget = m_jobItemToPlotWidget[item]; if( !widget && (item->isCompleted() || item->isCanceled())) { - qDebug() << "JobOutputDataWidget::itemClicked() -> creating"; -// widget = new OutputDataWidget(this, false, false, false); widget = new IntensityDataWidget(this); connect(widget, SIGNAL(savePlotRequest()), this, SLOT(onSavePlot())); widget->setItem(item->getIntensityDataItem()); m_stack->addWidget(widget); m_jobItemToPlotWidget[item] = widget; - } - else - { - if( m_stack->currentWidget() && m_stack->currentWidget() != widget) - { + } else { + if( m_stack->currentWidget() && m_stack->currentWidget() != widget) { m_stack->currentWidget()->hide(); } } - - if(widget) - { + if(widget) { qDebug() << "JobOutputDataWidget::itemClicked() -> setCurrentWidget"; - if(widget->isHidden()) - { + if(widget->isHidden()) { widget->show(); } @@ -154,48 +120,24 @@ void JobOutputDataWidget::setItem(JobItem * item) } } - -//void JobOutputDataWidget::onJobItemFinished(const QString &identifier) -//{ -// qDebug() << "JobOutputDataWidget::onJobItemFinished"; -// Q_ASSERT(0); -// Q_UNUSED(identifier); - -//// qDebug() << "JobOutputDataWidget::onJobItemFinished()"; -//// NJobItem *jobItem = m_jobModel->getJobQueueData()->getJobItem(identifier); - -//// if(jobItem == m_currentJobItem) -//// { -//// if((jobItem->isCompleted() || jobItem->isCanceled()) && jobItem->getIntensityDataItem()) -//// { -//// qDebug() << "JobOutputDataWidget::dataChanged() JobItem::Completed"; -//// itemClicked(jobItem); -//// } -//// } -//} - - void JobOutputDataWidget::togglePropertyPanel() { IntensityDataWidget *widget = getCurrentOutputDataWidget(); if(widget) widget->togglePropertyPanel(); } - void JobOutputDataWidget::toggleProjections() { IntensityDataWidget *widget = getCurrentOutputDataWidget(); if(widget) widget->toggleProjections(); } - void JobOutputDataWidget::onResetView() { IntensityDataWidget *widget = getCurrentOutputDataWidget(); if(widget) widget->onResetView(); } - void JobOutputDataWidget::onSavePlot() { QString dirname = QStandardPaths::writableLocation(QStandardPaths::HomeLocation); @@ -211,7 +153,6 @@ void JobOutputDataWidget::onSavePlot() if(widget) widget->savePlot(dirname); } - void JobOutputDataWidget::onActivityChanged(int activity) { m_toolBar->onActivityChanged(activity); @@ -219,12 +160,10 @@ void JobOutputDataWidget::onActivityChanged(int activity) IntensityDataWidget *widget = getCurrentOutputDataWidget(); if(widget) { widget->setPropertyPanelVisible(false); - //widget->setProjectionsVisible(false); } } } - void JobOutputDataWidget::connectSignals() { connect(m_toolBar, SIGNAL(jobViewActivityRequest(int)), this, SIGNAL(jobViewActivityRequest(int))); @@ -234,7 +173,6 @@ void JobOutputDataWidget::connectSignals() connect(m_toolBar, SIGNAL(savePlot()), this, SLOT(onSavePlot())); } - IntensityDataWidget *JobOutputDataWidget::getCurrentOutputDataWidget() { IntensityDataWidget *result = dynamic_cast<IntensityDataWidget *>(m_stack->currentWidget()); @@ -242,7 +180,6 @@ IntensityDataWidget *JobOutputDataWidget::getCurrentOutputDataWidget() return result; } - void JobOutputDataWidget::onJobItemDelete(JobItem *item) { qDebug() << "JobOutputDataWidget::onJobItemDelete()"; diff --git a/GUI/coregui/Views/JobWidgets/JobOutputDataWidget.h b/GUI/coregui/Views/JobWidgets/JobOutputDataWidget.h index 6c06201a2cfda89d6b5f9cd50da5bfda61624dba..b01ab5d78ff143e7d21c098f5408243661a820c1 100644 --- a/GUI/coregui/Views/JobWidgets/JobOutputDataWidget.h +++ b/GUI/coregui/Views/JobWidgets/JobOutputDataWidget.h @@ -20,12 +20,8 @@ #include <QWidget> #include <QMap> -//class OutputDataWidget; -//class JobQueueModel; class IntensityDataWidget; class QStackedWidget; -class QModelIndex; -//class JobItem; class JobOutputDataToolBar; class ProjectManager; class JobModel; @@ -35,10 +31,8 @@ class BA_CORE_API_ JobOutputDataWidget : public QWidget { Q_OBJECT public: -// explicit JobOutputDataWidget(JobQueueModel *jobQueueModel, ProjectManager *projectManager, QWidget *parent = 0); explicit JobOutputDataWidget(JobModel *joModel, ProjectManager *projectManager, QWidget *parent = 0); -// void setJobQueueModel(JobQueueModel *jobQueueModel); void setJobModel(JobModel *jobModel); JobOutputDataToolBar *getToolBar() { return m_toolBar; } @@ -49,7 +43,6 @@ signals: public slots: void setItem(JobItem *item); void onJobItemDelete(JobItem *item); -// void onJobItemFinished(const QString &identifier); void togglePropertyPanel(); void toggleProjections(); void onResetView(); @@ -60,7 +53,6 @@ private: void connectSignals(); IntensityDataWidget *getCurrentOutputDataWidget(); -// JobQueueModel *m_jobQueueModel; JobModel *m_jobModel; ProjectManager *m_projectManager; JobItem *m_currentJobItem; @@ -69,5 +61,4 @@ private: JobOutputDataToolBar *m_toolBar; }; - #endif diff --git a/GUI/coregui/Views/JobWidgets/JobPropertiesWidget.cpp b/GUI/coregui/Views/JobWidgets/JobPropertiesWidget.cpp index b093180ee51476d3c078acc10f417f3b159608d5..ee030ac631fb3a1cc28eed30e37be76518d50cea 100644 --- a/GUI/coregui/Views/JobWidgets/JobPropertiesWidget.cpp +++ b/GUI/coregui/Views/JobWidgets/JobPropertiesWidget.cpp @@ -59,7 +59,6 @@ JobPropertiesWidget::JobPropertiesWidget(QWidget *parent) setLayout(mainLayout); } - void JobPropertiesWidget::setModel(JobModel *model) { Q_ASSERT(model); @@ -77,16 +76,12 @@ void JobPropertiesWidget::setModel(JobModel *model) this, SLOT( setItem(JobItem *) ) ); - -// connect(m_jobModel, SIGNAL(dataChanged(QModelIndex, QModelIndex)) -// , this, SLOT(dataChanged(QModelIndex, QModelIndex))); } } - void JobPropertiesWidget::setItem(JobItem *jobItem) { - qDebug() << "JobPropertiesWidget::setItem" << jobItem; + //qDebug() << "JobPropertiesWidget::setItem" << jobItem; m_propertyEditor->setItem(jobItem); @@ -100,5 +95,4 @@ void JobPropertiesWidget::setItem(JobItem *jobItem) } m_commentsEditor->setText(jobItem->getComments()); } - } diff --git a/GUI/coregui/Views/JobWidgets/JobRealTimeToolBar.cpp b/GUI/coregui/Views/JobWidgets/JobRealTimeToolBar.cpp index 4eb0648bdd417f648f98824c09b6a0ae21198f72..c212c239868438cfe4adc4758bb3e63a9b767463 100644 --- a/GUI/coregui/Views/JobWidgets/JobRealTimeToolBar.cpp +++ b/GUI/coregui/Views/JobWidgets/JobRealTimeToolBar.cpp @@ -33,23 +33,12 @@ JobRealTimeToolBar::JobRealTimeToolBar(QWidget *parent) setContentsMargins(0,0,0,0); - // projections button m_resetParametersButton = new QToolButton; m_resetParametersButton->setText("Reset Values"); m_resetParametersButton->setIcon(QIcon(":/images/toolbar_refresh.png")); m_resetParametersButton->setToolButtonStyle(Qt::ToolButtonTextBesideIcon); m_resetParametersButton->setToolTip("Reset parameter tree to initial values"); - //m_importParametersButton->setShortcut(Qt::CTRL + Qt::Key_O); connect(m_resetParametersButton, SIGNAL(clicked()), this, SIGNAL(resetParameters())); addWidget(m_resetParametersButton); - - // plot properties button -// m_exportParametersButton = new QToolButton; -// m_exportParametersButton->setText("Export Values"); -// m_exportParametersButton->setIcon(QIcon(":/images/toolbar_parameter_export.png")); -// m_exportParametersButton->setToolButtonStyle(Qt::ToolButtonTextBesideIcon); -// m_exportParametersButton->setToolTip("Propagate current parameter values \nback to the original model."); -// connect(m_exportParametersButton, SIGNAL(clicked()), this, SIGNAL(exportParameters())); -// addWidget(m_exportParametersButton); } diff --git a/GUI/coregui/Views/JobWidgets/JobRealTimeToolBar.h b/GUI/coregui/Views/JobWidgets/JobRealTimeToolBar.h index d35eb2ec10da91917b336cebaa20a586c12951df..cec0054953e45f0e0587fd2b54ecca529097b9cb 100644 --- a/GUI/coregui/Views/JobWidgets/JobRealTimeToolBar.h +++ b/GUI/coregui/Views/JobWidgets/JobRealTimeToolBar.h @@ -21,7 +21,6 @@ class QToolButton; - //! The JobRealTimeToolBar contains buttons needed for JobRealTimeWidget class BA_CORE_API_ JobRealTimeToolBar : public QToolBar { @@ -32,7 +31,6 @@ public: signals: void resetParameters(); - //void exportParameters(); private: QToolButton *m_resetParametersButton; diff --git a/GUI/coregui/Views/JobWidgets/JobRealTimeWidget.cpp b/GUI/coregui/Views/JobWidgets/JobRealTimeWidget.cpp index 84791862b41fcd04abddb6c31124108f6f33d257..10cd017d22ee85053b94e74584aa4e16583dc2dc 100644 --- a/GUI/coregui/Views/JobWidgets/JobRealTimeWidget.cpp +++ b/GUI/coregui/Views/JobWidgets/JobRealTimeWidget.cpp @@ -26,7 +26,6 @@ #include <QDebug> #include "GUIHelpers.h" - JobRealTimeWidget::JobRealTimeWidget(JobModel *jobModel, QWidget *parent) : QWidget(parent) , m_jobModel(0) @@ -55,10 +54,8 @@ JobRealTimeWidget::JobRealTimeWidget(JobModel *jobModel, QWidget *parent) setLayout(mainLayout); connect(m_toolBar, SIGNAL(resetParameters()), this, SLOT(onResetParameters())); - //connect(m_toolBar, SIGNAL(exportParameters()), this, SLOT(onExportParameters())); } - void JobRealTimeWidget::setJobModel(JobModel *jobModel) { Q_ASSERT(jobModel); @@ -93,10 +90,9 @@ void JobRealTimeWidget::setJobModel(JobModel *jobModel) } } - void JobRealTimeWidget::setItem(JobItem * item) { - qDebug() << "JobOutputDataWidget::setItem()"; + //qDebug() << "JobOutputDataWidget::setItem()"; if(!item) return; m_currentJobItem = item; @@ -105,8 +101,7 @@ void JobRealTimeWidget::setItem(JobItem * item) ModelTuningWidget *widget = m_jobItemToTuningWidget[item]; if( !widget && isValidJobItem(item)) { - - qDebug() << "JobOutputDataWidget::itemClicked() -> creating"; + //qDebug() << "JobOutputDataWidget::itemClicked() -> creating"; widget = new ModelTuningWidget(m_jobModel->getJobQueueData()); widget->setCurrentItem(item); m_stack->addWidget(widget); @@ -127,10 +122,9 @@ void JobRealTimeWidget::setItem(JobItem * item) } } - void JobRealTimeWidget::onJobItemFinished(const QString &identifier) { - qDebug() << "JobOutputDataWidget::onJobItemFinished()"; + //qDebug() << "JobOutputDataWidget::onJobItemFinished()"; JobItem *jobItem = m_jobModel->getJobItemForIdentifier(identifier); if(jobItem == m_currentJobItem) { @@ -154,12 +148,6 @@ void JobRealTimeWidget::updateCurrentItem() setItem(m_currentJobItem); } -//void JobRealTimeWidget::onExportParameters() -//{ - -//} - - ModelTuningWidget *JobRealTimeWidget::getCurrentModelTuningWidget() { ModelTuningWidget *result = dynamic_cast<ModelTuningWidget *>(m_stack->currentWidget()); @@ -174,10 +162,9 @@ bool JobRealTimeWidget::isValidJobItem(JobItem *item) return (item->isCompleted() || item->isCanceled()) && item->getSampleModel() && item->getInstrumentModel(); } - void JobRealTimeWidget::onJobItemDelete(JobItem *item) { - qDebug() << "JobOutputDataWidget::onJobItemDelete()"; + //qDebug() << "JobOutputDataWidget::onJobItemDelete()"; ModelTuningWidget *widget = m_jobItemToTuningWidget[item]; if( !widget ) { // this is the case when user removes failed job which doesn't have propper widget diff --git a/GUI/coregui/Views/JobWidgets/JobRealTimeWidget.h b/GUI/coregui/Views/JobWidgets/JobRealTimeWidget.h index 4e890ad554beecb33b6764dc55cf1f8bfcdd5e9c..79823a89262814adb157456e502401f341847596 100644 --- a/GUI/coregui/Views/JobWidgets/JobRealTimeWidget.h +++ b/GUI/coregui/Views/JobWidgets/JobRealTimeWidget.h @@ -20,12 +20,9 @@ #include <QWidget> #include <QMap> -//class JobQueueModel; class JobModel; class JobItem; class QStackedWidget; -class QModelIndex; -//class JobItem; class ModelTuningWidget; class JobRealTimeToolBar; @@ -57,5 +54,4 @@ private: JobRealTimeToolBar *m_toolBar; }; - #endif diff --git a/GUI/coregui/Views/JobWidgets/JobSelectorWidget.cpp b/GUI/coregui/Views/JobWidgets/JobSelectorWidget.cpp index 1543ef7b090cdc72cdc6e13d7618fcfe27eb5296..b3753ca99a593ab7815683d5f9b8a9406c7e186f 100644 --- a/GUI/coregui/Views/JobWidgets/JobSelectorWidget.cpp +++ b/GUI/coregui/Views/JobWidgets/JobSelectorWidget.cpp @@ -28,8 +28,6 @@ #include <QHBoxLayout> #include <QDebug> - - JobSelectorWidget::JobSelectorWidget(JobModel *model, QWidget *parent) : QWidget(parent) , m_jobModel(0) @@ -43,7 +41,6 @@ JobSelectorWidget::JobSelectorWidget(JobModel *model, QWidget *parent) setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Expanding); setWindowTitle(QLatin1String("Job Selector")); setObjectName(QLatin1String("Job Selector")); -// setStyleSheet("background-color:white;"); m_splitter->setOrientation(Qt::Vertical); m_splitter->addWidget(m_jobListWidget); @@ -55,7 +52,6 @@ JobSelectorWidget::JobSelectorWidget(JobModel *model, QWidget *parent) mainLayout->setSpacing(0); mainLayout->addWidget(m_splitter); setLayout(mainLayout); - } @@ -68,15 +64,11 @@ void JobSelectorWidget::setModel(JobModel *model) } } - void JobSelectorWidget::makeJobItemSelected(JobItem *item) { Q_ASSERT(item); - qDebug() << "JobSelectorWidget::makeJobItemSelected(NJobItem *item)" << item; -// QModelIndex index = m_jobModel->getIndexForJobItem(item); + //qDebug() << "JobSelectorWidget::makeJobItemSelected(NJobItem *item)" << item; QModelIndex index = m_jobModel->indexOfItem(item); - qDebug() << index; Q_ASSERT(index.isValid()); m_jobListWidget->makeJobItemSelected(index); } - diff --git a/GUI/coregui/Views/JobWidgets/JobSelectorWidget.h b/GUI/coregui/Views/JobWidgets/JobSelectorWidget.h index 25bf79f5b92dd25731037ba5078a1cc1a36b1320..feff7403beae98d44d0dccc5e3c2bb01feea798d 100644 --- a/GUI/coregui/Views/JobWidgets/JobSelectorWidget.h +++ b/GUI/coregui/Views/JobWidgets/JobSelectorWidget.h @@ -19,7 +19,6 @@ #include "WinDllMacros.h" #include <QWidget> -//class JobQueueModel; class JobModel; class JobItem; class JobPropertiesWidget; @@ -44,12 +43,10 @@ public slots: void makeJobItemSelected(JobItem *); private: -// JobQueueModel *m_jobQueueModel; JobModel *m_jobModel; QSplitter *m_splitter; JobListWidget *m_jobListWidget; JobPropertiesWidget *m_jobProperties; - }; diff --git a/GUI/coregui/Views/JobWidgets/ModelTuningWidget.cpp b/GUI/coregui/Views/JobWidgets/ModelTuningWidget.cpp index 29d5ab8ef97c1c09a328d4394d8813d04157ba94..ceb2adec1d980bf4044bb610984be389ded866b0 100644 --- a/GUI/coregui/Views/JobWidgets/ModelTuningWidget.cpp +++ b/GUI/coregui/Views/JobWidgets/ModelTuningWidget.cpp @@ -42,11 +42,6 @@ ModelTuningWidget::ModelTuningWidget(JobQueueData *jobQueueData, QWidget *parent setMinimumSize(128, 128); setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding); -// QColor bgColor(0,0,255,255); -// QPalette palette; -// palette.setColor(QPalette::Background, bgColor); -// setAutoFillBackground(true); - m_sliderSettingsWidget = new SliderSettingsWidget(); connect(m_sliderSettingsWidget, SIGNAL(sliderRangeFactorChanged(double)), this, SLOT(onSliderValueChanged(double))); @@ -66,7 +61,6 @@ ModelTuningWidget::ModelTuningWidget(JobQueueData *jobQueueData, QWidget *parent } - ModelTuningWidget::~ModelTuningWidget() { delete m_parameterModel; @@ -74,7 +68,6 @@ ModelTuningWidget::~ModelTuningWidget() delete m_instrumentModelBackup; } - void ModelTuningWidget::setCurrentItem(JobItem *item) { qDebug() << "ModelTuningWidget::setCurrentItem" << item; @@ -85,7 +78,6 @@ void ModelTuningWidget::setCurrentItem(JobItem *item) } } - void ModelTuningWidget::onCurrentLinkChanged(ItemLink link) { qDebug() << "ModelTuningWidget::onCurrentLinkChanged"; @@ -96,13 +88,10 @@ void ModelTuningWidget::onCurrentLinkChanged(ItemLink link) if(link.getItem()) { qDebug() << "ModelTuningWidget::onCurrentLinkChanged() -> Starting to tune model" << link.getItem()->modelType() << link.getPropertyName() ; - // link.getItem()->setRegisteredProperty(link.getPropertyName(), link.getValue()); // link.getItem()->setRegisteredProperty(link.getPropertyName(), link.getVariant()); link.updateItem(); - // FIXME -// m_jobQueueData->runJob(m_jobQueueData->getIdentifierForJobItem(m_currentJobItem)); m_jobQueueData->runJob(m_currentJobItem->getIdentifier()); } } @@ -129,9 +118,7 @@ void ModelTuningWidget::updateParameterModel() 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_treeView->setModel(m_parameterModel); -// m_treeView->setFixedHeight(height); m_treeView->setColumnWidth(0, 170); m_treeView->expandAll(); } @@ -151,7 +138,6 @@ void ModelTuningWidget::backupModels() } - void ModelTuningWidget::restoreModelsOfCurrentJobItem() { if(m_currentJobItem->isRunning()) @@ -169,8 +155,6 @@ void ModelTuningWidget::restoreModelsOfCurrentJobItem() m_currentJobItem->setInstrumentModel(m_instrumentModelBackup->createCopy()); updateParameterModel(); - // FIXME -// m_jobQueueData->runJob(m_jobQueueData->getIdentifierForJobItem(m_currentJobItem)); m_jobQueueData->runJob(m_currentJobItem->getIdentifier()); } diff --git a/GUI/coregui/Views/JobWidgets/ModelTuningWidget.h b/GUI/coregui/Views/JobWidgets/ModelTuningWidget.h index 0b13d6103e9208d3556a604498cf3fad18b93f62..817610ca57286eab47a3adf550c42c7f5d8ad072 100644 --- a/GUI/coregui/Views/JobWidgets/ModelTuningWidget.h +++ b/GUI/coregui/Views/JobWidgets/ModelTuningWidget.h @@ -28,13 +28,11 @@ class QStandardItemModel; class SampleModel; class InstrumentModel; - class ModelTuningWidget : public QWidget { Q_OBJECT public: - ModelTuningWidget(JobQueueData *jobQueueData, QWidget *parent = 0); virtual ~ModelTuningWidget(); diff --git a/GUI/coregui/mainwindow/mainwindow.cpp b/GUI/coregui/mainwindow/mainwindow.cpp index f3b59370eb509179f78062c902bf6af73af35c86..4a5bf6b7fdc5876b6316a986a3637cdc123e45e4 100644 --- a/GUI/coregui/mainwindow/mainwindow.cpp +++ b/GUI/coregui/mainwindow/mainwindow.cpp @@ -24,7 +24,6 @@ #include "SimulationView.h" #include "MaterialEditorWidget.h" #include "stylehelper.h" -//#include "JobQueueModel.h" #include "JobModel.h" #include "MaterialModel.h" #include "InstrumentModel.h" @@ -83,7 +82,6 @@ MainWindow::MainWindow(QWidget *parent) , m_actionManager(0) , m_projectManager(0) , m_settings(new QSettings(Constants::APPLICATION_NAME, Constants::APPLICATION_NAME, this)) -// , m_jobQueueModel(0) , m_jobModel(0) , m_sampleModel(0) , m_instrumentModel(0) @@ -124,7 +122,6 @@ MainWindow::MainWindow(QWidget *parent) //m_testView = new TestView(m_sampleModel, this); //m_fitView = new FitView(m_fitProxyModel, this); -// m_jobView = new JobView(m_jobQueueModel, m_projectManager); m_jobView = new JobView(m_jobModel, m_projectManager); @@ -137,7 +134,6 @@ MainWindow::MainWindow(QWidget *parent) //m_tabWidget->insertTab(TestViewTab, m_testView, QIcon(":/images/main_simulation.png"), "Test"); //m_tabWidget->insertTab(FitViewTab, m_fitView, QIcon(":/images/main_simulation.png"), "Fit"); - m_tabWidget->setCurrentIndex(WELCOME); m_progressBar = new Manhattan::ProgressBar(this); @@ -147,7 +143,6 @@ MainWindow::MainWindow(QWidget *parent) setCentralWidget(m_tabWidget); - setAcceptDrops(true); // signals/slots @@ -159,13 +154,11 @@ MainWindow::MainWindow(QWidget *parent) m_projectManager->createNewProject(); } - MainWindow::~MainWindow() { delete m_materialEditor; } - void MainWindow::readSettings() { if(m_settings->childGroups().contains("MainWindow")) { @@ -178,7 +171,6 @@ void MainWindow::readSettings() m_projectManager->readSettings(m_settings); } - void MainWindow::writeSettings() { m_settings->beginGroup("MainWindow"); @@ -196,7 +188,6 @@ void MainWindow::onRunSimulationShortcut() m_simulationView->onRunSimulationShortcut(); } - void MainWindow::openRecentProject() { if (const QAction *action = qobject_cast<const QAction*>(sender())) { @@ -206,8 +197,6 @@ void MainWindow::openRecentProject() } } - - void MainWindow::onChangeTabWidget(int index) { // update views which depend on others @@ -225,14 +214,11 @@ void MainWindow::onChangeTabWidget(int index) } } - void MainWindow::onFocusRequest(int index) { m_tabWidget->setCurrentIndex(index); } - - void MainWindow::closeEvent(QCloseEvent *event) { if(m_jobModel->getJobQueueData()->hasUnfinishedJobs()) { @@ -266,7 +252,6 @@ void MainWindow::initModels() //initFitModel(); } - void MainWindow::initMaterialModel() { delete m_materialModel; @@ -280,7 +265,6 @@ void MainWindow::initMaterialModel() m_materialEditor = new MaterialEditor(m_materialModel); } - void MainWindow::initSampleModel() { Q_ASSERT(m_materialModel); @@ -297,64 +281,24 @@ void MainWindow::initSampleModel() // layer1->setItemName("layer1"); } - - void MainWindow::initJobQueueModel() { -// delete m_jobQueueModel; -// m_jobQueueModel = new JobQueueModel(this); - delete m_jobModel; m_jobModel = new JobModel(this); -// ParameterizedItem *jobItem = m_jobModel->insertNewItem(Constants::JobItemType); -// m_jobModel->insertNewItem(Constants::IntensityDataType, m_jobModel->indexOfItem(jobItem)); -// m_jobModel->save("jobmodel.txt"); } - void MainWindow::initInstrumentModel() { delete m_instrumentModel; m_instrumentModel = new InstrumentModel(this); m_instrumentModel->setIconProvider(new IconProvider()); - -// TestProperty_t property(new TestProperty()); -// property->m_data = 99.0; -// QVariant variant; -// variant.setValue(property); - -// ParameterizedItem *instrument1 = m_instrumentModel->insertNewItem(Constants::InstrumentType); -// instrument1->registerProperty("XXX", variant); -//// instrument1->setItemName("Default GISAS"); -//// ParameterizedItem *detector1 = m_instrumentModel->insertNewItem(Constants::DetectorType, m_instrumentModel->indexOfItem(instrument1)); -//// ParameterizedItem *beam1 = m_instrumentModel->insertNewItem(Constants::BeamType, m_instrumentModel->indexOfItem(instrument1)); -//// Q_UNUSED(detector1); -//// Q_UNUSED(beam1); - -// TestProperty_t tt = variant.value<TestProperty_t>(); -// qDebug() << tt->m_data; - - //m_instrumentModel->save("instrument.xml"); } void MainWindow::initFitModel() { m_fitProxyModel = new FitProxyModel; - -// ParameterizedItem *item1 = m_fitProxyModel->insertNewItem(Constants::FitParameterType); -// item1->setItemName("par1"); -// item1->setRegisteredProperty(FitParameterItem::P_MIN, 1.0); - -// FitParameterItem *item2 = dynamic_cast<FitParameterItem *>(m_fitModel->insertNewItem(Constants::FitParameterType)); -// item2->setItemName("par2"); - - //m_fitProxyModel->save("fitmodel.xml"); - - - //ParameterizedItem *old_item = m_fitModel->itemForIndex(m_fitModel->index(0,0, QModelIndex())); } - void MainWindow::testGUIObjectBuilder() { SampleBuilderFactory factory; diff --git a/GUI/coregui/mainwindow/mainwindow.h b/GUI/coregui/mainwindow/mainwindow.h index b9205ab13c153ba6bba1be8da6a5364c98ff65e3..7f429a58c4151dd2d39f43817c4776eb082bcc59 100644 --- a/GUI/coregui/mainwindow/mainwindow.h +++ b/GUI/coregui/mainwindow/mainwindow.h @@ -38,7 +38,6 @@ class ActionManager; class ProjectManager; class QCloseEvent; class QSettings; -//class JobQueueModel; class InstrumentModel; class MaterialEditor; class ToolTipDataBase; @@ -62,7 +61,6 @@ public: MaterialModel *getMaterialModel() { return m_materialModel; } InstrumentModel *getInstrumentModel() { return m_instrumentModel; } SampleModel *getSampleModel() { return m_sampleModel; } -// JobQueueModel *getJobQueueModel() { return m_jobQueueModel; } JobModel *getJobModel() { return m_jobModel; } Manhattan::ProgressBar *getProgressBar() { return m_progressBar; } QSettings *getSettings() const { return m_settings; } @@ -98,7 +96,6 @@ private: ProjectManager *m_projectManager; //!< handles activity related to opening/saving projects QSettings *m_settings; //!< application wide settings -// JobQueueModel *m_jobQueueModel; //!< model for all jobs JobModel *m_jobModel; //!< model for all jobs SampleModel *m_sampleModel; //!< model for all samples InstrumentModel *m_instrumentModel; //!< model for all instruments