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

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 - Tools 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 void ItemIconView::slotEditor()
0027 {
0028     const ItemInfoList& imageInfoList = selectedInfoList(ApplicationSettings::Tools);
0029     ItemInfo singleInfo               = currentInfo();
0030 
0031     if (singleInfo.isNull() && !imageInfoList.isEmpty())
0032     {
0033         singleInfo = imageInfoList.first();
0034     }
0035 
0036     Album* const current = currentAlbum();
0037     d->utilities->openInfos(singleInfo, imageInfoList, current);
0038 }
0039 
0040 void ItemIconView::slotFileWithDefaultApplication()
0041 {
0042     d->utilities->openInfosWithDefaultApplication(selectedInfoList(ApplicationSettings::Tools));
0043 }
0044 
0045 void ItemIconView::slotLightTable()
0046 {
0047     bool grouping                    = selectedNeedGroupResolving(ApplicationSettings::LightTable);
0048     const ItemInfoList& selectedList = selectedInfoList(false, grouping);
0049 
0050     if (selectedList.isEmpty())
0051     {
0052         grouping = allNeedGroupResolving(ApplicationSettings::LightTable);
0053     }
0054 
0055     const ItemInfoList& allInfoList = allInfo(grouping);
0056     const ItemInfo currentItemInfo  = currentInfo();
0057 
0058     d->utilities->insertToLightTableAuto(allInfoList, selectedList, currentItemInfo);
0059 }
0060 
0061 void ItemIconView::slotQueueMgr()
0062 {
0063     bool grouping                     = selectedNeedGroupResolving(ApplicationSettings::BQM);
0064     const ItemInfoList& imageInfoList = selectedInfoList(false, grouping);
0065     ItemInfo singleInfo                = currentInfo();
0066 
0067     if (singleInfo.isNull() && !imageInfoList.isEmpty())
0068     {
0069         singleInfo = imageInfoList.first();
0070     }
0071 
0072     if (singleInfo.isNull())
0073     {
0074         grouping                     = allNeedGroupResolving(ApplicationSettings::BQM);
0075         const ItemInfoList& allItems = allInfo(grouping);
0076 
0077         if (!allItems.isEmpty())
0078         {
0079             singleInfo = allItems.first();
0080         }
0081     }
0082 
0083     d->utilities->insertToQueueManager(imageInfoList, singleInfo, true);
0084 }
0085 
0086 void ItemIconView::slotImageEdit()
0087 {
0088     // Where is the difference to slotEditor?
0089 
0090     slotEditor();
0091 }
0092 
0093 void ItemIconView::slotImageLightTable()
0094 {
0095     const ItemInfoList& selectedList = selectedInfoList(ApplicationSettings::LightTable);
0096     const ItemInfo currentItemInfo   = currentInfo();
0097 
0098     // replace images in light table
0099 
0100     d->utilities->insertToLightTable(selectedList, currentItemInfo, false);
0101 }
0102 
0103 void ItemIconView::slotImageAddToLightTable()
0104 {
0105     const ItemInfoList& selectedList = selectedInfoList(ApplicationSettings::LightTable);
0106     const ItemInfo currentItemInfo   = currentInfo();
0107 
0108     // add to images in light table
0109 
0110     d->utilities->insertToLightTable(selectedList, currentItemInfo, true);
0111 }
0112 
0113 void ItemIconView::slotImageAddToCurrentQueue()
0114 {
0115     const ItemInfoList& selectedList = selectedInfoList(ApplicationSettings::BQM);
0116     const ItemInfo currentItemInfo   = currentInfo();
0117 
0118     d->utilities->insertToQueueManager(selectedList, currentItemInfo, false);
0119 }
0120 
0121 void ItemIconView::slotImageAddToNewQueue()
0122 {
0123     const bool newQueue              = QueueMgrWindow::queueManagerWindowCreated() &&
0124                     !QueueMgrWindow::queueManagerWindow()->queuesMap().isEmpty();
0125 
0126     const ItemInfoList& selectedList = selectedInfoList(ApplicationSettings::BQM);
0127     const ItemInfo currentItemInfo   = currentInfo();
0128 
0129     d->utilities->insertToQueueManager(selectedList, currentItemInfo, newQueue);
0130 }
0131 
0132 void ItemIconView::slotImageAddToExistingQueue(int queueid)
0133 {
0134     const ItemInfoList& selectedList = selectedInfoList(ApplicationSettings::BQM);
0135     const ItemInfo currentItemInfo   = currentInfo();
0136 
0137     if (!selectedList.isEmpty())
0138     {
0139         d->utilities->insertSilentToQueueManager(selectedList, currentItemInfo, queueid);
0140     }
0141 }
0142 
0143 } // namespace Digikam