00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015 #ifndef _MERGEDIALOG_H
00016 #include "MergeDialog_ui.h"
00017 #define _MERGEDIALOG_H
00018
00019 #include <vector>
00020
00021 #include <gtkmm/liststore.h>
00022
00023 #include <assa/EventHandler.h>
00024 #include <assa/Pipe.h>
00025
00026 #include "Config.h"
00027 #include "gWavMerger-main.h"
00028 #include "ModelColumns.h"
00029
00030 class Delays;
00031
00032 class MergeDialog :
00033 public MergeDialog_ui,
00034 public ASSA::EventHandler
00035 {
00036 public:
00037 MergeDialog (Config& cfg_,
00038 Glib::RefPtr<Gtk::ListStore> clist_,
00039 const ModelColumns& columns_);
00040 ~MergeDialog ();
00041
00042 virtual int handle_read (int fd_);
00043 virtual int handle_close (int fd_);
00044
00045 void run_merge ();
00046 void reply (int button_);
00047
00048 private:
00049 friend class MergeDialog_ui;
00050
00051 void init ();
00052 void roll_back (bool failed_ = false);
00053
00054 void on_ok_button_clicked ();
00055 void on_cancel_button_clicked ();
00056
00057 int create_pause_files (const string&, const string[], Delays&);
00058 void refresh_gui () const;
00059
00060 private:
00061 enum { pre = 0, post };
00062 typedef std::vector<std::string> PauseList;
00063
00064 Config& m_config;
00065 Glib::RefPtr<Gtk::ListStore> m_clist;
00066 const ModelColumns& m_columns;
00067
00068 bool m_in_progress;
00069 bool m_pause_in_progress;
00070
00071 PauseList m_pause_files;
00072 std::string m_result;
00073 std::string m_cwd;
00074 uint m_file_cnt;
00075 uint m_curr_file;
00076 bool m_del_old_file;
00077
00078 ASSA::Pipe m_pipe;
00079 FILE* m_pinstream;
00080 };
00081
00082
00083
00084
00085
00086 inline
00087
00088 MergeDialog::MergeDialog (Config& cfg_, Glib::RefPtr<Gtk::ListStore> clist_,
00089 const ModelColumns& columns_)
00090 : m_config (cfg_),
00091 m_clist (clist_),
00092 m_columns (columns_),
00093 m_in_progress (false),
00094 m_pause_in_progress (false),
00095 m_del_old_file (false),
00096 m_pinstream (NULL)
00097 {
00098 trace("MergeDialog::MergeDialog");
00099 init ();
00100 }
00101
00102 inline
00103
00104 MergeDialog::~MergeDialog ()
00105 {
00106 trace("MergerDialog::~MergeDialog");
00107 }
00108
00109 inline void
00110
00111 MergeDialog::reply (int button_)
00112 {
00113 m_del_old_file = button_ == 0 ? true : false;
00114 }
00115
00116 #endif