summaryrefslogtreecommitdiff
path: root/src/wx/batch_job_view.cc
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2017-01-28 00:35:55 +0000
committerCarl Hetherington <cth@carlh.net>2017-01-28 00:35:55 +0000
commitf5bc071ddac2355da1d116404cc37f4485e97699 (patch)
tree55da5257669b366fac0a6d9d214655f75867543a /src/wx/batch_job_view.cc
parent861267156da5960260c9a080dce94c0892fd012a (diff)
Add priority control buttons to batch converter (#961).
Diffstat (limited to 'src/wx/batch_job_view.cc')
-rw-r--r--src/wx/batch_job_view.cc46
1 files changed, 45 insertions, 1 deletions
diff --git a/src/wx/batch_job_view.cc b/src/wx/batch_job_view.cc
index 2a5e690d7..772c726f2 100644
--- a/src/wx/batch_job_view.cc
+++ b/src/wx/batch_job_view.cc
@@ -1,5 +1,5 @@
/*
- Copyright (C) 2012-2016 Carl Hetherington <cth@carlh.net>
+ Copyright (C) 2012-2017 Carl Hetherington <cth@carlh.net>
This file is part of DCP-o-matic.
@@ -19,8 +19,11 @@
*/
#include "batch_job_view.h"
+#include "lib/job_manager.h"
#include <wx/sizer.h>
+#include <wx/button.h>
+using std::list;
using boost::shared_ptr;
BatchJobView::BatchJobView (shared_ptr<Job> job, wxWindow* parent, wxWindow* container, wxFlexGridSizer* table)
@@ -34,3 +37,44 @@ BatchJobView::insert_position () const
{
return _table->GetEffectiveRowsCount() * _table->GetEffectiveColsCount();
}
+
+void
+BatchJobView::finish_setup (wxWindow* parent, wxSizer* sizer)
+{
+ _higher_priority = new wxButton (parent, wxID_ANY, _("Higher prioirity"));
+ _higher_priority->Bind (wxEVT_BUTTON, boost::bind (&BatchJobView::higher_priority_clicked, this));
+ sizer->Add (_higher_priority, 1, wxALIGN_CENTER_VERTICAL);
+ _lower_priority = new wxButton (parent, wxID_ANY, _("Lower prioirity"));
+ _lower_priority->Bind (wxEVT_BUTTON, boost::bind (&BatchJobView::lower_priority_clicked, this));
+ sizer->Add (_lower_priority, 1, wxALIGN_CENTER_VERTICAL);
+}
+void
+BatchJobView::higher_priority_clicked ()
+{
+ JobManager::instance()->increase_priority (_job);
+}
+
+void
+BatchJobView::lower_priority_clicked ()
+{
+ JobManager::instance()->decrease_priority (_job);
+}
+
+void
+BatchJobView::job_list_changed ()
+{
+ bool high = false;
+ bool low = false;
+ list<shared_ptr<Job> > jobs = JobManager::instance()->get();
+ if (!jobs.empty ()) {
+ if (_job != jobs.front()) {
+ high = true;
+ }
+ if (_job != jobs.back()) {
+ low = true;
+ }
+ }
+
+ _higher_priority->Enable (high);
+ _lower_priority->Enable (low);
+}