Main Page   Namespace List   Class Hierarchy   Compound List   File List   Namespace Members   Compound Members   File Members  

/home/vlg/develop/gwavmerger/src/MergeDialog.h

Go to the documentation of this file.
00001 // -*- c++ -*-
00002 //------------------------------------------------------------------------------
00003 //                              MergeDialog.h
00004 //------------------------------------------------------------------------------
00005 // $Id: MergeDialog.h,v 1.5 2003/02/07 05:15:10 vlg Exp $
00006 //------------------------------------------------------------------------------
00007 //  Copyright (c) 2001,2002 by Vladislav Grinchenko
00008 //
00009 //  This program is free software; you can redistribute it and/or
00010 //  modify it under the terms of the GNU General Public License
00011 //  as published by the Free Software Foundation; either version
00012 //  2 of the License, or (at your option) any later version.
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;  // Are we in process of merging?
00069     bool        m_pause_in_progress; // Are we in process of making pause files?
00070 
00071     PauseList   m_pause_files;  // list of pause files
00072     std::string m_result;       // path of the resultant file
00073     std::string m_cwd;          // current directory
00074     uint        m_file_cnt;     // count of all files
00075     uint        m_curr_file;    // current file being processed
00076     bool        m_del_old_file; // User's reply to delete old result file
00077 
00078     ASSA::Pipe  m_pipe;         // the pipe handler
00079     FILE*       m_pinstream;    // formatted stream to read from pipe
00080 };
00081 
00082 //==============================================================================
00083 // Inlines                                                                    
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

Generated on Tue Feb 11 23:05:19 2003 for gwavmerger by doxygen1.2.14 written by Dimitri van Heesch, © 1997-2002