File indexing completed on 2025-01-19 03:57:57

0001 /* ============================================================
0002  *
0003  * This file is a part of digiKam project
0004  * https://www.digikam.org
0005  *
0006  * Date        : 2010-09-17
0007  * Description : Face tag region item
0008  *
0009  * SPDX-FileCopyrightText: 2010      by Aditya Bhatt <adityabhatt1991 at gmail dot com>
0010  * SPDX-FileCopyrightText: 2010-2011 by Marcel Wiesweg <marcel dot wiesweg at gmx dot de>
0011  * SPDX-FileCopyrightText: 2012-2024 by Gilles Caulier <caulier dot gilles at gmail dot com>
0012  *
0013  * SPDX-License-Identifier: GPL-2.0-or-later
0014  *
0015  * ============================================================ */
0016 
0017 #include "assignnamewidgetstates.h"
0018 
0019 // Local includes
0020 
0021 #include "digikam_debug.h"
0022 #include "faceitem.h"
0023 #include "assignnamewidget.h"
0024 
0025 namespace Digikam
0026 {
0027 
0028 AssignNameWidgetStates::AssignNameWidgetStates(FaceItem* const item)
0029     : HidingStateChanger(item->widget(), "mode", item)
0030 {
0031     // The WidgetProxyItem
0032 
0033     addItem(item->hudWidget());
0034 
0035     connect(this, SIGNAL(stateChanged()),
0036             this, SLOT(slotStateChanged()));
0037 }
0038 
0039 AssignNameWidgetStates::~AssignNameWidgetStates()
0040 {
0041 }
0042 
0043 void AssignNameWidgetStates::slotStateChanged()
0044 {
0045     FaceItem* const item = static_cast<FaceItem*>(parent());
0046 
0047     // Show resize handles etc. only in edit modes
0048 
0049     item->setEditable(!((item->widget()->mode() == AssignNameWidget::IgnoredMode)  ||
0050                         (item->widget()->mode() == AssignNameWidget::ConfirmedMode)));
0051 }
0052 
0053 } // namespace Digikam
0054 
0055 #include "moc_assignnamewidgetstates.cpp"