vector<Sequence> motif_seq(motif.begin(), motif.end());
applyButton->setFocusPolicy(Qt::StrongFocus);
- connect(applyButton, SIGNAL(clicked()), this, SLOT(updateMotifs()));
+ connect(applyButton, SIGNAL(clicked()), this, SLOT(updateAnalysisMotifs()));
button_layout->addStretch();
button_layout->addWidget(applyButton);
void MotifEditor::updateModel()
{
- MotifModel *new_model = new MotifModel();
+ MotifModel *new_model = new MotifModel(analysis);
- new_model->push_empty();
-
// if there was an old model, delete it
if (model) {
delete model;
updateView();
}
-void MotifEditor::updateMotifs()
+void MotifEditor::updateAnalysisMotifs()
{
// This function is _sooo_ not thread safe
// erase motifs
public slots:
//! create model and attach it to the table view
void updateModel();
- //! called to apply motif changes
- void updateMotifs();
+ //! called to apply motif changes to the analysis
+ void updateAnalysisMotifs();
signals:
//! emitted when the use has applied the motif changes
#include <QColor>
-MotifModel::MotifModel(QObject *parent)
+MotifModel::MotifModel(MussaRef m, QObject *parent)
: QAbstractTableModel(parent)
{
+ const std::set<Sequence>& motif_set = m->motifs();
+ boost::shared_ptr<AnnotationColors> cm = m->colorMapper();
+
+ if (motif_set.size() == 0) {
+ push_empty();
+ } else {
+ std::set<Sequence>::const_iterator motif_i;
+ for(motif_i = motif_set.begin();
+ motif_i != motif_set.end();
+ ++motif_i)
+ {
+ // ideally we'd know what the motif color was?
+ MotifElement new_element(*motif_i, cm->lookup("motif", motif_i->get_sequence()));
+ push_back(new_element);
+ }
+ }
}
void MotifModel::assign(
#define _MOTIF_MODEL_HPP_
#include "alg/sequence.hpp"
+#include "alg/mussa.hpp"
#include "qui/motif_editor/MotifElement.hpp"
#include "qui/motif_editor/MotifEditorDelegate.hpp"
Q_OBJECT
public:
- MotifModel(QObject *parent = 0);
+ MotifModel(MussaRef m, QObject *parent = 0);
typedef std::vector<MotifElement> model_type;
typedef model_type::size_type size_type;