summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2012-09-22 00:29:58 +0100
committerCarl Hetherington <cth@carlh.net>2012-09-22 00:29:58 +0100
commitfb16d3932b49957672b5da3ced016186c926de9b (patch)
tree279994203c11a3a14a546da61c3e557f2c89c603 /src
parent72ac03711600e4b45b779665259137c138022564 (diff)
Tweak properties dialogue layout and add a note of how many J2K frames have already been encoded.
Diffstat (limited to 'src')
-rw-r--r--src/lib/film.cc11
-rw-r--r--src/lib/film.h2
-rw-r--r--src/wx/properties_dialog.cc19
-rw-r--r--src/wx/properties_dialog.h1
4 files changed, 28 insertions, 5 deletions
diff --git a/src/lib/film.cc b/src/lib/film.cc
index 3b74f1888..92b91d0ac 100644
--- a/src/lib/film.cc
+++ b/src/lib/film.cc
@@ -19,6 +19,7 @@
#include <stdexcept>
#include <iostream>
+#include <algorithm>
#include <fstream>
#include <cstdlib>
#include <sstream>
@@ -429,7 +430,6 @@ Film::j2k_dir () const
filesystem::path p;
-
/* Start with j2c */
p /= "j2c";
@@ -641,3 +641,12 @@ Film::copy_from_dvd ()
JobManager::instance()->add (j);
}
+int
+Film::encoded_frames () const
+{
+ if (format() == 0) {
+ return 0;
+ }
+
+ return distance (filesystem::directory_iterator (j2k_dir()), filesystem::directory_iterator ());
+}
diff --git a/src/lib/film.h b/src/lib/film.h
index 3ff671fbe..40aa7b0f6 100644
--- a/src/lib/film.h
+++ b/src/lib/film.h
@@ -229,6 +229,8 @@ public:
return _log;
}
+ int encoded_frames () const;
+
/** Emitted when some metadata property has changed */
mutable sigc::signal1<void, Property> Changed;
diff --git a/src/wx/properties_dialog.cc b/src/wx/properties_dialog.cc
index a447091c3..122d647ca 100644
--- a/src/wx/properties_dialog.cc
+++ b/src/wx/properties_dialog.cc
@@ -30,20 +30,24 @@ using namespace boost;
PropertiesDialog::PropertiesDialog (wxWindow* parent, Film* film)
: wxDialog (parent, wxID_ANY, _("Film Properties"), wxDefaultPosition, wxDefaultSize, wxDEFAULT_DIALOG_STYLE)
{
- wxFlexGridSizer* table = new wxFlexGridSizer (2, 6, 6);
+ wxFlexGridSizer* table = new wxFlexGridSizer (2, 3, 6);
add_label_to_sizer (table, this, "Frames");
_frames = new wxStaticText (this, wxID_ANY, std_to_wx (""));
table->Add (_frames, 1, wxALIGN_CENTER_VERTICAL);
- add_label_to_sizer (table, this, "Disk space for frames");
+ add_label_to_sizer (table, this, "Disk space required for frames");
_disk_for_frames = new wxStaticText (this, wxID_ANY, std_to_wx (""));
table->Add (_disk_for_frames, 1, wxALIGN_CENTER_VERTICAL);
- add_label_to_sizer (table, this, "Total disk space");
+ add_label_to_sizer (table, this, "Total disk space required");
_total_disk = new wxStaticText (this, wxID_ANY, std_to_wx (""));
table->Add (_total_disk, 1, wxALIGN_CENTER_VERTICAL);
+ add_label_to_sizer (table, this, "Frames already encoded");
+ _encoded = new wxStaticText (this, wxID_ANY, std_to_wx (""));
+ table->Add (_encoded, 1, wxALIGN_CENTER_VERTICAL);
+
_frames->SetLabel (std_to_wx (lexical_cast<string> (film->length ())));
double const disk = ((double) Config::instance()->j2k_bandwidth() / 8) * film->length() / (film->frames_per_second () * 1073741824);
stringstream s;
@@ -54,8 +58,15 @@ PropertiesDialog::PropertiesDialog (wxWindow* parent, Film* film)
t << fixed << setprecision (1) << (disk * 2) << "Gb";
_total_disk->SetLabel (std_to_wx (t.str ()));
+ stringstream u;
+ u << film->encoded_frames();
+ if (film->length()) {
+ u << " (" << (film->encoded_frames() * 100 / film->length()) << "%)";
+ }
+ _encoded->SetLabel (std_to_wx (u.str ()));
+
wxBoxSizer* overall_sizer = new wxBoxSizer (wxVERTICAL);
- overall_sizer->Add (table);
+ overall_sizer->Add (table, 0, wxALL, 8);
wxSizer* buttons = CreateSeparatedButtonSizer (wxOK);
if (buttons) {
diff --git a/src/wx/properties_dialog.h b/src/wx/properties_dialog.h
index e74344ff6..25c11e8d0 100644
--- a/src/wx/properties_dialog.h
+++ b/src/wx/properties_dialog.h
@@ -30,5 +30,6 @@ private:
wxStaticText* _frames;
wxStaticText* _disk_for_frames;
wxStaticText* _total_disk;
+ wxStaticText* _encoded;
};