From: Carl Hetherington Date: Wed, 7 Oct 2015 16:11:31 +0000 (+0100) Subject: Basics of job view when sending KDM emails from dcpomatic_kdm. X-Git-Tag: v2.4.6~32 X-Git-Url: https://main.carlh.net/gitweb/?p=dcpomatic.git;a=commitdiff_plain;h=f29f405000752ad568de1e304640a4edac8214bc Basics of job view when sending KDM emails from dcpomatic_kdm. --- diff --git a/src/tools/dcpomatic_kdm.cc b/src/tools/dcpomatic_kdm.cc index 5972b6c0f..dd2c09bb0 100644 --- a/src/tools/dcpomatic_kdm.cc +++ b/src/tools/dcpomatic_kdm.cc @@ -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 (new SendKDMEmailJob ( - decrypted.annotation_text(), - decrypted.content_title_text(), - _timing->from(), _timing->until(), - CinemaKDMs::collect (screen_kdms) - )) - ); + shared_ptr 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 diff --git a/src/wx/job_view.cc b/src/wx/job_view.cc index fca297430..87582ec8c 100644 --- a/src/wx/job_view.cc +++ b/src/wx/job_view.cc @@ -27,34 +27,33 @@ using std::string; using std::min; using boost::shared_ptr; -JobView::JobView (shared_ptr job, wxScrolledWindow* window, wxPanel* panel, wxFlexGridSizer* table) +JobView::JobView (shared_ptr 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 diff --git a/src/wx/job_view.h b/src/wx/job_view.h index 0ca0d4cff..97c09dfbd 100644 --- a/src/wx/job_view.h +++ b/src/wx/job_view.h @@ -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, wxScrolledWindow* window, wxPanel* panel, wxFlexGridSizer* table); + JobView (boost::shared_ptr job, wxWindow* parent, wxWindow* container, wxFlexGridSizer* table); void maybe_pulse (); @@ -47,8 +47,7 @@ private: void pause_clicked (wxCommandEvent &); boost::shared_ptr _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 index 000000000..a2e3cfe27 --- /dev/null +++ b/src/wx/job_view_dialog.cc @@ -0,0 +1,36 @@ +/* + Copyright (C) 2015 Carl Hetherington + + 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) + : 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 index 000000000..0282d9848 --- /dev/null +++ b/src/wx/job_view_dialog.h @@ -0,0 +1,34 @@ +/* + Copyright (C) 2015 Carl Hetherington + + 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 + +class JobView; +class Job; + +class JobViewDialog : public TableDialog +{ +public: + JobViewDialog (wxWindow* parent, wxString title, boost::shared_ptr job); + ~JobViewDialog (); + +private: + JobView* _view; +}; diff --git a/src/wx/table_dialog.cc b/src/wx/table_dialog.cc index b3937fd18..3c5d9d3d5 100644 --- a/src/wx/table_dialog.cc +++ b/src/wx/table_dialog.cc @@ -20,14 +20,14 @@ #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); diff --git a/src/wx/table_dialog.h b/src/wx/table_dialog.h index f04c2027c..555721031 100644 --- a/src/wx/table_dialog.h +++ b/src/wx/table_dialog.h @@ -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 @@ -39,9 +39,10 @@ protected: void layout (); + wxFlexGridSizer* _table; + private: wxSizer* _overall_sizer; - wxFlexGridSizer* _table; }; #endif diff --git a/src/wx/wscript b/src/wx/wscript index e0750941e..3657f5287 100644 --- a/src/wx/wscript +++ b/src/wx/wscript @@ -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