home *** CD-ROM | disk | FTP | other *** search
/ Clickx 115 / Clickx 115.iso / software / tools / windows / tails-i386-0.16.iso / live / filesystem.squashfs / usr / include / scribus-ng / multiprogressdialog.h < prev    next >
Encoding:
C/C++ Source or Header  |  2008-05-12  |  5.1 KB  |  151 lines

  1. /*
  2. For general Scribus (>=1.3.2) copyright and licensing information please refer
  3. to the COPYING file provided with the program. Following this notice may exist
  4. a copyright and/or license notice that predates the release of Scribus 1.3.2
  5. for which a new license (GPL+exception) is in place.
  6. */
  7. /***************************************************************************
  8. *   Copyright (C) 2005 by Craig Bradney                                   *
  9. *   cbradney@zip.com.au                                                   *
  10. *                                                                         *
  11. *   This program is free software; you can redistribute it and/or modify  *
  12. *   it under the terms of the GNU General Public License as published by  *
  13. *   the Free Software Foundation; either version 2 of the License, or     *
  14. *   (at your option) any later version.                                   *
  15. *                                                                         *
  16. *   This program is distributed in the hope that it will be useful,       *
  17. *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
  18. *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
  19. *   GNU General Public License for more details.                          *
  20. *                                                                         *
  21. *   You should have received a copy of the GNU General Public License     *
  22. *   along with this program; if not, write to the                         *
  23. *   Free Software Foundation, Inc.,                                       *
  24. *   59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.             *
  25. ***************************************************************************/
  26.  
  27. #ifndef MULTIPROGRESSDIALOG_H
  28. #define MULTIPROGRESSDIALOG_H
  29.  
  30. #include "scribusapi.h"
  31. #include "ui_multiprogressdialog.h"
  32.  
  33. #include <QProgressBar>
  34. #include <QDialog>
  35. #include <QLabel>
  36. #include <QLayout>
  37. #include <QMap>
  38. #include <QPushButton>
  39. #include <QStringList>
  40. #include <QString>
  41. #include <QList>
  42.  
  43.  
  44. class SCRIBUS_API MultiProgressDialog : public QDialog, Ui::MultiProgressDialog
  45. {
  46.     Q_OBJECT
  47.  
  48.     public:
  49.         MultiProgressDialog(QWidget* parent=0, Qt::WFlags f=0);
  50.         /**
  51.          * Create a multi progress bar dialog for long operations with multiple steps. The dialog includes
  52.          * one standard progress bar, typically for the overall progress and others may be added easily.
  53.          * @param titleText Title of the dialog
  54.          * @param cancelButtonText Text of the cancel button.. Cancel, Close, @sa CommontStrings::
  55.          * @param parent Parent widget for the dialog, commonly ScMW
  56.          * @param f Qt GUI flags
  57.          */
  58.         MultiProgressDialog(const QString& titleText, const QString & cancelButtonText,
  59.                             QWidget* parent=0, Qt::WFlags f=0);
  60.         ~MultiProgressDialog();
  61.         
  62.         /**
  63.          * Remove all progress bars other than the main one
  64.          */
  65.         void removeExtraProgressBars();
  66.         /**
  67.          * Add a list of progress bars, where barsList contains a list of references and barTexts
  68.          * contains the labels for the bars. Set the bools in barsNumerical to true to get a "X of Y" indicator
  69.          * Eg:
  70.          * "MYBAR1" -> "My Bar 1:"
  71.          * "MYBAR2" -> "My Bar 2:"
  72.          * @param barsList
  73.          * @param barsTexts
  74.          * @param barsNumerical
  75.          * @return Success
  76.          */
  77.         bool addExtraProgressBars(const QStringList &barsList, const QStringList &barsTexts, const QList<bool>& barsNumerical);
  78.         /**
  79.          * Set a new label for a user defined progress bar
  80.          * @param barName Progress bar name
  81.          * @param newLabel New label
  82.          * @return Success
  83.          */
  84.         bool setLabel(const QString &barName, const QString & newLabel);
  85.         /**
  86.          * Set the total steps for a user defined progress bar
  87.          * @param barName 
  88.          * @param totalSteps 
  89.          * @return Success
  90.          */
  91.         bool setTotalSteps(const QString &barName, int totalSteps);
  92.         /**
  93.          * Set the progress for a user defined progress bar
  94.          * @param barName 
  95.          * @param progress 
  96.          * @return 
  97.          */
  98.         bool setProgress(const QString &barName, int progress);
  99.         /**
  100.          * Set the prgress and total steps for a user defined progress bar
  101.          * @param barName 
  102.          * @param progress 
  103.          * @param totalSteps 
  104.          * @return 
  105.          */
  106.         bool setProgress(const QString &barName, int progress, int totalSteps);
  107.         /**
  108.          * Set the overall total steps for the dialog
  109.          * @param totalSteps 
  110.          */
  111.         void setOverallTotalSteps(int totalSteps);
  112.         /**
  113.          * Set the overall progress for the dialog
  114.          * @param progress 
  115.          */
  116.         void setOverallProgress(int progress);
  117.         /**
  118.          * Set the overall progress and total steps for the dialog
  119.          * @param progress 
  120.          * @param totalSteps 
  121.          */
  122.         void setOverallProgress(int progress, int totalSteps);
  123.         /**
  124.          * Create a new progress bar in one step
  125.          * @param barName 
  126.          * @param barText 
  127.          * @param progress 
  128.          * @param totalSteps 
  129.          * @return 
  130.          */
  131.         bool setupBar(const QString &barName, const QString &barText, int progress, int totalSteps);
  132.         /**
  133.          * Set the cancel button text
  134.          * @param cancelButtonText 
  135.          */
  136.         void setCancelButtonText(const QString & cancelButtonText);
  137.  
  138.     signals:
  139.         void canceled();
  140.  
  141.     protected:
  142.         QStringList progressBarTitles;
  143.         QMap<QString, QProgressBar*> progressBars;
  144.         QMap<QString, QLabel*> progressLabels;
  145.  
  146.     private slots:
  147.         void emitCancel();
  148. };
  149.  
  150. #endif
  151.