File indexing completed on 2024-04-28 03:50:32

0001 // SPDX-License-Identifier: LGPL-2.1-or-later
0002 //
0003 // SPDX-FileCopyrightText: 2011 Dennis Nienhüser <nienhueser@kde.org>
0004 // SPDX-FileCopyrightText: 2013 Bernhard Beschow <bbeschow@cs.tu-berlin.de>
0005 //
0006 
0007 
0008 #ifndef MARBLE_LOCALOSMSEARCHPLUGIN_H
0009 #define MARBLE_LOCALOSMSEARCHPLUGIN_H
0010 
0011 #include "SearchRunnerPlugin.h"
0012 #include "OsmDatabase.h"
0013 
0014 #include <QFileSystemWatcher>
0015 
0016 namespace Marble
0017 {
0018 
0019 class LocalOsmSearchPlugin : public SearchRunnerPlugin
0020 {
0021     Q_OBJECT
0022     Q_PLUGIN_METADATA(IID "org.kde.marble.LocalOsmSearchPlugin")
0023     Q_INTERFACES( Marble::SearchRunnerPlugin )
0024 
0025 public:
0026     explicit LocalOsmSearchPlugin( QObject *parent = nullptr );
0027 
0028     QString name() const override;
0029 
0030     QString guiString() const override;
0031 
0032     QString nameId() const override;
0033 
0034     QString version() const override;
0035 
0036     QString description() const override;
0037 
0038     QString copyrightYears() const override;
0039 
0040     QVector<PluginAuthor> pluginAuthors() const override;
0041 
0042     SearchRunner* newRunner() const override;
0043 
0044 private Q_SLOTS:
0045     void updateDirectory( const QString &directory );
0046 
0047     void updateFile( const QString &directory );
0048 
0049 private:
0050     void addDatabaseDirectory( const QString &path );
0051 
0052     void updateDatabase();
0053 
0054     QStringList m_databaseFiles;
0055     QFileSystemWatcher m_watcher;
0056 };
0057 
0058 }
0059 
0060 #endif