diff options
author | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2010-02-03 01:26:04 +0000 |
---|---|---|
committer | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2010-02-03 01:26:04 +0000 |
commit | 3c7b870f367df150ea60eb9d6bb2fd41646545d7 (patch) | |
tree | ac8705b4703cebb5031f9443eafd3e429a17ac1a /src/part/progressBox.cpp | |
download | filelight-3c7b870f367df150ea60eb9d6bb2fd41646545d7.tar.gz filelight-3c7b870f367df150ea60eb9d6bb2fd41646545d7.zip |
Added abandoned Filelight application
git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/applications/filelight@1084392 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'src/part/progressBox.cpp')
-rw-r--r-- | src/part/progressBox.cpp | 65 |
1 files changed, 65 insertions, 0 deletions
diff --git a/src/part/progressBox.cpp b/src/part/progressBox.cpp new file mode 100644 index 0000000..5bf205a --- /dev/null +++ b/src/part/progressBox.cpp @@ -0,0 +1,65 @@ +//Author: Max Howell <[email protected]>, (C) 2003-4 +//Copyright: See COPYING file that comes with this distribution + +#include <kglobal.h> +#include <kglobalsettings.h> +#include <kio/job.h> +#include <klocale.h> + +#include "scan.h" +#include "progressBox.h" + + +ProgressBox::ProgressBox( QWidget *parent, QObject *part ) + : QLabel( parent, "ProgressBox" ) +{ + hide(); + + setAlignment( Qt::AlignCenter ); + setFont( KGlobalSettings::fixedFont() ); + setSizePolicy( QSizePolicy::Minimum, QSizePolicy::Fixed ); + + setText( 999999 ); + setMinimumWidth( sizeHint().width() ); + + connect( &m_timer, SIGNAL(timeout()), SLOT(report()) ); + connect( part, SIGNAL(started( KIO::Job* )), SLOT(start()) ); + connect( part, SIGNAL(completed()), SLOT(stop()) ); + connect( part, SIGNAL(canceled( const QString& )), SLOT(halt()) ); +} + +void +ProgressBox::start() //slot +{ + m_timer.start( 50 ); //20 times per second - very smooth + report(); + show(); +} + +void +ProgressBox::report() //slot +{ + setText( Filelight::ScanManager::files() ); +} + +void +ProgressBox::stop() +{ + m_timer.stop(); +} + +void +ProgressBox::halt() +{ + // canceled by stop button + m_timer.stop(); + QTimer::singleShot( 2000, this, SLOT(hide()) ); +} + +void +ProgressBox::setText( int files ) +{ + QLabel::setText( i18n("%n File", "%n Files", files) ); +} + +#include "progressBox.moc" |