diff --git a/GUI/coregui/Models/JobQueueData.cpp b/GUI/coregui/Models/JobQueueData.cpp index b17944d20c0a4a21308cfb712f97faa29a7cabfd..60763d957cbcfbb38daaafa489b569c9fbd3317e 100644 --- a/GUI/coregui/Models/JobQueueData.cpp +++ b/GUI/coregui/Models/JobQueueData.cpp @@ -197,6 +197,8 @@ void JobQueueData::onFinishedJob() getThread(runner->getIdentifier())->quit(); assignForDeletion(runner); + + emit focusRequest(jobItem); } diff --git a/GUI/coregui/Models/JobQueueData.h b/GUI/coregui/Models/JobQueueData.h index 31fbe96e5b10cdd1a99cc2e786ddb9a4f9857181..715de8f5e19a541e4df95a0754f57d412adb5a3c 100644 --- a/GUI/coregui/Models/JobQueueData.h +++ b/GUI/coregui/Models/JobQueueData.h @@ -32,6 +32,7 @@ public: signals: void globalProgress(int); + void focusRequest(JobItem *item); public slots: void onStartedJob(); diff --git a/GUI/coregui/Models/JobQueueModel.cpp b/GUI/coregui/Models/JobQueueModel.cpp index 8013bbc4d9e4d68e4a8ef86184b90e953d8c6d37..c09f8f08e8f4c71e55ad16e97d746b393fba5ff8 100644 --- a/GUI/coregui/Models/JobQueueModel.cpp +++ b/GUI/coregui/Models/JobQueueModel.cpp @@ -295,13 +295,15 @@ void JobQueueModel::onSelectionChanged( const QItemSelection &selected, const QI //! Method should be called to inform given model about changes in JobItem void JobQueueModel::onJobItemIsModified(JobItem *modified_item) { - QString identifier = m_queue_data->getIdentifierForJobItem(modified_item); - foreach(JobQueueItem *queue_item, m_jobs) { - if(queue_item->getIdentifier() == identifier) { - QModelIndex item_index = index(m_jobs.indexOf(queue_item), 0); - dataChanged(item_index, item_index); - } - } + QModelIndex itemIndex = getIndexForJobItem(modified_item); + dataChanged(itemIndex, itemIndex); +// QString identifier = m_queue_data->getIdentifierForJobItem(modified_item); +// foreach(JobQueueItem *queue_item, m_jobs) { +// if(queue_item->getIdentifier() == identifier) { +// QModelIndex item_index = index(m_jobs.indexOf(queue_item), 0); +// dataChanged(item_index, item_index); +// } +// } } @@ -329,6 +331,19 @@ JobItem *JobQueueModel::getJobItemForIndex(const QModelIndex &index) } +QModelIndex JobQueueModel::getIndexForJobItem(const JobItem *item) +{ + QString identifier = m_queue_data->getIdentifierForJobItem(item); + foreach(JobQueueItem *queue_item, m_jobs) { + if(queue_item->getIdentifier() == identifier) { + return index(m_jobs.indexOf(queue_item), 0); + } + } + + return QModelIndex(); +} + + //! runs corresponding job in a thread void JobQueueModel::runJob(const QModelIndex &index) { diff --git a/GUI/coregui/Models/JobQueueModel.h b/GUI/coregui/Models/JobQueueModel.h index b0efb92b34bdf12cba7c8fdb00a4f1068eaecfb2..beac2072eabd230a4042c1b17b9b98be8695e3ca 100644 --- a/GUI/coregui/Models/JobQueueModel.h +++ b/GUI/coregui/Models/JobQueueModel.h @@ -81,6 +81,8 @@ public: const JobItem *getJobItemForIndex(const QModelIndex &index) const; JobItem *getJobItemForIndex(const QModelIndex &index); + QModelIndex getIndexForJobItem(const JobItem *item); + JobQueueData *getJobQueueData() { return m_queue_data; } signals: diff --git a/GUI/coregui/Views/Components/JobQueueWidgets/JobListWidget.cpp b/GUI/coregui/Views/Components/JobQueueWidgets/JobListWidget.cpp index 21923cc9d0a77f502136afe21517b63d5d76fb8f..5583e91b54f13f53c674d4f951ac9556858bf290 100644 --- a/GUI/coregui/Views/Components/JobQueueWidgets/JobListWidget.cpp +++ b/GUI/coregui/Views/Components/JobQueueWidgets/JobListWidget.cpp @@ -128,4 +128,11 @@ void JobListWidget::removeJob() } +void JobListWidget::makeJobItemSelected(const QModelIndex &index) +{ + m_listView->selectionModel()->clearSelection(); + m_listView->selectionModel()->select(index, QItemSelectionModel::Select); +} + + diff --git a/GUI/coregui/Views/Components/JobQueueWidgets/JobListWidget.h b/GUI/coregui/Views/Components/JobQueueWidgets/JobListWidget.h index f80978992f0a6e90199321aab10f4537ac90a0a9..d86128e448d801488b457da62fc2afb5b3598fbc 100644 --- a/GUI/coregui/Views/Components/JobQueueWidgets/JobListWidget.h +++ b/GUI/coregui/Views/Components/JobQueueWidgets/JobListWidget.h @@ -22,6 +22,8 @@ public: void setModel(JobQueueModel *model); // QSize sizeHint() const { return QSize(128, 128); } +public slots: + void makeJobItemSelected(const QModelIndex &index); private slots: void save(); diff --git a/GUI/coregui/Views/Components/JobQueueWidgets/JobSelectorWidget.cpp b/GUI/coregui/Views/Components/JobQueueWidgets/JobSelectorWidget.cpp index d4f288ad135136c08be00e837d7332c0f9be178a..6b9dc7983f27abed887d269566a48a996de83ea1 100644 --- a/GUI/coregui/Views/Components/JobQueueWidgets/JobSelectorWidget.cpp +++ b/GUI/coregui/Views/Components/JobQueueWidgets/JobSelectorWidget.cpp @@ -53,3 +53,11 @@ void JobSelectorWidget::setModel(JobQueueModel *model) } } + +void JobSelectorWidget::makeJobItemSelected(JobItem *item) +{ + QModelIndex index = m_jobQueueModel->getIndexForJobItem(item); + Q_ASSERT(index.isValid()); + m_jobListWidget->makeJobItemSelected(index); +} + diff --git a/GUI/coregui/Views/Components/JobQueueWidgets/JobSelectorWidget.h b/GUI/coregui/Views/Components/JobQueueWidgets/JobSelectorWidget.h index 4bd8ea2bb7f5d11181b49cab223fdae0f6313f03..34cea5269b1345c002ccce40fe76727bb8d575d1 100644 --- a/GUI/coregui/Views/Components/JobQueueWidgets/JobSelectorWidget.h +++ b/GUI/coregui/Views/Components/JobQueueWidgets/JobSelectorWidget.h @@ -8,6 +8,7 @@ class JobPropertiesWidget; class QSplitter; class QPushButton; class JobListWidget; +class JobItem; //! Widget to select JobQueueItem in a list and display its properties @@ -23,6 +24,9 @@ public: QSize sizeHint() const { return QSize(158, 600); } QSize minimumSizeHint() const { return QSize(64, 300); } +public slots: + void makeJobItemSelected(JobItem *); + private: JobQueueModel *m_jobQueueModel; QSplitter *m_splitter; diff --git a/GUI/coregui/Views/JobQueueView.cpp b/GUI/coregui/Views/JobQueueView.cpp index 76806bf609531b3f55ae36f38120317e6954e67f..c92f78a602ed5279dfa86a8baa93142ecfc99de5 100644 --- a/GUI/coregui/Views/JobQueueView.cpp +++ b/GUI/coregui/Views/JobQueueView.cpp @@ -3,6 +3,7 @@ #include "JobItem.h" #include "JobSelectorWidget.h" #include "JobOutputDataWidget.h" +#include "mainwindow.h" #include "minisplitter.h" #include "progressbar.h" #include <QVBoxLayout> @@ -30,6 +31,7 @@ JobQueueView::JobQueueView(JobQueueModel *model, QWidget *parent) setLayout(mainLayout); connect(m_jobQueueModel->getJobQueueData(), SIGNAL(globalProgress(int)), this, SLOT(updateGlobalProgressBar(int))); + connect(m_jobQueueModel->getJobQueueData(), SIGNAL(focusRequest(JobItem*)), this, SLOT(onFocusRequest(JobItem*))); } @@ -57,3 +59,9 @@ void JobQueueView::updateGlobalProgressBar(int progress) } +void JobQueueView::onFocusRequest(JobItem *item) +{ + m_jobSelector->makeJobItemSelected(item); + emit focusRequest(MainWindow::JobTab); +} + diff --git a/GUI/coregui/Views/JobQueueView.h b/GUI/coregui/Views/JobQueueView.h index 37fa409e667c5cd1fc948c45dd15f7cf5a76a97a..8734c6525b616bef70c15453fba4673acb77c023 100644 --- a/GUI/coregui/Views/JobQueueView.h +++ b/GUI/coregui/Views/JobQueueView.h @@ -13,6 +13,7 @@ class QPushButton; class JobQueueModel; class QDockWidget; class QSplitter; +class JobItem; namespace Manhattan { class ProgressBar; @@ -37,8 +38,12 @@ public: void setProgressBar(Manhattan::ProgressBar *progressBar); +signals: + void focusRequest(int); + public slots: void updateGlobalProgressBar(int); + void onFocusRequest(JobItem *); private: JobQueueModel *m_jobQueueModel; diff --git a/GUI/coregui/Views/SimulationView.cpp b/GUI/coregui/Views/SimulationView.cpp index 1a55241fe3290321d6cd3d8c64167314093c6ba0..300c0da64bd2cf173f4034394210e660bb6d662f 100644 --- a/GUI/coregui/Views/SimulationView.cpp +++ b/GUI/coregui/Views/SimulationView.cpp @@ -15,10 +15,8 @@ #include <QMessageBox> #include <QFileDialog> #include <QDir> -#include <QDateTime> -#include <QFuture> -#include <QFutureWatcher> #include <QtCore> +#include <QMenu> SimulationView::SimulationView(SimulationDataModel *p_simulation_data_model, QWidget *parent) : QWidget(parent) @@ -74,6 +72,10 @@ SimulationView::SimulationView(SimulationDataModel *p_simulation_data_model, QWi // run simulation button runSimulationButton = new QPushButton(tr("Run Simulation")); +// QMenu *simMenu = new QMenu(this); +// simMenu->addAction(tr("&Run Simulation")); +// simMenu->addAction(tr("&Run background Simulation")); +// runSimulationButton->setMenu(simMenu); // run simulation with python script sample builder //runPyScriptSimulation = new QPushButton(tr("Run Simulation with Python Sample")); diff --git a/GUI/coregui/mainwindow/mainwindow.cpp b/GUI/coregui/mainwindow/mainwindow.cpp index 999bde5d872d001a9501e3dc51548bdcb5a2891d..1691ea52789f798df3a9eff1b51c915658bc4468 100644 --- a/GUI/coregui/mainwindow/mainwindow.cpp +++ b/GUI/coregui/mainwindow/mainwindow.cpp @@ -32,7 +32,6 @@ #include "GUIObjectBuilder.h" #include <QApplication> -#include <iostream> #include <QStatusBar> MainWindow::MainWindow(QWidget *parent) @@ -113,6 +112,7 @@ MainWindow::MainWindow(QWidget *parent) // signals/slots connect(m_tabWidget, SIGNAL(currentChanged(int)), this, SLOT(onChangeTabWidget(int))); + connect(m_jobQueueView, SIGNAL(focusRequest(int)), this, SLOT(onFocusRequest(int))); readSettings(); @@ -177,7 +177,7 @@ void MainWindow::onChangeTabWidget(int index) } -void MainWindow::setActiveTab(int index) +void MainWindow::onFocusRequest(int index) { m_tabWidget->setCurrentIndex(index); } @@ -305,19 +305,11 @@ void MainWindow::updateSimModel() void MainWindow::testGUIObjectBuilder() { SampleBuilderFactory factory; - //SampleBuilder_t builder = factory.createBuilder("isgisaxs01"); - - //ISample *sample = builder->buildSample(); boost::scoped_ptr<ISample> sample(factory.createSample("isgisaxs01")); sample->printSampleTree(); - //SessionModel *model = new SessionModel(); - GUIObjectBuilder guiBuilder; guiBuilder.populateModel(m_sessionModel, sample.get()); - - //model->save("new_model.xml"); - } diff --git a/GUI/coregui/mainwindow/mainwindow.h b/GUI/coregui/mainwindow/mainwindow.h index 493d5ca689b64388987ac05e7f6d7f67d60a3fbd..814e8d9da15bee7261d07ae155b92164d36b9387 100644 --- a/GUI/coregui/mainwindow/mainwindow.h +++ b/GUI/coregui/mainwindow/mainwindow.h @@ -54,7 +54,7 @@ public: public slots: void onChangeTabWidget(int index); - void setActiveTab(int index); + void onFocusRequest(int index); void openRecentProject(); void readSettings(); void writeSettings();