File indexing completed on 2025-03-09 03:58:42

0001 /* ============================================================
0002  *
0003  * This file is a part of digiKam project
0004  * https://www.digikam.org
0005  *
0006  * Date        : 2012-25-07
0007  * Description : Private Qt item view for images
0008  *
0009  * SPDX-FileCopyrightText: 2012      by Islam Wazery <wazery at ubuntu dot com>
0010  * SPDX-FileCopyrightText: 2012-2024 by Gilles Caulier <caulier dot gilles at gmail dot com>
0011  *
0012  * SPDX-License-Identifier: GPL-2.0-or-later
0013  *
0014  * ============================================================ */
0015 
0016 #include "importiconview_p.h"
0017 
0018 namespace Digikam
0019 {
0020 
0021 ImportIconView::Private::Private(ImportIconView* const qq)
0022     : utilities(nullptr),
0023       normalDelegate(nullptr),
0024       overlaysActive(false),
0025       rotateLeftOverlay(nullptr),
0026       rotateRightOverlay(nullptr),
0027       q_ptr(qq)
0028 {
0029 }
0030 
0031 ImportIconView::Private::~Private()
0032 {
0033 }
0034 
0035 void ImportIconView::Private::updateOverlays()
0036 {
0037     Q_Q(ImportIconView);
0038 
0039     ImportSettings* const settings = ImportSettings::instance();
0040 
0041     if (overlaysActive)
0042     {
0043         if (!settings->getIconShowOverlays())
0044         {
0045             disconnect(rotateLeftOverlay, SIGNAL(signalRotate(QList<QModelIndex>)),
0046                        q, SLOT(slotRotateLeft(QList<QModelIndex>)));
0047 
0048             disconnect(rotateRightOverlay, SIGNAL(signalRotate(QList<QModelIndex>)),
0049                        q, SLOT(slotRotateRight(QList<QModelIndex>)));
0050 
0051             q->removeOverlay(rotateRightOverlay);
0052             q->removeOverlay(rotateLeftOverlay);
0053 
0054             overlaysActive = false;
0055         }
0056     }
0057     else
0058     {
0059         if (settings->getIconShowOverlays())
0060         {
0061             q->addOverlay(rotateLeftOverlay, normalDelegate);
0062             q->addOverlay(rotateRightOverlay, normalDelegate);
0063 
0064             connect(rotateLeftOverlay, SIGNAL(signalRotate(QList<QModelIndex>)),
0065                     q, SLOT(slotRotateLeft(QList<QModelIndex>)));
0066 
0067             connect(rotateRightOverlay, SIGNAL(signalRotate(QList<QModelIndex>)),
0068                     q, SLOT(slotRotateRight(QList<QModelIndex>)));
0069 
0070             overlaysActive = true;
0071         }
0072     }
0073 }
0074 
0075 } // namespace Digikam
0076 
0077 #include "moc_importiconview_p.cpp"