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 - Sidebar 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 QList<SidebarWidget*> ItemIconView::leftSidebarWidgets() const
0027 {
0028     return d->leftSideBarWidgets;
0029 }
0030 
0031 void ItemIconView::showSideBars()
0032 {
0033     d->leftSideBar->restore();
0034     d->rightSideBar->restore();
0035 }
0036 
0037 void ItemIconView::hideSideBars()
0038 {
0039     d->leftSideBar->backup();
0040     d->rightSideBar->backup();
0041 }
0042 
0043 void ItemIconView::toggleLeftSidebar()
0044 {
0045     d->leftSideBar->isExpanded() ? d->leftSideBar->shrink()
0046                                  : d->leftSideBar->expand();
0047 }
0048 
0049 void ItemIconView::toggleRightSidebar()
0050 {
0051     d->rightSideBar->isExpanded() ? d->rightSideBar->shrink()
0052                                   : d->rightSideBar->expand();
0053 }
0054 
0055 void ItemIconView::previousLeftSideBarTab()
0056 {
0057     d->leftSideBar->activePreviousTab();
0058 }
0059 
0060 void ItemIconView::nextLeftSideBarTab()
0061 {
0062     d->leftSideBar->activeNextTab();
0063 }
0064 
0065 void ItemIconView::previousRightSideBarTab()
0066 {
0067     d->rightSideBar->activePreviousTab();
0068 }
0069 
0070 void ItemIconView::nextRightSideBarTab()
0071 {
0072     d->rightSideBar->activeNextTab();
0073 }
0074 
0075 void ItemIconView::slotNotificationError(const QString& message, int type)
0076 {
0077     d->errorWidget->setMessageType((DNotificationWidget::MessageType)type);
0078     d->errorWidget->setText(message);
0079     d->errorWidget->animatedShowTemporized(15000);   // Notification will be closed automatically in 15s
0080 }
0081 
0082 void ItemIconView::slotLeftSideBarActivateAlbums()
0083 {
0084     d->leftSideBar->setActiveTab(d->albumFolderSideBar);
0085 }
0086 
0087 void ItemIconView::slotLeftSideBarActivateTags()
0088 {
0089     d->leftSideBar->setActiveTab(d->tagViewSideBar);
0090 }
0091 
0092 void ItemIconView::slotLeftSideBarActivate(SidebarWidget* widget)
0093 {
0094     d->leftSideBar->setActiveTab(widget);
0095 }
0096 
0097 void ItemIconView::slotLeftSideBarActivate(QWidget* widget)
0098 {
0099     slotLeftSideBarActivate(static_cast<SidebarWidget*>(widget));
0100 }
0101 
0102 void ItemIconView::slotRightSideBarActivateTitles()
0103 {
0104     d->rightSideBar->setActiveTab(d->rightSideBar->imageDescEditTab());
0105     d->rightSideBar->imageDescEditTab()->setFocusToTitlesEdit();
0106 }
0107 
0108 void ItemIconView::slotRightSideBarActivateComments()
0109 {
0110     d->rightSideBar->setActiveTab(d->rightSideBar->imageDescEditTab());
0111     d->rightSideBar->imageDescEditTab()->setFocusToCommentsEdit();
0112 }
0113 
0114 void ItemIconView::slotRightSideBarActivateAssignedTags()
0115 {
0116     d->rightSideBar->setActiveTab(d->rightSideBar->imageDescEditTab());
0117     d->rightSideBar->imageDescEditTab()->activateAssignedTagsButton();
0118 }
0119 
0120 void ItemIconView::slotLeftSidebarChangedTab(QWidget* w)
0121 {
0122     // TODO update, temporary cast
0123 
0124     SidebarWidget* const widget = dynamic_cast<SidebarWidget*>(w);
0125 
0126     Q_FOREACH (SidebarWidget* const sideBarWidget, d->leftSideBarWidgets)
0127     {
0128         bool active = (widget && (widget == sideBarWidget));
0129         sideBarWidget->setActive(active);
0130     }
0131 }
0132 
0133 void ItemIconView::slotSidebarTabTitleStyleChanged()
0134 {
0135     d->leftSideBar->setStyle(ApplicationSettings::instance()->getSidebarTitleStyle());
0136     d->rightSideBar->setStyle(ApplicationSettings::instance()->getSidebarTitleStyle());
0137 
0138     /// @todo Which settings actually have to be reloaded?
0139     //d->rightSideBar->applySettings();
0140 }
0141 
0142 void ItemIconView::slotPopupFiltersView()
0143 {
0144     d->rightSideBar->setActiveTab(d->filterWidget);
0145     d->filterWidget->setFocusToTextFilter();
0146 }
0147 
0148 } // namespace Digikam