Tweak properties dialogue layout and add a note of how many J2K frames have already...
authorCarl Hetherington <cth@carlh.net>
Fri, 21 Sep 2012 23:29:58 +0000 (00:29 +0100)
committerCarl Hetherington <cth@carlh.net>
Fri, 21 Sep 2012 23:29:58 +0000 (00:29 +0100)
ChangeLog
src/lib/film.cc
src/lib/film.h
src/wx/properties_dialog.cc
src/wx/properties_dialog.h

index 693b87b186528edea6d86f4de0d16a6876e8d60e..cc348b21ef2571fae9f3e272e89d9f8dc1bf8929 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -3,6 +3,10 @@
        * Rename servomatic to servomatic_cli and
        add a very basic system-tray-dwelling GUI server.
 
+       * Tweak formatting of properties dialogue
+       and add a note of how many J2K frames
+       have already been encoded.
+
 2012-09-18  Carl Hetherington  <cth@carlh.net>
 
        * Fix non-working removal of encode servers.
index 3b74f188824ed207eb7d4a6f5a592584a4f017fe..92b91d0ac60901abf1c36764ed9adff70a0905ab 100644 (file)
@@ -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 ());
+}
index 3ff671fbe7e7792308ec5ed488ce123f23ee16a1..40aa7b0f6617deaa85c18a65852953e223e9e50d 100644 (file)
@@ -229,6 +229,8 @@ public:
                return _log;
        }
 
+       int encoded_frames () const;
+
        /** Emitted when some metadata property has changed */
        mutable sigc::signal1<void, Property> Changed;
        
index a447091c3874f6d8fec39e41a61287336a93899c..122d647ca0883e8e888fb3d8e7e0ee14dd5cd25e 100644 (file)
@@ -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) {
index e74344ff6a403a6d5e6c308ab147344293feb708..25c11e8d0025f8a206df1dbb799170ab751ba3a2 100644 (file)
@@ -30,5 +30,6 @@ private:
        wxStaticText* _frames;
        wxStaticText* _disk_for_frames;
        wxStaticText* _total_disk;
+       wxStaticText* _encoded;
 };