~ubuntu-branches/ubuntu/precise/koffice/precise

« back to all changes in this revision

Viewing changes to krita/plugins/paintops/mypaint/mypaint_paintop_factory.cpp

  • Committer: Bazaar Package Importer
  • Author(s): Alessandro Ghersi
  • Date: 2010-10-27 17:52:57 UTC
  • mfrom: (0.12.1 upstream)
  • Revision ID: james.westby@ubuntu.com-20101027175257-s04zqqk5bs8ckm9o
Tags: 1:2.2.83-0ubuntu1
* Merge with Debian git remaining changes:
 - Add build-deps on librcps-dev, opengtl-dev, libqtgtl-dev, freetds-dev,
   create-resources, libspnav-dev
 - Remove needless build-dep on libwv2-dev
 - koffice-libs recommends create-resources
 - krita recommends pstoedit
 - Keep our patches
* New upstream release 2.3 beta 3
  - Remove debian/patches fixed by upstream
  - Update install files

Show diffs side-by-side

added added

removed removed

Lines of Context:
36
36
public:
37
37
 
38
38
    KoResourceServer<MyPaintBrushResource>* brushServer;
39
 
    KoResourceLoaderThread* brushThread;
40
39
    QMap<QString, MyPaintBrushResource*> brushes;
41
40
};
42
41
 
46
45
    : m_d( new Private )
47
46
{
48
47
    KGlobal::mainComponent().dirs()->addResourceType("mypaint_brushes", "data", "krita/brushes/");
 
48
 
49
49
    m_d->brushServer = new KoResourceServer<MyPaintBrushResource>("mypaint_brushes", "*.myb");
50
 
    m_d->brushThread = new KoResourceLoaderThread(m_d->brushServer);
51
 
    connect(m_d->brushThread, SIGNAL(finished()), this, SLOT(brushThreadDone()));
52
 
    m_d->brushThread->start();
 
50
    KoResourceLoaderThread thread(m_d->brushServer);
 
51
 
 
52
    QStringList extensionList = m_d->brushServer->extensions().split(':');
 
53
    QStringList fileNames;
 
54
 
 
55
    foreach (const QString &extension, extensionList) {
 
56
        fileNames += KGlobal::mainComponent().dirs()->findAllResources(m_d->brushServer->type().toAscii(), extension);
 
57
    }
 
58
 
 
59
    m_d->brushServer->loadResources(fileNames);
 
60
    foreach(MyPaintBrushResource* brush, m_d->brushServer->resources()) {
 
61
        QFileInfo info(brush->filename());
 
62
        m_d->brushes[info.baseName()] = brush;
 
63
    }
53
64
 
54
65
}
55
66
 
56
67
MyPaintFactory::~MyPaintFactory()
57
68
{
58
 
    if (m_d->brushThread) m_d->brushThread->cancel();
59
69
    delete m_d->brushServer;
60
70
    delete m_d;
61
71
}
76
86
    return new MyPaintSettings();
77
87
}
78
88
 
79
 
void MyPaintFactory::brushThreadDone()
80
 
{
81
 
    delete m_d->brushThread;
82
 
    m_d->brushThread = 0;
83
 
    foreach(MyPaintBrushResource* brush, m_d->brushServer->resources()) {
84
 
        QFileInfo info(brush->filename());
85
 
        m_d->brushes[info.baseName()] = brush;
86
 
    }
87
 
}
88
 
 
89
89
KisPaintOpSettingsWidget* MyPaintFactory::createSettingsWidget(QWidget * parent)
90
90
{
91
 
    while(m_d->brushThread) {
92
 
        qApp->processEvents();
93
 
    }
94
91
    return new MyPaintSettingsWidget(parent);
95
92
}
96
93