Subversion Repositories Scribus

Rev

Rev 4430 | 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
#include "multiprogressdialog.h"
28
#include "multiprogressdialog.moc"
29
 
30
MultiProgressDialog::MultiProgressDialog(QWidget* parent, const char*name, bool modal, WFlags f)
31
: MultiProgressDialogBase(parent, name, modal, f)
32
{
33
}
34
 
35
MultiProgressDialog::MultiProgressDialog(const QString& titleText, const QString & cancelButtonText, QWidget* parent, const char*name, bool modal, WFlags f)
36
: MultiProgressDialogBase(parent, name, modal, f)
37
{
38
        setCaption(titleText);
39
        buttonCancel->setText(cancelButtonText);
40
}
41
 
42
MultiProgressDialog::~MultiProgressDialog()
43
{
44
}
45
 
46
void MultiProgressDialog::removeExtraProgressBars()
47
{
48
        progressBars.clear();
49
        progressLabels.clear();
50
}
51
 
5370 cbradney 52
bool MultiProgressDialog::addExtraProgressBars(const QStringList &barsList, const QStringList &barsTexts, const QValueList<bool>& barsNumerical)
4028 cbradney 53
{
54
        uint barCount=barsList.count();
55
        if (barCount==0)
56
                return false;
57
        int gridLayoutRow=gridLayout->numRows();
58
        for (uint i=0; i<barCount; ++i)
59
        {
60
                QString barName(barsList[i]);
61
                if(progressBarTitles.contains(barName))
62
                        continue;
63
                progressBarTitles.append(barName);
5370 cbradney 64
                progressBars.insert(barName, new ScProgressBar(barsNumerical[i], this, barName));
4028 cbradney 65
                progressLabels.insert(barName, new QLabel(barsTexts[i], this, barName));
66
                gridLayout->addWidget(progressLabels[barName], gridLayoutRow, 0);
67
                gridLayout->addWidget(progressBars[barName], gridLayoutRow, 1);
68
                ++gridLayoutRow;
69
        }
70
        return true;
71
}
72
 
73
bool MultiProgressDialog::setLabel(const QString &barName, const QString & newLabel)
74
{
75
        if (progressLabels.contains(barName))
76
        {
77
                progressLabels[barName]->setText(newLabel);
78
                return true;
79
        }
80
        return false;
81
}
82
 
83
bool MultiProgressDialog::setTotalSteps(const QString &barName, int totalSteps)
84
{
85
        if (progressBars.contains(barName))
86
        {
87
                progressBars[barName]->setTotalSteps(totalSteps);
88
                return true;
89
        }
90
        return false;
91
}
92
 
93
bool MultiProgressDialog::setProgress(const QString &barName, int progress)
94
{
95
        if (progressBars.contains(barName))
96
        {
97
                progressBars[barName]->setProgress(progress);
98
                return true;
99
        }
100
        return false;
101
}
102
 
103
bool MultiProgressDialog::setProgress(const QString &barName, int progress, int totalSteps)
104
{
105
        if (progressBars.contains(barName))
106
        {
107
                progressBars[barName]->setProgress(progress, totalSteps);
108
                return true;
109
        }
110
        return false;
111
}
112
 
113
bool MultiProgressDialog::setupBar(const QString &barName, const QString & barText, int progress, int totalSteps)
114
{
115
        if (progressLabels.contains(barName))
116
                progressLabels[barName]->setText(barText);
117
        else
118
                return false;
119
        if (progressBars.contains(barName))
120
        {
121
                progressBars[barName]->setProgress(progress, totalSteps);
122
                return true;
123
        }
124
        return false;
125
}
126
 
127
 
128
void MultiProgressDialog::setCancelButtonText(const QString & cancelButtonText)
129
{
130
        buttonCancel->setText(cancelButtonText);
131
}
132
 
4038 cbradney 133
void MultiProgressDialog::setOverallTotalSteps(int totalSteps)
4028 cbradney 134
{
135
        overallProgressBar->setTotalSteps(totalSteps);
136
}
137
 
4038 cbradney 138
void MultiProgressDialog::setOverallProgress(int progress)
4028 cbradney 139
{
140
        overallProgressBar->setProgress(progress);
141
}
142
 
4038 cbradney 143
void MultiProgressDialog::setOverallProgress(int progress, int totalSteps)
4028 cbradney 144
{
145
        overallProgressBar->setProgress(progress, totalSteps);
146
}