You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
adept/adept/adept/progress.cpp

59 lines
1.3 KiB

#include <tdeapplication.h>
#include <tqcursor.h>
#include <kdebug.h>
#include <adept/progress.h>
#include <adept/utils.h>
using namespace adept;
Progress::Progress()
: m_pbar( 0 ), m_sbar( 0 ), m_busy( false )
{
}
void Progress::Update ()
{
if (!m_sbar)
return;
if (!m_pbar) {
if (Percent) {
m_pbar = new KProgress( m_sbar );
m_pbar->setMinimumWidth( 80 );
m_pbar->setMaximumWidth( 120 );
m_pbar->setTextEnabled( false );
m_pbar->show();
m_sbar->addWidget( m_pbar, 0, true );
m_pbar->setTotalSteps( 100 );
}
MajorChange = true;
}
if (MajorChange) {
if ( !m_busy ) {
TQApplication::setOverrideCursor( TQCursor( TQt::BusyCursor ) );
m_busy = true;
}
m_sbar->message( u8( Op + "..." ) );
}
if (CheckChange (0.05) == false)
return;
// kdDebug() << "Progress::Update()" << endl;
if (m_pbar)
m_pbar->setProgress( Percent );
kapp->processEvents();
}
void Progress::Done ()
{
kdDebug() << "Progress::Done()" << endl;
TQApplication::restoreOverrideCursor();
m_busy = false;
if (m_sbar)
m_sbar->clear();
delete m_pbar;
m_pbar = 0;
}
Progress::~Progress() {}