Subversion Repositories Scribus

Rev

Rev 4430 | Rev 5215 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
4430 cbradney 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
*/
4028 cbradney 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 "multiprogressdialogbase.h"
31
 
32
#include <qprogressbar.h>
33
#include <qpushbutton.h>
34
#include <qlabel.h>
35
#include <qlayout.h>
36
#include <qstringlist.h>
37
#include <qstring.h>
38
#include <qdialog.h>
39
#include <qmap.h>
40
 
41
class MultiProgressDialog : public MultiProgressDialogBase
42
{
43
        Q_OBJECT
44
 
45
        public:
46
                MultiProgressDialog(QWidget* parent=0, const char*name=0, bool modal=false, WFlags f=0);
4783 cbradney 47
                /**
48
                 * Create a multi progress bar dialog for long operations with multiple steps. The dialog includes
49
                 * one standard progress bar, typically for the overall progress and others may be added easily.
50
                 * @param titleText Title of the dialog
51
                 * @param cancelButtonText Text of the cancel button.. Cancel, Close, @sa CommontStrings::
52
                 * @param parent Parent widget for the dialog, commonly ScMW
53
                 * @param name
54
                 * @param modal
55
                 * @param f
56
                 * @return
57
                 */
4028 cbradney 58
                MultiProgressDialog(const QString& titleText, const QString & cancelButtonText, QWidget* parent=0, const char*name=0, bool modal=true, WFlags f=0);
59
                ~MultiProgressDialog();
60
 
4783 cbradney 61
                /**
62
                 * Remove all progress bars other than the main one
63
                 */
4028 cbradney 64
                void removeExtraProgressBars();
4783 cbradney 65
                /**
66
                 * Add a list of progress bars, where barsList contains a list of references and barTexts
67
                 * contains the labels for the bars.
68
                 * Eg:
69
                 * "MYBAR1" -> "My Bar 1:"
70
                 * "MYBAR2" -> "My Bar 2:"
71
                 * @param barsList
72
                 * @param barsTexts
73
                 * @return Success
74
                 */
4028 cbradney 75
                bool addExtraProgressBars(const QStringList &barsList, const QStringList &barsTexts);
4783 cbradney 76
                /**
77
                 * Set a new label for a user defined progress bar
78
                 * @param barName Progress bar name
79
                 * @param newLabel New label
80
                 * @return Success
81
                 */
4028 cbradney 82
                bool setLabel(const QString &barName, const QString & newLabel);
4783 cbradney 83
                /**
84
                 * Set the total steps for a user defined progress bar
85
                 * @param barName
86
                 * @param totalSteps
87
                 * @return Success
88
                 */
4028 cbradney 89
                bool setTotalSteps(const QString &barName, int totalSteps);
4783 cbradney 90
                /**
91
                 * Set the progress for a user defined progress bar
92
                 * @param barName
93
                 * @param progress
94
                 * @return
95
                 */
4028 cbradney 96
                bool setProgress(const QString &barName, int progress);
4783 cbradney 97
                /**
98
                 * Set the prgress and total steps for a user defined progress bar
99
                 * @param barName
100
                 * @param progress
101
                 * @param totalSteps
102
                 * @return
103
                 */
4028 cbradney 104
                bool setProgress(const QString &barName, int progress, int totalSteps);
4783 cbradney 105
                /**
106
                 * Set the overall total steps for the dialog
107
                 * @param totalSteps
108
                 */
4038 cbradney 109
                void setOverallTotalSteps(int totalSteps);
4783 cbradney 110
                /**
111
                 * Set the overall progress for the dialog
112
                 * @param progress
113
                 */
4038 cbradney 114
                void setOverallProgress(int progress);
4783 cbradney 115
                /**
116
                 * Set the overall progress and total steps for the dialog
117
                 * @param progress
118
                 * @param totalSteps
119
                 */
4038 cbradney 120
                void setOverallProgress(int progress, int totalSteps);
4783 cbradney 121
                /**
122
                 * Create a new progress bar in one step
123
                 * @param barName
124
                 * @param barText
125
                 * @param progress
126
                 * @param totalSteps
127
                 * @return
128
                 */
4028 cbradney 129
                bool setupBar(const QString &barName, const QString &barText, int progress, int totalSteps);
4783 cbradney 130
                /**
131
                 * Set the cancel button text
132
                 * @param cancelButtonText
133
                 */
4028 cbradney 134
                void setCancelButtonText(const QString & cancelButtonText);
135
 
136
        protected:
137
                QStringList progressBarTitles;
138
                QMap<QString, QProgressBar*> progressBars;
139
                QMap<QString, QLabel*> progressLabels;
140
};
141
 
142
#endif