Back to index

scribus-ng  1.3.4.dfsg+svn20071115
scprogressbar.cpp
Go to the documentation of this file.
00001 /*
00002 For general Scribus (>=1.3.2) copyright and licensing information please refer
00003 to the COPYING file provided with the program. Following this notice may exist
00004 a copyright and/or license notice that predates the release of Scribus 1.3.2
00005 for which a new license (GPL+exception) is in place.
00006 */
00007 /***************************************************************************
00008                           scrpogressbar.cpp  -  description
00009                              -------------------
00010     begin                : Sat Jan 19 2002
00011     copyright            : (C) 2006 by Craig Bradney
00012     email                : cbradney@zip.com.au
00013  ***************************************************************************/
00014 
00015 /***************************************************************************
00016  *                                                                         *
00017  *   This program is free software; you can redistribute it and/or modify  *
00018  *   it under the terms of the GNU General Public License as published by  *
00019  *   the Free Software Foundation; either version 2 of the License, or     *
00020  *   (at your option) any later version.                                   *
00021  *                                                                         *
00022  ***************************************************************************/
00023  
00024 #include "scprogressbar.h"
00025 #include "scprogressbar.moc"
00026 
00027 ScProgressBar::ScProgressBar( bool showNumbers, QWidget *parent, const char *name, WFlags f ) :
00028        QProgressBar( parent, name, f ),
00029        m_useNumeric(showNumbers)
00030 {
00031 }
00032 
00033 ScProgressBar::ScProgressBar( bool showNumbers, int totalSteps, QWidget* parent, const char* name, WFlags f ) :
00034        QProgressBar( totalSteps, parent, name, f ),
00035        m_useNumeric(showNumbers)
00036 {
00037 }
00038 
00039 
00040 ScProgressBar::~ScProgressBar()
00041 {
00042 }
00043 
00044 bool ScProgressBar::setIndicator( QString & indicator, int progress, int totalSteps )
00045 {
00046        if ( !totalSteps )
00047               return FALSE;
00048        if ( progress < 0 ) {
00049               indicator = QString::fromLatin1("");
00050               return TRUE;
00051        } else {
00052               if (!m_useNumeric)
00053                      return QProgressBar::setIndicator(indicator, progress, totalSteps);
00054               else
00055               {
00056                      indicator = tr("%1 of %2").arg(progress).arg(totalSteps);
00057                      return true;
00058               }
00059        }
00060 }
00061