Playlist UI Tweaks: assign pgroup_id's on Import (libardour part)

This commit is contained in:
Ben Loftis 2021-06-25 16:18:20 -05:00 committed by Robin Gareus
parent d1941c9cbc
commit 42d9e88263
Signed by: rgareus
GPG Key ID: A090BCE02CF57F04
2 changed files with 33 additions and 2 deletions

View File

@ -110,8 +110,26 @@ public:
bool set_name (const std::string& str);
void set_region_ownership ();
std::string pgroup_id() { return _pgroup_id; }
void set_pgroup_id(std::string pgid) { _pgroup_id = pgid; PropertyChanged (Properties::name); }
/*playlist group IDs (pgroup_id) is a group identifier that is implicitly
* or explicitly assigned to playlists so they can be associated with each other.
*
* For example, when you switch a track's playlist, you can choose to
* switch other tracks to the same pgroup_id
*
* pgroup_id's should be unique; currently we use a timestamp to avoid duplicates.
* pgroup_id's are human-readable strings; use string comparison to find matches.
*
* To be useful, we want every playlist to be assigned a sensible pgroup_id
* Some examples of pgroup_id's getting assigned *explicitly* include:
* when the user makes a new playlist for a track or Track Group
* when the user triggers an action like "new playlist for rec-armed tracks"
* Some examples of pgroup_id's getting assigned *implicitly* include:
* the user makes the first recording pass ("take") in an empty playlist
* the user imports tracks.
*/
static std::string generate_pgroup_id();
std::string pgroup_id() { return _pgroup_id; }
void set_pgroup_id(std::string pgid) { _pgroup_id = pgid; PropertyChanged (Properties::name); }
virtual void clear (bool with_signals = true);
virtual void dump () const;

View File

@ -30,6 +30,8 @@
#include <stdint.h>
#include <string>
#include <glibmm/datetime.h>
#include "pbd/stateful_diff_command.h"
#include "pbd/strsplit.h"
#include "pbd/types_convert.h"
@ -2240,6 +2242,17 @@ Playlist::clear_owned_changes ()
Stateful::clear_owned_changes ();
}
string
Playlist::generate_pgroup_id ()
{
time_t now;
time (&now);
Glib::DateTime tm (Glib::DateTime::create_now_local (now));
string gid;
gid = (tm.format ("%F %H.%M.%S"));
return gid;
}
void
Playlist::update (const RegionListProperty::ChangeRecord& change)
{