File indexing completed on 2025-01-19 03:50:45

0001 /* ============================================================
0002  *
0003  * This file is a part of digiKam project
0004  * https://www.digikam.org
0005  *
0006  * Date        : 28/08/2021
0007  * Description : Item icon view interface - Image Quality Sorting.
0008  *
0009  * SPDX-FileCopyrightText: 2021-2024 by Gilles Caulier <caulier dot gilles at gmail dot com>
0010  * SPDX-FileCopyrightText: 2021 by Phuoc Khanh Le <phuockhanhnk94 at gmail dot com>
0011  *
0012  * SPDX-License-Identifier: GPL-2.0-or-later
0013  *
0014  * ============================================================ */
0015 
0016 #include "itemiconview_p.h"
0017 
0018 // Local includes
0019 
0020 #include "setupimagequalitysorter.h"
0021 #include "maintenancethread.h"
0022 
0023 namespace Digikam
0024 {
0025 
0026 void ItemIconView::slotImageQualitySorter()
0027 {
0028     Setup::execSinglePage(qApp->activeWindow(), Setup::ImageQualityPage);
0029 
0030     QStringList paths;
0031 
0032     for (const auto& url : selectedUrls())
0033     {
0034         paths<<url.toLocalFile();
0035     }
0036 
0037     SetupImageQualitySorter* const settingWidgets = new SetupImageQualitySorter();
0038 
0039     ImageQualityContainer settings                = settingWidgets->getImageQualityContainer();
0040 
0041     MaintenanceThread* const thread               = new MaintenanceThread(this);
0042 
0043     thread->sortByImageQuality(paths, settings);
0044     thread->start();
0045 
0046     connect(thread, &QThread::finished,
0047             thread, &QObject::deleteLater);
0048 }
0049 
0050 } // namespace Digikam