File indexing completed on 2025-01-19 03:50:43
0001 /* ============================================================ 0002 * 0003 * This file is a part of digiKam project 0004 * https://www.digikam.org 0005 * 0006 * Date : 2009-12-05 0007 * Description : Side Bar Widget for the gps search. 0008 * 0009 * SPDX-FileCopyrightText: 2009-2010 by Johannes Wienke <languitar at semipol dot de> 0010 * SPDX-FileCopyrightText: 2010-2024 by Gilles Caulier <caulier dot gilles at gmail dot com> 0011 * SPDX-FileCopyrightText: 2012 by Andi Clemens <andi dot clemens at gmail dot com> 0012 * SPDX-FileCopyrightText: 2014 by Mohamed_Anwer <m_dot_anwer at gmx dot com> 0013 * SPDX-FileCopyrightText: 2010 by Aditya Bhatt <adityabhatt1991 at gmail dot com> 0014 * 0015 * SPDX-License-Identifier: GPL-2.0-or-later 0016 * 0017 * ============================================================ */ 0018 0019 #include "gpssearchsidebarwidget.h" 0020 0021 // Qt includes 0022 0023 #include <QScrollArea> 0024 #include <QApplication> 0025 #include <QStyle> 0026 #include <QIcon> 0027 0028 // KDE includes 0029 0030 #include <kconfiggroup.h> 0031 #include <klocalizedstring.h> 0032 0033 // Local includes 0034 0035 #include "digikam_debug.h" 0036 #include "albumpointer.h" 0037 #include "applicationsettings.h" 0038 #include "editablesearchtreeview.h" 0039 #include "searchfolderview.h" 0040 #include "searchtabheader.h" 0041 #include "searchtextbar.h" 0042 #include "searchtreeview.h" 0043 0044 namespace Digikam 0045 { 0046 0047 class Q_DECL_HIDDEN GPSSearchSideBarWidget::Private 0048 { 0049 public: 0050 0051 explicit Private() 0052 : gpsSearchView(nullptr) 0053 { 0054 } 0055 0056 GPSSearchView* gpsSearchView; 0057 }; 0058 0059 GPSSearchSideBarWidget::GPSSearchSideBarWidget(QWidget* const parent, 0060 SearchModel* const searchModel, 0061 SearchModificationHelper* const searchModificationHelper, 0062 ItemFilterModel* const imageFilterModel, 0063 QItemSelectionModel* const itemSelectionModel) 0064 : SidebarWidget(parent), 0065 d (new Private) 0066 { 0067 setObjectName(QLatin1String("GPS Search Sidebar")); 0068 setProperty("Shortcut", QKeySequence(Qt::CTRL | Qt::SHIFT | Qt::Key_F8)); 0069 0070 d->gpsSearchView = new GPSSearchView(this, searchModel, searchModificationHelper, imageFilterModel, itemSelectionModel); 0071 d->gpsSearchView->setConfigGroup(getConfigGroup()); 0072 0073 const int spacing = qMin(QApplication::style()->pixelMetric(QStyle::PM_LayoutHorizontalSpacing), 0074 QApplication::style()->pixelMetric(QStyle::PM_LayoutVerticalSpacing)); 0075 0076 QScrollArea* const scrollArea = new QScrollArea(this); 0077 QVBoxLayout* const layout = new QVBoxLayout(this); 0078 0079 layout->addWidget(scrollArea); 0080 layout->setContentsMargins(0, 0, spacing, 0); 0081 scrollArea->setWidget(d->gpsSearchView); 0082 scrollArea->setWidgetResizable(true); 0083 0084 connect(d->gpsSearchView, SIGNAL(signalMapSoloItems(QList<qlonglong>,QString)), 0085 this, SIGNAL(signalMapSoloItems(QList<qlonglong>,QString))); 0086 } 0087 0088 GPSSearchSideBarWidget::~GPSSearchSideBarWidget() 0089 { 0090 delete d; 0091 } 0092 0093 void GPSSearchSideBarWidget::setActive(bool active) 0094 { 0095 d->gpsSearchView->setActive(active); 0096 } 0097 0098 void GPSSearchSideBarWidget::doLoadState() 0099 { 0100 d->gpsSearchView->loadState(); 0101 } 0102 0103 void GPSSearchSideBarWidget::doSaveState() 0104 { 0105 d->gpsSearchView->saveState(); 0106 } 0107 0108 void GPSSearchSideBarWidget::applySettings() 0109 { 0110 } 0111 0112 void GPSSearchSideBarWidget::changeAlbumFromHistory(const QList<Album*>& album) 0113 { 0114 d->gpsSearchView->changeAlbumFromHistory(dynamic_cast<SAlbum*>(album.first())); 0115 } 0116 0117 const QIcon GPSSearchSideBarWidget::getIcon() 0118 { 0119 return QIcon::fromTheme(QLatin1String("globe")); 0120 } 0121 0122 const QString GPSSearchSideBarWidget::getCaption() 0123 { 0124 return i18nc("Search images on a map", "Map"); 0125 } 0126 0127 } // namespace Digikam 0128 0129 #include "moc_gpssearchsidebarwidget.cpp"