summaryrefslogtreecommitdiffstats
path: root/src/k3bjobprogressdialog.h
blob: 18b605c59c4f5dc03a13433606523516552f2321 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
/* 
 *
 * $Id: k3bjobprogressdialog.h 619556 2007-01-03 17:38:12Z trueg $
 * Copyright (C) 2003 Sebastian Trueg <[email protected]>
 *
 * This file is part of the K3b project.
 * Copyright (C) 1998-2007 Sebastian Trueg <[email protected]>
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 * See the file "COPYING" for the exact licensing terms.
 */


#ifndef _K3B_JOB_PROGRESSDIALOG_H_
#define _K3B_JOB_PROGRESSDIALOG_H_

#include <kdialog.h>

#include "k3bdebuggingoutputfile.h"

#include <k3bjobhandler.h>

#include <tqdatetime.h>
#include <tqfile.h>

class TQVBoxLayout;
class TQHBoxLayout;
class TQGridLayout;
class KListView;
class TQFrame;
class TQGroupBox;
class TQLabel;
class TQListViewItem;
class KProgress;
class TQPushButton;
class TQTimer;
class K3bJob;
class KCutLabel;
class TQCloseEvent;
class TQGridLayout;
class TQKeyEvent;
class K3bJobProgressOSD;
class K3bThemedLabel;


class K3bJobProgressDialog : public KDialog, public K3bJobHandler
{
  Q_OBJECT
  TQ_OBJECT

 public:
  K3bJobProgressDialog( TQWidget* parent = 0, 
			const char* name = 0, 
			bool showSubProgress = true, 
			bool modal = FALSE, 
			WFlags fl = 0 );
  virtual ~K3bJobProgressDialog();

  virtual void setJob( K3bJob* job );
  void setExtraInfo( TQWidget *extra );

  /**
   * reimplemented for internal reasons
   */
  void show();

  /**
   * reimplemented for internal reasons
   */
  void hide();

  /**
   * This will show the dialog and then start the given job or
   * if job == 0 the job set with setJob
   * Use instead of exec()
   */
  int startJob( K3bJob* job = 0 );

  TQSize sizeHint() const;

  /**
   * @reimplemented from K3bJobHandler
   */
  int waitForMedia( K3bDevice::Device*,
		    int mediaState = K3bDevice::STATE_EMPTY,
		    int mediaType = K3bDevice::MEDIA_WRITABLE_CD,
		    const TQString& message = TQString() );
  
  /**
   * @reimplemented from K3bJobHandler
   */
  bool questionYesNo( const TQString& text,
		      const TQString& caption = TQString(),
		      const TQString& yesText = TQString(),
		      const TQString& noText = TQString() );

  /**
   * reimplemented from K3bJobHandler
   */
  void blockingInformation( const TQString& text,
			    const TQString& caption = TQString() );
  
 protected slots:
  virtual void slotProcessedSize( int processed, int size );
  virtual void slotProcessedSubSize( int processed, int size );
  virtual void slotInfoMessage( const TQString& infoString, int type );
  virtual void slotDebuggingOutput( const TQString&, const TQString& );
  virtual void slotNewSubTask(const TQString& name);
  virtual void slotNewTask(const TQString& name);
  virtual void slotFinished(bool);
  virtual void slotCanceled();
  virtual void slotStarted();


  void slotCancelButtonPressed();
  void slotUpdateTime();
  void slotShowDebuggingOutput();

  void slotProgress( int );

  virtual void slotThemeChanged();

 protected:
  void closeEvent( TQCloseEvent* );
  void keyPressEvent( TQKeyEvent* e );

  void setupGUI();
  void setupConnections();
	
  K3bThemedLabel* m_labelJob;
  K3bThemedLabel* m_labelJobDetails;
  KListView* m_viewInfo;
  K3bThemedLabel* m_labelTask;
  K3bThemedLabel* m_labelElapsedTime;
  KCutLabel* m_labelSubTask;
  TQLabel* m_labelSubProcessedSize;
  KProgress* m_progressSubPercent;
  TQLabel* m_labelProcessedSize;
  KProgress* m_progressPercent;
  TQFrame* m_frameExtraInfo;
  TQPushButton* m_buttonCancel;
  TQPushButton* m_buttonClose;
  TQPushButton* m_buttonShowDebug;
  K3bThemedLabel* m_pixLabel;

  TQGridLayout* m_frameExtraInfoLayout;

 private:
  class Private;
  Private* d;

  K3bJob* m_job;
  TQTimer* m_timer;
  TQTime m_startTime;
  TQTime m_lastProgressUpdateTime;

  K3bDebuggingOutputFile m_logFile;

  TQMap<TQString, TQStringList> m_debugOutputMap;

  bool m_bCanceled;

  TQString m_plainCaption;

  bool in_loop;

  K3bJobProgressOSD* m_osd;
};


#endif