File indexing completed on 2025-01-19 03:53:31
0001 /* ============================================================ 0002 * 0003 * This file is a part of digiKam project 0004 * https://www.digikam.org 0005 * 0006 * Date : 2015-06-05 0007 * Description : Manager for creating and starting DB jobs threads 0008 * 0009 * SPDX-FileCopyrightText: 2015 by Mohamed_Anwer <m_dot_anwer at gmx dot com> 0010 * 0011 * SPDX-License-Identifier: GPL-2.0-or-later 0012 * 0013 * ============================================================ */ 0014 0015 #include "dbjobsmanager.h" 0016 0017 // Local includes 0018 0019 0020 namespace Digikam 0021 { 0022 0023 class Q_DECL_HIDDEN DBJobsManagerCreator 0024 { 0025 public: 0026 0027 DBJobsManager object; 0028 }; 0029 0030 Q_GLOBAL_STATIC(DBJobsManagerCreator, creator) 0031 0032 // ----------------------------------------------- 0033 0034 DBJobsManager::DBJobsManager() 0035 { 0036 } 0037 0038 DBJobsManager* DBJobsManager::instance() 0039 { 0040 return &creator->object; 0041 } 0042 0043 AlbumsDBJobsThread* DBJobsManager::startAlbumsJobThread(const AlbumsDBJobInfo& jInfo) 0044 { 0045 AlbumsDBJobsThread* const thread = new AlbumsDBJobsThread(this); 0046 thread->albumsListing(jInfo); 0047 0048 connect(thread, SIGNAL(finished()), 0049 thread, SLOT(deleteLater()), 0050 Qt::QueuedConnection); 0051 0052 thread->start(); 0053 0054 return thread; 0055 } 0056 0057 DatesDBJobsThread* DBJobsManager::startDatesJobThread(const DatesDBJobInfo& jInfo) 0058 { 0059 DatesDBJobsThread* const thread = new DatesDBJobsThread(this); 0060 thread->datesListing(jInfo); 0061 0062 connect(thread, SIGNAL(finished()), 0063 thread, SLOT(deleteLater()), 0064 Qt::QueuedConnection); 0065 0066 thread->start(); 0067 0068 return thread; 0069 } 0070 0071 TagsDBJobsThread* DBJobsManager::startTagsJobThread(const TagsDBJobInfo& jInfo) 0072 { 0073 TagsDBJobsThread* const thread = new TagsDBJobsThread(this); 0074 thread->tagsListing(jInfo); 0075 0076 connect(thread, SIGNAL(finished()), 0077 thread, SLOT(deleteLater()), 0078 Qt::QueuedConnection); 0079 0080 thread->start(); 0081 0082 return thread; 0083 } 0084 0085 SearchesDBJobsThread* DBJobsManager::startSearchesJobThread(const SearchesDBJobInfo& jInfo) 0086 { 0087 SearchesDBJobsThread* const thread = new SearchesDBJobsThread(this); 0088 thread->searchesListing(jInfo); 0089 0090 connect(thread, SIGNAL(finished()), 0091 thread, SLOT(deleteLater()), 0092 Qt::QueuedConnection); 0093 0094 thread->start(); 0095 0096 return thread; 0097 } 0098 0099 GPSDBJobsThread* DBJobsManager::startGPSJobThread(const GPSDBJobInfo& jInfo) 0100 { 0101 GPSDBJobsThread* const thread = new GPSDBJobsThread(this); 0102 thread->GPSListing(jInfo); 0103 0104 connect(thread, SIGNAL(finished()), 0105 thread, SLOT(deleteLater()), 0106 Qt::QueuedConnection); 0107 0108 thread->start(); 0109 0110 return thread; 0111 } 0112 0113 } // namespace Digikam 0114 0115 #include "moc_dbjobsmanager.cpp"