kdeui
kprogress.h
Go to the documentation of this file. 00001 /* This file is part of the KDE libraries
00002 Copyright (C) 1996 Martynas Kunigelis
00003
00004 This library is free software; you can redistribute it and/or
00005 modify it under the terms of the GNU Library General Public
00006 License version 2 as published by the Free Software Foundation.
00007
00008 This library is distributed in the hope that it will be useful,
00009 but WITHOUT ANY WARRANTY; without even the implied warranty of
00010 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
00011 Library General Public License for more details.
00012
00013 You should have received a copy of the GNU Library General Public License
00014 along with this library; see the file COPYING.LIB. If not, write to
00015 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
00016 Boston, MA 02110-1301, USA.
00017 */
00018 /*****************************************************************************
00019 * *
00020 * KProgress -- progress indicator widget for KDE *
00021 * Original QRangeControl-based version written by Martynas Kunigelis *
00022 * Current QProgressBar based version by Aaron Seigo *
00023 * *
00024 *****************************************************************************/
00025
00026 #ifndef _KPROGRESS_H
00027 #define _KPROGRESS_H "$Id: kprogress.h 589356 2006年09月28日 00:58:09Z jbaptiste $"
00028
00029 #include <qprogressbar.h>
00030 #include <kdialogbase.h>
00031
00046 class KDEUI_EXPORT KProgress : public QProgressBar
00047 {
00048 Q_OBJECT
00049
00050 public:
00054 KProgress(QWidget *parent=0, const char *name=0, WFlags f = 0);
00055
00062 KProgress(int totalSteps, QWidget *parent=0, const char *name=0, WFlags f = 0);
00063
00067 ~KProgress();
00068
00073 void setTextEnabled(bool);
00074
00080 // ### Remove this KDE 4.0
00081 int value() const KDE_DEPRECATED;
00082
00089 bool textEnabled() const;
00090
00095 QString format() const;
00096
00101 // ### Remove this KDE 4.0
00102 void setRange(int min, int max) KDE_DEPRECATED;
00103
00107 // ### Remove this KDE 4.0
00108 int maxValue() KDE_DEPRECATED;
00109
00110 public slots:
00111
00124 void setFormat(const QString & format);
00125
00130 void setTotalSteps(int totalSteps);
00131
00135 virtual void setProgress(int progress);
00136
00140 // ### Remove this KDE 4.0
00141 void setValue(int progress);
00142
00150 virtual void advance(int offset);
00151
00152 signals:
00156 void percentageChanged(int);
00157
00158 protected:
00159 virtual bool setIndicator(QString & indicator, int progress, int totalSteps);
00160
00161 private:
00162 QString mFormat;
00163
00164 protected:
00165 virtual void virtual_hook( int id, void* data );
00166 private:
00167 class KProgressPrivate;
00168 KProgressPrivate *d;
00169 };
00170
00187 class KDEUI_EXPORT KProgressDialog : public KDialogBase
00188 {
00189 Q_OBJECT
00190
00191 public:
00201 KProgressDialog(QWidget* parent = 0, const char* name = 0,
00202 const QString& caption = QString::null,
00203 const QString& text = QString::null,
00204 bool modal = false);
00205
00209 ~KProgressDialog();
00210
00216 KProgress* progressBar();
00217
00223 const KProgress* progressBar() const;
00224
00230 void setLabel(const QString & text);
00231
00236 // ### Remove this KDE 4.0
00237 QString labelText() KDE_DEPRECATED;
00238
00242 QString labelText() const;
00243
00253 void setAllowCancel(bool allowCancel);
00254
00259 // ### Remove this KDE 4.0
00260 bool allowCancel() KDE_DEPRECATED;
00261
00265 bool allowCancel() const;
00266
00273 void showCancelButton(bool show);
00274
00279 void setAutoClose(bool close);
00280
00285 // ### Remove this KDE 4.0
00286 bool autoClose();
00287
00292 bool autoClose() const;
00293
00299 void setAutoReset(bool autoReset);
00300
00305 // ### Remove this KDE 4.0
00306 bool autoReset();
00307
00312 bool autoReset() const;
00313
00319 // ### Remove this KDE 4.0
00320 bool wasCancelled();
00321
00327 bool wasCancelled() const;
00328
00335 void ignoreCancel();
00336
00340 void setButtonText(const QString&);
00341
00346 // ### Remove this KDE 4.0
00347 QString buttonText() KDE_DEPRECATED;
00348
00352 QString buttonText() const;
00353
00358 void setMinimumDuration(int ms);
00359
00364 // ### Remove this KDE 4.0
00365 int minimumDuration() KDE_DEPRECATED;
00366
00370 int minimumDuration() const;
00371
00375 virtual void show();
00376
00377 protected slots:
00378 void slotAutoShow();
00379 void slotAutoActions(int percentage);
00380 void slotCancel();
00381
00382 private:
00383 // ### Move these member variables to d in KDE 4.0
00384 bool mAutoClose;
00385 bool mAutoReset;
00386 bool mCancelled;
00387 bool mAllowCancel;
00388 bool mShown;
00389 QString mCancelText;
00390 QLabel* mLabel;
00391 KProgress* mProgressBar;
00392 QTimer* mShowTimer;
00393 int mMinDuration;
00394 protected:
00395 virtual void virtual_hook( int id, void* data );
00396 private:
00397 struct KProgressDialogPrivate;
00398 KProgressDialogPrivate *d;
00399 };
00400
00401 #endif