comparison kdiff3/src/fileaccess.h @ 66:efe33e938730

0.9.86
author joachim99
date Thu, 16 Sep 2004 02:40:08 +0000
parents 8af4bb9d9a5a
children 8febbfb1148c
comparison
equal deleted inserted replaced
65:8ea11c8efeb5 66:efe33e938730
172 public: 172 public:
173 ProgressDialog( QWidget* pParent ); 173 ProgressDialog( QWidget* pParent );
174 174
175 void setInformation( const QString& info, bool bRedrawUpdate=true ); 175 void setInformation( const QString& info, bool bRedrawUpdate=true );
176 void setInformation( const QString& info, double dCurrent, bool bRedrawUpdate=true ); 176 void setInformation( const QString& info, double dCurrent, bool bRedrawUpdate=true );
177 void step( bool bRedrawUpdate=true); 177 void setCurrent( double dCurrent, bool bRedrawUpdate=true );
178 void setMaximum( int maximum ); 178 void step( bool bRedrawUpdate=true );
179 179 void setMaxNofSteps( int dMaxNofSteps );
180 void setSubInformation(const QString& info, double dSubCurrent, bool bRedrawUpdate=true ); 180 void push();
181 void setSubCurrent( double dSubCurrent, bool bRedrawUpdate=true ); 181 void pop(bool bRedrawUpdate=true);
182 182
183 // The progressbar goes from 0 to 1 usually. 183 // The progressbar goes from 0 to 1 usually.
184 // By supplying a subrange transformation the subCurrent-values 184 // By supplying a subrange transformation the subCurrent-values
185 // 0 to 1 will be transformed to dMin to dMax instead. 185 // 0 to 1 will be transformed to dMin to dMax instead.
186 // Requirement: 0 < dMin < dMax < 1 186 // Requirement: 0 < dMin < dMax < 1
187 void setRangeTransformation( double dMin, double dMax );
187 void setSubRangeTransformation( double dMin, double dMax ); 188 void setSubRangeTransformation( double dMin, double dMax );
188 189
189 void exitEventLoop(); 190 void exitEventLoop();
190 void enterEventLoop( KIO::Job* pJob, const QString& jobInfo ); 191 void enterEventLoop( KIO::Job* pJob, const QString& jobInfo );
191
192 void start();
193 192
194 bool wasCancelled(); 193 bool wasCancelled();
195 void show(); 194 void show();
196 void hide(); 195 void hide();
197 196
198 virtual void timerEvent(QTimerEvent*); 197 virtual void timerEvent(QTimerEvent*);
199 private: 198 private:
199
200 struct ProgressLevelData
201 {
202 ProgressLevelData()
203 {
204 m_dCurrent=0; m_maxNofSteps=1; m_dRangeMin=0; m_dRangeMax=1;
205 m_dSubRangeMin = 0; m_dSubRangeMax = 1;
206 }
207 double m_dCurrent;
208 int m_maxNofSteps; // when step() is used.
209 double m_dRangeMax;
210 double m_dRangeMin;
211 double m_dSubRangeMax;
212 double m_dSubRangeMin;
213 };
214 std::list<ProgressLevelData> m_progressStack;
215
200 KProgress* m_pProgressBar; 216 KProgress* m_pProgressBar;
201 KProgress* m_pSubProgressBar; 217 KProgress* m_pSubProgressBar;
202 QLabel* m_pInformation; 218 QLabel* m_pInformation;
203 QLabel* m_pSubInformation; 219 QLabel* m_pSubInformation;
204 QLabel* m_pSlowJobInfo; 220 QLabel* m_pSlowJobInfo;
205 QPushButton* m_pAbortButton; 221 QPushButton* m_pAbortButton;
206 int m_maximum;
207 double m_dCurrent;
208 double m_dSubCurrent;
209 double m_dSubMin;
210 double m_dSubMax;
211 void recalc(bool bRedrawUpdate); 222 void recalc(bool bRedrawUpdate);
212 QTime m_t1; 223 QTime m_t1;
213 QTime m_t2; 224 QTime m_t2;
214 bool m_bWasCancelled; 225 bool m_bWasCancelled;
215 KIO::Job* m_pJob; 226 KIO::Job* m_pJob;
219 private slots: 230 private slots:
220 void delayedHide(); 231 void delayedHide();
221 void slotAbort(); 232 void slotAbort();
222 }; 233 };
223 234
235 // When using the ProgressProxy you need not take care of the push and pop, except when explicit.
236 class ProgressProxy
237 {
238 public:
239 ProgressProxy();
240 ~ProgressProxy();
241
242 void setInformation( const QString& info, bool bRedrawUpdate=true );
243 void setInformation( const QString& info, double dCurrent, bool bRedrawUpdate=true );
244 void setCurrent( double dCurrent, bool bRedrawUpdate=true );
245 void step( bool bRedrawUpdate=true );
246 void setMaxNofSteps( int dMaxNofSteps );
247 bool wasCancelled();
248 void setRangeTransformation( double dMin, double dMax );
249 void setSubRangeTransformation( double dMin, double dMax );
250 private:
251 };
252
224 extern ProgressDialog* g_pProgressDialog; 253 extern ProgressDialog* g_pProgressDialog;
225 254
226 255
227 256
228 #endif 257 #endif