the_seqs.clear();
the_paths.clear();
analysis_path = fs::path();
- dirty = false;
+ set_dirty(false);
+}
+
+void Mussa::set_dirty(bool new_state)
+{
+ if (dirty != new_state) {
+ dirty = new_state;
+ emit isModified(dirty);
+ }
}
bool Mussa::is_dirty() const
Mussa::set_name(string a_name)
{
analysis_name = a_name;
- dirty = true;
+ set_dirty(true);
}
string Mussa::get_name() const
Mussa::set_window(int a_window)
{
window = a_window;
- dirty = true;
+ set_dirty(true);
}
int Mussa::get_window() const
Mussa::set_threshold(int a_threshold)
{
threshold = a_threshold;
- dirty = true;
+ set_dirty(true);
if (a_threshold > soft_thres) {
soft_thres = a_threshold;
}
Mussa::set_analysis_mode(enum analysis_modes new_ana_mode)
{
ana_mode = new_ana_mode;
- dirty = true;
+ set_dirty(true);
}
enum Mussa::analysis_modes Mussa::get_analysis_mode() const
{
boost::shared_ptr<Sequence> seq_copy(new Sequence(a_seq));
the_seqs.push_back(seq_copy);
- dirty = true;
+ set_dirty(true);
}
void Mussa::append_sequence(boost::shared_ptr<Sequence> a_seq)
{
the_seqs.push_back(a_seq);
- dirty = true;
+ set_dirty(true);
}
aseq->set_species(*name);
}
the_seqs.push_back(aseq);
- dirty = true;
+ set_dirty(true);
}
void
// << " threshold = " << threshold << endl;
}
// no file was loaded, signal error
- dirty = true;
+ set_dirty(true);
}
}
}
- dirty = false;
+ set_dirty(false);
analysis_path = save_path;
}
{
motif_sequences.insert(motif);
color_mapper->appendInstanceColor("motif", motif.get_sequence(), color);
- dirty = true;
+ set_dirty(true);
}
void Mussa::set_motifs(const vector<Sequence>& motifs,
signals:
//! call whatever signaling system we want
void progress(const std::string& description, int cur, int max);
+ //! triggered when our state changes between unsaved(true) and saved(false)
+ void isModified(bool);
public:
typedef std::set<Sequence> motif_set;
enum analysis_modes get_analysis_mode() const;
//! return a string name for an analysis mode
std::string get_analysis_mode_name() const;
+ //! set our current dirty state
+ void set_dirty(bool);
//! return if we have unsaved changes
bool is_dirty() const;
//! is there anything loaded into this analysis?
if (analysis) {
connect(analysis.get(), SIGNAL(progress(const std::string&, int, int)),
this, SLOT(updateProgress(const std::string&, int, int)));
+ connect(analysis.get(), SIGNAL(isModified(bool)),
+ this, SLOT(updateAnalysisModified(bool)));
}
updateTitle();
updateAnalysis();
qApp->processEvents();
}
+void MussaWindow::updateAnalysisModified(bool is_modified)
+{
+ setWindowModified(is_modified);
+}
+
void MussaWindow::updateTitle()
{
if (analysis) {
- setWindowTitle(analysis->get_title().c_str());
+ QString title(analysis->get_title().c_str());
+ title += "[*]";
+ setWindowTitle(title);
}
}