1 /*  cdrdao - write audio CD-Rs in disc-at-once mode
2  *
3  *  Copyright (C) 1998-2001  Andreas Mueller <mueller@daneb.ping.de>
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 #ifndef __PROGRESS_DIALOG_H__
21 #define __PROGRESS_DIALOG_H__
22 
23 #include <sys/time.h>
24 #include <gtkmm.h>
25 #include <gtk/gtk.h>
26 
27 class TocEdit;
28 class CdDevice;
29 
30 class ProgressDialogPool;
31 
32 class ProgressDialog : public Gtk::Dialog
33 {
34 public:
35   ProgressDialog(ProgressDialogPool *father);
36   ~ProgressDialog();
37 
38   bool on_delete_event(GdkEventAny*);
39 
40 private:
41   friend class ProgressDialogPool;
42 
43   ProgressDialogPool *poolFather_;
44 
45   bool active_;
46   CdDevice *device_;
47 
48   int finished_;
49   int actStatus_;
50   int actTrack_;
51   int actTrackProgress_;
52   int actTotalProgress_;
53   int actBufferFill_;
54   int actWriterFill_;
55 
56   int actCloseButtonLabel_;
57 
58   Gtk::Label *currentTime_;
59   Gtk::Label *remainingTime_;
60 
61   long leadTime_;
62   bool leadTimeFilled_;
63 
64   struct timeval time_;
65   bool time();
66 
67   Gtk::Button *cancelButton_;
68   Gtk::Button *closeButton_;
69   Gtk::Button *ejectButton_;
70   Gtk::Label *tocName_;
71 
72   Gtk::Label *statusMsg_;;
73   Gtk::ProgressBar *trackProgress_;
74   Gtk::Label *trackLabel_;
75   Gtk::ProgressBar *totalProgress_;
76   Gtk::ProgressBar *bufferFillRate_;
77   Gtk::ProgressBar *writerFillRate_;
78   Gtk::Label *bufferFillRateLabel_;
79   Gtk::Label *writerFillRateLabel_;
80   void needBufferProgress(bool visible);
81   void needTrackProgress(bool visible);
82 
83   ProgressDialog *poolNext_;
84 
85   void update(unsigned long);
86   void start(CdDevice *, const char *tocFileName);
87   void stop();
88   void closeAction();
89   void ejectAction();
90   void clear();
91   void setCloseButtonLabel(int l);
92 
93 };
94 
95 class ProgressDialogPool
96 {
97 public:
98   ProgressDialogPool();
99   ~ProgressDialogPool();
100 
101   void update(unsigned long);
102 
103   ProgressDialog* start(CdDevice*, const char* tocFileName,
104                         bool showBuffer = true, bool showTrack = true);
105   ProgressDialog* start(Gtk::Window& parent_window,
106                         CdDevice*, const char* tocFileName,
107                         bool showBuffer = true, bool showTrack = true);
108   void stop(ProgressDialog*);
109 
110 private:
111   ProgressDialog* activeDialogs_;
112   ProgressDialog* pool_;
113 };
114 
115 
116 #endif
117