home *** CD-ROM | disk | FTP | other *** search
/ Personal Computer World 2009 February / PCWFEB09.iso / Software / Linux / SLAX 6.0.8 / slax-6.0.8.iso / slax / base / 006-devel.lzm / usr / include / k3bthroughputestimator.h < prev    next >
Encoding:
C/C++ Source or Header  |  2008-05-27  |  1.3 KB  |  58 lines

  1. /* 
  2.  *
  3.  * $Id: k3bthroughputestimator.h 619556 2007-01-03 17:38:12Z trueg $
  4.  * Copyright (C) 2003 Sebastian Trueg <trueg@k3b.org>
  5.  *
  6.  * This file is part of the K3b project.
  7.  * Copyright (C) 1998-2007 Sebastian Trueg <trueg@k3b.org>
  8.  *
  9.  * This program is free software; you can redistribute it and/or modify
  10.  * it under the terms of the GNU General Public License as published by
  11.  * the Free Software Foundation; either version 2 of the License, or
  12.  * (at your option) any later version.
  13.  * See the file "COPYING" for the exact licensing terms.
  14.  */
  15.  
  16. #ifndef _K3B_THROUGHPUT_ESTIMATOR_H_
  17. #define _K3B_THROUGHPUT_ESTIMATOR_H_
  18.  
  19. #include <qobject.h>
  20.  
  21.  
  22. /**
  23.  * Little helper class that allows an estimation of the current writing
  24.  * speed. Just init with @p reset() then always call @p dataWritten with
  25.  * the already written data in KB. The class will emit throughput signals
  26.  * whenever the throughput changes.
  27.  */
  28. class K3bThroughputEstimator : public QObject
  29. {
  30.   Q_OBJECT
  31.  
  32.  public:
  33.   K3bThroughputEstimator( QObject* parent = 0, const char* name = 0 );
  34.   ~K3bThroughputEstimator();
  35.  
  36.   int average() const;
  37.  
  38.  signals:
  39.   /**
  40.    * kb/s if differs from previous
  41.    */
  42.   void throughput( int );
  43.  
  44.  public slots:
  45.   void reset();
  46.  
  47.   /**
  48.    * @param data written kb
  49.    */
  50.   void dataWritten( unsigned long data );
  51.  
  52.  private:
  53.   class Private;
  54.   Private* d;
  55. };
  56.  
  57. #endif
  58.