Allow setting a name for a motif
authorDiane Trout <diane@caltech.edu>
Thu, 29 Jun 2006 00:20:32 +0000 (00:20 +0000)
committerDiane Trout <diane@caltech.edu>
Thu, 29 Jun 2006 00:20:32 +0000 (00:20 +0000)
its a quick hack, but there's now a field for entering a name for a motif
though it'd be nice to change the dialog box to use Qts MVC classes.

qui/motif_editor/MotifDetail.cpp
qui/motif_editor/MotifDetail.hpp

index 333cb1ff6903b7b5f41a357bb1937e533e4144be..6c76825e3f2b98b99c748a089f5912c37fa6cc98 100644 (file)
@@ -20,14 +20,16 @@ MotifDetail::MotifDetail(QWidget *parent)
 MotifDetail::MotifDetail(const MotifDetail &md)
   : QWidget((QWidget *)md.parent()),
     motif_color(md.motif_color),
-    motifText(md.motifText.displayText())
+    motifText(md.motifText.displayText()),
+    motifName(md.motifName.displayText())
 {
 }
 
-MotifDetail::MotifDetail(std::string& m, Color& c, QWidget *parent)
+MotifDetail::MotifDetail(std::string& m, Color& c, std::string& name, QWidget *parent)
   : QWidget(parent),
     motif_color(c),
-    motifText(m.c_str())
+    motifText(m.c_str()),
+    motifName(name.c_str())
 {
   setupWidget();
 }
@@ -44,6 +46,7 @@ void MotifDetail::setupWidget()
   layout->addWidget(&colorButton);
   motifText.setValidator(&iupacValidator);
   layout->addWidget(&motifText);
+  layout->addWidget(&motifName);
   
   setLayout(layout);
 }
@@ -58,6 +61,16 @@ string MotifDetail::motif() const
   return motifText.text().toStdString();
 }
 
+void MotifDetail::setName(const std::string& name)
+{
+  motifName.setText(name.c_str());
+}
+
+std::string MotifDetail::name() const
+{
+  return motifName.text().toStdString();
+}
+
 void MotifDetail::setColor(const Color &c)
 {
   motif_color = c;
index 0397976a3af5a550d1b1dd742bfeb4bfc3b87fd1..a503a673971c2c5ab661a7f4ce101ce29d4bb1f5 100644 (file)
@@ -19,11 +19,14 @@ class MotifDetail : public QWidget
 public:
   MotifDetail(QWidget *parent=0);
   MotifDetail(const MotifDetail &);
-  MotifDetail(std::string& m, Color& c, QWidget *parent=0);
+  MotifDetail(std::string& m, Color& c, std::string& name, QWidget *parent=0);
 
   void setMotif(const std::string& m);
   std::string motif() const;
 
+  void setName(const std::string& name);
+  std::string name() const;
+
   void setColor(const Color&);
   Color color() const;
   QColor qcolor() const;
@@ -39,5 +42,6 @@ private:
   // widgets
   QPushButton colorButton;
   QLineEdit motifText;
+  QLineEdit motifName;
 };
 #endif