return analysis_path;
}
+void Mussa::set_analysis_path(boost::filesystem::path pathname)
+{
+ analysis_path = pathname;
+}
+
// set all parameters to null state
void
Mussa::clear()
dirty = true;
}
-string Mussa::get_name()
+string Mussa::get_name() const
{
return analysis_name;
}
+string Mussa::get_title() const
+{
+ fs::path analysis_path = get_analysis_path();
+ if (not analysis_path.empty()) {
+ return analysis_path.native_file_string();
+ } else if (get_name().size() > 0) {
+ return get_name();
+ } else {
+ return std::string("Unnamed");
+ }
+}
+
int
Mussa::size() const
{
void load(boost::filesystem::path ana_path);
// ! return path to the where the analysis is stored
boost::filesystem::path get_analysis_path() const;
+ //! set analysis path
+ void set_analysis_path(boost::filesystem::path);
//! clear parameters and initialize data lists
void clear();
//! set analysis name
void set_name(std::string a_name);
//! return name for this analysis
- std::string get_name();
+ std::string get_name() const;
+ //! return a reasonable window title for this analysis
+ /*! this returns the "variable" portion for a title
+ */
+ std::string get_title() const;
//! return number of sequences in this analyzis
/*! this returns either the_seqs.size() or seq_files.size()
BOOST_CHECK_EQUAL(m.get_analysis_mode(), Mussa::TransitiveNway);
}
+BOOST_AUTO_TEST_CASE ( mussa_title )
+{
+ Mussa m;
+
+ BOOST_CHECK_EQUAL( m.get_title(), "Unnamed");
+ string foo("foo");
+ m.set_name(foo);
+ BOOST_CHECK_EQUAL( m.get_title(), foo);
+ string foopath_name("/my/silly/path");
+ fs::path foopath(foopath_name);
+ m.set_analysis_path(foopath);
+ BOOST_CHECK_EQUAL( m.get_title(), foopath_name);
+}
+
BOOST_AUTO_TEST_CASE( mussa_analysis_name )
{
Mussa m;
message << "Selected " << selected_paths.size() << " paths";
statusBar()->showMessage(message.str().c_str(), 5000);
browser.updatePosition();
+
+ updateTitle();
}
void MussaAlignedWindow::setupActions()
browser.update();
}
+void MussaAlignedWindow::updateTitle()
+{
+ std::string title("Sequence View: ");
+ if (analysis) {
+ title += analysis->get_title();
+ }
+ setWindowTitle(title.c_str());
+}
+
void MussaAlignedWindow::computeMatchLines()
{
browser.clear_links();
//! just force updating the window
void update();
+
+ //! set the title based on the analysis
+ void updateTitle();
protected:
// figure out what Alignments we have (needed for setupAlignmentMenus)
default_dir(QDir::home().absolutePath().toStdString(), fs::native),
motif_editor(0),
setup_analysis_dialog(new MussaSetupDialog(this)),
- subanalysis_window(new SubanalysisWindow),
+ subanalysis_window(new SubanalysisWindow(analysis)),
browser(new SequenceBrowserWidget(this)),
mussaViewTB(new QToolBar("Path Views")),
zoom(new ZoomWidget),
void MussaWindow::updateTitle()
{
if (analysis) {
- fs::path analysis_path = analysis->get_analysis_path();
- if (not analysis_path.empty()) {
- setWindowTitle(analysis_path.native_file_string().c_str());
- } else if (analysis->get_name().size() > 0) {
- setWindowTitle(analysis->get_name().c_str());
- }
+ setWindowTitle(analysis->get_title().c_str());
}
}
#include <QHBoxLayout>
#include <QGridLayout>
-SubanalysisWindow::SubanalysisWindow(QWidget *parent)
+SubanalysisWindow::SubanalysisWindow(MussaRef m, QWidget *parent)
: QWidget(parent),
+ analysis(m),
window(0),
threshold(0),
table(0),
this, SLOT(modelUpdated(const QModelIndex&, int, int)));
connect(&model, SIGNAL(rowsRemoved(const QModelIndex&, int, int)),
this, SLOT(modelUpdated(const QModelIndex&, int, int)));
+
+ updateTitle();
}
SequenceLocationModel& SubanalysisWindow::getModel()
// if the model is empty we shouldn't be able to click ok
if (ok) ok->setEnabled(not model.empty());
}
+
+void SubanalysisWindow::updateTitle()
+{
+ std::string title("Subanalysis: ");
+ if (analysis) {
+ title += analysis->get_title();
+ }
+ setWindowTitle(title.c_str());
+}
\ No newline at end of file
#include <QWidget>
#include "qui/SequenceLocationModel.hpp"
+#include "alg/mussa.hpp"
class SubanalysisWindow : public QWidget
{
Q_OBJECT
public:
- SubanalysisWindow(QWidget *parent = 0);
+ SubanalysisWindow(MussaRef m, QWidget *parent = 0);
//! return a modifiable reference to our SequenceLocationModel
SequenceLocationModel& getModel();
void run();
//! provide a way for the model to tell us to update our gui
void modelUpdated(const QModelIndex&, int, int);
+ //! update our title
+ void updateTitle();
-private:
+private:
+ //! keep track of what analysis we're attached to
+ MussaRef analysis;
QSpinBox *window;
QSpinBox *threshold;
QTableView *table;
void MotifEditor::updateTitle()
{
- QString title("Motif Editor: ");
- title.append(analysis->get_name().c_str());
- setWindowTitle(title);
-
+ std::string title("Motif Editor: ");
+ if (analysis) {
+ title += analysis->get_title();
+ }
+ setWindowTitle(title.c_str());
}
void MotifEditor::updateView()
: QDialog(parent, f),
setupWidget(0)
{
+ setWindowTitle("Define New Analysis");
setupWidget = new MussaSetupWidget;
connect(setupWidget, SIGNAL(createButtonPushed()),