add getter and setter methods for MixerSnapshot class members

This commit is contained in:
Nikolaus Gullotta 2019-04-03 14:47:52 -05:00 committed by Nikolaus Gullotta
parent 78d283cc5d
commit 9ace01398c
No known key found for this signature in database
GPG key ID: 565F60578092AA31
3 changed files with 33 additions and 19 deletions

View file

@ -291,13 +291,13 @@ void MixerSnapshotDialog::new_snapshot(bool global)
string new_label;
prompt.get_result(new_label);
if (new_label.length() > 0) {
snap->label = new_label;
snap->set_label(new_label);
string path = "";
if(global) {
path = Glib::build_filename(user_config_directory(-1), "mixer_snapshots/", snap->label + ".xml");
path = Glib::build_filename(user_config_directory(-1), "mixer_snapshots/", snap->get_label() + ".xml");
} else {
path = Glib::build_filename(_session->session_directory().root_path(), "mixer_snapshots/", snap->label + ".xml");
path = Glib::build_filename(_session->session_directory().root_path(), "mixer_snapshots/", snap->get_label() + ".xml");
}
if(!rl.empty() && sel->get_active())
@ -338,13 +338,13 @@ void MixerSnapshotDialog::new_snap_from_session(bool global)
MixerSnapshot* snapshot = new MixerSnapshot(_session, session_path);
snapshot->label = basename_nosuffix(session_path);
snapshot->set_label(basename_nosuffix(session_path));
string path = "";
if(global) {
path = Glib::build_filename(user_config_directory(-1), "mixer_snapshots/", snapshot->label + ".xml");
path = Glib::build_filename(user_config_directory(-1), "mixer_snapshots/", snapshot->get_label() + ".xml");
} else {
path = Glib::build_filename(_session->session_directory().root_path(), "mixer_snapshots/", snapshot->label + ".xml");
path = Glib::build_filename(_session->session_directory().root_path(), "mixer_snapshots/", snapshot->get_label() + ".xml");
}
snapshot->write(path);
@ -365,7 +365,7 @@ void MixerSnapshotDialog::refill()
string name = basename_nosuffix(*(i));
MixerSnapshot* snap = new MixerSnapshot(_session, path);
snap->label = name;
snap->set_label(name);
TreeModel::Row row = *(global_model->append());
if (name.length() > 48) {
@ -374,7 +374,7 @@ void MixerSnapshotDialog::refill()
}
row[_columns.name] = name;
row[_columns.favorite] = snap->favorite;
row[_columns.favorite] = snap->get_favorite();
row[_columns.version] = snap->get_last_modified_with();
row[_columns.n_tracks] = snap->get_routes().size();
row[_columns.n_vcas] = snap->get_vcas().size();
@ -402,7 +402,7 @@ void MixerSnapshotDialog::refill()
string name = basename_nosuffix(*(i));
MixerSnapshot* snap = new MixerSnapshot(_session, path);
snap->label = name;
snap->set_label(name);
TreeModel::Row row = *(local_model->append());
if (name.length() > 48) {
@ -411,7 +411,7 @@ void MixerSnapshotDialog::refill()
}
row[_columns.name] = name;
row[_columns.favorite] = snap->favorite;
row[_columns.favorite] = snap->get_favorite();
row[_columns.version] = snap->get_last_modified_with();
row[_columns.n_tracks] = snap->get_routes().size();
row[_columns.n_vcas] = snap->get_vcas().size();
@ -439,8 +439,8 @@ void MixerSnapshotDialog::fav_cell_action(const string& path, bool global)
if(iter) {
MixerSnapshot* snap = (*iter)[_columns.snapshot];
snap->favorite = !snap->favorite;
(*iter)[_columns.favorite] = snap->favorite;
snap->set_favorite(!snap->get_favorite());
(*iter)[_columns.favorite] = snap->get_favorite();
snap->write((*iter)[_columns.full_path]);
}
}

View file

@ -65,12 +65,21 @@ class LIBARDOUR_API MixerSnapshot
std::vector<State> get_routes() {return route_states;};
std::vector<State> get_groups() {return group_states;};
std::vector<State> get_vcas() {return vca_states;};
std::string get_last_modified_with() {return last_modified_with;};
int id;
std::string label;
std::time_t timestamp;
bool favorite;
unsigned int get_id() {return id;};
void set_id(unsigned int new_id) {id = new_id;};
std::string get_label() {return label;};
void set_label(std::string new_label) {label = new_label;};
bool get_favorite() {return timestamp;};
void set_favorite(bool yn) {favorite = yn;};
std::time_t get_timestamp() {return timestamp;};
void set_timestamp(std::time_t new_timestamp) {timestamp = new_timestamp;};
std::string get_last_modified_with() {return last_modified_with;};
void set_last_modified_with(std::string new_modified_with) {last_modified_with = new_modified_with;};
private:
ARDOUR::Session* _session;
@ -80,7 +89,12 @@ class LIBARDOUR_API MixerSnapshot
void load_from_session(std::string);
void load_from_session(XMLNode&);
unsigned int id;
bool favorite;
std::string label;
std::time_t timestamp;
std::string last_modified_with;
std::vector<State> route_states;
std::vector<State> group_states;
std::vector<State> vca_states;

View file

@ -22,9 +22,9 @@ using namespace ARDOUR;
MixerSnapshot::MixerSnapshot(Session* s)
: id(0)
, favorite(false)
, label("snapshot")
, timestamp(time(0))
, favorite(false)
, last_modified_with(string_compose("%1 %2", PROGRAM_NAME, revision))
{
if(s)
@ -33,9 +33,9 @@ MixerSnapshot::MixerSnapshot(Session* s)
MixerSnapshot::MixerSnapshot(Session* s, string file_path)
: id(0)
, favorite(false)
, label("snapshot")
, timestamp(time(0))
, favorite(false)
, last_modified_with(string_compose("%1 %2", PROGRAM_NAME, revision))
{
if(s)