Properites -> Properties spelling err fix.
[mussa.git] / qui / seqbrowser / seqproperties / PropertiesWindow.cpp
index 24d1521f286144bc1fb54879a67a36d57dbf0f6a..54c2fa33dee2acffe890b2c8333be962e8c6100b 100644 (file)
@@ -14,26 +14,27 @@ PropertiesWindow::PropertiesWindow(/* MussaRef m, */
   : QWidget(parent),
     /* analysis(m), */
     table(0),
-    ok(0),
-    cancel(0),
+    applyButton(0),
+    closeButton(0),
     model(glseqs)
 {
   QGridLayout *parameterLayout = new QGridLayout;
 
-  ok = new QPushButton(tr("&OK"), this);
-  ok->setEnabled( false );
-  connect(ok, SIGNAL(clicked()), this, SLOT(apply()));
+  applyButton = new QPushButton(tr("&Apply"), this);
+  applyButton->setFocusPolicy(Qt::StrongFocus);
+  applyButton->setEnabled( not model.empty() );
+  connect(applyButton, SIGNAL(clicked()), this, SLOT(apply()));
 
-  cancel = new QPushButton(tr("Cancel"), this);
-  connect(cancel, SIGNAL(clicked()), this, SLOT(cancel()));
+  closeButton = new QPushButton(tr("Close"), this);
+  connect(closeButton, SIGNAL(clicked()), this, SLOT(close()));
 
   table = new QTableView(this);
   table->setModel(&model);
 
   // layout buttons
   QHBoxLayout *buttonLayout = new QHBoxLayout;
-  buttonLayout->addWidget(ok);
-  buttonLayout->addWidget(cancel);
+  buttonLayout->addWidget(applyButton);
+  buttonLayout->addWidget(closeButton);
 
   // layout verticle space
   QVBoxLayout *verticalLayout = new QVBoxLayout;
@@ -55,7 +56,7 @@ SequencePropertiesModel& PropertiesWindow::getModel()
   return model;
 }
 
-void PropertiesWindow::abort()
+void PropertiesWindow::close()
 {
   model.clear();
   hide();
@@ -63,24 +64,19 @@ void PropertiesWindow::abort()
 
 void PropertiesWindow::apply()
 {
-  std::cout << "implement PropertiesWindow::apply" << std::endl;
-  
-  for(SequencePropertiesModel::iterator itor = model.begin();
-      itor != model.end();
-      ++itor)
-  {
-  }
+  model.saveChanges();
+  emit propertiesChanged();
 }
 
 void PropertiesWindow::modelUpdated(const QModelIndex&, int, int )
 {
   // if the model is empty we shouldn't be able to click ok
-  if (ok) ok->setEnabled(not model.empty());
+  if (applyButton) applyButton->setEnabled(not model.empty());
 }
 
 void PropertiesWindow::updateTitle()
 {
-  std::string title("Sequence Properites: ");
+  std::string title("Sequence Properties: ");
   if (analysis) {
     title += analysis->get_title();
   }