~ubuntu-branches/ubuntu/saucy/digikam/saucy

« back to all changes in this revision

Viewing changes to libs/dimg/filters/dimgthreadedfilter.cpp

  • Committer: Bazaar Package Importer
  • Author(s): Scott Kitterman
  • Date: 2010-12-21 23:19:11 UTC
  • mfrom: (1.2.33 upstream) (3.1.7 experimental)
  • Revision ID: james.westby@ubuntu.com-20101221231911-z9jip7s5aht1jqn9
Tags: 2:1.7.0-1ubuntu1
* Merge from Debian Experimental. Remaining Ubuntu changes:
  - Export .pot name and copy to plugins in debian/rules
  - Version build-depends on kipi-plugins-dev to ensure build is against the
    same version on all archs
* Drop debian/patches/kubuntu_01_linker.diff, incoporated upstream
* Remove patches directory and unused patches

Show diffs side-by-side

added added

removed removed

Lines of Context:
36
36
{
37
37
 
38
38
DImgThreadedFilter::DImgThreadedFilter(QObject* parent)
39
 
                  : DynamicThread()
 
39
    : DynamicThread()
40
40
{
41
41
    setOriginalImage(DImg());
42
42
    setFilterName(QString());
51
51
 
52
52
DImgThreadedFilter::DImgThreadedFilter(DImg* orgImage, QObject* parent,
53
53
                                       const QString& name)
54
 
                  : DynamicThread()
 
54
    : DynamicThread()
55
55
{
56
56
    // remove meta data
57
57
    setOriginalImage(orgImage->copyImageData());
79
79
    m_progressBegin   = progressBegin;
80
80
    m_progressSpan    = progressEnd - progressBegin;
81
81
    m_progressCurrent = 0;
82
 
    
 
82
 
83
83
    m_master->setSlave(this);
84
84
}
85
85
 
86
86
DImgThreadedFilter::~DImgThreadedFilter()
87
87
{
88
88
    cancelFilter();
 
89
 
89
90
    if (m_master)
 
91
    {
90
92
        m_master->setSlave(0);
 
93
    }
91
94
}
92
95
 
93
96
void DImgThreadedFilter::setOriginalImage(const DImg& orgImage)
112
115
                       m_orgImage.sixteenBit(), m_orgImage.hasAlpha());
113
116
 
114
117
    if (m_master)
 
118
    {
115
119
        startFilterDirectly();
 
120
    }
116
121
}
117
122
 
118
123
void DImgThreadedFilter::startFilter()
135
140
        emit started();
136
141
 
137
142
        m_wasCancelled = false;
 
143
 
138
144
        try
139
145
        {
140
146
            filterImage();
141
147
        }
142
 
        catch (std::bad_alloc &ex)
 
148
        catch (std::bad_alloc& ex)
143
149
        {
144
150
            //TODO: User notification
145
151
            kError() << "Caught out-of-memory exception! Aborting operation" << ex.what();
164
170
void DImgThreadedFilter::cancelFilter()
165
171
{
166
172
    if (isRunning())
 
173
    {
167
174
        m_wasCancelled = true;
 
175
    }
 
176
 
168
177
    stop();
 
178
 
169
179
    if (m_slave)
170
180
    {
171
181
        m_slave->stop();
172
182
        // do not wait on slave, it is not running in its own separate thread!
173
183
        //m_slave->cleanupFilter();
174
184
    }
 
185
 
175
186
    wait();
176
187
    cleanupFilter();
177
188
}