1 #include "qui/SubanalysisWindow.hpp"
2 #include "qui/MussaWindow.hpp"
4 #include "mussa_exceptions.hpp"
5 #include "alg/mussa.hpp"
11 SubanalysisWindow::SubanalysisWindow(QWidget *parent)
19 QGridLayout *parameterLayout = new QGridLayout;
21 QLabel *thresholdLabel = new QLabel(tr("threshold (bp)"));
22 parameterLayout->addWidget(thresholdLabel, 0, 0);
23 threshold = new QSpinBox(this);
24 threshold->setValue(8);
25 parameterLayout->addWidget(threshold, 1, 0);
26 QLabel *windowLabel = new QLabel(tr("window (bp)"));
27 parameterLayout->addWidget(windowLabel, 0, 1);
28 window = new QSpinBox(this);
30 parameterLayout->addWidget(window, 1, 1);
32 ok = new QPushButton(tr("&OK"), this);
33 connect(ok, SIGNAL(clicked()), this, SLOT(run()));
34 cancel = new QPushButton(tr("Cancel"), this);
35 connect(cancel, SIGNAL(clicked()), this, SLOT(abort()));
36 table = new QTableView(this);
37 table->setModel(&model);
40 QHBoxLayout *buttonLayout = new QHBoxLayout;
41 buttonLayout->addWidget(ok);
42 buttonLayout->addWidget(cancel);
44 // layout verticle space
45 QVBoxLayout *verticalLayout = new QVBoxLayout;
46 verticalLayout->addLayout(parameterLayout);
47 verticalLayout->addWidget(table);
48 verticalLayout->addLayout(buttonLayout);
49 setLayout(verticalLayout);
52 SequenceLocationModel& SubanalysisWindow::getModel()
57 void SubanalysisWindow::abort()
63 void SubanalysisWindow::run()
65 if (window == 0 or threshold == 0)
66 throw std::runtime_error("SubanalysisWindow misconstructed");
68 std::auto_ptr<Mussa> m(new Mussa);
70 for(SequenceLocationModel::iterator itor = model.begin();
74 m->append_sequence(itor->getSelectedSequence());
77 m->set_window(window->value());
78 m->set_threshold(threshold->value());
80 MussaWindow *mw = new MussaWindow(m.get());