Add ReadOnly ThresholdWidget to MussaAlignedWindow
authorDiane Trout <diane@caltech.edu>
Tue, 3 Oct 2006 20:52:02 +0000 (20:52 +0000)
committerDiane Trout <diane@caltech.edu>
Tue, 3 Oct 2006 20:52:02 +0000 (20:52 +0000)
The simplest way of report the threshold was to reuse the current
threshold widget. However since it makes no sense to change the threshold
at on the aligned sequence level view, I added the ability to make
the widget read only.

qui/MussaAlignedWindow.cpp
qui/MussaAlignedWindow.hpp
qui/ThresholdWidget.cpp
qui/ThresholdWidget.hpp

index 4c917c45da40a8d653d72aba3c3d00b3695e7638..4daa5d8a6068be9b280f39560b1002d1e952eb98 100644 (file)
@@ -21,6 +21,7 @@ MussaAlignedWindow::MussaAlignedWindow(MussaRef m,
     subanalysis_window(window),
     pick_align_menu(tr("Choose Alignment")),
     view_align_menu(tr("View Alignment")),
+    threshold_widget(0),
     zoom(0),
     alignTB(0)
 {
@@ -40,8 +41,15 @@ MussaAlignedWindow::MussaAlignedWindow(MussaRef m,
   
   setCentralWidget(&browser);
 
+  // Add a threhold widget set to our current threshold and make it readonly 
+  threshold_widget = new ThresholdWidget;
+  threshold_widget->setRange(analysis->get_threshold(),analysis->get_window());
+  threshold_widget->setBasepairThreshold(analysis->get_soft_threshold());
+  threshold_widget->setReadOnly(true);
+  
   alignTB = new QToolBar();
   alignTB->addWidget(zoom);
+  alignTB->addWidget(threshold_widget);
   addToolBar(alignTB);
   
   ostringstream message;
index 452ac0e5bea391e48ba588a0a69d391833e8cd08..f67e5b32c2cc0537ae728249ffd83cdec4cdb31c 100644 (file)
@@ -11,6 +11,7 @@
 #include "alg/mussa.hpp"
 #include "qui/IntAction.hpp"
 #include "qui/ZoomWidget.hpp"
+#include "qui/ThresholdWidget.hpp"
 #include "qui/seqbrowser/SequenceBrowserWidget.hpp"
 #include "qui/SubanalysisWindow.hpp"
 
@@ -68,6 +69,7 @@ protected:
   std::vector <IntAction *> pick_actions;
   std::vector <IntAction *> view_actions;
   ZoomWidget *zoom;
+  ThresholdWidget *threshold_widget;
   QToolBar *alignTB;
 };
 
index c1ca76c2ffae3474bbdf5666c8a7eccda372ea5f..fc2444e5f2f3f3d8ba31d64d588957d9da0e53cb 100644 (file)
@@ -43,6 +43,16 @@ void ThresholdWidget::setRange(int min, int max)
   updatePercentThreshold();
 }
 
+bool ThresholdWidget::isReadOnly() const
+{
+  return basepair_spinner->isReadOnly();
+}
+
+void ThresholdWidget::setReadOnly(bool read_only)
+{
+  basepair_spinner->setReadOnly(read_only);
+}
+
 double ThresholdWidget::min_ratio() const
 {
   double ratio=((double)basepair_spinner->minimum()/
index 319175a985f91527af48563c0e53be8aa55ef594..e83c815695cec7089996a0a2e82dde552b4cbdac 100644 (file)
@@ -12,6 +12,11 @@ class ThresholdWidget : public QWidget
 
 public: 
   ThresholdWidget(QWidget *parent = 0, int min=20, int max=30);
+  
+  //! is the widget in read only mode
+  bool isReadOnly() const;
+  //! set the widget to specified read only state
+  void setReadOnly(bool);
 
   //! return min_threshold/max_threshold
   double min_ratio() const;