From: Diane Trout Date: Tue, 3 Oct 2006 20:52:02 +0000 (+0000) Subject: Add ReadOnly ThresholdWidget to MussaAlignedWindow X-Git-Url: http://woldlab.caltech.edu/gitweb/?p=mussa.git;a=commitdiff_plain;h=2ce573032c393aaa8c2cc6863c6325211b8bab7d Add ReadOnly ThresholdWidget to MussaAlignedWindow 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. --- diff --git a/qui/MussaAlignedWindow.cpp b/qui/MussaAlignedWindow.cpp index 4c917c4..4daa5d8 100644 --- a/qui/MussaAlignedWindow.cpp +++ b/qui/MussaAlignedWindow.cpp @@ -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; diff --git a/qui/MussaAlignedWindow.hpp b/qui/MussaAlignedWindow.hpp index 452ac0e..f67e5b3 100644 --- a/qui/MussaAlignedWindow.hpp +++ b/qui/MussaAlignedWindow.hpp @@ -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 pick_actions; std::vector view_actions; ZoomWidget *zoom; + ThresholdWidget *threshold_widget; QToolBar *alignTB; }; diff --git a/qui/ThresholdWidget.cpp b/qui/ThresholdWidget.cpp index c1ca76c..fc2444e 100644 --- a/qui/ThresholdWidget.cpp +++ b/qui/ThresholdWidget.cpp @@ -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()/ diff --git a/qui/ThresholdWidget.hpp b/qui/ThresholdWidget.hpp index 319175a..e83c815 100644 --- a/qui/ThresholdWidget.hpp +++ b/qui/ThresholdWidget.hpp @@ -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;