File indexing completed on 2025-01-05 03:58:35
0001 /* ============================================================ 0002 * 0003 * This file is a part of digiKam project 0004 * https://www.digikam.org 0005 * 0006 * Date : 2009-12-01 0007 * Description : world map widget library 0008 * 0009 * SPDX-FileCopyrightText: 2010-2024 by Gilles Caulier <caulier dot gilles at gmail dot com> 0010 * SPDX-FileCopyrightText: 2009-2011 by Michael G. Hansen <mike at mghansen dot de> 0011 * SPDX-FileCopyrightText: 2014 by Justus Schwartz <justus at gmx dot li> 0012 * 0013 * SPDX-License-Identifier: GPL-2.0-or-later 0014 * 0015 * ============================================================ */ 0016 0017 #include "mapwidget_p.h" 0018 0019 namespace Digikam 0020 { 0021 0022 MapWidget::MapWidget(QWidget* const parent) 0023 : QWidget(parent), 0024 s (new GeoIfaceSharedData), 0025 d (new Private) 0026 { 0027 createActions(); 0028 0029 s->worldMapWidget = this; 0030 s->tileGrouper = new TileGrouper(s, this); 0031 0032 d->stackedLayout = new QStackedLayout(this); 0033 setLayout(d->stackedLayout); 0034 0035 d->placeholderWidget = new PlaceholderWidget(); 0036 d->stackedLayout->addWidget(d->placeholderWidget); 0037 0038 d->loadedBackends.append(new BackendGoogleMaps(s, this)); 0039 0040 #ifdef HAVE_GEOLOCATION 0041 0042 d->loadedBackends.append(new BackendMarble(s, this)); 0043 0044 #endif 0045 0046 /* 0047 d->loadedBackends.append(new BackendOSM(s, this)); 0048 */ 0049 createActionsForBackendSelection(); 0050 0051 setAcceptDrops(true); 0052 } 0053 0054 MapWidget::~MapWidget() 0055 { 0056 // release all widgets: 0057 0058 for (int i = 0 ; i < d->stackedLayout->count() ; ++i) 0059 { 0060 d->stackedLayout->removeWidget(d->stackedLayout->widget(i)); 0061 } 0062 0063 GeolocationSettings::instance()->unregisterWidget(this); 0064 0065 qDeleteAll(d->loadedBackends); 0066 d->currentBackend = nullptr; 0067 d->loadedBackends.clear(); 0068 0069 delete d; 0070 0071 /// @todo delete s, but make sure it is not accessed by any other objects any more! 0072 } 0073 0074 } // namespace Digikam 0075 0076 #include "moc_mapwidget.cpp"