add timestamp to location and date sorting from timestamps to export_timespan_selector

This commit is contained in:
Nikolaus Gullotta 2019-04-12 15:41:14 -05:00
parent 3e7e89db8f
commit 59b6b46a13
4 changed files with 26 additions and 3 deletions

View file

@ -405,6 +405,7 @@ ExportTimespanSelectorSingle::ExportTimespanSelectorSingle (ARDOUR::Session * se
range_view.append_column (*label_col);
range_view.append_column (_("Length"), range_cols.length);
range_view.append_column (_("Creation Date"), range_cols.date);
}
void
@ -443,7 +444,10 @@ ExportTimespanSelectorSingle::fill_range_list ()
row[range_cols.realtime] = realtime;
row[range_cols.name] = (*it)->name();
row[range_cols.label] = construct_label (*it);
row[range_cols.length] = construct_length (*it);
Glib::DateTime gdt(Glib::DateTime::create_now_local ((*it)->timestamp()));
row[range_cols.timestamp] = (*it)->timestamp();
row[range_cols.date] = gdt.format ("%F %H:%M");;
add_range_to_selection (*it, false);
@ -496,6 +500,11 @@ ExportTimespanSelectorMultiple::ExportTimespanSelectorMultiple (ARDOUR::Session
range_view.append_column (*label_col);
range_view.append_column (_("Length"), range_cols.length);
range_view.append_column (_("Creation Date"), range_cols.date);
range_list->set_sort_column(5, Gtk::SORT_DESCENDING);
Gtk::TreeViewColumn* date_col = range_view.get_column(5); // date column
date_col->set_sort_column(7); // set sort as the timestamp
}
void
@ -526,6 +535,10 @@ ExportTimespanSelectorMultiple::fill_range_list ()
row[range_cols.name] = (*it)->name();
row[range_cols.label] = construct_label (*it);
row[range_cols.length] = construct_length (*it);
Glib::DateTime gdt(Glib::DateTime::create_now_local ((*it)->timestamp()));
row[range_cols.timestamp] = (*it)->timestamp();
row[range_cols.date] = gdt.format ("%F %H:%M");;
}
set_selection_from_state ();

View file

@ -24,6 +24,7 @@
#include "audio_clock.h"
#include <list>
#include <ctime>
#ifdef interface
#undef interface
@ -136,8 +137,10 @@ protected:
Gtk::TreeModelColumn<bool> realtime;
Gtk::TreeModelColumn<std::string> name;
Gtk::TreeModelColumn<std::string> length;
Gtk::TreeModelColumn<std::string> date;
Gtk::TreeModelColumn<time_t> timestamp;
RangeCols () { add (location); add(label); add(selected); add(realtime); add(name); add(length); }
RangeCols () { add (location); add(label); add(selected); add(realtime); add(name); add(length); add(date); add(timestamp);}
};
RangeCols range_cols;

View file

@ -23,6 +23,7 @@
#include <list>
#include <iostream>
#include <map>
#include <ctime>
#include <sys/types.h>
@ -69,6 +70,8 @@ public:
void lock ();
void unlock ();
time_t timestamp() { return _timestamp; };
samplepos_t start() const { return _start; }
samplepos_t end() const { return _end; }
samplecnt_t length() const { return _end - _start; }
@ -160,6 +163,7 @@ private:
bool _locked;
PositionLockStyle _position_lock_style;
boost::shared_ptr<SceneChange> _scene_change;
time_t _timestamp;
void set_mark (bool yn);
bool set_flag_internal (bool yn, Flags flag);

View file

@ -65,6 +65,7 @@ Location::Location (Session& s)
, _flags (Flags (0))
, _locked (false)
, _position_lock_style (AudioTime)
, _timestamp(time(0))
{
assert (_start >= 0);
assert (_end >= 0);
@ -79,7 +80,7 @@ Location::Location (Session& s, samplepos_t sample_start, samplepos_t sample_end
, _flags (bits)
, _locked (false)
, _position_lock_style (s.config.get_glue_new_markers_to_bars_and_beats() ? MusicTime : AudioTime)
, _timestamp(time(0))
{
recompute_beat_from_samples (sub_num);
@ -599,6 +600,7 @@ Location::get_state ()
node->set_property ("flags", _flags);
node->set_property ("locked", _locked);
node->set_property ("position-lock-style", _position_lock_style);
node->set_property ("timestamp", _timestamp);
if (_scene_change) {
node->add_child_nocopy (_scene_change->get_state());
@ -683,6 +685,7 @@ Location::set_state (const XMLNode& node, int version)
}
node.get_property ("position-lock-style", _position_lock_style);
node.get_property ("timestamp", _timestamp);
XMLNode* scene_child = find_named_node (node, SceneChange::xml_node_name);