1 /*
2  *  This file is part of RawTherapee.
3  *
4  *  Copyright (c) 2004-2010 Gabor Horvath <hgabor@rawtherapee.com>
5  *
6  *  RawTherapee 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 3 of the License, or
9  *  (at your option) any later version.
10  *
11  *  RawTherapee 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 RawTherapee.  If not, see <https://www.gnu.org/licenses/>.
18  */
19 #pragma once
20 
21 #include <memory>
22 
23 #include <gtkmm.h>
24 
25 #include "bqentryupdater.h"
26 #include "options.h"
27 #include "thumbbrowserentrybase.h"
28 
29 #include "../rtengine/noncopyable.h"
30 
31 class Thumbnail;
32 
33 namespace rtengine
34 {
35 class ProcessingJob;
36 
37 namespace procparams
38 {
39 
40 class ProcParams;
41 
42 }
43 
44 }
45 
46 class BatchQueueEntry;
47 struct BatchQueueEntryIdleHelper {
48     BatchQueueEntry* bqentry;
49     bool destroyed;
50     int pending;
51 };
52 
53 class BatchQueueEntry : public ThumbBrowserEntryBase, public BQEntryUpdateListener, public rtengine::NonCopyable
54 {
55 
56     guint8* opreview;
57     int origpw, origph;
58     BatchQueueEntryIdleHelper* bqih;
59     bool opreviewDone;
60     static bool iconsLoaded;
61 
62 public:
63 
64     static Glib::RefPtr<Gdk::Pixbuf> savedAsIcon;
65 
66     rtengine::ProcessingJob* job;
67     const std::unique_ptr<rtengine::procparams::ProcParams> params;
68     Glib::ustring savedParamsFile;
69     double progress;
70     Glib::ustring outFileName;
71     int sequence;
72     SaveFormat saveFormat;
73     bool forceFormatOpts;
74     bool fast_pipeline;
75     bool overwriteFile;
76 
77     BatchQueueEntry (rtengine::ProcessingJob* job, const rtengine::procparams::ProcParams& pparams, Glib::ustring fname, int prevw, int prevh, Thumbnail* thm = nullptr, bool overwrite = false);
78     ~BatchQueueEntry () override;
79 
80     void refreshThumbnailImage () override;
81     void calcThumbnailSize () override;
82 
83     void drawProgressBar (Glib::RefPtr<Gdk::Window> win, const Gdk::RGBA& foregr, const Gdk::RGBA& backgr, int x, int w, int y, int h) override;
84 
85     void removeButtonSet ();
86 
87     std::vector<Glib::RefPtr<Gdk::Pixbuf>> getIconsOnImageArea () override;
88     void getIconSize (int& w, int& h) const override;
89     std::tuple<Glib::ustring, bool> getToolTip (int x, int y) const override;
90 
91     // bqentryupdatelistener interface
92     void updateImage (guint8* img, int w, int h, int origw, int origh, guint8* newOPreview) override;
93     void _updateImage (guint8* img, int w, int h); // inside gtk thread
94 };
95