projects
/
dcpomatic.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
std::shared_ptr
[dcpomatic.git]
/
src
/
wx
/
content_view.cc
diff --git
a/src/wx/content_view.cc
b/src/wx/content_view.cc
index f2117fc20e5ff7f6f80619d77a99b653dc3c007d..67a9a3fa53c90b4faa1395ef5200c1701bdba14f 100644
(file)
--- a/
src/wx/content_view.cc
+++ b/
src/wx/content_view.cc
@@
-35,14
+35,14
@@
using std::string;
using std::cout;
using std::list;
using std::string;
using std::cout;
using std::list;
-using
boost
::shared_ptr;
-using
boost
::weak_ptr;
+using
std
::shared_ptr;
+using
std
::weak_ptr;
using boost::optional;
using boost::optional;
-using boost::dynamic_pointer_cast;
+using std::dynamic_pointer_cast;
+using namespace dcpomatic;
-ContentView::ContentView (wxWindow* parent
, weak_ptr<Film> film
)
+ContentView::ContentView (wxWindow* parent)
: wxListCtrl (parent, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLC_REPORT | wxLC_NO_HEADER)
: wxListCtrl (parent, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLC_REPORT | wxLC_NO_HEADER)
- , _film (film)
{
AppendColumn (wxT(""), wxLIST_FORMAT_LEFT, 80);
/* type */
{
AppendColumn (wxT(""), wxLIST_FORMAT_LEFT, 80);
/* type */
@@
-66,18
+66,13
@@
ContentView::selected () const
void
ContentView::update ()
{
void
ContentView::update ()
{
- shared_ptr<Film> film = _film.lock ();
- if (!film) {
- return;
- }
-
using namespace boost::filesystem;
DeleteAllItems ();
_content.clear ();
optional<path> dir = Config::instance()->player_content_directory();
using namespace boost::filesystem;
DeleteAllItems ();
_content.clear ();
optional<path> dir = Config::instance()->player_content_directory();
- if (!dir) {
-
return
;
+ if (!dir
|| !boost::filesystem::is_directory(*dir)
) {
+
dir = home_directory ()
;
}
wxProgressDialog progress (_("DCP-o-matic"), _("Reading content directory"));
}
wxProgressDialog progress (_("DCP-o-matic"), _("Reading content directory"));
@@
-87,21
+82,23
@@
ContentView::update ()
for (directory_iterator i = directory_iterator(*dir); i != directory_iterator(); ++i) {
try {
for (directory_iterator i = directory_iterator(*dir); i != directory_iterator(); ++i) {
try {
+ progress.Pulse ();
+
shared_ptr<Content> content;
if (is_directory(*i) && (is_regular_file(*i / "ASSETMAP") || is_regular_file(*i / "ASSETMAP.xml"))) {
shared_ptr<Content> content;
if (is_directory(*i) && (is_regular_file(*i / "ASSETMAP") || is_regular_file(*i / "ASSETMAP.xml"))) {
- content.reset (new DCPContent(
film,
*i));
+ content.reset (new DCPContent(*i));
} else if (i->path().extension() == ".mp4" || i->path().extension() == ".ecinema") {
} else if (i->path().extension() == ".mp4" || i->path().extension() == ".ecinema") {
- content = content_factory(
film,
*i).front();
+ content = content_factory(*i).front();
}
if (content) {
}
if (content) {
- shared_ptr<ExamineContentJob> job(new ExamineContentJob(
film
, content));
+ shared_ptr<ExamineContentJob> job(new ExamineContentJob(
shared_ptr<Film>()
, content));
jm->add (job);
jobs.push_back (job);
}
} catch (boost::filesystem::filesystem_error& e) {
/* Never mind */
jm->add (job);
jobs.push_back (job);
}
} catch (boost::filesystem::filesystem_error& e) {
/* Never mind */
- } catch (dcp::
DCP
ReadError& e) {
+ } catch (dcp::ReadError& e) {
/* Never mind */
}
}
/* Never mind */
}
}
@@
-114,7
+111,7
@@
ContentView::update ()
}
return;
}
}
return;
}
- dcpomatic_sleep (1);
+ dcpomatic_sleep
_seconds
(1);
}
/* Add content from successful jobs and report errors */
}
/* Add content from successful jobs and report errors */
@@
-136,7
+133,7
@@
ContentView::add (shared_ptr<Content> content)
wxListItem it;
it.SetId(N);
it.SetColumn(0);
wxListItem it;
it.SetId(N);
it.SetColumn(0);
- DCPTime length = content->
length_after_trim
();
+ DCPTime length = content->
approximate_length
();
int h, m, s, f;
length.split (24, h, m, s, f);
it.SetText(wxString::Format("%02d:%02d:%02d", h, m, s));
int h, m, s, f;
length.split (24, h, m, s, f);
it.SetText(wxString::Format("%02d:%02d:%02d", h, m, s));
@@
-167,9
+164,3
@@
ContentView::get (string digest) const
return shared_ptr<Content>();
}
return shared_ptr<Content>();
}
-
-void
-ContentView::set_film (weak_ptr<Film> film)
-{
- _film = film;
-}