Supporters update.
[dcpomatic.git] / src / wx / job_view.h
1 /*
2     Copyright (C) 2012-2017 Carl Hetherington <cth@carlh.net>
3
4     This file is part of DCP-o-matic.
5
6     DCP-o-matic is free software; you can redistribute it and/or modify
7     it under the terms of the GNU General Public License as published by
8     the Free Software Foundation; either version 2 of the License, or
9     (at your option) any later version.
10
11     DCP-o-matic is distributed in the hope that it will be useful,
12     but WITHOUT ANY WARRANTY; without even the implied warranty of
13     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14     GNU General Public License for more details.
15
16     You should have received a copy of the GNU General Public License
17     along with DCP-o-matic.  If not, see <http://www.gnu.org/licenses/>.
18
19 */
20
21
22 #ifndef DCPOMATIC_JOB_VIEW_H
23 #define DCPOMATIC_JOB_VIEW_H
24
25
26 #include <boost/signals2.hpp>
27
28
29 class CheckBox;
30 class Job;
31 class wxBoxSizer;
32 class wxButton;
33 class wxCommandEvent;
34 class wxFlexGridSizer;
35 class wxGauge;
36 class wxScrolledWindow;
37 class wxSizer;
38 class wxStaticText;
39 class wxWindow;
40
41
42 class JobView
43 {
44 public:
45         JobView (std::shared_ptr<Job> job, wxWindow* parent, wxWindow* container, wxFlexGridSizer* table);
46         virtual ~JobView () {}
47
48         JobView (JobView const&) = delete;
49         JobView& operator= (JobView const&) = delete;
50
51         virtual int insert_position () const = 0;
52         virtual void job_list_changed () {}
53
54         void setup ();
55         void maybe_pulse ();
56         void insert (int pos);
57         void detach ();
58
59         std::shared_ptr<Job> job () const {
60                 return _job;
61         }
62
63 protected:
64         virtual void finished ();
65
66         std::shared_ptr<Job> _job;
67         wxFlexGridSizer* _table;
68         /** sizer for buttons (cancel, details, pause etc.) */
69         wxBoxSizer* _buttons;
70         /** sizer for the gauge and the message underneath it */
71         wxBoxSizer* _gauge_message;
72
73 private:
74
75         virtual void finish_setup (wxWindow *, wxSizer *) {}
76
77         void progress ();
78         void details_clicked (wxCommandEvent &);
79         void cancel_clicked (wxCommandEvent &);
80         void notify_clicked ();
81
82         wxWindow* _parent;
83         wxWindow* _container;
84         wxGauge* _gauge;
85         wxStaticText* _message;
86         wxButton* _cancel;
87         wxButton* _details;
88         CheckBox* _notify;
89         /** sizer for all right-hand-size controls */
90         wxBoxSizer* _controls;
91         std::string _last_message;
92
93         boost::signals2::scoped_connection _progress_connection;
94         boost::signals2::scoped_connection _finished_connection;
95 };
96
97
98 #endif