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        : 2002-16-10
0007  * Description : Item icon view interface - Group methods.
0008  *
0009  * SPDX-FileCopyrightText: 2002-2005 by Renchi Raju <renchi dot raju at gmail dot com>
0010  * SPDX-FileCopyrightText: 2002-2024 by Gilles Caulier <caulier dot gilles at gmail dot com>
0011  * SPDX-FileCopyrightText: 2009-2011 by Johannes Wienke <languitar at semipol dot de>
0012  * SPDX-FileCopyrightText: 2010-2011 by Andi Clemens <andi dot clemens at gmail dot com>
0013  * SPDX-FileCopyrightText: 2011-2013 by Michael G. Hansen <mike at mghansen dot de>
0014  * SPDX-FileCopyrightText: 2014-2015 by Mohamed_Anwer <m_dot_anwer at gmx dot com>
0015  * SPDX-FileCopyrightText: 2017      by Simon Frei <freisim93 at gmail dot com>
0016  *
0017  * SPDX-License-Identifier: GPL-2.0-or-later
0018  *
0019  * ============================================================ */
0020 
0021 #include "itemiconview_p.h"
0022 
0023 namespace Digikam
0024 {
0025 
0026 bool ItemIconView::allNeedGroupResolving(const ApplicationSettings::OperationType type) const
0027 {
0028     switch (viewMode())
0029     {
0030         case StackedView::TableViewMode:
0031             return d->tableView->allNeedGroupResolving(type);
0032 
0033         case StackedView::MapWidgetMode:
0034         case StackedView::PreviewImageMode:
0035         case StackedView::MediaPlayerMode:
0036         case StackedView::IconViewMode:
0037             // all of these modes use the same selection model and data as the IconViewMode
0038 
0039             return d->iconView->allNeedGroupResolving(type);
0040 
0041         default:
0042             return false;
0043     }
0044 }
0045 
0046 bool ItemIconView::selectedNeedGroupResolving(const ApplicationSettings::OperationType type) const
0047 {
0048     switch (viewMode())
0049     {
0050         case StackedView::TableViewMode:
0051             return d->tableView->selectedNeedGroupResolving(type);
0052 
0053         case StackedView::MapWidgetMode:
0054         case StackedView::PreviewImageMode:
0055         case StackedView::MediaPlayerMode:
0056         case StackedView::IconViewMode:
0057             // all of these modes use the same selection model and data as the IconViewMode
0058 
0059             return d->iconView->selectedNeedGroupResolving(type);
0060 
0061         default:
0062             return false;
0063     }
0064 }
0065 
0066 void ItemIconView::setAllGroupsOpen(bool open)
0067 {
0068     ApplicationSettings::instance()->setAllGroupsOpen(open);
0069 
0070     if (!d->iconView->getFaceMode())
0071     {
0072         d->iconView->imageFilterModel()->setAllGroupsOpen(open);
0073     }
0074 }
0075 
0076 void ItemIconView::slotCreateGroupFromSelection()
0077 {
0078     FileActionMngr::instance()->addToGroup(currentInfo(), selectedInfoList(false, true));
0079 }
0080 
0081 void ItemIconView::slotCreateGroupByTimeFromSelection()
0082 {
0083     d->utilities->createGroupByTimeFromInfoList(selectedInfoList(false, true));
0084 }
0085 
0086 void ItemIconView::slotCreateGroupByFilenameFromSelection()
0087 {
0088     d->utilities->createGroupByFilenameFromInfoList(selectedInfoList(false, true));
0089 }
0090 
0091 void ItemIconView::slotCreateGroupByTimelapseFromSelection()
0092 {
0093     d->utilities->createGroupByTimelapseFromInfoList(selectedInfoList(false, true));
0094 }
0095 
0096 void ItemIconView::slotRemoveSelectedFromGroup()
0097 {
0098     FileActionMngr::instance()->removeFromGroup(selectedInfoList(false, true));
0099 }
0100 
0101 void ItemIconView::slotUngroupSelected()
0102 {
0103     FileActionMngr::instance()->ungroup(selectedInfoList(false, true));
0104 }
0105 
0106 } // namespace Digikam