ticket:139 the motif editor dialog wasn't actually looking at the
motifs stored in the analysis to initialize its model with. So
when one either closed the window or tried initializing from a file
the dialog wouldn't reflect what was actually on the screen.
vector<Sequence> motif_seq(motif.begin(), motif.end());
applyButton->setFocusPolicy(Qt::StrongFocus);
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);
button_layout->addStretch();
button_layout->addWidget(applyButton);
void MotifEditor::updateModel()
{
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;
// if there was an old model, delete it
if (model) {
delete model;
-void MotifEditor::updateMotifs()
+void MotifEditor::updateAnalysisMotifs()
{
// This function is _sooo_ not thread safe
// erase motifs
{
// This function is _sooo_ not thread safe
// erase motifs
public slots:
//! create model and attach it to the table view
void updateModel();
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
signals:
//! emitted when the use has applied the motif changes
-MotifModel::MotifModel(QObject *parent)
+MotifModel::MotifModel(MussaRef m, QObject *parent)
: QAbstractTableModel(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(
}
void MotifModel::assign(
#define _MOTIF_MODEL_HPP_
#include "alg/sequence.hpp"
#define _MOTIF_MODEL_HPP_
#include "alg/sequence.hpp"
+#include "alg/mussa.hpp"
#include "qui/motif_editor/MotifElement.hpp"
#include "qui/motif_editor/MotifEditorDelegate.hpp"
#include "qui/motif_editor/MotifElement.hpp"
#include "qui/motif_editor/MotifEditorDelegate.hpp"
- MotifModel(QObject *parent = 0);
+ MotifModel(MussaRef m, QObject *parent = 0);
typedef std::vector<MotifElement> model_type;
typedef model_type::size_type size_type;
typedef std::vector<MotifElement> model_type;
typedef model_type::size_type size_type;