summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2025-05-02 22:08:57 +0200
committerCarl Hetherington <cth@carlh.net>2025-06-03 22:46:26 +0200
commitf7cc496189ee73e0e19e45080a1effd2b41f31b5 (patch)
tree787d0cf3b4aa53ab6e841d09a15a1cb35d4210e1
parent3aade5890a0beb3427a11ada85745974fc7fb1c7 (diff)
wip: retry.
-rw-r--r--src/lib/job.cc6
-rw-r--r--src/lib/job.h4
-rw-r--r--src/lib/upload_job.cc10
-rw-r--r--src/lib/upload_job.h4
-rw-r--r--src/wx/job_view.cc14
-rw-r--r--src/wx/job_view.h3
6 files changed, 41 insertions, 0 deletions
diff --git a/src/lib/job.cc b/src/lib/job.cc
index 02d9d2a00..f83dd6a83 100644
--- a/src/lib/job.cc
+++ b/src/lib/job.cc
@@ -762,3 +762,9 @@ Job::set_rate_limit_progress(bool rate_limit)
_rate_limit_progress = rate_limit;
}
+
+void
+Job::retry() const
+{
+ DCPOMATIC_ASSERT(false);
+}
diff --git a/src/lib/job.h b/src/lib/job.h
index d46e5c73a..021387626 100644
--- a/src/lib/job.h
+++ b/src/lib/job.h
@@ -60,6 +60,10 @@ public:
virtual bool enable_notify() const {
return false;
}
+ virtual void retry() const;
+ virtual bool enable_retry() const {
+ return false;
+ }
void start();
virtual void pause() {}
diff --git a/src/lib/upload_job.cc b/src/lib/upload_job.cc
index 3cfbad727..5d4558f3a 100644
--- a/src/lib/upload_job.cc
+++ b/src/lib/upload_job.cc
@@ -30,6 +30,7 @@
#include "dcpomatic_log.h"
#include "film.h"
#include "log.h"
+#include "job_manager.h"
#include "scp_uploader.h"
#include "upload_job.h"
#include <fmt/format.h>
@@ -37,6 +38,7 @@
#include "i18n.h"
+using std::make_shared;
using std::min;
using std::shared_ptr;
using std::string;
@@ -117,3 +119,11 @@ UploadJob::set_status (string s)
boost::mutex::scoped_lock lm (_status_mutex);
_status = s;
}
+
+
+void
+UploadJob::retry() const
+{
+ JobManager::instance()->add(make_shared<UploadJob>(film(), _destination));
+}
+
diff --git a/src/lib/upload_job.h b/src/lib/upload_job.h
index eee890e34..bd9428bd7 100644
--- a/src/lib/upload_job.h
+++ b/src/lib/upload_job.h
@@ -40,6 +40,10 @@ public:
bool enable_notify() const override {
return true;
}
+ void retry() const override;
+ bool enable_retry() const override {
+ return true;
+ }
std::string status () const override;
private:
diff --git a/src/wx/job_view.cc b/src/wx/job_view.cc
index 954989130..0b101f3d2 100644
--- a/src/wx/job_view.cc
+++ b/src/wx/job_view.cc
@@ -83,6 +83,12 @@ JobView::setup()
_details->Enable(false);
_buttons->Add(_details, 1, wxALIGN_CENTER_VERTICAL | wxRIGHT, DCPOMATIC_BUTTON_STACK_GAP);
+ if (_job->enable_retry()) {
+ _retry = new Button(_container, _("Retry"));
+ _retry->bind(&JobView::retry_clicked, this);
+ _buttons->Add(_retry, 0, wxTOP, DCPOMATIC_BUTTON_STACK_GAP);
+ }
+
finish_setup(_container, _buttons);
_controls = new wxBoxSizer(wxVERTICAL);
@@ -222,3 +228,11 @@ JobView::notify_clicked()
{
Config::instance()->set_default_notify(_notify->GetValue());
}
+
+
+void
+JobView::retry_clicked()
+{
+ _job->retry();
+}
+
diff --git a/src/wx/job_view.h b/src/wx/job_view.h
index 2d8ac77fc..d9d75da66 100644
--- a/src/wx/job_view.h
+++ b/src/wx/job_view.h
@@ -26,6 +26,7 @@
#include <boost/signals2.hpp>
+class Button;
class CheckBox;
class Job;
class wxBoxSizer;
@@ -78,6 +79,7 @@ private:
void details_clicked(wxCommandEvent &);
void cancel_clicked(wxCommandEvent &);
void notify_clicked();
+ void retry_clicked();
wxWindow* _parent;
wxWindow* _container;
@@ -85,6 +87,7 @@ private:
wxStaticText* _message;
wxButton* _cancel;
wxButton* _details;
+ Button* _retry;
CheckBox* _notify = nullptr;
/** sizer for all right-hand-size controls */
wxBoxSizer* _controls;