Subversion Repositories Scribus

Rev

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