Basics of job view when sending KDM emails from dcpomatic_kdm.
authorCarl Hetherington <cth@carlh.net>
Wed, 7 Oct 2015 16:11:31 +0000 (17:11 +0100)
committerCarl Hetherington <cth@carlh.net>
Fri, 9 Oct 2015 12:44:58 +0000 (13:44 +0100)
src/tools/dcpomatic_kdm.cc
src/wx/job_view.cc
src/wx/job_view.h
src/wx/job_view_dialog.cc [new file with mode: 0644]
src/wx/job_view_dialog.h [new file with mode: 0644]
src/wx/table_dialog.cc
src/wx/table_dialog.h
src/wx/wscript

index 5972b6c0f9a9259040a79d9b4398e6bc8a352b04..dd2c09bb0eab6c35e7bdeda5aaf66beb8679fcda 100644 (file)
@@ -25,6 +25,7 @@
 #include "wx/screens_panel.h"
 #include "wx/kdm_timing_panel.h"
 #include "wx/kdm_output_panel.h"
+#include "wx/job_view_dialog.h"
 #include "lib/config.h"
 #include "lib/util.h"
 #include "lib/screen.h"
@@ -61,6 +62,7 @@ public:
        DOMFrame (wxString const & title)
                : wxFrame (NULL, -1, title)
                , _config_dialog (0)
+               , _job_view (0)
        {
                wxMenuBar* bar = new wxMenuBar;
                setup_menu (bar);
@@ -270,14 +272,20 @@ private:
                                        wxString::Format (s, int(screen_kdms.size()), std_to_wx(_output->directory().string()).data())
                                        );
                        } else {
-                               JobManager::instance()->add (
-                                       shared_ptr<Job> (new SendKDMEmailJob (
-                                                                decrypted.annotation_text(),
-                                                                decrypted.content_title_text(),
-                                                                _timing->from(), _timing->until(),
-                                                                CinemaKDMs::collect (screen_kdms)
-                                                                ))
-                                       );
+                               shared_ptr<Job> job (new SendKDMEmailJob (
+                                                            decrypted.annotation_text(),
+                                                            decrypted.content_title_text(),
+                                                            _timing->from(), _timing->until(),
+                                                            CinemaKDMs::collect (screen_kdms)
+                                                            ));
+
+                               JobManager::instance()->add (job);
+                               if (_job_view) {
+                                       _job_view->Destroy ();
+                                       _job_view = 0;
+                               }
+                               _job_view = new JobViewDialog (this, _("Send KDM emails"), job);
+                               _job_view->ShowModal ();
                        }
                } catch (dcp::NotEncryptedError& e) {
                        error_dialog (this, _("CPL's content is not encrypted."));
@@ -308,6 +316,7 @@ private:
        wxStaticText* _issue_date;
        wxButton* _create;
        KDMOutputPanel* _output;
+       JobViewDialog* _job_view;
 };
 
 /** @class App
index fca29743055a9902852f5b6d9a13080db2797eac..87582ec8c137ad74360378f36fa2414c77e29f55 100644 (file)
@@ -27,34 +27,33 @@ using std::string;
 using std::min;
 using boost::shared_ptr;
 
-JobView::JobView (shared_ptr<Job> job, wxScrolledWindow* window, wxPanel* panel, wxFlexGridSizer* table)
+JobView::JobView (shared_ptr<Job> job, wxWindow* parent, wxWindow* container, wxFlexGridSizer* table)
        : _job (job)
-       , _window (window)
-       , _panel (panel)
+       , _parent (parent)
 {
        int n = 0;
 
        _gauge_message = new wxBoxSizer (wxVERTICAL);
-       _gauge = new wxGauge (panel, wxID_ANY, 100);
+       _gauge = new wxGauge (container, wxID_ANY, 100);
        /* This seems to be required to allow the gauge to shrink under OS X */
        _gauge->SetMinSize (wxSize (0, -1));
        _gauge_message->Add (_gauge, 0, wxEXPAND | wxLEFT | wxRIGHT);
-       _message = new wxStaticText (panel, wxID_ANY, wxT (" \n "));
+       _message = new wxStaticText (container, wxID_ANY, wxT (" \n "));
        _gauge_message->Add (_message, 1, wxEXPAND | wxALIGN_CENTER_VERTICAL | wxALL, 6);
        table->Insert (n, _gauge_message, 1, wxEXPAND | wxLEFT | wxRIGHT);
        ++n;
 
-       _cancel = new wxButton (panel, wxID_ANY, _("Cancel"));
+       _cancel = new wxButton (container, wxID_ANY, _("Cancel"));
        _cancel->Bind (wxEVT_COMMAND_BUTTON_CLICKED, &JobView::cancel_clicked, this);
        table->Insert (n, _cancel, 1, wxALIGN_CENTER_VERTICAL | wxALL, 3);
        ++n;
 
-       _pause = new wxButton (_panel, wxID_ANY, _("Pause"));
+       _pause = new wxButton (container, wxID_ANY, _("Pause"));
        _pause->Bind (wxEVT_COMMAND_BUTTON_CLICKED, &JobView::pause_clicked, this);
        table->Insert (n, _pause, 1, wxALIGN_CENTER_VERTICAL | wxALL, 3);
        ++n;
 
-       _details = new wxButton (_panel, wxID_ANY, _("Details..."));
+       _details = new wxButton (container, wxID_ANY, _("Details..."));
        _details->Bind (wxEVT_COMMAND_BUTTON_CLICKED, &JobView::details_clicked, this);
        _details->Enable (false);
        table->Insert (n, _details, 1, wxALIGN_CENTER_VERTICAL | wxALL, 3);
@@ -115,7 +114,7 @@ JobView::details_clicked (wxCommandEvent &)
 {
        string s = _job->error_summary();
        s[0] = toupper (s[0]);
-       error_dialog (_window, std_to_wx (String::compose ("%1.\n\n%2", s, _job->error_details())));
+       error_dialog (_parent, std_to_wx (String::compose ("%1.\n\n%2", s, _job->error_details())));
 }
 
 void
index 0ca0d4cff9df889c9b19d406d858bcb029d6c905..97c09dfbdee7d2e728846d5bd0b4f483018f63c1 100644 (file)
@@ -23,7 +23,7 @@
 
 class Job;
 class wxScrolledWindow;
-class wxPanel;
+class wxWindow;
 class wxFlexGridSizer;
 class wxCommandEvent;
 class wxBoxSizer;
@@ -34,7 +34,7 @@ class wxButton;
 class JobView : public boost::noncopyable
 {
 public:
-       JobView (boost::shared_ptr<Job> job, wxScrolledWindow* window, wxPanel* panel, wxFlexGridSizer* table);
+       JobView (boost::shared_ptr<Job> job, wxWindow* parent, wxWindow* container, wxFlexGridSizer* table);
 
        void maybe_pulse ();
 
@@ -47,8 +47,7 @@ private:
        void pause_clicked (wxCommandEvent &);
 
        boost::shared_ptr<Job> _job;
-       wxScrolledWindow* _window;
-       wxPanel* _panel;
+       wxWindow* _parent;
        wxBoxSizer* _gauge_message;
        wxGauge* _gauge;
        wxStaticText* _message;
diff --git a/src/wx/job_view_dialog.cc b/src/wx/job_view_dialog.cc
new file mode 100644 (file)
index 0000000..a2e3cfe
--- /dev/null
@@ -0,0 +1,36 @@
+/*
+    Copyright (C) 2015 Carl Hetherington <cth@carlh.net>
+
+    This program is free software; you can redistribute it and/or modify
+    it under the terms of the GNU General Public License as published by
+    the Free Software Foundation; either version 2 of the License, or
+    (at your option) any later version.
+
+    This program is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+    GNU General Public License for more details.
+
+    You should have received a copy of the GNU General Public License
+    along with this program; if not, write to the Free Software
+    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+
+*/
+
+#include "job_view_dialog.h"
+#include "job_view.h"
+
+using boost::shared_ptr;
+
+JobViewDialog::JobViewDialog (wxWindow* parent, wxString title, shared_ptr<Job> job)
+       : TableDialog (parent, title, 4, 0, false)
+{
+       _view = new JobView (job, this, this, _table);
+       layout ();
+       SetMinSize (wxSize (960, -1));
+}
+
+JobViewDialog::~JobViewDialog ()
+{
+       delete _view;
+}
diff --git a/src/wx/job_view_dialog.h b/src/wx/job_view_dialog.h
new file mode 100644 (file)
index 0000000..0282d98
--- /dev/null
@@ -0,0 +1,34 @@
+/*
+    Copyright (C) 2015 Carl Hetherington <cth@carlh.net>
+
+    This program is free software; you can redistribute it and/or modify
+    it under the terms of the GNU General Public License as published by
+    the Free Software Foundation; either version 2 of the License, or
+    (at your option) any later version.
+
+    This program is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+    GNU General Public License for more details.
+
+    You should have received a copy of the GNU General Public License
+    along with this program; if not, write to the Free Software
+    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+
+*/
+
+#include "table_dialog.h"
+#include <boost/shared_ptr.hpp>
+
+class JobView;
+class Job;
+
+class JobViewDialog : public TableDialog
+{
+public:
+       JobViewDialog (wxWindow* parent, wxString title, boost::shared_ptr<Job> job);
+       ~JobViewDialog ();
+
+private:
+       JobView* _view;
+};
index b3937fd1868212b2a19c965076824c25b9388e6a..3c5d9d3d53e8315041f0da069f95f46e9608f543 100644 (file)
 #include "table_dialog.h"
 #include "wx_util.h"
 
-TableDialog::TableDialog (wxWindow* parent, wxString title, int columns, bool cancel)
+TableDialog::TableDialog (wxWindow* parent, wxString title, int columns, int growable, bool cancel)
        : wxDialog (parent, wxID_ANY, title)
 {
        _overall_sizer = new wxBoxSizer (wxVERTICAL);
        SetSizer (_overall_sizer);
 
        _table = new wxFlexGridSizer (columns, DCPOMATIC_SIZER_X_GAP, DCPOMATIC_SIZER_Y_GAP);
-       _table->AddGrowableCol (1, 1);
+       _table->AddGrowableCol (growable, 1);
 
        _overall_sizer->Add (_table, 1, wxEXPAND | wxALL, DCPOMATIC_DIALOG_BORDER);
 
index f04c2027ca4d8feba8b5397fc8330b9c16390edf..55572103118a6c826ba84daec39ebdbd9f950b3c 100644 (file)
@@ -25,7 +25,7 @@
 class TableDialog : public wxDialog
 {
 public:
-       TableDialog (wxWindow* parent, wxString title, int columns, bool cancel);
+       TableDialog (wxWindow* parent, wxString title, int columns, int growable, bool cancel);
 
 protected:
        template<class T>
@@ -39,9 +39,10 @@ protected:
 
        void layout ();
 
+       wxFlexGridSizer* _table;
+
 private:
        wxSizer* _overall_sizer;
-       wxFlexGridSizer* _table;
 };
 
 #endif
index e0750941e3f4ea70a2b91743cae8221b7a7f107c..3657f5287520ce274b9ba4c48cfae4e8db90225d 100644 (file)
@@ -54,6 +54,7 @@ sources = """
           gain_calculator_dialog.cc
           hints_dialog.cc
           job_view.cc
+          job_view_dialog.cc
           job_manager_view.cc
           kdm_dialog.cc
           kdm_output_panel.cc