1 #include "qui/seqbrowser/seqproperties/PropertiesWindow.hpp"
3 #include "mussa_exceptions.hpp"
4 #include "alg/mussa.hpp"
11 PropertiesWindow::PropertiesWindow(/* MussaRef m, */
12 SequencePropertiesModel::model_type glseqs,
21 QGridLayout *parameterLayout = new QGridLayout;
23 applyButton = new QPushButton(tr("&Apply"), this);
24 applyButton->setFocusPolicy(Qt::StrongFocus);
25 applyButton->setEnabled( not model.empty() );
26 connect(applyButton, SIGNAL(clicked()), this, SLOT(apply()));
28 closeButton = new QPushButton(tr("Close"), this);
29 connect(closeButton, SIGNAL(clicked()), this, SLOT(close()));
31 table = new QTableView(this);
32 table->setModel(&model);
35 QHBoxLayout *buttonLayout = new QHBoxLayout;
36 buttonLayout->addWidget(applyButton);
37 buttonLayout->addWidget(closeButton);
39 // layout verticle space
40 QVBoxLayout *verticalLayout = new QVBoxLayout;
41 verticalLayout->addWidget(table);
42 verticalLayout->addLayout(buttonLayout);
43 setLayout(verticalLayout);
45 // now that we're all setup lets get notices when we're updated
46 connect(&model, SIGNAL(rowsInserted(const QModelIndex&, int, int)),
47 this, SLOT(modelUpdated(const QModelIndex&, int, int)));
48 connect(&model, SIGNAL(rowsRemoved(const QModelIndex&, int, int)),
49 this, SLOT(modelUpdated(const QModelIndex&, int, int)));
54 SequencePropertiesModel& PropertiesWindow::getModel()
59 void PropertiesWindow::close()
65 void PropertiesWindow::apply()
68 emit propertiesChanged();
71 void PropertiesWindow::modelUpdated(const QModelIndex&, int, int )
73 // if the model is empty we shouldn't be able to click ok
74 if (applyButton) applyButton->setEnabled(not model.empty());
77 void PropertiesWindow::updateTitle()
79 std::string title("Sequence Properties: ");
81 title += analysis->get_title();
83 setWindowTitle(title.c_str());