Some improvements in progress reporting, especially for long jobs.
[dcpomatic.git] / src / wx / job_manager_view.cc
index 20f885a9b284cf7b8b0b12256413bf1ea3f618f3..bd0554f45f056c34c336dfac6b3de7cb058aace4 100644 (file)
@@ -43,15 +43,17 @@ public:
                , _window (window)
                , _panel (panel)
                , _table (table)
-               , _needs_pulse (false)
        {
                int n = 0;
                
-               wxStaticText* m = new wxStaticText (panel, wxID_ANY, std_to_wx (_job->name ()));
-               table->Insert (n, m, 0, wxALIGN_CENTER_VERTICAL | wxALL, 6);
+               _name = new wxStaticText (panel, wxID_ANY, "");
+               _name->SetLabelMarkup ("<b>" + _job->name () + "</b>");
+               table->Insert (n, _name, 0, wxALIGN_CENTER_VERTICAL | wxALL, 6);
                ++n;
        
                _gauge = new wxGauge (panel, wxID_ANY, 100);
+               /* This seems to be required to allow the gauge to shrink under OS X */
+               _gauge->SetMinSize (wxSize (0, -1));
                table->Insert (n, _gauge, 1, wxEXPAND | wxLEFT | wxRIGHT);
                ++n;
                
@@ -86,22 +88,24 @@ public:
 
        void maybe_pulse ()
        {
-               if (_job->running() && _needs_pulse) {
+               if (_job->running() && _job->progress_unknown ()) {
                        _gauge->Pulse ();
                }
-
-               _needs_pulse = true;
        }
 
 private:
 
        void progress ()
        {
-               float const p = _job->overall_progress ();
+               float const p = _job->progress ();
                if (p >= 0) {
                        checked_set (_message, _job->status ());
+                       string const n = "<b>" + _job->name () + "</b>\n" + _job->sub_name ();
+                       if (n != _last_name) {
+                               _name->SetLabelMarkup (std_to_wx (n));
+                               _last_name = n;
+                       }
                        _gauge->SetValue (p * 100);
-                       _needs_pulse = false;
                }
 
                _table->Layout ();
@@ -151,12 +155,13 @@ private:
        wxScrolledWindow* _window;
        wxPanel* _panel;
        wxFlexGridSizer* _table;
+       wxStaticText* _name;
        wxGauge* _gauge;
        wxStaticText* _message;
        wxButton* _cancel;
        wxButton* _pause;
        wxButton* _details;
-       bool _needs_pulse;
+       std::string _last_name;
 };
 
 /** Must be called in the GUI thread */