forked from FLAME-HPC/flame_visualiser
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Animation delay added. Bug fixes.
- Loading branch information
Showing
61 changed files
with
3,478 additions
and
2,514 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,24 +1,30 @@ | ||
#ifndef AGENTDIALOG_H | ||
#define AGENTDIALOG_H | ||
/*! | ||
* \file agentdialog.h | ||
* \author Simon Coakley | ||
* \date 2012 | ||
* \copyright Copyright (c) 2012 University of Sheffield | ||
* \brief Header file for agent dialog | ||
*/ | ||
#ifndef AGENTDIALOG_H_ | ||
#define AGENTDIALOG_H_ | ||
|
||
#include <QDialog> | ||
#include "agent.h" | ||
#include "./agent.h" | ||
|
||
namespace Ui { | ||
class AgentDialog; | ||
} | ||
|
||
class AgentDialog : public QDialog | ||
{ | ||
class AgentDialog : public QDialog { | ||
Q_OBJECT | ||
|
||
public: | ||
public: | ||
explicit AgentDialog(Agent * a, QWidget *parent = 0); | ||
~AgentDialog(); | ||
|
||
private: | ||
private: | ||
Ui::AgentDialog *ui; | ||
Agent * agent; | ||
}; | ||
|
||
#endif // AGENTDIALOG_H | ||
#endif // AGENTDIALOG_H_ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,29 @@ | ||
#ifndef AGENTTYPE_H | ||
#define AGENTTYPE_H | ||
/*! | ||
* \file agenttype.h | ||
* \author Simon Coakley | ||
* \date 2012 | ||
* \copyright Copyright (c) 2012 University of Sheffield | ||
* \brief Header file for agent type | ||
*/ | ||
#ifndef AGENTTYPE_H_ | ||
#define AGENTTYPE_H_ | ||
|
||
#include <QString> | ||
#include <QList> | ||
|
||
class AgentType | ||
{ | ||
public: | ||
class AgentType { | ||
public: | ||
AgentType() { agent = true; } | ||
AgentType(QString n) { name = n; agent = true; isEnvironment = false; } | ||
explicit AgentType(QString n) { | ||
name = n; | ||
agent = true; | ||
isEnvironment = false; | ||
} | ||
|
||
QString name; | ||
QList<QString> variables; | ||
bool agent; | ||
bool isEnvironment; | ||
}; | ||
|
||
#endif // AGENTTYPE_H | ||
#endif // AGENTTYPE_H_ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,51 +1,52 @@ | ||
#include "agenttypedelegate.h" | ||
/*! | ||
* \file agenttypedelegate.cpp | ||
* \author Simon Coakley | ||
* \date 2012 | ||
* \copyright Copyright (c) 2012 University of Sheffield | ||
* \brief Implementation of agent type delegate | ||
*/ | ||
#include <QComboBox> | ||
#include <QDebug> | ||
#include "./agenttypedelegate.h" | ||
|
||
AgentTypeDelegate::AgentTypeDelegate(QList<AgentType> * ats, QObject * parent) | ||
: QItemDelegate(parent) | ||
{ | ||
: QItemDelegate(parent) { | ||
agentTypes = ats; | ||
} | ||
|
||
QWidget *AgentTypeDelegate::createEditor(QWidget *parent, | ||
const QStyleOptionViewItem &/*option*/, | ||
const QModelIndex &/*index*/) const | ||
{ | ||
const QModelIndex &/*index*/) const { | ||
QComboBox *editor = new QComboBox(parent); | ||
for(int i = 0; i < agentTypes->count(); i++) | ||
{ | ||
for (int i = 0; i < agentTypes->count(); i++) { | ||
editor->insertItem(i, agentTypes->at(i).name); | ||
//qDebug() << "AgentTypeDelegate::createEditor " << agentTypes->at(i).name; | ||
// qDebug() << "AgentTypeDelegate::createEditor " | ||
// << agentTypes->at(i).name; | ||
} | ||
//editor->insertItem(agentTypes->count(), "add..."); | ||
// editor->insertItem(agentTypes->count(), "add..."); | ||
return editor; | ||
} | ||
|
||
void AgentTypeDelegate::setEditorData(QWidget *editor, | ||
const QModelIndex &index) const | ||
{ | ||
const QModelIndex &index) const { | ||
QString value = index.data().toString(); | ||
|
||
QComboBox *comboBox = static_cast<QComboBox*>(editor); | ||
for(int i = 0; i < comboBox->count(); i++) | ||
{ | ||
if(comboBox->itemText(i) == value) | ||
for (int i = 0; i < comboBox->count(); i++) { | ||
if (comboBox->itemText(i) == value) | ||
comboBox->setCurrentIndex(i); | ||
} | ||
} | ||
|
||
void AgentTypeDelegate::setModelData(QWidget *editor, QAbstractItemModel *model, | ||
const QModelIndex &index) const | ||
{ | ||
void AgentTypeDelegate::setModelData(QWidget *editor, | ||
QAbstractItemModel *model, const QModelIndex &index) const { | ||
QComboBox *comboBox = static_cast<QComboBox*>(editor); | ||
QString value = comboBox->currentText(); | ||
|
||
model->setData(index, value, Qt::EditRole); | ||
} | ||
|
||
void AgentTypeDelegate::updateEditorGeometry(QWidget *editor, | ||
const QStyleOptionViewItem &option, const QModelIndex &/*index*/) const | ||
{ | ||
const QStyleOptionViewItem &option, const QModelIndex &/*index*/) const { | ||
editor->setGeometry(option.rect); | ||
} |
Oops, something went wrong.