/* * SPDX-FileCopyrightText: 2009 Peter Penz * * SPDX-License-Identifier: GPL-2.0-or-later */ #ifndef UPDATEITEMSTATESTHREAD_H #define UPDATEITEMSTATESTHREAD_H #include "dolphin_export.h" #include "views/versioncontrol/versioncontrolobserver.h" #include #include #include /** * The performance of updating the version state of items depends * on the used plugin. To prevent that Dolphin gets blocked by a * slow plugin, the updating is delegated to a thread. */ class DOLPHIN_EXPORT UpdateItemStatesThread : public QThread { Q_OBJECT public: /** * @param plugin Version control plugin that is used to update the * state of the items. Whenever the plugin is accessed * from the thread creator after starting the thread, * UpdateItemStatesThread::lockPlugin() and * UpdateItemStatesThread::unlockPlugin() must be used. * @param itemStates List of items, where the states get updated. */ UpdateItemStatesThread(KVersionControlPlugin *plugin, const QMap> &itemStates); ~UpdateItemStatesThread() override; QMap> itemStates() const; protected: void run() override; private: QMutex *m_globalPluginMutex; // Protects the m_plugin globally QPointer m_plugin; QMap> m_itemStates; }; #endif // UPDATEITEMSTATESTHREAD_H