From 37a7cf86cdd25b8881c030cb62c68ecbe3b2efa3 Mon Sep 17 00:00:00 2001 From: Carl Hetherington Date: Tue, 2 Sep 2014 19:39:35 +0100 Subject: Use the DCP-o-matic info dialogue for the batch converter. --- src/tools/dcpomatic_batch.cc | 34 +++++----------------------------- 1 file changed, 5 insertions(+), 29 deletions(-) (limited to 'src/tools') diff --git a/src/tools/dcpomatic_batch.cc b/src/tools/dcpomatic_batch.cc index 49b341443..234bfea5c 100644 --- a/src/tools/dcpomatic_batch.cc +++ b/src/tools/dcpomatic_batch.cc @@ -1,5 +1,5 @@ /* - Copyright (C) 2013 Carl Hetherington + Copyright (C) 2013-2014 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 @@ -28,6 +28,7 @@ #include "lib/film.h" #include "lib/job_manager.h" #include "wx/wx_util.h" +#include "wx/about_dialog.h" #include "wx/wx_ui_signaller.h" #include "wx/job_manager_view.h" @@ -135,34 +136,9 @@ private: void help_about () { - wxAboutDialogInfo info; - info.SetName (_("DCP-o-matic Batch Converter")); - if (strcmp (dcpomatic_git_commit, "release") == 0) { - info.SetVersion (std_to_wx (String::compose ("version %1", dcpomatic_version))); - } else { - info.SetVersion (std_to_wx (String::compose ("version %1 git %2", dcpomatic_version, dcpomatic_git_commit))); - } - info.SetDescription (_("Free, open-source DCP generation from almost anything.")); - info.SetCopyright (_("(C) 2012-2013 Carl Hetherington, Terrence Meiczinger, Paul Davis, Ole Laursen")); - - wxArrayString authors; - authors.Add (wxT ("Carl Hetherington")); - authors.Add (wxT ("Terrence Meiczinger")); - authors.Add (wxT ("Paul Davis")); - authors.Add (wxT ("Ole Laursen")); - info.SetDevelopers (authors); - - wxArrayString translators; - translators.Add (wxT ("Olivier Perriere")); - translators.Add (wxT ("Lilian Lefranc")); - translators.Add (wxT ("Thierry Journet")); - translators.Add (wxT ("Massimiliano Broggi")); - translators.Add (wxT ("Manuel AC")); - translators.Add (wxT ("Adam Klotblixt")); - info.SetTranslators (translators); - - info.SetWebSite (wxT ("http://carlh.net/software/dcpomatic")); - wxAboutBox (info); + AboutDialog* d = new AboutDialog (this); + d->ShowModal (); + d->Destroy (); } void add_film () -- cgit v1.2.3 From 8407612363705f757d3ab26d6e119171c217b00a Mon Sep 17 00:00:00 2001 From: Carl Hetherington Date: Tue, 2 Sep 2014 22:09:33 +0100 Subject: Seemingly rather long-winded way of making the JobManagerView in dcpomatic_batch shrink nicely (i.e. shrinking the gauge) when the window is shrunk. It seems surprising that we have to call back to children to tell them to layout / fit-inside, but it does all *seem* to be necessary. --- ChangeLog | 4 ++++ src/tools/dcpomatic_batch.cc | 17 ++++++++++++----- src/wx/job_manager_view.cc | 12 +++++++++++- src/wx/job_manager_view.h | 1 + 4 files changed, 28 insertions(+), 6 deletions(-) (limited to 'src/tools') diff --git a/ChangeLog b/ChangeLog index 9314e4066..54188c26a 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +2014-09-02 Carl Hetherington + + * Improve behaviour of batch converter window when it is shrunk (#338). + 2014-09-01 Carl Hetherington * Version 1.73.1 released. diff --git a/src/tools/dcpomatic_batch.cc b/src/tools/dcpomatic_batch.cc index 234bfea5c..de255e65e 100644 --- a/src/tools/dcpomatic_batch.cc +++ b/src/tools/dcpomatic_batch.cc @@ -62,6 +62,7 @@ class Frame : public wxFrame public: Frame (wxString const & title) : wxFrame (NULL, -1, title) + , _sizer (new wxBoxSizer (wxVERTICAL)) { wxMenuBar* bar = new wxMenuBar; setup_menu (bar); @@ -76,24 +77,29 @@ public: s->Add (panel, 1, wxEXPAND); SetSizer (s); - wxSizer* sizer = new wxBoxSizer (wxVERTICAL); - JobManagerView* job_manager_view = new JobManagerView (panel, JobManagerView::PAUSE); - sizer->Add (job_manager_view, 1, wxALL | wxEXPAND, 6); + _sizer->Add (job_manager_view, 1, wxALL | wxEXPAND, 6); wxSizer* buttons = new wxBoxSizer (wxHORIZONTAL); wxButton* add = new wxButton (panel, wxID_ANY, _("Add Film...")); add->Bind (wxEVT_COMMAND_BUTTON_CLICKED, boost::bind (&Frame::add_film, this)); buttons->Add (add, 1, wxALL, 6); - sizer->Add (buttons, 0, wxALL, 6); + _sizer->Add (buttons, 0, wxALL, 6); - panel->SetSizer (sizer); + panel->SetSizer (_sizer); Bind (wxEVT_CLOSE_WINDOW, boost::bind (&Frame::close, this, _1)); + Bind (wxEVT_SIZE, boost::bind (&Frame::sized, this, _1)); } private: + void sized (wxSizeEvent& ev) + { + _sizer->Layout (); + ev.Skip (); + } + bool should_close () { if (!JobManager::instance()->work_to_do ()) { @@ -176,6 +182,7 @@ private: } boost::optional _last_parent; + wxSizer* _sizer; }; static const wxCmdLineEntryDesc command_line_description[] = { diff --git a/src/wx/job_manager_view.cc b/src/wx/job_manager_view.cc index df9c6f5f1..5146243b4 100644 --- a/src/wx/job_manager_view.cc +++ b/src/wx/job_manager_view.cc @@ -202,14 +202,24 @@ JobManagerView::JobManagerView (wxWindow* parent, Buttons buttons) _panel->SetSizer (_table); SetScrollRate (0, 32); + EnableScrolling (false, true); Bind (wxEVT_TIMER, boost::bind (&JobManagerView::periodic, this)); _timer.reset (new wxTimer (this)); _timer->Start (1000); - + + Bind (wxEVT_SIZE, boost::bind (&JobManagerView::sized, this, _1)); JobManager::instance()->JobAdded.connect (bind (&JobManagerView::job_added, this, _1)); } +void +JobManagerView::sized (wxSizeEvent& ev) +{ + _table->FitInside (_panel); + _table->Layout (); + ev.Skip (); +} + void JobManagerView::job_added (weak_ptr j) { diff --git a/src/wx/job_manager_view.h b/src/wx/job_manager_view.h index c4bb1e218..83ce4ee5a 100644 --- a/src/wx/job_manager_view.h +++ b/src/wx/job_manager_view.h @@ -43,6 +43,7 @@ public: private: void job_added (boost::weak_ptr); void periodic (); + void sized (wxSizeEvent &); wxPanel* _panel; wxFlexGridSizer* _table; -- cgit v1.2.3 From 42ff121e14f55cbdcff40f7ae488cb9ff7bc6f90 Mon Sep 17 00:00:00 2001 From: Carl Hetherington Date: Wed, 3 Sep 2014 22:12:54 +0100 Subject: Better reporting of unknown exceptions in some cases. --- src/tools/dcpomatic.cc | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) (limited to 'src/tools') diff --git a/src/tools/dcpomatic.cc b/src/tools/dcpomatic.cc index 09aebd39c..6b7ad0273 100644 --- a/src/tools/dcpomatic.cc +++ b/src/tools/dcpomatic.cc @@ -798,12 +798,21 @@ class App : public wxApp return true; } + /* An unhandled exception has occurred inside the main event loop */ bool OnExceptionInMainLoop () { - error_dialog (0, _("An unknown exception occurred. Please report this problem to the DCP-o-matic author (carl@dcpomatic.com).")); + try { + throw; + } catch (exception& e) { + error_dialog (0, wxString::Format (_("An exception occurred (%s). Please report this problem to the DCP-o-matic author (carl@dcpomatic.com)."), e.what ())); + } catch (...) { + error_dialog (0, _("An unknown exception occurred. Please report this problem to the DCP-o-matic author (carl@dcpomatic.com).")); + } + + /* This will terminate the program */ return false; } - + void OnUnhandledException () { error_dialog (0, _("An unknown exception occurred. Please report this problem to the DCP-o-matic author (carl@dcpomatic.com).")); -- cgit v1.2.3