Subversion Repositories Scribus

Rev

Rev 16729 | Rev 18194 | 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.,                                       *
18122 mrdocs 24
*   51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.             *
4028 cbradney 25
***************************************************************************/
26
 
27
#ifndef MULTIPROGRESSDIALOG_H
28
#define MULTIPROGRESSDIALOG_H
29
 
5215 mrdocs 30
#include "scribusapi.h"
8524 subik 31
#include "ui_multiprogressdialog.h"
4028 cbradney 32
 
9951 cbradney 33
#include <QProgressBar>
9729 cbradney 34
#include <QDialog>
35
#include <QLabel>
36
#include <QLayout>
37
#include <QMap>
38
#include <QPushButton>
39
#include <QStringList>
40
#include <QString>
41
#include <QList>
5370 cbradney 42
 
4028 cbradney 43
 
8524 subik 44
class SCRIBUS_API MultiProgressDialog : public QDialog, Ui::MultiProgressDialog
4028 cbradney 45
{
46
        Q_OBJECT
47
 
48
        public:
10508 cbradney 49
                MultiProgressDialog(QWidget* parent=0, Qt::WFlags f=0);
4783 cbradney 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
12071 subik 56
                 * @param f Qt GUI flags
4783 cbradney 57
                 */
12071 subik 58
                MultiProgressDialog(const QString& titleText, const QString & cancelButtonText,
59
                                                        QWidget* parent=0, Qt::WFlags f=0);
4028 cbradney 60
                ~MultiProgressDialog();
61
 
4783 cbradney 62
                /**
63
                 * Remove all progress bars other than the main one
64
                 */
4028 cbradney 65
                void removeExtraProgressBars();
4783 cbradney 66
                /**
67
                 * Add a list of progress bars, where barsList contains a list of references and barTexts
5370 cbradney 68
                 * contains the labels for the bars. Set the bools in barsNumerical to true to get a "X of Y" indicator
4783 cbradney 69
                 * Eg:
70
                 * "MYBAR1" -> "My Bar 1:"
71
                 * "MYBAR2" -> "My Bar 2:"
5370 cbradney 72
                 * @param barsList
73
                 * @param barsTexts
74
                 * @param barsNumerical
4783 cbradney 75
                 * @return Success
76
                 */
9729 cbradney 77
                bool addExtraProgressBars(const QStringList &barsList, const QStringList &barsTexts, const QList<bool>& barsNumerical);
4783 cbradney 78
                /**
13873 jghali 79
                 * Get the overall progress for the dialog
80
                 * @return overall progress
81
                 */
82
                int overallProgress() const;
83
                /**
84
                 * Get the progress for a user defined progress bar
85
                 * @param barName
86
                 * @return progress for specified user bar
87
                 */
88
                int progress(const QString &barName) const;
89
                /**
4783 cbradney 90
                 * Set a new label for a user defined progress bar
91
                 * @param barName Progress bar name
92
                 * @param newLabel New label
93
                 * @return Success
94
                 */
4028 cbradney 95
                bool setLabel(const QString &barName, const QString & newLabel);
4783 cbradney 96
                /**
16729 fschmid 97
                 * Sets a user defined progress bar to a busy bar
98
                 * @param barName
99
                 * @return Success
100
                 */
101
                bool setBusyIndicator(const QString &barName);
102
                /**
4783 cbradney 103
                 * Set the total steps for a user defined progress bar
104
                 * @param barName
105
                 * @param totalSteps
106
                 * @return Success
107
                 */
4028 cbradney 108
                bool setTotalSteps(const QString &barName, int totalSteps);
4783 cbradney 109
                /**
110
                 * Set the progress for a user defined progress bar
111
                 * @param barName
112
                 * @param progress
113
                 * @return
114
                 */
4028 cbradney 115
                bool setProgress(const QString &barName, int progress);
4783 cbradney 116
                /**
117
                 * Set the prgress and total steps for a user defined progress bar
118
                 * @param barName
119
                 * @param progress
120
                 * @param totalSteps
121
                 * @return
122
                 */
4028 cbradney 123
                bool setProgress(const QString &barName, int progress, int totalSteps);
4783 cbradney 124
                /**
125
                 * Set the overall total steps for the dialog
126
                 * @param totalSteps
127
                 */
4038 cbradney 128
                void setOverallTotalSteps(int totalSteps);
4783 cbradney 129
                /**
130
                 * Set the overall progress for the dialog
131
                 * @param progress
132
                 */
4038 cbradney 133
                void setOverallProgress(int progress);
4783 cbradney 134
                /**
135
                 * Set the overall progress and total steps for the dialog
136
                 * @param progress
137
                 * @param totalSteps
138
                 */
4038 cbradney 139
                void setOverallProgress(int progress, int totalSteps);
4783 cbradney 140
                /**
141
                 * Create a new progress bar in one step
142
                 * @param barName
143
                 * @param barText
144
                 * @param progress
145
                 * @param totalSteps
146
                 * @return
147
                 */
4028 cbradney 148
                bool setupBar(const QString &barName, const QString &barText, int progress, int totalSteps);
4783 cbradney 149
                /**
150
                 * Set the cancel button text
151
                 * @param cancelButtonText
152
                 */
4028 cbradney 153
                void setCancelButtonText(const QString & cancelButtonText);
8559 subik 154
 
155
        signals:
156
                void canceled();
157
 
4028 cbradney 158
        protected:
159
                QStringList progressBarTitles;
9951 cbradney 160
                QMap<QString, QProgressBar*> progressBars;
4028 cbradney 161
                QMap<QString, QLabel*> progressLabels;
8559 subik 162
 
163
        private slots:
164
                void emitCancel();
4028 cbradney 165
};
166
 
167
#endif