]> cloud.milkyroute.net Git - dolphin.git/blob - src/versioncontrol/updateitemstatesthread.h
* enable the loading of version control plugins (thanks to Aaron for the hint)
[dolphin.git] / src / versioncontrol / updateitemstatesthread.h
1 /***************************************************************************
2 * Copyright (C) 2009 by Peter Penz <peter.penz@gmx.at> *
3 * *
4 * This program is free software; you can redistribute it and/or modify *
5 * it under the terms of the GNU General Public License as published by *
6 * the Free Software Foundation; either version 2 of the License, or *
7 * (at your option) any later version. *
8 * *
9 * This program is distributed in the hope that it will be useful, *
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
12 * GNU General Public License for more details. *
13 * *
14 * You should have received a copy of the GNU General Public License *
15 * along with this program; if not, write to the *
16 * Free Software Foundation, Inc., *
17 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA *
18 ***************************************************************************/
19
20 #ifndef UPDATEITEMSTATESTHREAD_H
21 #define UPDATEITEMSTATESTHREAD_H
22
23 #include <libdolphin_export.h>
24 #include <versioncontrol/versioncontrolobserver.h>
25
26 #include <QMutex>
27 #include <QThread>
28
29 class KVersionControlPlugin;
30
31 /**
32 * The performance of updating the version state of items depends
33 * on the used plugin. To prevent that Dolphin gets blocked by a
34 * slow plugin, the updating is delegated to a thread.
35 */
36 class LIBDOLPHINPRIVATE_EXPORT UpdateItemStatesThread : public QThread
37 {
38 Q_OBJECT
39
40 public:
41 UpdateItemStatesThread(QObject* parent);
42 virtual ~UpdateItemStatesThread();
43
44 void setData(KVersionControlPlugin* plugin,
45 const QList<VersionControlObserver::ItemState>& itemStates);
46
47 bool beginReadItemStates();
48 void endReadItemStates();
49 QList<VersionControlObserver::ItemState> itemStates() const;
50
51 bool retrievedItems() const;
52
53 void deleteWhenFinished();
54
55 protected:
56 virtual void run();
57
58 private slots:
59 void slotFinished();
60
61 private:
62 bool m_retrievedItems;
63 KVersionControlPlugin* m_plugin;
64 QMutex m_mutex;
65 QList<VersionControlObserver::ItemState> m_itemStates;
66 };
67
68 #endif // UPDATEITEMSTATESTHREAD_H