File indexing completed on 2025-01-05 03:52:08

0001 /* ============================================================
0002  *
0003  * This file is a part of digiKam project
0004  * https://www.digikam.org
0005  *
0006  * Date        : 2017-09-24
0007  * Description : a media server to export collections through DLNA.
0008  *
0009  * SPDX-FileCopyrightText: 2017-2024 by Gilles Caulier <caulier dot gilles at gmail dot com>
0010  *
0011  * SPDX-License-Identifier: GPL-2.0-or-later
0012  *
0013  * ============================================================ */
0014 
0015 #ifndef DIGIKAM_DMEDIA_SERVER_H
0016 #define DIGIKAM_DMEDIA_SERVER_H
0017 
0018 // Qt includes
0019 
0020 #include <QObject>
0021 #include <QString>
0022 #include <QUrl>
0023 #include <QMap>
0024 #include <QList>
0025 
0026 namespace DigikamGenericMediaServerPlugin
0027 {
0028 
0029 /// A kind of map of albums with urls contents to share with DLNA media server.
0030 typedef QMap<QString, QList<QUrl> > MediaServerMap;
0031 
0032 class DMediaServer : public QObject
0033 {
0034     Q_OBJECT
0035 
0036 public:
0037 
0038     explicit DMediaServer(QObject* const parent = nullptr);
0039     ~DMediaServer() override;
0040 
0041     /**
0042      * Initialize the internal server instance and return true if all is ready to host contents.
0043      * If port = 0, the server will select one automatically, else it will use the specified one.
0044      */
0045     bool init(int port = 0);
0046 
0047     /**
0048      * To share a list of albums with dedicated urls list for each one.
0049      */
0050     void addAlbumsOnServer(const MediaServerMap& map);
0051 
0052 private:
0053 
0054     class Private;
0055     Private* const d;
0056 
0057 private:
0058 
0059     Q_DISABLE_COPY(DMediaServer)
0060 };
0061 
0062 } // namespace DigikamGenericMediaServerPlugin
0063 
0064 #endif // DIGIKAM_DMEDIA_SERVER_H