File indexing completed on 2025-01-05 03:51:13

0001 /* ============================================================
0002  *
0003  * This file is a part of digiKam project
0004  * https://www.digikam.org
0005  *
0006  * Date        : 2009-10-03
0007  * Description : Private Qt model-view for items
0008  *
0009  * SPDX-FileCopyrightText: 2009-2011 by Marcel Wiesweg <marcel dot wiesweg at gmx dot de>
0010  * SPDX-FileCopyrightText: 2009-2024 by Gilles Caulier <caulier dot gilles at gmail dot com>
0011  * SPDX-FileCopyrightText: 2009      by Johannes Wienke <languitar at semipol do de>
0012  *
0013  * SPDX-License-Identifier: GPL-2.0-or-later
0014  *
0015  * ============================================================ */
0016 
0017 #include "digikamitemview_p.h"
0018 
0019 // Local includes
0020 
0021 #include "contextmenuhelper.h"
0022 
0023 namespace Digikam
0024 {
0025 
0026 DigikamItemView::Private::Private(DigikamItemView* const qq)
0027     : utilities          (nullptr),
0028       normalDelegate     (nullptr),
0029       faceDelegate       (nullptr),
0030       overlaysActive     (false),
0031       fullscreenActive   (false),
0032       rotateLeftOverlay  (nullptr),
0033       rotateRightOverlay (nullptr),
0034       fullscreenOverlay  (nullptr),
0035       faceMode           (false),
0036       q_ptr              (qq)
0037 {
0038 }
0039 
0040 DigikamItemView::Private::~Private()
0041 {
0042 }
0043 
0044 void DigikamItemView::Private::updateOverlays()
0045 {
0046     Q_Q(DigikamItemView);
0047 
0048     ApplicationSettings* const settings = ApplicationSettings::instance();
0049 
0050     if (overlaysActive)
0051     {
0052         if (!settings->getIconShowOverlays())
0053         {
0054             disconnect(rotateLeftOverlay, SIGNAL(signalRotate(QList<QModelIndex>)),
0055                        q, SLOT(slotRotateLeft(QList<QModelIndex>)));
0056 
0057             disconnect(rotateRightOverlay, SIGNAL(signalRotate(QList<QModelIndex>)),
0058                        q, SLOT(slotRotateRight(QList<QModelIndex>)));
0059 
0060             q->removeOverlay(rotateLeftOverlay);
0061             q->removeOverlay(rotateRightOverlay);
0062 
0063             overlaysActive = false;
0064         }
0065     }
0066     else
0067     {
0068         if (settings->getIconShowOverlays())
0069         {
0070             q->addOverlay(rotateLeftOverlay, normalDelegate);
0071             q->addOverlay(rotateRightOverlay, normalDelegate);
0072 
0073             connect(rotateLeftOverlay, SIGNAL(signalRotate(QList<QModelIndex>)),
0074                     q, SLOT(slotRotateLeft(QList<QModelIndex>)));
0075 
0076             connect(rotateRightOverlay, SIGNAL(signalRotate(QList<QModelIndex>)),
0077                     q, SLOT(slotRotateRight(QList<QModelIndex>)));
0078 
0079             overlaysActive = true;
0080         }
0081     }
0082 
0083     if (fullscreenActive)
0084     {
0085         if (!settings->getIconShowFullscreen())
0086         {
0087             disconnect(fullscreenOverlay, SIGNAL(signalRotate(QList<QModelIndex>)),
0088                        q, SLOT(slotFullscreen(QList<QModelIndex>)));
0089 
0090             q->removeOverlay(fullscreenOverlay);
0091 
0092             fullscreenActive = false;
0093         }
0094     }
0095     else
0096     {
0097         if (settings->getIconShowFullscreen())
0098         {
0099             fullscreenActive = true;
0100 
0101             q->addOverlay(fullscreenOverlay, normalDelegate);
0102 
0103             connect(fullscreenOverlay, SIGNAL(signalFullscreen(QList<QModelIndex>)),
0104                     q, SLOT(slotFullscreen(QList<QModelIndex>)));
0105         }
0106     }
0107 }
0108 
0109 } // namespace Digikam
0110 
0111 #include "moc_digikamitemview_p.cpp"