Merge branch 'master' of git.ardour.org:ardour/ardour
[ardour.git] / gtk2_ardour / video_copy_dialog.h
1 /*
2     Copyright (C) 2010 Paul Davis
3     Author: Robin Gareus <robin@gareus.org>
4
5     This program is free software; you can redistribute it and/or modify
6     it under the terms of the GNU General Public License as published by
7     the Free Software Foundation; either version 2 of the License, or
8     (at your option) any later version.
9
10     This program is distributed in the hope that it will be useful,
11     but WITHOUT ANY WARRANTY; without even the implied warranty of
12     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13     GNU General Public License for more details.
14
15     You should have received a copy of the GNU General Public License
16     along with this program; if not, write to the Free Software
17     Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
18
19 */
20 #ifdef WITH_VIDEOTIMELINE
21
22 #ifndef __gtk_ardour_video_copy_dialog_h__
23 #define __gtk_ardour_video_copy_dialog_h__
24
25 #include <string>
26
27 #include <gtkmm.h>
28
29 #include "ardour/types.h"
30 #include "ardour/template_utils.h"
31 #include "ardour_dialog.h"
32
33 /** @class ExportVideoDialog
34  *  @brief dialog box and progress report for linking and copying video-files to the session.
35  */
36 class VideoCopyDialog : public ArdourDialog , public PBD::ScopedConnectionList
37 {
38   public:
39         /** @param infile absolute-path to the file to copy or link */
40         VideoCopyDialog (ARDOUR::Session*, std::string infile);
41         ~VideoCopyDialog ();
42         /** if set to true before calling dialog->show()
43          * the dialog will only show the progres report and
44          * start copying or linking immediatly
45          * @param destfn destination path to copy or link the infile to.
46          */
47         void setup_non_interactive_copy(std::string destfn ="");
48         std::string get_filename () { return outfn; }
49
50         /*
51          * Note: it's actually 'private' function but used
52          * by the internal pthread, which only has a pointer
53          * to this instance and thus can only access public fn.
54          */
55         void do_copy ();
56
57   private:
58         void on_show ();
59         void abort_clicked ();
60         bool aborted;
61         bool autostart;
62         bool finished;
63         pthread_t thread;
64
65         void launch_copy ();
66         std::string infn;
67         std::string outfn;
68
69         gint progress_timeout ();
70         sigc::connection p_connection;
71         ssize_t p_cur;
72         off_t  p_tot;
73
74         void open_browse_dialog ();
75         Gtk::Label        path_label;
76         Gtk::Entry        path_entry;
77         Gtk::Button       browse_button;
78         Gtk::Button      *cancel_button;
79         Gtk::Button       copy_button;
80
81         Gtk::HBox*  path_hbox;
82         Gtk::VBox*  progress_box;
83         Gtk::Button abort_button;
84         Gtk::Label  progress_label;
85         Gtk::ProgressBar pbar;
86 };
87
88 #endif /* __gtk_ardour_video_copy_dialog_h__ */
89
90 #endif /* WITH_VIDEOTIMELINE */